WO2024088167A1 - 图像处理方法、设备、终端和介质 - Google Patents

图像处理方法、设备、终端和介质 Download PDF

Info

Publication number
WO2024088167A1
WO2024088167A1 PCT/CN2023/125630 CN2023125630W WO2024088167A1 WO 2024088167 A1 WO2024088167 A1 WO 2024088167A1 CN 2023125630 W CN2023125630 W CN 2023125630W WO 2024088167 A1 WO2024088167 A1 WO 2024088167A1
Authority
WO
WIPO (PCT)
Prior art keywords
current frame
frame image
corner points
image
preset
Prior art date
Application number
PCT/CN2023/125630
Other languages
English (en)
French (fr)
Inventor
廖声洋
Original Assignee
蔚来移动科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 蔚来移动科技有限公司 filed Critical 蔚来移动科技有限公司
Publication of WO2024088167A1 publication Critical patent/WO2024088167A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting
    • G06T3/403Edge-driven scaling; Edge-based scaling

Definitions

  • the present invention relates to the technical field of image processing, and specifically provides an image processing method, device, terminal and medium.
  • terminal devices can support the document shooting function.
  • users can use the document shooting function to take pictures of documents to achieve functions such as searching for questions online or extracting text from pictures.
  • the image it captures may be too large or too small, which is inconsistent with the actual needs of the user.
  • the image size is generally adjusted based on manual adjustment.
  • manually adjusting the image it brings instability to the user's use, and it is difficult to find a suitable zoom ratio, and the image display effect is still poor.
  • the present invention is proposed to provide an image processing method, device, terminal and medium that solve or at least partially solve the technical problems that when manually adjusting the image, it brings inconsistency to the user's use, it is difficult to find a suitable scaling ratio, and the image display effect is still poor.
  • the present invention provides an image processing method, the image processing method comprising:
  • the scaling factor of the current frame image is determined according to each scaling factor and its corresponding coefficient threshold, and the current frame image is scaled to obtain a target image.
  • filtering the multiple initial corner points within the range formed by the preset polygon to obtain multiple available corner points of the current frame image includes:
  • the number of frames corresponding to the current frame image is greater than or equal to the preset number of frames, and the number of candidate corner points of the current frame image is the number of corners of the preset polygon, determine a second distance between each candidate corner point of the current frame image and a corresponding candidate corner point of the previous frame image;
  • median filtering is performed in the time domain on the candidate corner points of the multiple frame images within the range formed by the preset polygon to obtain multiple available corner points of the current frame image; wherein the multiple frame images include the current frame image and at least two frame images before the current frame image.
  • the above-mentioned image processing method further includes:
  • the value corresponding to the candidate corner point of the current frame image is updated to the value corresponding to the multiple available corner points of the current frame image.
  • determining the scaling factor of the current frame image according to each scaling factor and its corresponding coefficient threshold, and scaling the current frame image to obtain a target image includes:
  • the ratio of each coefficient threshold to the corresponding scaling coefficient is determined, and the minimum ratio is selected as the scaling coefficient of the current frame image, and the current frame image is scaled to obtain a target image.
  • the above-mentioned image processing method further includes:
  • the scaling factor of the current frame image is stored.
  • obtaining a plurality of initial corner points of the current frame image includes:
  • determining the scaling factor in each direction according to the maximum distance in each direction includes:
  • the ratio of the maximum distance to the side length in the corresponding direction is used as the scaling factor in the corresponding direction.
  • the present invention provides an image processing device, comprising a processor and a storage device, wherein the storage device is suitable for storing a plurality of program codes, and the program codes are suitable for being loaded and run by the processor to execute the image processing method according to any one of claims 1 to 7.
  • a terminal comprising the image processing device as described above.
  • a computer-readable storage medium wherein a plurality of program codes are stored in the computer-readable storage medium, wherein the program codes are suitable for being loaded and run by a processor to execute the image processing method described in any one of the above technical solutions.
  • multiple initial corner points of the current frame image of the target document are obtained, and the multiple initial corner points are filtered within the range formed by the preset polygon to obtain multiple available corner points of the current frame image, and then the first distance between any two available corner points is determined, and based on all the first distances, the maximum distance in each direction corresponding to the preset polygon is obtained; then, based on the maximum distance in each direction, the zoom coefficient in each direction is determined, and when each zoom coefficient is greater than the corresponding coefficient threshold, a zoom coefficient is selected to zoom the current frame image to obtain the target image, thereby realizing dynamic adjustment of the image display ratio of the target document, bringing convenience to the user, and adjusting the image display ratio is more accurate than manual adjustment, thereby improving the image display effect and enhancing the user experience.
  • FIG1 is a schematic flow chart of main steps of an image processing method according to an embodiment of the present invention.
  • FIG. 2 is a schematic diagram of determining the backup corner points of the current frame image of the target document
  • FIG3 is a schematic diagram of determining available corner points of a current frame image of a target document
  • FIG4 is a schematic flow chart of main steps of an image processing method according to another embodiment of the present invention.
  • FIG5 is an image corresponding to part (1) in FIG2 after adaptive adjustment
  • FIG. 6 is a main structural block diagram of an image processing device according to an embodiment of the present invention.
  • module and “processor” may include hardware, software or a combination of the two.
  • a module may include hardware circuits, various suitable sensors, communication ports, and memories, and may also include software parts, such as program codes, or a combination of software and hardware.
  • the processor may be a central processing unit, a microprocessor, an image processor, a digital signal processor, or any other suitable processor.
  • the processor has data and/or signal processing functions.
  • the processor may be implemented in software, hardware, or a combination of the two.
  • Non-temporary computer-readable storage media include any suitable medium that can store program codes, such as a magnetic disk, a hard disk, an optical disk, a flash memory, a read-only memory, a random access memory, and the like.
  • a and/or B means all possible combinations of A and B, such as only A, only B, or A and B.
  • the term "at least one A or B” or “at least one of A and B” has a similar meaning to “A and/or B", and may include only A, only B, or A and B.
  • the singular terms “one” and “the” may also include plural forms.
  • the image it captures may be too large or too small.
  • the actual needs of users are inconsistent.
  • the image size is generally adjusted based on manual adjustment.
  • manually adjusting the image it brings instability to the user, and it is difficult to find a suitable scaling ratio, and the image display effect is still poor.
  • the present invention provides the following technical solutions:
  • FIG. 1 is a schematic flow chart of the main steps of an image processing method according to an embodiment of the present invention.
  • the control method of a smart home device in the embodiment of the present invention mainly includes the following steps 101 to 105 .
  • Step 101 obtaining a plurality of initial corner points of a current frame image of a target document
  • a sequence of frame images (0th, 1st, 2nd...N-1st, Nth, N+1st...frame images) of the target document can be obtained frame by frame.
  • multiple initial corner points of the current frame image can be obtained.
  • the current frame image can be scaled based on the scaling factor corresponding to the previous frame image or the preset scaling factor to obtain the scaled current frame image, and multiple initial corner points of the scaled current frame image can be obtained based on the preset corner point detection algorithm.
  • the scaling factor corresponding to the previous frame image is the coefficient used to scale the previous frame image.
  • the preset scaling factor can be set manually, and usually, it can be 1, that is, the image is not scaled.
  • the preset corner point detection algorithm can refer to the existing related technology to select the required method, and this embodiment does not make specific restrictions.
  • Step 102 Filter the multiple initial corner points within the range formed by the preset polygon to obtain multiple available corner points of the current frame image;
  • a range formed by a preset polygon can be selected in the current frame image, and multiple initial corner points in the range can be filtered to obtain multiple available corner points of the current frame image.
  • the number of available corner points is the same as the number of corners of the preset polygon.
  • the preset polygon can be a square, and the number of available corner points is 4.
  • the implementation step can be implemented according to the following steps:
  • FIG2 is a schematic diagram of determining the backup corner points of the current frame image of the target document.
  • FIG2 takes the preset polygon as a square as an example.
  • the current frame image has four backup corner points, which are respectively denoted as An, Bn, Cn, and Dn. See part (2) of FIG2.
  • Part (1) of FIG2 is when The four initial corner points An0, An1, An2 and An3 corresponding to the first backup corner point An of the previous frame image can be obtained by median filtering the four initial corner points An0, An1, An2 and An3 in the spatial domain. Similarly, other backup corner points Bn, Cn and Dn can be obtained, which will not be given one by one here.
  • the middle boxes in parts (1) and (2) of Figure 2 represent images, and the outer boxes represent preset squares.
  • the number of multiple candidate corner points of the current frame image may not actually be consistent with the number of corners of the preset polygon. Therefore, it is necessary to detect whether the number of multiple candidate corner points of the current frame image is equal to the number of corners of the preset polygon.
  • the preset number of frames can be greater than or equal to 3. Only when the number of frames corresponding to the current frame image is greater than or equal to the preset number of frames and the number of candidate corner points of the current frame image is the number of corners of the preset polygon, can multiple available corner points of the current frame image be further obtained.
  • a second distance between each candidate corner point of the current frame image and the corresponding candidate corner point of the previous frame image may be determined
  • the candidate corner points of the previous frame image may be An-1, Bn-1, Cn-1, and Dn-1, then the second distance between each candidate corner point of the current frame image and the corresponding candidate corner point of the previous frame image may be recorded as
  • the process may return to step 101 .
  • is recorded as the maximum second distance maxDis, and then it is determined whether the maximum second distance maxDis is less than the preset distance TreDis. If the maximum second distance maxDis is less than the preset distance TreDis, the candidate corner points of the multiple frame images are subjected to time domain median filtering within the range formed by the preset polygon to obtain multiple available corner points of the current frame image.
  • the multiple frame images include the current frame image and at least two frames of images before the current frame image.
  • FIG3 is a schematic diagram of determining the available corner points of the current frame image of the target document.
  • the three backup corner points An-2, An-1, and An from the N-2th frame to the Nth frame in part (1) of FIG3 are subjected to time domain median filtering to obtain the first available corner point Ao in part (2) of FIG3.
  • the other available corner points Bo, Co, and Do in part (2) of FIG3 can be obtained.
  • the process may return to step 101 .
  • Step 103 determine the first distance between any two available corner points, and obtain the maximum distance in each direction corresponding to the preset polygon based on all the first distances;
  • the first distance between any two available corner points can be determined, and the maximum distance in each direction corresponding to the preset polygon can be obtained based on all the first distances, wherein each direction corresponding to the preset polygon is determined based on the extension direction of the edge of the preset polygon.
  • the directions corresponding to the preset polygon are the length direction and the width direction.
  • ) and the maximum first distance in the height direction maxH max(
  • the preset polygon is a triangle, the directions corresponding to the preset polygon are the directions corresponding to the three sides, which will not be explained one by one here.
  • Step 104 Determine the scaling factor in each direction according to the maximum distance in each direction;
  • the ratio of the maximum distance to the side length in the corresponding direction can be used as the scaling factor in the corresponding direction.
  • Step 105 If each scaling factor is greater than the corresponding coefficient threshold, The number average and its corresponding coefficient threshold are used to determine the scaling coefficient of the current frame image, and the current frame image is scaled to obtain a target image.
  • each scaling factor is greater than the corresponding coefficient threshold. If each scaling factor is greater than the corresponding coefficient threshold, the scaling factor of the current frame image can be determined according to each scaling factor and its corresponding coefficient threshold, and the current frame image is scaled to obtain a target image. If at least one scaling factor is less than or equal to the corresponding coefficient threshold, the process can return to step 101.
  • the ratio of each coefficient threshold to the corresponding zoom coefficient can be determined, and the minimum ratio is selected as the zoom coefficient of the current frame image, and the current frame image is zoomed to obtain the target image. In this way, it is avoided that the image is over-magnified, or the image is still large after being reduced, so that it can be more in line with the actual needs of users.
  • the image processing method of this embodiment obtains multiple initial corner points of the current frame image of the target document, and filters the multiple initial corner points within the range formed by the preset polygon to obtain multiple available corner points of the current frame image, then determines the first distance between any two available corner points, and obtains the maximum distance in each direction corresponding to the preset polygon based on all the first distances; then, based on the maximum distance in each direction, determines the zoom factor in each direction, and when each zoom factor is greater than the corresponding coefficient threshold, selects a zoom factor to zoom the current frame image to obtain the target image, thereby realizing dynamic adjustment of the image display ratio of the target document, bringing convenience to users, and adjusting the image display ratio is more accurate than manual adjustment, thereby improving image display effect and user experience.
  • the scaling factor of the current frame image can also be stored, so that when the next frame image is obtained, the next frame image can be scaled according to the scaling factor of the current frame image to obtain multiple initial corner points of the next entire image.
  • each scaling coefficient is greater than the corresponding coefficient threshold, the numerical value corresponding to the alternative corner point of the current frame image is updated to the numerical value corresponding to multiple available corner points of the current frame image, so that when the next frame image is scaled, the alternative corner points of the current frame image can be used to perform median filtering on the next frame image.
  • FIG4 is a schematic flow chart of the main steps of an image processing method according to another embodiment of the present invention.
  • the control method of the smart home device in the embodiment of the present invention mainly includes:
  • the process includes the following steps 401 to 411 .
  • Step 401 The camera enters the document mode and obtains the current frame image of the target document;
  • Step 402 After scaling the current frame image according to a preset scaling factor, a plurality of initial corner points of the current frame image are obtained;
  • Step 403 Performing spatial domain median filtering on the multiple initial corner points within the range formed by the preset polygon to obtain multiple candidate corner points of the current frame image;
  • Step 404 determine whether the number of frames of the current frame image is less than 3, or whether the number of candidate corner points is not equal to 4; if so, return to step 402; if not, execute step 405;
  • Step 405 determining a second distance between each candidate corner point of the current frame image and a corresponding candidate corner point of the previous frame image, and determining a maximum second distance
  • Step 406 determine whether the maximum second distance is less than the preset distance; if so, execute step 407, if not, return to step 402;
  • Step 407 Performing time-domain median filtering on candidate corner points of multiple frames of images within a range formed by a preset polygon to obtain multiple available corner points of the current frame of image;
  • Step 408 determine the first distance between any two available corner points, and obtain the maximum distance in the width direction and the maximum distance in the height direction according to all the first distances, and calculate the scaling factor in the width direction and the scaling factor in the height direction;
  • Step 409 determine whether the maximum distance in the width direction is greater than the coefficient threshold in the width direction and the maximum distance in the height direction; if so, execute step 410, if not, return to step 402;
  • Step 410 determine the ratio of each coefficient threshold to the corresponding zoom coefficient, select the minimum ratio as the zoom coefficient of the current frame image, store the zoom coefficient of the current frame image, and update the value corresponding to the candidate corner point of the current frame image to the value corresponding to the multiple available corner points of the current frame image;
  • Step 411 Scale the current frame image according to the scaling factor of the current frame image to obtain a target image.
  • Fig. 5 is an image after adaptive adjustment corresponding to part (1) in Fig. 2.
  • Part (1) in Fig. 5 is the original image of the current frame image
  • part (2) in Fig. 5 is the enlarged image of the current frame image.
  • the present invention implements all or part of the processes in the method of the above embodiment, and can also be completed by instructing the relevant hardware through a computer program
  • the computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of each of the above method embodiments when executed by the processor.
  • the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form.
  • the computer-readable storage medium may include: any entity or device, medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory, random access memory, electric carrier signal, telecommunication signal and software distribution medium that can carry the computer program code.
  • computer-readable storage medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction.
  • computer-readable storage media do not include electric carrier signals and telecommunication signals.
  • the present invention also provides an image processing device.
  • FIG6 is a main structural block diagram of an image processing device according to an embodiment of the present invention.
  • the image processing device in the embodiment of the present invention may include a processor 60 and a storage device 61 .
  • the storage device 61 may be configured to store a program for executing the image processing method of the above method embodiment, and the processor 60 may be configured to execute the program in the storage device 61, which includes but is not limited to a program for executing the image processing method of the above method embodiment.
  • the image processing device may be a control device formed by various electronic devices.
  • the present invention also provides a terminal, comprising the image processing device described in the above embodiment.
  • the present invention also provides a computer-readable storage medium.
  • the computer-readable storage medium may be configured to store a program for executing the image processing method of the above method embodiment, and the program may be loaded and run by a processor to implement the above image processing method.
  • the computer-readable storage medium can be a storage device formed by various electronic devices.
  • the computer-readable storage medium in the embodiments of the invention is a non-temporary computer-readable storage medium.
  • each module is only for illustrating the functional units of the device of the present invention
  • the physical devices corresponding to these modules may be the processor itself, or a part of the software in the processor, a part of the hardware, or a part of the combination of software and hardware. Therefore, the number of each module in the figure is only schematic.
  • modules in the device can be adaptively split or merged. Such splitting or merging of specific modules will not cause the technical solution to deviate from the principle of the present invention, and therefore, the technical solutions after splitting or merging will fall within the protection scope of the present invention.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Human Computer Interaction (AREA)
  • General Engineering & Computer Science (AREA)
  • Editing Of Facsimile Originals (AREA)

Abstract

本发明提供了一种图像处理方法、设备、终端和介质,包括获取目标文档的当前帧图像的多个初始角点;在预设多边形形成的范围内对多个初始角点进行滤波,得到当前帧图像的多个可用角点;确定任意两个可用角点之间的第一距离,并根据所有第一距离,得到预设多边形对应的各方向上最大距离;根据各方向上最大距离,确定各方向的缩放系数;若每个缩放系数均大于对应的系数阈值,根据每个缩放系数均及其对应的系数阈值,确定当前帧图像的缩放系数,并对当前帧图像进行缩放,得到目标图像,实现了动态的调整目标文档的图像显示比例,给用户的使用带来方便,且调整图像显示比例相对于手动调节更加准确,提高了图像显示效果,并提升了用户体验。

Description

图像处理方法、设备、终端和介质
本申请要求2022年10月24日提交的、发明名称为“图像处理方法、设备、终端和介质”的中国专利申请202211301775.3的优先权,上述中国专利申请的全部内容通过引用并入本申请中。
技术领域
本发明涉及图像处理技术领域,具体提供一种图像处理方法、设备、终端和介质。
背景技术
随着互联网的普及和发展,人们对于终端设备的功能需求也越发多样化。例如,为了满足用户在终端设备中随时查看文档的使用需求,较多终端设备可以支持文档拍摄功能。例如,用户可以利用文档拍摄功能拍摄文档图片,实现如网上搜题或者提取图片中的文字等功能。
终端设备在文档拍摄模式下,其拍摄的图像可能过大或过小,与用户的实际需求不一致。目前,普遍基于手动调节的方式调节图像的大小。然而,手动调节图像时,给用户的使用带来不变,且难以找到合适的缩放比例,图像显示效果仍然较差。
发明内容
为了克服上述缺陷,提出了本发明,以提供解决或至少部分地解决手动调节图像时,给用户的使用带来不变,且难以找到合适的缩放比例,图像显示效果仍然较差的技术问题的图像处理方法、设备、终端和介质。
在第一方面,本发明提供一种图像处理方法,所述图像处理方法包括:
获取目标文档的当前帧图像的多个初始角点;
在预设多边形形成的范围内对多个所述初始角点进行滤波,得到所 述当前帧图像的多个可用角点;其中,可用角点的数目与所述预设多边形的角数目相同;
确定任意两个可用角点之间的第一距离,并根据所有第一距离,得到所述预设多边形对应的各方向上最大距离;其中,所述预设多边形对应的各方向根据所述预设多边形的边的延伸方向确定;
根据各方向上最大距离,确定各方向的缩放系数;
若每个缩放系数均大于对应的系数阈值,根据每个缩放系数均及其对应的系数阈值,确定所述当前帧图像的缩放系数,并对所述当前帧图像进行缩放,得到目标图像。
进一步地,上述所述的图像处理方法中,在预设多边形形成的范围内对多个所述初始角点进行滤波,得到所述当前帧图像的多个可用角点,包括:
在预设多边形形成的范围内对多个所述初始角点进行空间域的中值滤波,得到所述当前帧图像的多个备选角点;
若所述当前帧图像对应的帧数大于或等于预设帧数,且所述当前帧图像的备选角点的数目为所述预设多边形的角数目,确定所述当前帧图像的每个备选角点与对应的上一帧图像的备选角点之间的第二距离;
若最大的第二距离小于预设距离,在预设多边形形成的范围内对多帧图像的备选角点进行时间域的中值滤波,得到所述当前帧图像的多个可用角点;其中,多帧图像包括当前帧图像以及当前帧图像之前至少两帧图像。
进一步地,上述所述的图像处理方法,还包括:
若每个缩放系数均大于对应的系数阈值,将所述当前帧图像的备选角点对应的数值更新为所述当前帧图像的多个可用角点对应的数值。
进一步地,上述所述的图像处理方法中,根据每个缩放系数均及其对应的系数阈值,确定所述当前帧图像的缩放系数,并对所述当前帧图像进行缩放,得到目标图像,包括:
确定每个系数阈值与对应缩放系数的比值,并选取最小比值作为当前帧图像的缩放系数,对所述当前帧图像进行缩放,得到目标图像。
进一步地,上述所述的图像处理方法,还包括:
存储所述当前帧图像的缩放系数。
进一步地,上述所述的图像处理方法中,获取当前帧图像的多个初始角点,包括:
基于上一帧图像对应的缩放系数或者预设缩放系数,对所述当前帧图像进行缩放,得到缩放后的当前帧图像;
基于预设的角点检测算法,获取缩放后的当前帧图像多个初始角点。
进一步地,上述所述的图像处理方法中,根据各方向上最大距离,确定各方向的缩放系数,包括:
将最大距离与对应方向上的边长的比值作为所述对应方向上的缩放系数。
在第二方面,本发明提供一种图像处理设备,包括处理器和存储装置,所述存储装置适于存储多条程序代码,所述程序代码适于由所述处理器加载并运行以执行权利要求1至7中任一项所述的图像处理方法。
在第三方面,提供一种终端,所述终端包括如上所述的图像处理设备。
在第四方面,提供一种计算机可读存储介质,该计算机可读存储介质其中存储有多条程序代码,所述程序代码适于由处理器加载并运行以执行上述任一项技术方案所述的图像处理方法。
本发明上述一个或多个技术方案,至少具有如下一种或多种有益效果:
在实施本发明的技术方案中,通过获取目标文档的当前帧图像的多个初始角点,并在预设多边形形成的范围内对多个所述初始角点进行滤波,得到所述当前帧图像的多个可用角点后,确定任意两个可用角点之间的第一距离,并根据所有第一距离,得到所述预设多边形对应的各方向上最大距离;然后,根据各方向上最大距离,确定各方向的缩放系数,并在每个缩放系数均大于对应的系数阈值时,选取一个缩放系数,对所述当前帧图像进行缩放,得到目标图像,实现了动态的调整目标文档的图像显示比例,给用户的使用带来方便,且调整图像显示比例相对于手动调节更加准确,提高了图像显示效果,并提升了用户体验。
附图说明
参照附图,本发明的公开内容将变得更易理解。本领域技术人员容易理解的是:这些附图仅仅用于说明的目的,而并非意在对本发明的保护范围组成限制。此外,图中类似的数字用以表示类似的部件,其中:
图1是根据本发明的一个实施例的图像处理方法的主要步骤流程示意图;
图2是确定目标文档的当前帧图像的备用角点的示意图;
图3是确定目标文档的当前帧图像的可用角点的示意图;
图4是根据本发明的另一个实施例的图像处理方法的主要步骤流程示意图;
图5是图2中(1)部分对应的自适应调整后的图像;
图6是根据本发明的一个实施例的图像处理设备的主要结构框图。
具体实施方式
下面参照附图来描述本发明的一些实施方式。本领域技术人员应当理解的是,这些实施方式仅仅用于解释本发明的技术原理,并非旨在限制本发明的保护范围。
在本发明的描述中,“模块”、“处理器”可以包括硬件、软件或者两者的组合。一个模块可以包括硬件电路,各种合适的感应器,通信端口,存储器,也可以包括软件部分,比如程序代码,也可以是软件和硬件的组合。处理器可以是中央处理器、微处理器、图像处理器、数字信号处理器或者其他任何合适的处理器。处理器具有数据和/或信号处理功能。处理器可以以软件方式实现、硬件方式实现或者二者结合方式实现。非暂时性的计算机可读存储介质包括任何合适的可存储程序代码的介质,比如磁碟、硬盘、光碟、闪存、只读存储器、随机存取存储器等等。术语“A和/或B”表示所有可能的A与B的组合,比如只是A、只是B或者A和B。术语“至少一个A或B”或者“A和B中的至少一个”含义与“A和/或B”类似,可以包括只是A、只是B或者A和B。单数形式的术语“一个”、“这个”也可以包含复数形式。
终端设备在文档拍摄模式下,其拍摄的图像可能过大或过小,与用 户的实际需求不一致。目前,普遍基于手动调节的方式调节图像的大小。然而,手动调节图像时,给用户的使用带来不变,且难以找到合适的缩放比例,图像显示效果仍然较差。
因此,为了解决上述技术问题,本发明提供了以下技术方案:
参阅附图1,图1是根据本发明的一个实施例的图像处理方法的主要步骤流程示意图。如图1所示,本发明实施例中的智能家居设备的控制方法主要包括下列步骤101-步骤105。
步骤101、获取目标文档的当前帧图像的多个初始角点;
在一个具体实现过程中,终端设备的相机进入文档模式后,可以获取目标文档一帧一帧的序列帧图像(第0、1、2......N-1、N、N+1......帧图像)。在得到当前帧图像后,可以获取当前帧图像的多个初始角点。
具体地,可以基于上一帧图像对应的缩放系数或者预设缩放系数,对所述当前帧图像进行缩放,得到缩放后的当前帧图像,并基于预设的角点检测算法,获取缩放后的当前帧图像多个初始角点。其中,上一帧图像对应的缩放系数为对上一帧图像进行缩放使用的系数。预设缩放系数可以人为设定,通常情况下,可以为1,即对图像不进行缩放。预设的角点检测算法可以参照现有相关技术选取所需的方法,本实施例不做具体限制。
步骤102、在预设多边形形成的范围内对多个所述初始角点进行滤波,得到所述当前帧图像的多个可用角点;
在一个具体实现过程中,可以在当前帧图像中选取一个由预设多边形形成的范围,并对该范围中的多个初始角点进行滤波,得到所述当前帧图像的多个可用角点。其中,可用角点的数目与所述预设多边形的角数目相同。例如,预设多边形可以为正方形,可用角点的数目则为4个。
具体地,该实现步骤可以按照如下步骤实现:
a、在预设多边形形成的范围内对多个所述初始角点进行空间域的中值滤波,得到所述当前帧图像的多个备选角点;
图2是确定目标文档的当前帧图像的备用角点的示意图。图2以预设多边形为正方形为例进行说明,当前帧图像具有4个备用角点,分别记为An、Bn、Cn、Dn,参见图2中(2)部分。图2中(1)部分为当 前帧图像的第一个备用角点An对应的4个初始角点An0、An1、An2和An3,对4个初始角点An0、An1、An2和An3进行空间域的中值滤波后,可以得到第一个备用角点An。同理,可以得到其他备用角点Bn、Cn、Dn,在此不再一一举例。其中,图2的(1)和(2)部分中间方框表示图像,外面的方框表示预设正方形。
b、若所述当前帧图像对应的帧数大于或等于预设帧数,且所述当前帧图像的备选角点的数目为所述预设多边形的角数目,确定所述当前帧图像的每个备选角点与对应的上一帧图像的备选角点之间的第二距离;
在一个具体实现过程中,得到所述当前帧图像的多个备选角点的数目可能实际与预设多边形的角数目并不一致,因此,需要检测当前帧图像的多个备选角点的数目是否等于预设多边形的角数目。另外,在进行时间域的中值滤波时,通常需要至少3帧图像,因此,还需检测当前帧图像对应的帧数大于或等于预设帧数,其中,预设帧数可以大于或等于3。只有所述当前帧图像对应的帧数大于或等于预设帧数,且所述当前帧图像的备选角点的数目为所述预设多边形的角数目时,可以进一步得到当前帧图像的多个可用角点。
具体地,若所述当前帧图像对应的帧数大于或等于预设帧数,且所述当前帧图像的备选角点的数目为所述预设多边形的角数目,可以确定所述当前帧图像的每个备选角点与对应的上一帧图像的备选角点之间的第二距离;
例如,上一帧图像的备选角点可以为An-1、Bn-1、Cn-1、Dn-1,则所述当前帧图像的每个备选角点与对应的上一帧图像的备选角点之间的第二距离可以记为|An An-1|、|Bn Bn-1|、|Cn Cn-1|、|Dn Dn-1|。
需要说明的是,若所述当前帧图像对应的帧数小于预设帧数,或所述当前帧图像的备选角点的数目为所述预设多边形的角数目,可以返回步骤101。
c、若最大的第二距离小于预设距离,在预设多边形形成的范围内对多帧图像的备选角点进行时间域的中值滤波,得到所述当前帧图像的多个可用角点。
在一个具体实现过程中,可以计算出|An An-1|、|Bn Bn-1|、|Cn Cn-1|、 |Dn Dn-1|四者之间的最大值记为最大的第二距离maxDis,然后判断最大的第二距离maxDis是否小于预设距离TreDis。若最大的第二距离maxDis小于预设距离TreDis,在预设多边形形成的范围内对多帧图像的备选角点进行时间域的中值滤波,得到所述当前帧图像的多个可用角点。其中,多帧图像包括当前帧图像以及当前帧图像之前至少两帧图像。
图3是确定目标文档的当前帧图像的可用角点的示意图。如图3所示,图3中(1)部分第N-2帧至第N帧的三个备用角点An-2、An-1、An,对三个备用角点An-2、An-1、An进行时间域的中值滤波后,可以得到图3中(2)部分的第一个可用角点Ao。同理,可以得到图3中(2)部分的其他可用角点Bo、Co、Do。
需要说明的是,若最大的第二距离大于或等于预设距离,可以返回步骤101。
步骤103、确定任意两个可用角点之间的第一距离,并根据所有第一距离,得到所述预设多边形对应的各方向上最大距离;
在一个具体实现过程中,可以确定任意两个可用角点之间的第一距离,并根据所有第一距离,得到所述预设多边形对应的各方向上最大距离。其中,所述预设多边形对应的各方向根据所述预设多边形的边的延伸方向确定。
具体地,若预设多边形为正方形,则预设多边形对应的各方向则为长度方向和宽度方向。参见图3,可以计算可用角点之间的第一距离|AoBo|、|AoCo|、|CoDo|、|BoDo|,计算宽度方向最大第一距离maxW=max(|AoBo|,|CoDo|),高度方向最大第一距离maxH=max(|AoCo|,|BoDo|)。若预设多边形为三角形,则预设多边形对应的各方向则为三条边对应的方向,在此不再一一举例说明。
步骤104、根据各方向上最大距离,确定各方向的缩放系数;
具体地,可以将最大距离与对应方向上的边长的比值作为所述对应方向上的缩放系数。参见图3,可以计算宽度方向缩放系数rw=maxW/IW,高度方向缩放系数rh=maxH/IH。其中,IW为当前图像帧的宽度,IH为当前图像帧的长度。
步骤105、若每个缩放系数均大于对应的系数阈值,根据每个缩放系 数均及其对应的系数阈值,确定所述当前帧图像的缩放系数,并对所述当前帧图像进行缩放,得到目标图像。
在一个具体实现过程中,可以依次判断每个缩放系数是否大于对应的系数阈值,若每个缩放系数均大于对应的系数阈值,可以根据每个缩放系数均及其对应的系数阈值,确定所述当前帧图像的缩放系数,并对所述当前帧图像进行缩放,得到目标图像。若至少一个个缩放系数小于或等于对应的系数阈值,则可以返回步骤101。
在一个具体实现过程中,可以确定每个系数阈值与对应缩放系数的比值,并选取最小比值作为当前帧图像的缩放系数,对所述当前帧图像进行缩放,得到目标图像。,这样,避免过于放大图像,或,缩小图像后图像仍较大的现象,从而能够与用户实际需求更加相符。
本实施例的图像处理方法,通过获取目标文档的当前帧图像的多个初始角点,并在预设多边形形成的范围内对多个所述初始角点进行滤波,得到所述当前帧图像的多个可用角点后,确定任意两个可用角点之间的第一距离,并根据所有第一距离,得到所述预设多边形对应的各方向上最大距离;然后,根据各方向上最大距离,确定各方向的缩放系数,并在每个缩放系数均大于对应的系数阈值时,选取一个缩放系数,对所述当前帧图像进行缩放,得到目标图像,实现了动态的调整目标文档的图像显示比例,给用户的使用带来方便,且调整图像显示比例相对于手动调节更加准确,提高了图像显示效果,并提升了用户体验。
在一个具体实现过程中,还可以存储所述当前帧图像的缩放系数,以便在获取到下一帧图像时,可以按照当前帧图像的缩放系数对下一帧图像进行所放过后,再获取下一整图像的多个初始角点。
在一个具体实现过程中,若每个缩放系数均大于对应的系数阈值,所述当前帧图像的备选角点对应的数值更新为所述当前帧图像的多个可用角点对应的数值,以便在对下一帧图像进行缩放时,可以利用当前帧图像的备选角点对下一帧图像进行中值滤波。
下面结合图2和图3对本发明的处理方法具体应用进行说明。
图4是根据本发明的另一个实施例的图像处理方法的主要步骤流程示意图,如图4所示,本发明实施例中的智能家居设备的控制方法主要 包括下列步骤401-步骤411。
步骤401、相机进入文档模式,获取目标文档的当前帧图像;
步骤402、按照预设缩放系数对当前帧图像进行缩放后,获取当前帧图像的多个初始角点;
步骤403、在预设多边形形成的范围内对多个所述初始角点进行空间域的中值滤波,得到所述当前帧图像的多个备选角点;
步骤404、判断当前帧图像的帧数是否小于3,或者,备选角点的数目是否不等于4;若是,返回步骤402,若否,执行步骤405;
步骤405、确定所述当前帧图像的每个备选角点与对应的上一帧图像的备选角点之间的第二距离,并确定出最大的第二距离;
步骤406、判断最大的第二距离是否小于预设距离;若是,执行步骤407,若否,返回步骤402;
步骤407、在预设多边形形成的范围内对多帧图像的备选角点进行时间域的中值滤波,得到所述当前帧图像的多个可用角点;
步骤408、确定任意两个可用角点之间的第一距离,并根据所有第一距离,得到宽度方向上最大距离和高度方向上的最大距离,并计算宽度方向的缩放系数和高度方向的缩放系数;
步骤409、判断宽度方向上最大距离是否大于宽度方向的系数阈值和高度方向上的最大距离;若是,执行步骤410,若否,返回步骤402;
步骤410、确定每个系数阈值与对应缩放系数的比值,选取最小比值作为当前帧图像的缩放系数,并存储当前帧图像的缩放系数,以及将所述当前帧图像的备选角点对应的数值更新为所述当前帧图像的多个可用角点对应的数值;
步骤411、根据所述当前帧图像的缩放系数,对所述当前帧图像进行缩放,得到目标图像。
图5是图2中(1)部分对应的自适应调整后的图像。图5中(1)部分为当前帧图像的原始图像,图5中(2)部分为当前帧图像的放大图像。
需要指出的是,尽管上述实施例中将各个步骤按照特定的先后顺序进行了描述,但是本领域技术人员可以理解,为了实现本发明的效果, 不同的步骤之间并非必须按照这样的顺序执行,其可以同时(并行)执行或以其他顺序执行,这些变化都在本发明的保护范围之内。
本领域技术人员能够理解的是,本发明实现上述一实施例的方法中的全部或部分流程,也可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。其中,所述计算机程序包括计算机程序代码,所述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读存储介质可以包括:能够携带所述计算机程序代码的任何实体或装置、介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器、随机存取存储器、电载波信号、电信信号以及软件分发介质等。需要说明的是,所述计算机可读存储介质包含的内容可以根据司法管辖区内立法和专利实践的要求进行适当的增减,例如在某些司法管辖区,根据立法和专利实践,计算机可读存储介质不包括电载波信号和电信信号。
进一步,本发明还提供了一种图像处理设备。
参阅附图6,图6是根据本发明的一个实施例的图像处理设备的主要结构框图。如图6所示,本发明实施例中的图像处理设备可以包括处理器60和存储装置61。
存储装置61可以被配置成存储执行上述方法实施例的图像处理方法的程序,处理器60可以被配置成用于执行存储装置61中的程序,该程序包括但不限于执行上述方法实施例的图像处理方法的程序。为了便于说明,仅示出了与本发明实施例相关的部分,具体技术细节未揭示的,请参照本发明实施例方法部分。该图像处理设备可以是包括各种电子设备形成的控制设备。
进一步,本发明还提供了一种终端,包括上述实施例所述的图像处理设备。
进一步,本发明还提供了一种计算机可读存储介质。在根据本发明的一个计算机可读存储介质实施例中,计算机可读存储介质可以被配置成存储执行上述方法实施例的图像处理方法的程序,该程序可以由处理器加载并运行以实现上述图像处理方法。为了便于说明,仅示出了与本 发明实施例相关的部分,具体技术细节未揭示的,请参照本发明实施例方法部分。该计算机可读存储介质可以是包括各种电子设备形成的存储装置设备,可选的,本发明实施例中计算机可读存储介质是非暂时性的计算机可读存储介质。
进一步,应该理解的是,由于各个模块的设定仅仅是为了说明本发明的装置的功能单元,这些模块对应的物理器件可以是处理器本身,或者处理器中软件的一部分,硬件的一部分,或者软件和硬件结合的一部分。因此,图中的各个模块的数量仅仅是示意性的。
本领域技术人员能够理解的是,可以对装置中的各个模块进行适应性地拆分或合并。对具体模块的这种拆分或合并并不会导致技术方案偏离本发明的原理,因此,拆分或合并之后的技术方案都将落入本发明的保护范围内。
至此,已经结合附图所示的优选实施方式描述了本发明的技术方案,但是,本领域技术人员容易理解的是,本发明的保护范围显然不局限于这些具体实施方式。在不偏离本发明的原理的前提下,本领域技术人员可以对相关技术特征作出等同的更改或替换,这些更改或替换之后的技术方案都将落入本发明的保护范围之内。

Claims (10)

  1. 一种图像处理方法,其特征在于,包括:
    获取目标文档的当前帧图像的多个初始角点;
    在预设多边形形成的范围内对多个所述初始角点进行滤波,得到所述当前帧图像的多个可用角点;其中,可用角点的数目与所述预设多边形的角数目相同;
    确定任意两个可用角点之间的第一距离,并根据所有第一距离,得到所述预设多边形对应的各方向上最大距离;其中,所述预设多边形对应的各方向根据所述预设多边形的边的延伸方向确定;
    根据各方向上最大距离,确定各方向的缩放系数;
    若每个缩放系数均大于对应的系数阈值,根据每个缩放系数均及其对应的系数阈值,确定所述当前帧图像的缩放系数,并对所述当前帧图像进行缩放,得到目标图像。
  2. 根据权利要求1所述的图像处理方法,其特征在于,所述在预设多边形形成的范围内对多个所述初始角点进行滤波,得到所述当前帧图像的多个可用角点,包括:
    在预设多边形形成的范围内对多个所述初始角点进行空间域的中值滤波,得到所述当前帧图像的多个备选角点;
    若所述当前帧图像对应的帧数大于或等于预设帧数,且所述当前帧图像的备选角点的数目为所述预设多边形的角数目,确定所述当前帧图像的每个备选角点与对应的上一帧图像的备选角点之间的第二距离;
    若最大的第二距离小于预设距离,在预设多边形形成的范围内对多帧图像的备选角点进行时间域的中值滤波,得到所述当前帧图像的多个可用角点;其中,多帧图像包括当前帧图像以及当前帧图像之前至少两帧图像。
  3. 根据权利要求1或2所述的图像处理方法,其特征在于,还包括:
    若每个缩放系数均大于对应的系数阈值,将所述当前帧图像的备选 角点对应的数值更新为所述当前帧图像的多个可用角点对应的数值。
  4. 根据权利要求1至3任一项所述的图像处理方法,其特征在于,所述根据每个缩放系数均及其对应的系数阈值,确定所述当前帧图像的缩放系数,并对所述当前帧图像进行缩放,得到目标图像,包括:
    确定每个系数阈值与对应缩放系数的比值,并选取最小比值作为当前帧图像的缩放系数,对所述当前帧图像进行缩放,得到目标图像。
  5. 根据权利要求4所述的图像处理方法,其特征在于,还包括:
    存储所述当前帧图像的缩放系数。
  6. 根据权利要求1至5任一项所述的图像处理方法,其特征在于,所述获取目标文档的当前帧图像的多个初始角点,包括:
    基于上一帧图像对应的缩放系数或者预设缩放系数,对所述当前帧图像进行缩放,得到缩放后的当前帧图像;
    基于预设的角点检测算法,获取缩放后的当前帧图像多个初始角点。
  7. 根据权利要求1至6任一项所述的图像处理方法,其特征在于,所述根据各方向上最大距离,确定各方向的缩放系数,包括:
    将最大距离与对应方向上的边长的比值作为所述对应方向上的缩放系数。
  8. 一种图像处理设备,包括处理器和存储装置,所述存储装置适于存储多条程序代码,其特征在于,所述程序代码适于由所述处理器加载并运行以执行权利要求1至7中任一项所述的图像处理方法。
  9. 一种终端,其特征在于,包括如权利要求8所述的图像处理设备。
  10. 一种计算机可读存储介质,其中存储有多条程序代码,其特征在于,所述程序代码适于由处理器加载并运行以执行权利要求1至7中任 一项所述的图像处理方法。
PCT/CN2023/125630 2022-10-24 2023-10-20 图像处理方法、设备、终端和介质 WO2024088167A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202211301775.3A CN117974429A (zh) 2022-10-24 2022-10-24 图像处理方法、设备、终端和介质
CN202211301775.3 2022-10-24

Publications (1)

Publication Number Publication Date
WO2024088167A1 true WO2024088167A1 (zh) 2024-05-02

Family

ID=90830113

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/125630 WO2024088167A1 (zh) 2022-10-24 2023-10-20 图像处理方法、设备、终端和介质

Country Status (2)

Country Link
CN (1) CN117974429A (zh)
WO (1) WO2024088167A1 (zh)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120113489A1 (en) * 2010-11-05 2012-05-10 Rdm Corporation System for mobile image capture and processing of financial documents
US20140032406A1 (en) * 2008-01-18 2014-01-30 Mitek Systems Systems for Mobile Image Capture and Remittance Processing of Documents on a Mobile Device
CN110602401A (zh) * 2019-09-17 2019-12-20 维沃移动通信有限公司 一种拍照方法及终端
CN112399065A (zh) * 2019-08-12 2021-02-23 青岛海信移动通信技术股份有限公司 一种调整焦距的方法和设备
CN113850238A (zh) * 2021-11-29 2021-12-28 北京世纪好未来教育科技有限公司 文档检测方法、装置、电子设备及存储介质

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140032406A1 (en) * 2008-01-18 2014-01-30 Mitek Systems Systems for Mobile Image Capture and Remittance Processing of Documents on a Mobile Device
US20120113489A1 (en) * 2010-11-05 2012-05-10 Rdm Corporation System for mobile image capture and processing of financial documents
CN112399065A (zh) * 2019-08-12 2021-02-23 青岛海信移动通信技术股份有限公司 一种调整焦距的方法和设备
CN110602401A (zh) * 2019-09-17 2019-12-20 维沃移动通信有限公司 一种拍照方法及终端
CN113850238A (zh) * 2021-11-29 2021-12-28 北京世纪好未来教育科技有限公司 文档检测方法、装置、电子设备及存储介质

Also Published As

Publication number Publication date
CN117974429A (zh) 2024-05-03

Similar Documents

Publication Publication Date Title
EP3614333B1 (en) Image processing method, storage medium, and electronic apparatus
EP3614334B1 (en) Method for image processing and electronic device
CN108833784B (zh) 一种自适应构图方法、移动终端及计算机可读存储介质
CN109285136B (zh) 一种图像的多尺度融合方法、装置、存储介质及终端
CN108898549B (zh) 图片处理方法、图片处理装置及终端设备
CN106454139A (zh) 拍照方法及移动终端
EP3940633B1 (en) Image alignment method and apparatus, electronic device, and storage medium
CN106249508A (zh) 自动对焦方法和系统、拍摄装置
WO2022233185A1 (zh) 一种图像滤波方法、装置、终端和计算机可读存储介质
CN105513021A (zh) 图像去噪装置和方法
CN111223061A (zh) 图像修正方法、修正装置、终端设备及可读存储介质
CN111818385B (zh) 视频处理方法、视频处理装置及终端设备
WO2024088167A1 (zh) 图像处理方法、设备、终端和介质
CN113012073A (zh) 视频质量提升模型的训练方法和装置
CN111724326B (zh) 图像处理方法及装置、电子设备及存储介质
CN104883495A (zh) 一种拍照方法及装置
TW200949759A (en) Image processing apparatus and method
CN114827567B (zh) 视频质量分析方法、设备和可读介质
CN110677586A (zh) 图像显示方法、图像显示装置及移动终端
CN113850238B (zh) 文档检测方法、装置、电子设备及存储介质
CN105100587B (zh) 摄像装置及其控制方法
US11132762B2 (en) Content aware image fitting
CN110413817B (zh) 用于对图片进行聚类的方法和设备
CN111612682B (zh) 一种水印处理方法及其装置
JP2984516B2 (ja) 画像の鮮鋭度調整方法