[go: up one dir, main page]

CN115334245A - Image correction method and device, electronic equipment and storage medium - Google Patents

Image correction method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN115334245A
CN115334245A CN202211065428.5A CN202211065428A CN115334245A CN 115334245 A CN115334245 A CN 115334245A CN 202211065428 A CN202211065428 A CN 202211065428A CN 115334245 A CN115334245 A CN 115334245A
Authority
CN
China
Prior art keywords
image
camera
area
occluded
determining
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202211065428.5A
Other languages
Chinese (zh)
Inventor
祝丰年
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Cloudminds Shanghai Robotics Co Ltd
Original Assignee
Cloudminds Shanghai Robotics Co Ltd
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 Cloudminds Shanghai Robotics Co Ltd filed Critical Cloudminds Shanghai Robotics Co Ltd
Priority to CN202211065428.5A priority Critical patent/CN115334245A/en
Publication of CN115334245A publication Critical patent/CN115334245A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/695Control of camera direction for changing a field of view, e.g. pan, tilt or based on tracking of objects
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/64Computer-aided capture of images, e.g. transfer from script file into camera, check of taken image quality, advice or proposal for image composition or decision on when to take image
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/67Focus control based on electronic image sensor signals
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N5/00Details of television systems
    • H04N5/14Picture signal circuitry for video frequency region
    • H04N5/21Circuitry for suppressing or minimising disturbance, e.g. moiré or halo

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Studio Devices (AREA)
  • Image Processing (AREA)

Abstract

The disclosure relates to an image rectification method, an image rectification device, an electronic device and a storage medium. The image rectification method comprises the following steps: when the camera has a stain, determining a shielded area in a first image shot by the camera; determining an offset angle according to the actual size information of the shielded area and a first constraint relation of the offset angle; controlling the camera to adjust the shooting angle according to the offset angle through the electronic equipment, and shooting a second image, wherein the second image and the first image are shot by the same camera; extracting a region image corresponding to the shielded region in the second image, and adjusting the extracted region image according to a second constraint relation between the shooting angle adjusted by the camera and the element value of the extracted region image to obtain a replacement image; and replacing the image of the shielded area in the first image with the replacement image for image correction. Through the scheme, the influence of the sheltered area in the image on the image quality is reduced, extra cleaning equipment is not needed, and the cost is reduced.

Description

一种图像矫正方法、装置、电子设备及存储介质Image correction method, device, electronic equipment and storage medium

分案申请divisional application

本申请是分案申请,原申请的申请号为:201911241547.X,申请日为2019年12月06日,发明名称为“一种图像矫正方法、电子设备及存储介质”。This application is a divisional application, the application number of the original application is: 201911241547.X, the application date is December 06, 2019, and the title of the invention is "an image correction method, electronic equipment and storage medium".

技术领域technical field

本发明实施例涉及图像处理领域,特别涉及一种图像矫正方法、装置、电子设备及存储介质。Embodiments of the present invention relate to the field of image processing, and in particular, to an image correction method, device, electronic equipment, and storage medium.

背景技术Background technique

在摄像头采集的时候,如果摄像头镜头上有污点(比如泥点等),就会导致后续采集出来的图像或者视频数据中的部分数据被污染(被泥点遮挡的部分所采集的数据会失真)。When the camera is collecting, if there are stains (such as mud spots, etc.) on the camera lens, it will cause some data in the subsequent collected images or video data to be polluted (the data collected by the part blocked by the mud spots will be distorted) .

然而,发明人发现现有技术中至少存在如下问题:为减少污点对采集的图像的影响,通过需要通过外置的清理设备来清理摄像头上的污点,成本高。However, the inventors have found that at least the following problems exist in the prior art: in order to reduce the impact of stains on the captured images, it is necessary to clean the stains on the camera with an external cleaning device, which is costly.

发明内容Contents of the invention

本发明实施方式的目的在于提供一种图像矫正方法、装置、电子设备及存储介质,使得减少图像中的被遮挡区域对图像质量的影响,无需额外的清洗设备,降低了成本。The purpose of the embodiment of the present invention is to provide an image correction method, device, electronic equipment and storage medium, so that the influence of the occluded area in the image on the image quality is reduced, no additional cleaning equipment is needed, and the cost is reduced.

为解决上述技术问题,本发明的实施方式提供了一种图像矫正方法,包括以下步骤:当摄像头存在污点时,确定所述摄像头拍摄的第一图像中的被遮挡区域;根据所述被遮挡区域的实际尺寸信息和偏移角度的第一约束关系确定偏移角度;通过电子设备控制所述摄像头按照所述偏移角度调整所述拍摄角度,并拍摄第二图像,所述第二图像与所述第一图像为同一摄像头拍摄;提取所述第二图像中与所述被遮挡区域相对应的区域图像,根据所述摄像头调整的拍摄角度与提取的区域图像的元素值的第二约束关系,对所述提取的区域图像进行调整,得到替换图像;用所述替换图像替换所述第一图像中所述被遮挡区域的图像进行图像修正。In order to solve the above-mentioned technical problems, an embodiment of the present invention provides an image correction method, which includes the following steps: when there is a stain on the camera, determining the occluded area in the first image captured by the camera; according to the occluded area The first constraint relationship between the actual size information of the offset angle and the offset angle determines the offset angle; the electronic device controls the camera to adjust the shooting angle according to the offset angle, and takes a second image, and the second image is consistent with the offset angle The first image is taken by the same camera; an area image corresponding to the covered area in the second image is extracted, and according to the second constraint relationship between the shooting angle adjusted by the camera and the element value of the extracted area image, Adjusting the extracted area image to obtain a replacement image; replacing the image of the covered area in the first image with the replacement image to perform image correction.

本发明的实施方式还提供了一种图像矫正装置,包括:区域确定模块,用于当摄像头存在污点时,确定所述摄像头拍摄的第一图像中的被遮挡区域;角度确定模块,用于根据所述被遮挡区域的实际尺寸信息和偏移角度的第一约束关系确定偏移角度;摄像头控制模块,用于通过电子设备控制所述摄像头按照所述偏移角度调整所述拍摄角度,并拍摄第二图像,所述第二图像与所述第一图像为同一摄像头拍摄;图像调整模块,用于提取所述第二图像中与所述被遮挡区域相对应的区域图像,根据所述摄像头调整的拍摄角度与提取的区域图像的元素值的第二约束关系,对所述提取的区域图像进行调整,得到替换图像;图像修正模块,用于用所述替换图像替换所述第一图像中所述被遮挡区域的图像进行图像修正。Embodiments of the present invention also provide an image correction device, including: an area determination module, configured to determine an occluded area in the first image captured by the camera when there is a stain on the camera; an angle determination module, configured to The actual size information of the covered area and the first constraint relationship of the offset angle determine the offset angle; the camera control module is used to control the camera through the electronic device to adjust the shooting angle according to the offset angle, and shoot The second image, the second image and the first image are taken by the same camera; the image adjustment module is used to extract the area image corresponding to the covered area in the second image, and adjust the image according to the camera The second constraint relationship between the shooting angle of the extracted area image and the element value of the extracted area image is adjusted to obtain a replacement image; an image correction module is used to replace all the elements in the first image with the replacement image Perform image correction on the image of the above-mentioned occluded area.

本发明的实施方式还提供了一种电子设备,包括:至少一个处理器;以及,与至少一个处理器通信连接的存储器;其中,存储器存储有可被至少一个处理器执行的指令,指令被至少一个处理器执行,以使至少一个处理器能够执行如上述实施方式提及的图像矫正方法。The embodiment of the present invention also provides an electronic device, including: at least one processor; and a memory connected to the at least one processor in communication; wherein, the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by at least one processor. Executed by a processor, so that at least one processor can execute the image correction method mentioned in the above-mentioned embodiments.

本发明的实施方式还提供了一种计算机可读存储介质,存储有计算机程序,计算机程序被处理器执行时实现上述实施方式提及的图像矫正方法。Embodiments of the present invention also provide a computer-readable storage medium storing a computer program, and implementing the image correction method mentioned in the above embodiment when the computer program is executed by a processor.

进一步的,所述根据所述被遮挡区域的实际尺寸信息和偏移角度的第一约束关系确定偏移角度,具体包括:根据所述被遮挡区域的图像尺寸信息,确定所述被遮挡区域的实际尺寸信息;根据所述实际尺寸信息,以及预设的实际尺寸信息和偏移角度的第一约束关系,确定偏移角度。Further, the determining the offset angle according to the actual size information of the occluded area and the first constraint relationship of the offset angle specifically includes: according to the image size information of the occluded area, determining the Actual size information: determining the offset angle according to the actual size information and the preset first constraint relationship between the actual size information and the offset angle.

进一步的,所述被遮挡区域的实际尺寸信息为所述被遮挡区域对应的空间的实际高度,所述第一约束关系为:偏移角度=第一比例参数*实际高度÷摄像头的焦距。Further, the actual size information of the occluded area is the actual height of the space corresponding to the occluded area, and the first constraint relationship is: offset angle=first scale parameter*actual height÷the focal length of the camera.

进一步的,所述提取所述第二图像中与所述被遮挡区域相对应的区域图像,根据所述摄像头调整的拍摄角度与提取的区域图像的元素值的第二约束关系,对所述提取的区域图像进行调整,得到替换图像,具体包括:将与所述被遮挡区域相对应的区域的图像作为候选图像;根据所述摄像头调整的角度和候选图像的像素的元素值的第二约束关系,确定所述替换图像中各像素的元素值;对所述候选图像进行调整,得到所述替换图像。Further, in the extraction of the area image corresponding to the occluded area in the second image, according to the second constraint relationship between the shooting angle adjusted by the camera and the element value of the extracted area image, the extracted Adjust the area image of the area to obtain a replacement image, specifically including: using the image of the area corresponding to the occluded area as a candidate image; according to the second constraint relationship between the angle adjusted by the camera and the element value of the pixel of the candidate image , determining the element value of each pixel in the replacement image; adjusting the candidate image to obtain the replacement image.

进一步的,所述根据所述摄像头调整的角度和候选图像的像素的元素值的第二约束关系,确定所述替换图像中各像素的元素值,具体包括:根据所述摄像头调整的角度,以及候选图像的像素的元素值、摄像头调整的角度和替换图像的像素的元素值的第二约束关系,确定所述替换图像中各像素的元素值;其中,所述第二约束关系为:替换图像中的像素的元素值=候选图像的像素的元素值*第二比例参数,所述第二比例参数根据所述摄像头调整的角度确定。Further, the determining the element value of each pixel in the replacement image according to the second constraint relationship between the angle adjusted by the camera and the element value of the pixel in the candidate image specifically includes: according to the angle adjusted by the camera, and The second constraint relationship of the element value of the pixel of the candidate image, the angle adjusted by the camera, and the element value of the pixel of the replacement image determines the element value of each pixel in the replacement image; wherein, the second constraint relationship is: the replacement image The element value of the pixel in=the element value of the pixel of the candidate image*the second scale parameter, the second scale parameter is determined according to the angle adjusted by the camera.

进一步的,所述图像矫正方法还包括:提取所述第一图像的图像特征;将所述第一图像的图像特征与图像数据集中存储的第三图像的图像特征进行比较,根据比较结果,判断所述第一图像中是否存在被遮挡区域。Further, the image correction method further includes: extracting the image features of the first image; comparing the image features of the first image with the image features of the third image stored in the image data set, and judging according to the comparison result Whether there is an occluded area in the first image.

进一步的,所述根据比较结果,判断所述第一图像中是否存在被遮挡区域,具体包括:若所述第一图像与所述图像数据集中所有图像的比较结果中,指示所述第一图像中存在被遮挡区域的比较结果的个数不小于N,则确定所述第一图像中存在被遮挡区域;若指示所述第一图像中存在被遮挡区域的比较结果的个数小于N,则确定所述第一图像中不存在被遮挡区域。Further, the judging whether there is an occluded area in the first image according to the comparison result specifically includes: if the comparison result between the first image and all the images in the image data set indicates that the first image If the number of comparison results of the occluded area in the first image is not less than N, it is determined that there is an occluded area in the first image; if the number of comparison results indicating that there is an occluded area in the first image is less than N, then It is determined that there is no occluded area in the first image.

进一步的,所述确定第二图像中与被遮挡区域相对应的区域,具体方法包括:确定所述第一图像中被遮挡区域的左边界坐标和右边界坐标,将所述被遮挡区域的左边界坐标作为所述第二图像中与所述被遮挡区域相对应的区域的左边界坐标,将所述被遮挡区域的右边界坐标作为所述第二图像中与所述被遮挡区域相对应的区域的右边界坐标;根据所述摄像头调整的角度和摄像头的焦距,确定上边界坐标和下边界坐标的调整量;确定所述第一图像中所述被遮挡区域的上边界坐标和下边界坐标,将所述被遮挡区域的上边界坐标加调整量得到的值,作为所述第二图像中与所述被遮挡区域相对应的区域的上边界坐标,将所述被遮挡区域的下边界坐标加调整量得到的值,作为所述第二图像中与所述被遮挡区域相对应的区域的下边界坐标。Further, the specific method of determining the area corresponding to the occluded area in the second image includes: determining the left boundary coordinates and right boundary coordinates of the occluded area in the first image, and dividing the left boundary coordinates of the occluded area The boundary coordinates are used as the left boundary coordinates of the area corresponding to the occluded area in the second image, and the right boundary coordinates of the occluded area are used as the area corresponding to the occluded area in the second image. The right boundary coordinates of the area; according to the adjusted angle of the camera and the focal length of the camera, determine the adjustment amount of the upper boundary coordinates and the lower boundary coordinates; determine the upper boundary coordinates and the lower boundary coordinates of the covered area in the first image , the value obtained by adding the adjustment amount to the upper boundary coordinate of the occluded area is used as the upper boundary coordinate of the area corresponding to the occluded area in the second image, and the lower boundary coordinate of the occluded area is The value obtained by adding the adjustment amount is used as the lower boundary coordinate of the area corresponding to the occluded area in the second image.

本发明实施方式相对于现有技术而言,在第一图像中存在被遮挡区域的情况下,可以自动调整摄像头的拍摄角度,以获取包含被遮挡区域的图像的第二图像。基于第二图像对第一图像进行修正,可以减少第一图像中被遮挡区域的大小,减少了由于污点等遮挡物的存在导致图像数据丢失的情况,使得减少图像中的被遮挡区域对图像质量的影响。由于该图像矫正方法无需额外的清洗设备对污点进行清洗,降低了成本。Compared with the prior art, the embodiment of the present invention can automatically adjust the shooting angle of the camera to acquire the second image containing the image of the blocked area when the blocked area exists in the first image. Correcting the first image based on the second image can reduce the size of the occluded area in the first image, and reduce the loss of image data due to the existence of occlusions such as stains, so that reducing the occluded area in the image has an impact on image quality Impact. Since the image correction method does not require additional cleaning equipment to clean the stains, the cost is reduced.

附图说明Description of drawings

一个或多个实施例通过与之对应的附图中的图片进行示例性说明,这些示例性说明并不构成对实施例的限定,附图中具有相同参考数字标号的元件表示为类似的元件,除非有特别申明,附图中的图不构成比例限制。One or more embodiments are exemplified by the pictures in the corresponding drawings, and these exemplifications do not constitute a limitation to the embodiments. Elements with the same reference numerals in the drawings represent similar elements. Unless otherwise stated, the drawings in the drawings are not limited to scale.

图1是根据本发明的第一实施方式的图像矫正方法的流程图;Fig. 1 is a flowchart of an image correction method according to a first embodiment of the present invention;

图2是根据本发明的第一实施方式的摄像头和拍摄物体的位置关系示意图;2 is a schematic diagram of the positional relationship between the camera and the photographed object according to the first embodiment of the present invention;

图3a是根据本发明的第一实施方式的第一图像的示意图;Figure 3a is a schematic diagram of a first image according to a first embodiment of the present invention;

图3b是根据本发明的第一实施方式的第二图像的示意图;Figure 3b is a schematic diagram of a second image according to the first embodiment of the present invention;

图3c是根据本发明的第一实施方式的修正后的第一图像的示意图;Fig. 3c is a schematic diagram of the corrected first image according to the first embodiment of the present invention;

图4是根据本发明的第二实施方式的图像矫正方法的流程图;4 is a flowchart of an image correction method according to a second embodiment of the present invention;

图5是根据本发明的第三实施方式的图像矫正装置的结构示意图;5 is a schematic structural diagram of an image correction device according to a third embodiment of the present invention;

图6是根据本发明的第四实施方式的图像矫正装置的结构示意图;6 is a schematic structural diagram of an image correction device according to a fourth embodiment of the present invention;

图7是根据本发明的第五实施方式的图像矫正装置的结构示意图;7 is a schematic structural diagram of an image correction device according to a fifth embodiment of the present invention;

图8是根据本发明的第五实施方式的电子设备的结构示意图。FIG. 8 is a schematic structural diagram of an electronic device according to a fifth embodiment of the present invention.

具体实施方式Detailed ways

为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合附图对本发明的各实施方式进行详细的阐述。然而,本领域的普通技术人员可以理解,在本发明各实施方式中,为了使读者更好地理解本申请而提出了许多技术细节。但是,即使没有这些技术细节和基于以下各实施方式的种种变化和修改,也可以实现本申请所要求保护的技术方案。In order to make the purpose, technical solutions and advantages of the embodiments of the present invention more clear, various implementation modes of the present invention will be described in detail below in conjunction with the accompanying drawings. However, those of ordinary skill in the art can understand that, in each implementation manner of the present invention, many technical details are provided for readers to better understand the present application. However, even without these technical details and various changes and modifications based on the following implementation modes, the technical solution claimed in this application can also be realized.

除非上下文明确要求,否则整个说明书和权利要求书中的“包括”、“包含”等类似词语应当解释为包含的含义而不是排他或穷举的含义;也就是说,是“包括但不限于”的含义。Unless the context clearly requires, throughout the specification and claims, "comprises", "comprises" and similar words should be interpreted in an inclusive sense rather than an exclusive or exhaustive meaning; that is, "including but not limited to" meaning.

在本发明公开的描述中,需要理解的是,术语“第一”、“第二”等仅用于描述目的,而不能理解为指示或暗示相对重要性。此外,在本发明公开的描述中,除非另有说明,“多个”的含义是两个或两个以上。In the description of the present disclosure, it should be understood that the terms "first", "second" and so on are used for descriptive purposes only, and should not be understood as indicating or implying relative importance. In addition, in the description of the present disclosure, unless otherwise specified, "plurality" means two or more.

本发明的第一实施方式涉及一种图像矫正方法,应用于电子设备,如终端或服务器。如图1所示,图像矫正方法包括以下步骤:The first embodiment of the present invention relates to an image correction method, which is applied to an electronic device, such as a terminal or a server. As shown in Figure 1, the image correction method includes the following steps:

步骤101:当摄像头存在污点时,确定所述摄像头拍摄的第一图像中的被遮挡区域。Step 101: When there is a stain on the camera, determine an occluded area in the first image captured by the camera.

具体地说,当摄像头存在污点,或被拍摄物体被其他物体遮挡时,电子设备认为第一图像中存在被遮挡区域。Specifically, when there is a stain on the camera or the object to be photographed is blocked by other objects, the electronic device determines that there is a blocked area in the first image.

步骤102:根据所述被遮挡区域的实际尺寸信息和偏移角度的第一约束关系确定偏移角度。Step 102: Determine the offset angle according to the actual size information of the covered area and the first constraint relationship of the offset angle.

以下对电子设备调整摄像头的拍摄角度的方式进行举例说明。The manner in which the electronic device adjusts the shooting angle of the camera is described below with an example.

方式a,电子设备按照预设的偏移角度,控制摄像头转动偏移角度。In mode a, the electronic device controls the rotation of the camera to the offset angle according to the preset offset angle.

方式b,电子设备根据被遮挡区域的图像尺寸信息,确定被遮挡区域的实际尺寸信息;根据实际尺寸信息,以及预设的实际尺寸信息和偏移角度的第一约束关系,确定偏移角度;控制摄像头转动偏移角度。Mode b, the electronic device determines the actual size information of the occluded area according to the image size information of the occluded area; determines the offset angle according to the actual size information, and the preset first constraint relationship between the actual size information and the offset angle; Control the camera rotation offset angle.

在一个实施例中,被遮挡区域的实际尺寸信息为被遮挡区域对应的空间的实际高度。第一约束关系为:偏移角度=第一比例参数*实际高度÷摄像头的焦距。其中,第一比例参数可以根据实际测量结果得到,取值范围为-90°~90°。摄像头11和拍摄物体12的位置关系示意图如图2所示,假设,图像偏移对应的空间的实际高度为d,摄像头的焦距为f,由图2可知,摄像头偏移角度B和偏移的高度呈正比例关系,因此,可以偏移角度和被遮挡区域的高度的函数关系为:B=k*d/f。In one embodiment, the actual size information of the blocked area is the actual height of the space corresponding to the blocked area. The first constraint relationship is: offset angle=first proportional parameter*actual height÷the focal length of the camera. Wherein, the first ratio parameter can be obtained according to actual measurement results, and the value range is -90°˜90°. The schematic diagram of the positional relationship between the camera 11 and the shooting object 12 is shown in Figure 2. Assume that the actual height of the space corresponding to the image offset is d, and the focal length of the camera is f. As can be seen from Figure 2, the camera offset angle B and the offset The height is directly proportional, therefore, the functional relationship between the offset angle and the height of the blocked area is: B=k*d/f.

需要说明的是,被遮挡区域尺寸和偏移角度之间还可以是其他约束关系,本实施方式仅为举例说明,不限制被遮挡区域尺寸和偏移角度的具体约束关系。It should be noted that there may be other constraint relationships between the size of the shaded area and the offset angle. This embodiment is only for illustration, and does not limit the specific constraint relationship between the size of the shaded area and the offset angle.

步骤103:通过电子设备控制所述摄像头按照所述偏移角度调整所述拍摄角度,并拍摄第二图像,所述第二图像与所述第一图像为同一摄像头拍摄。Step 103: Control the camera through the electronic device to adjust the shooting angle according to the offset angle, and shoot a second image, where the second image is taken by the same camera as the first image.

当摄像头存在污点,或被拍摄物体被其他物体遮挡时,电子设备认为第一图像中存在被遮挡区域的情况下,电子设备通过调整摄像头的拍摄角度,根据步骤102中确定的偏移角度来拍摄第二图像,以使污点或其他物体遮挡的部分或全部图像出现在第二图像中。When there is a stain on the camera, or the object to be photographed is blocked by other objects, and the electronic device considers that there is an occluded area in the first image, the electronic device adjusts the shooting angle of the camera and takes the picture according to the offset angle determined in step 102 A second image, so that some or all of the image that is obscured by a stain or other object appears in the second image.

具体地说,由于第二图像中包括被污点或其他物体遮挡的部分或全部图像,电子设备可以基于第二图像,完善第一图像,以减少第一图像中被遮挡区域的大小。Specifically, since the second image includes part or all of the image that is blocked by stains or other objects, the electronic device may improve the first image based on the second image, so as to reduce the size of the blocked area in the first image.

步骤104:提取所述第二图像中与所述被遮挡区域相对应的区域图像,根据所述摄像头调整的拍摄角度与提取的区域图像的元素值的第二约束关系,对所述提取的区域图像进行调整,得到替换图像。Step 104: extracting the area image corresponding to the occluded area in the second image, and according to the second constraint relationship between the shooting angle adjusted by the camera and the element value of the extracted area image, the extracted area The image is adjusted to obtain a replacement image.

步骤105:用所述替换图像替换所述第一图像中所述被遮挡区域的图像进行图像修正。Step 105: Replace the image of the occluded area in the first image with the replacement image to perform image correction.

对于步骤104和105,具体地,在一个实施例中,电子设备修正第一图像的过程包括:根据第一图像中被遮挡区域的位置信息,以及摄像头调整的角度,确定第二图像中与被遮挡区域相对应的区域;提取第二图像中与被遮挡区域相对应的区域的图像,得到替换图像;用替换图像替换第一图像中被遮挡区域的图像。Regarding steps 104 and 105, specifically, in one embodiment, the process of correcting the first image by the electronic device includes: determining the position information of the occluded area in the first image and the angle adjusted by the camera An area corresponding to the occluded area; extracting an image of the area corresponding to the occluded area in the second image to obtain a replacement image; replacing the image of the occluded area in the first image with the replacement image.

在一个实施例中,电子设备确定第二图像中与被遮挡区域相对应的区域的方法是:确定第一图像中被遮挡区域的左边界坐标和右边界坐标,将被遮挡区域的左边界坐标作为第二图像中与被遮挡区域相对应的区域的左边界坐标,将被遮挡区域的右边界坐标作为第二图像中与被遮挡区域相对应的区域的右边界坐标。根据摄像头调整的角度和摄像头的焦距,确定上边界坐标和下边界坐标的调整量。确定第一图像中被遮挡区域的上边界坐标和下边界坐标,将被遮挡区域的上边界坐标加调整量得到的值,作为第二图像中与被遮挡区域相对应的区域的上边界坐标,将被遮挡区域的下边界坐标加调整量得到的值,作为第二图像中与被遮挡区域相对应的区域的下边界坐标。In one embodiment, the method for the electronic device to determine the area corresponding to the occluded area in the second image is: determine the left boundary coordinates and right boundary coordinates of the occluded area in the first image, and the left boundary coordinates of the occluded area As the left boundary coordinates of the area corresponding to the occluded area in the second image, the right boundary coordinates of the occluded area are used as the right boundary coordinates of the area corresponding to the occluded area in the second image. According to the adjusted angle of the camera and the focal length of the camera, the adjustment amounts of the upper boundary coordinates and the lower boundary coordinates are determined. Determine the upper boundary coordinates and lower boundary coordinates of the occluded area in the first image, add the value obtained by adding the adjustment amount to the upper boundary coordinates of the occluded area, as the upper boundary coordinates of the area corresponding to the occluded area in the second image, A value obtained by adding the adjustment amount to the lower boundary coordinate of the occluded area is used as the lower boundary coordinate of the area corresponding to the occluded area in the second image.

需要说明的是,本领域技术人员可以理解,实际应用中,还可以通过其他方式来确定第二图像中与被遮挡区域相对应的区域的位置,本实施方式不限制电子设备确定第二图像中与被遮挡区域相对应的区域的位置的方法。It should be noted that those skilled in the art can understand that in practical applications, other methods can also be used to determine the position of the region corresponding to the blocked region in the second image. This embodiment does not limit the electronic device to determine Method for the position of the region corresponding to the occluded region.

在一个实施例中,替换图像的获取过程包括:电子设备将第二图像中与被遮挡区域相对应的区域的图像作为候选图像;根据摄像头调整的角度,对候选图像进行调整,得到替换图像。In one embodiment, the process of obtaining the replacement image includes: the electronic device takes an image of an area corresponding to the occluded area in the second image as a candidate image; and adjusts the candidate image according to the angle adjusted by the camera to obtain the replacement image.

在一个实施例中,电子设备对候选图像进行调整的过程包括:根据摄像头调整的角度,以及候选图像的像素的元素值、摄像头调整的角度和替换图像的像素的元素值的第二约束关系,确定替换图像中各像素的元素值;其中,第二约束关系为:替换图像中的像素的元素值=候选图像的像素的元素值*第二比例参数,第二比例参数根据摄像头调整的角度确定。其中,第二比例参数取值范围为0~1。In one embodiment, the process of the electronic device adjusting the candidate image includes: according to the angle adjusted by the camera, and the second constraint relationship between the element value of the pixel of the candidate image, the angle adjusted by the camera, and the element value of the pixel of the replacement image, Determine the element value of each pixel in the replacement image; wherein, the second constraint relationship is: the element value of the pixel in the replacement image=the element value of the pixel in the candidate image*the second scale parameter, and the second scale parameter is determined according to the angle adjusted by the camera . Wherein, the value range of the second ratio parameter is 0-1.

例如,电子设备可以通过图像的非线性拉升,转化候选图像,得到替换图像,以使替换图像与第一图像更贴合。具体地说,电子设备可以将候选图像的图像信息可以转化为矩阵数据进行存储,构造矩阵数据src,表示该候选图像的图像信息,构造矩阵数据dst,用于表示替换图像的图像信息。假设src中,位置(i,j)的元素值为s,把src的位置(i,j)的元素映射到dst的位置(i,j)上,该映射关系与摄像头调整的角度相关,可以建立如下的映射关系:t=s*k(B),其中,t表示dst的位置(i,j)上的元素值,s表示src的位置(i,j)的元素值,k(B)是关于调整角度B的函数,即第二比例参数,可以根据实际测量结果得到。For example, the electronic device can transform the candidate image through nonlinear upscaling of the image to obtain a replacement image, so that the replacement image fits better with the first image. Specifically, the electronic device can convert the image information of the candidate image into matrix data for storage, construct matrix data src to represent the image information of the candidate image, and construct matrix data dst to represent the image information of the replacement image. Assuming that in src, the element value of position (i, j) is s, the element of position (i, j) of src is mapped to the position (i, j) of dst. The mapping relationship is related to the angle of camera adjustment, which can be Establish the following mapping relationship: t=s*k(B), wherein, t represents the element value on the position (i, j) of dst, s represents the element value of the position (i, j) of src, k(B) is a function about the adjustment angle B, that is, the second proportional parameter, which can be obtained according to actual measurement results.

需要说明的是,本领域技术人员可以理解,第二比例参数和摄像头调整的角度之间的约束关系可以根据需要设置,本实施方式不作限制。It should be noted that those skilled in the art can understand that the constraint relationship between the second scale parameter and the angle adjusted by the camera can be set as required, which is not limited in this embodiment.

需要说明的是,本领域技术人员可以理解,实际应用中,第二约束关系可以根据需要设置,本实施方式仅为举例说明。It should be noted that those skilled in the art may understand that in practical applications, the second constraint relationship may be set as required, and this embodiment is only for illustration.

例如,摄像头拍摄的第一图像如图3a所示,第二图像如图3b所示,图3b中虚线框表示与第一图像中的被遮挡区域相对应的区域,通过本实施方式提及的图像矫正方法,可以将图3b中虚线框的图像与第一图像进行合成,以修正第一图像,修正后的第一图像如图3c所示。For example, the first image captured by the camera is shown in Figure 3a, and the second image is shown in Figure 3b. The dashed box in Figure 3b indicates the area corresponding to the blocked area in the first image. In the image correction method, the image framed by a dotted line in FIG. 3b can be synthesized with the first image to correct the first image. The corrected first image is shown in FIG. 3c.

需要说明的是,以上仅为举例说明,并不对本发明的技术方案构成限定。It should be noted that the above is only for illustration and does not limit the technical solution of the present invention.

与现有技术相比,本实施方式中提供的图像矫正方法,在第一图像中存在被遮挡区域的情况下,可以自动调整摄像头的拍摄角度,以获取包含被遮挡区域的图像的第二图像。基于第二图像对第一图像进行修正,可以减少第一图像中被遮挡区域的大小,减少了由于污点等遮挡物的存在导致图像数据丢失的情况,使得减少图像中的被遮挡区域对图像质量的影响。由于该图像矫正方法无需额外的清洗设备对污点进行清洗,降低了成本。Compared with the prior art, the image correction method provided in this embodiment can automatically adjust the shooting angle of the camera to obtain the second image containing the image of the occluded area when there is an occluded area in the first image . Correcting the first image based on the second image can reduce the size of the occluded area in the first image, and reduce the loss of image data due to the existence of occlusions such as stains, so that reducing the occluded area in the image has an impact on image quality Impact. Since the image correction method does not require additional cleaning equipment to clean the stains, the cost is reduced.

本发明的第二实施方式涉及一种图像矫正方法,本实施方式中,举例说明了第一实施方式中,电子设备确定第一图像中存在被遮挡区域的方法。The second embodiment of the present invention relates to an image correction method. In this embodiment, an example is given to illustrate the method for the electronic device to determine that an occluded area exists in the first image in the first embodiment.

具体的说,如图4所示,在本实施方式中,电子设备确定第一图像中存在被遮挡区域的方法包括以下步骤:Specifically, as shown in FIG. 4, in this embodiment, the method for the electronic device to determine that there is an occluded area in the first image includes the following steps:

步骤201:提取第一图像的图像特征。Step 201: Extract image features of the first image.

具体地说,电子设备对当前采集的第一图像的图像特征进行提取。Specifically, the electronic device extracts image features of the currently collected first image.

需要说明的是,图像特征可以是图像的灰度值、亮度值等特征中的任意一个或任意组合,本实施方式不作限制。It should be noted that the image feature may be any one or any combination of features such as grayscale value and brightness value of the image, which is not limited in this embodiment.

步骤202:将第一图像的图像特征与图像数据集中存储的第三图像的图像特征进行比较,根据比较结果,判断第一图像中是否存在被遮挡区域。Step 202: Compare the image features of the first image with the image features of the third image stored in the image data set, and judge whether there is an occluded area in the first image according to the comparison result.

具体地说,图像数据集中可以包括预存图像,和/或,摄像头在拍摄第一图像之前拍摄的第三图像。若图像数据集中的第三图像为不存在被遮挡区域的图像,则第一图像中存在被遮挡区域时,第一图像的图像特征和第三图像的图像特征存在差异。若图像数据集中第三图像为存在被遮挡区域的图像,则第一图像中存在被遮挡区域时,第一图像的图像特征与该区域也被遮挡的第三图像的图像特征相近。Specifically, the image data set may include a prestored image, and/or a third image captured by the camera before the first image is captured. If the third image in the image data set is an image without an occluded area, then when an occluded area exists in the first image, there is a difference between the image features of the first image and the image features of the third image. If the third image in the image data set is an image with an occluded area, then when an occluded area exists in the first image, the image features of the first image are similar to the image features of the third image whose area is also occluded.

以下以第三图像为不存在被遮挡区域的图像为例,对电子设备确定比较结果的过程进行举例说明。The process of determining the comparison result by the electronic device will be illustrated below by taking the third image as an image without an occluded area as an example.

在一个实施例中,第一图像拍摄的场景为静态场景。电子设备将第一图像的图像特征与图像数据集的该场景的第三图像的图像特征进行比较。可选的,电子设备将第一图像划分为多个区域,若第一图像某个区域的图像特征与第三图像的图像特征不相近,则第一图像与该第三图像的比较结果指示第一图像存在被遮挡区域。若第一图像的所有区域的图像特征与第三图像的图像特征均相近,则第一图像与该第三图像的比较结果指示第一图像不存在被遮挡区域。其中,两个区域的图像特征是否相近的判断标准可以是,判断这两个区域的图像特征的差值是否大于预设值,若大于预设值,则认为两者不相近,若不大于预设值,则认为两者相近。In one embodiment, the scene captured by the first image is a static scene. The electronic device compares image features of the first image with image features of a third image of the scene of the image data set. Optionally, the electronic device divides the first image into multiple regions, and if the image features of a certain region of the first image are not similar to the image features of the third image, the comparison result between the first image and the third image indicates that the third image An image has an occluded area. If the image features of all areas of the first image are similar to those of the third image, the comparison result between the first image and the third image indicates that there is no blocked area in the first image. Wherein, the criterion for judging whether the image features of the two regions are similar may be to judge whether the difference of the image features of the two regions is greater than a preset value, if it is greater than the preset value, it is considered that the two are not similar, and if it is not greater than the preset value. value, the two are considered to be similar.

在一个实施例中,第一图像拍摄的场景为动态场景,电子设备将第一图像的图像特征与图像数据集中该场景的第三图像的图像特征进行比较。可选的,电子设备将第一图像划分为多个区域,若第一图像某个区域的图像特征与第三图像的图像特征相近,则第一图像与该第三图像的比较结果指示第一图像存在被遮挡区域。若第一图像中所有区域的图像特征与第三图像的图像特征均不相近,则第一图像与该第三图像的比较结果指示第一图像不存在被遮挡区域。In one embodiment, the scene captured by the first image is a dynamic scene, and the electronic device compares the image features of the first image with the image features of the third image of the scene in the image data set. Optionally, the electronic device divides the first image into multiple regions, and if the image features of a certain region of the first image are similar to those of the third image, the comparison result between the first image and the third image indicates that the first There are occluded areas in the image. If the image features of all regions in the first image are not similar to the image features of the third image, the comparison result between the first image and the third image indicates that there is no blocked area in the first image.

需要说明的是,电子设备判定第一图像和第三图像的比较结果的方式可以根据需要设置,本实施方式仅为举例说明。It should be noted that, the manner in which the electronic device determines the comparison result between the first image and the third image may be set as required, and this embodiment is only for illustration.

在一个实施例中,电子设备可以根据第一图像中,与第三图像的图像特征相近的区域在第一图像中的占比,判断当前拍摄的场景为静态场景还是动态场景。例如,若占比大于预设比值,则认为当前拍摄的场景为静态场景,若不大于预设的比值,则认为当前拍摄的场景为动态场景。In an embodiment, the electronic device may determine whether the currently captured scene is a static scene or a dynamic scene according to the proportion of the area in the first image that is similar to the image feature of the third image in the first image. For example, if the ratio is greater than the preset ratio, the currently photographed scene is considered to be a static scene, and if not greater than the preset ratio, the currently photographed scene is considered to be a dynamic scene.

需要说明的是,实际应用中,电子设备也可以根据外部输入,或者其他方式,判断当前拍摄的场景是静态场景还是动态场景,本实施方式仅为举例说明。It should be noted that, in practical applications, the electronic device may also determine whether the currently photographed scene is a static scene or a dynamic scene according to external input or other methods, and this embodiment is only for illustration.

在一个实施例中,若第一图像与图像数据集中所有图像的比较结果中,指示第一图像中存在被遮挡区域的比较结果的个数不小于N,则确定第一图像中存在被遮挡区域;若指示第一图像中存在被遮挡区域的比较结果的个数小于N,则确定第一图像中不存在被遮挡区域。其中,N可以根据需要设置为任意正整数。In one embodiment, if among the comparison results between the first image and all images in the image data set, the number of comparison results indicating that there is an occluded area in the first image is not less than N, then it is determined that there is an occluded area in the first image ; If the number of comparison results indicating that there is an occluded area in the first image is less than N, then determine that there is no occluded area in the first image. Wherein, N can be set as any positive integer as required.

值得一提的是,在N个比较结果指示第一图像中存在被遮挡区域后,才判定第一图像存在被遮挡区域,执行步骤101和步骤102所示的图像矫正方法,减少了由于将不存在被遮挡区域的图像判为存在被遮挡区域的图像造成的计算资源浪费。It is worth mentioning that after the N comparison results indicate that there is an occluded area in the first image, it is determined that there is an occluded area in the first image, and the image correction method shown in steps 101 and 102 is executed, which reduces the An image with an occluded area is judged to be a waste of computing resources caused by an image with an occluded area.

在另一实施例中,第一图像依次与图像数据集中的第三图像进行比较,图像数据集中的任意一幅图像的图像特征与第一图像的图像特征的比较结果指示第一图像存在被遮挡区域时,则认为第一图像存在被遮挡区域。In another embodiment, the first image is sequentially compared with the third image in the image data set, and the comparison result of the image features of any image in the image data set with the image features of the first image indicates that the first image is occluded area, it is considered that the first image has an occluded area.

值得一提的是,在任一比较结果指示第一图像存在被遮挡区域的情况下,判定第一图像存在被遮挡区域,提高了电子设备检查图像是否存在被遮挡区域的查全率。It is worth mentioning that, if any comparison result indicates that the first image has an occluded area, it is determined that the first image has an occluded area, which improves the recall rate of the electronic device for checking whether the image has an occluded area.

需要说明的是,本领域技术人员可以理解,实际应用中,可以根据需要设置第一图像存在被遮挡区域的判断标准,上述实施例仅为举例说明,本实施方式不限制其具体判断过程。It should be noted that those skilled in the art can understand that in practical applications, the criterion for judging that the first image has an occluded region can be set as required. The above-mentioned embodiment is only for illustration, and this embodiment does not limit the specific judging process.

需要说明的是,以上仅为举例说明,并不对本发明的技术方案构成限定。It should be noted that the above is only for illustration and does not limit the technical solution of the present invention.

与现有技术相比,本实施方式中提供的图像矫正方法,电子设备将第一图像的图像特征与图像数据集中的第三图像的图像特征进行比较,以确定第一图像中是否存在被遮挡区域,实现了第一图像的被遮挡区域的自动检测,提高了电子设备的智能性。Compared with the prior art, in the image correction method provided in this embodiment, the electronic device compares the image features of the first image with the image features of the third image in the image data set to determine whether there is an occluded image in the first image. The region realizes the automatic detection of the blocked region of the first image, and improves the intelligence of the electronic device.

上面各种方法的步骤划分,只是为了描述清楚,实现时可以合并为一个步骤或者对某些步骤进行拆分,分解为多个步骤,只要包括相同的逻辑关系,都在本专利的保护范围内;对算法中或者流程中添加无关紧要的修改或者引入无关紧要的设计,但不改变其算法和流程的核心设计都在该专利的保护范围内。The step division of the above various methods is only for the sake of clarity of description. During implementation, it can be combined into one step or some steps can be split and decomposed into multiple steps. As long as they include the same logical relationship, they are all within the scope of protection of this patent. ; Adding insignificant modifications or introducing insignificant designs to the algorithm or process, but not changing the core design of the algorithm and process are all within the scope of protection of this patent.

本发明的第三实施方式涉及一种图像矫正装置,如图5所示,包括:摄像头控制模块501和图像修正模块502。摄像头控制模块501用于在确定摄像头拍摄的第一图像中存在被遮挡区域后,控制摄像头调整拍摄角度,并拍摄第二图像。图像修正模块502用于根据第二图像,修正第一图像中被遮挡区域的图像。The third embodiment of the present invention relates to an image correction device, as shown in FIG. 5 , including: a camera control module 501 and an image correction module 502 . The camera control module 501 is configured to control the camera to adjust the shooting angle and take a second image after determining that there is an occluded area in the first image captured by the camera. The image correction module 502 is used for correcting the image of the occluded area in the first image according to the second image.

具体更详尽的,如图6所示,所述图像矫正装置包括:区域确定模块505、角度确定模块506、摄像头控制模块501、图像调整模块507和图像修正模块502。More specifically, as shown in FIG. 6 , the image correction device includes: an area determination module 505 , an angle determination module 506 , a camera control module 501 , an image adjustment module 507 and an image correction module 502 .

区域确定模块505,用于当摄像头存在污点时,确定所述摄像头拍摄的第一图像中的被遮挡区域;An area determination module 505, configured to determine the covered area in the first image captured by the camera when there is a stain on the camera;

角度确定模块506,用于根据所述被遮挡区域的实际尺寸信息和偏移角度的第一约束关系确定偏移角度;An angle determination module 506, configured to determine the offset angle according to the actual size information of the covered area and the first constraint relationship of the offset angle;

摄像头控制模块501,用于通过电子设备控制所述摄像头按照所述偏移角度调整所述拍摄角度,并拍摄第二图像,所述第二图像与所述第一图像为同一摄像头拍摄;The camera control module 501 is configured to control the camera through an electronic device to adjust the shooting angle according to the offset angle, and take a second image, and the second image and the first image are taken by the same camera;

图像调整模块507,用于提取所述第二图像中与所述被遮挡区域相对应的区域图像,根据所述摄像头调整的拍摄角度与提取的区域图像的元素值的第二约束关系,对所述提取的区域图像进行调整,得到替换图像;The image adjustment module 507 is configured to extract an area image corresponding to the occluded area in the second image, and perform an adjustment on the area image according to the second constraint relationship between the shooting angle adjusted by the camera and the element value of the extracted area image. adjusting the extracted region image to obtain a replacement image;

图像修正模块502,用于用所述替换图像替换所述第一图像中所述被遮挡区域的图像进行图像修正。An image correction module 502, configured to replace the image of the occluded area in the first image with the replacement image to perform image correction.

其中,区域确定模块505、角度确定模块506、摄像头控制模块501、图像调整模块507和图像修正模块502的具体执行功能可参考图1中的相关步骤方法的执行。Wherein, the specific execution functions of the area determination module 505 , the angle determination module 506 , the camera control module 501 , the image adjustment module 507 and the image correction module 502 can refer to the implementation of the relevant steps and methods in FIG. 1 .

不难发现,本实施方式为与第一实施方式相对应的系统实施例,本实施方式可与第一实施方式互相配合实施。第一实施方式中提到的相关技术细节在本实施方式中依然有效,为了减少重复,这里不再赘述。相应地,本实施方式中提到的相关技术细节也可应用在第一实施方式中。It is not difficult to find that this embodiment is a system embodiment corresponding to the first embodiment, and this embodiment can be implemented in cooperation with the first embodiment. The relevant technical details mentioned in the first embodiment are still valid in this embodiment, and will not be repeated here in order to reduce repetition. Correspondingly, the relevant technical details mentioned in this implementation manner can also be applied in the first implementation manner.

值得一提的是,本实施方式中所涉及到的各模块均为逻辑模块,在实际应用中,一个逻辑单元可以是一个物理单元,也可以是一个物理单元的一部分,还可以以多个物理单元的组合实现。此外,为了突出本发明的创新部分,本实施方式中并没有将与解决本发明所提出的技术问题关系不太密切的单元引入,但这并不表明本实施方式中不存在其它的单元。It is worth mentioning that all the modules involved in this embodiment are logical modules. In practical applications, a logical unit can be a physical unit, or a part of a physical unit, or multiple physical units. Combination of units. In addition, in order to highlight the innovative part of the present invention, units that are not closely related to solving the technical problems proposed by the present invention are not introduced in this embodiment, but this does not mean that there are no other units in this embodiment.

本发明的第四实施方式涉及一种图像矫正装置,本实施方式是对第三实施方式的进一步改进,具体改进为:本实施方式还包括特征提取模块503和图像分析模块504,两者耦合,用于判断第一图像是否存在被遮挡区域。The fourth embodiment of the present invention relates to an image correction device. This embodiment is a further improvement on the third embodiment. The specific improvement is: this embodiment also includes a feature extraction module 503 and an image analysis module 504, the two are coupled, It is used to judge whether there is an occluded area in the first image.

具体地说,如图7所示,图像矫正装置还包括:特征提取模块503,用于提取第一图像的图像特征;图像分析模块504,用于将第一图像的图像特征与图像数据集中存储的第三图像的图像特征进行比较,根据比较结果,判断第一图像中是否存在被遮挡区域。Specifically, as shown in FIG. 7 , the image correction device further includes: a feature extraction module 503 for extracting image features of the first image; an image analysis module 504 for centrally storing the image features and image data of the first image The image features of the third image are compared, and according to the comparison result, it is judged whether there is an occluded area in the first image.

由于第二实施方式与本实施方式相互对应,因此本实施方式可与第二实施方式互相配合实施。第二实施方式中提到的相关技术细节在本实施方式中依然有效,在第二实施方式中所能达到的技术效果在本实施方式中也同样可以实现,为了减少重复,这里不再赘述。相应地,本实施方式中提到的相关技术细节也可应用在第二实施方式中。Since the second embodiment corresponds to the present embodiment, the present embodiment can be implemented in cooperation with the second embodiment. The relevant technical details mentioned in the second embodiment are still valid in this embodiment, and the technical effects that can be achieved in the second embodiment can also be achieved in this embodiment, and in order to reduce repetition, details are not repeated here. Correspondingly, the relevant technical details mentioned in this embodiment mode can also be applied in the second embodiment mode.

本发明的第五实施方式涉及一种电子设备,如图8所示,包括:至少一个处理器601;以及,与至少一个处理器601通信连接的存储器602;其中,存储器602存储有可被至少一个处理器601执行的指令,指令被至少一个处理器601执行,以使至少一个处理器601能够执行如第一实施方式或第二实施方式提及的图像矫正方法。The fifth embodiment of the present invention relates to an electronic device, as shown in FIG. 8 , including: at least one processor 601; and a memory 602 communicatively connected to at least one processor 601; Instructions executed by one processor 601, the instructions are executed by at least one processor 601, so that at least one processor 601 can execute the image correction method as mentioned in the first embodiment or the second embodiment.

该电子设备包括:一个或多个处理器601以及存储器602,图7中以一个处理器601为例。处理器601、存储器602可以通过总线或者其他方式连接,图7中以通过总线连接为例。存储器602作为一种非易失性计算机可读存储介质,可用于存储非易失性软件程序、非易失性计算机可执行程序以及模块。处理器601通过运行存储在存储器602中的非易失性软件程序、指令以及模块,从而执行设备的各种功能应用以及数据处理,即实现上述图像矫正方法。The electronic device includes: one or more processors 601 and a memory 602, one processor 601 is taken as an example in FIG. 7 . The processor 601 and the memory 602 may be connected through a bus or in other ways, and connection through a bus is taken as an example in FIG. 7 . The memory 602, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs and modules. The processor 601 executes various functional applications and data processing of the device by running the non-volatile software programs, instructions and modules stored in the memory 602, that is, implements the above-mentioned image correction method.

存储器602可以包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需要的应用程序;存储数据区可存储选项列表等。此外,存储器602可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他非易失性固态存储器件。在一些实施方式中,存储器602可选包括相对于处理器601远程设置的存储器,这些远程存储器可以通过网络连接至外接设备。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。The memory 602 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application program required by at least one function; the data storage area may store an option list and the like. In addition, the memory 602 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid-state storage devices. In some implementations, the memory 602 may optionally include a memory that is set remotely relative to the processor 601, and these remote memories may be connected to an external device through a network. Examples of the aforementioned networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

一个或者多个模块存储在存储器602中,当被一个或者多个处理器601执行时,执行上述任意方法实施方式中的图像矫正方法。One or more modules are stored in the memory 602, and when executed by one or more processors 601, execute the image correction method in any method implementation above.

上述产品可执行本申请实施方式所提供的方法,具备执行方法相应的功能模块和有益效果,未在本实施方式中详尽描述的技术细节,可参见本申请实施方式所提供的方法。The above-mentioned products can execute the methods provided in the embodiments of this application, and have the corresponding functional modules and beneficial effects for executing the methods. For technical details not described in detail in this embodiment, please refer to the methods provided in the embodiments of this application.

本发明的第六实施方式涉及一种计算机可读存储介质,存储有计算机程序。计算机程序被处理器执行时实现上述方法实施例。A sixth embodiment of the present invention relates to a computer-readable storage medium storing a computer program. The above method embodiments are implemented when the computer program is executed by the processor.

即,本领域技术人员可以理解,实现上述实施例方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,该程序存储在一个存储介质中,包括若干指令用以使得一个设备(可以是单片机,芯片等)或处理器(processor)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-OnlyMemory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。That is, those skilled in the art can understand that all or part of the steps in the method of the above-mentioned embodiments can be completed by instructing related hardware through a program, the program is stored in a storage medium, and includes several instructions to make a device ( It may be a single chip microcomputer, a chip, etc.) or a processor (processor) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk, and other media that can store program codes.

本领域的普通技术人员可以理解,上述各实施方式是实现本发明的具体实施例,而在实际应用中,可以在形式上和细节上对其作各种改变,而不偏离本发明的精神和范围。Those of ordinary skill in the art can understand that the above-mentioned embodiments are specific examples for realizing the present invention, and in practical applications, various changes can be made to it in form and details without departing from the spirit and spirit of the present invention. scope.

Claims (11)

1. An image rectification method, comprising:
when the camera has a stain, determining a shielded area in a first image shot by the camera;
determining an offset angle according to the actual size information of the shielded area and a first constraint relation of the offset angle;
controlling the camera to adjust the shooting angle according to the offset angle through electronic equipment, and shooting a second image, wherein the second image and the first image are shot by the same camera;
extracting a region image corresponding to the shielded region in the second image, and adjusting the extracted region image according to a second constraint relation between the shooting angle adjusted by the camera and the element value of the extracted region image to obtain a replacement image;
and replacing the image of the shielded area in the first image by the replacement image for image correction.
2. The image rectification method according to claim 1, wherein the determining the offset angle according to the actual size information of the occluded area and the first constraint relationship of the offset angle specifically includes:
determining actual size information of the shielded area according to the image size information of the shielded area;
and determining the offset angle according to the actual size information and a first constraint relation between the preset actual size information and the offset angle.
3. The image rectification method according to claim 2, wherein the actual size information of the occluded area is an actual height of a space corresponding to the occluded area, and the first constraint relationship is: offset angle = first scale parameter actual height ÷ focal length of the camera.
4. The image rectification method according to claim 1, wherein the extracting a region image corresponding to the occluded region in the second image, and adjusting the extracted region image according to a second constraint relationship between a shooting angle adjusted by the camera and an element value of the extracted region image to obtain a replacement image specifically includes:
taking an image of a region corresponding to the occluded region as a candidate image;
determining the element value of each pixel in the replacement image according to the second constraint relation between the angle adjusted by the camera and the element value of the pixel of the candidate image;
and adjusting the candidate image to obtain the replacement image.
5. The image rectification method according to claim 4, wherein the determining the element value of each pixel in the replacement image according to the second constraint relationship between the angle adjusted by the camera and the element value of the pixel of the candidate image specifically includes:
determining the element value of each pixel in the replacement image according to the angle adjusted by the camera and the second constraint relation among the element value of the pixel of the candidate image, the angle adjusted by the camera and the element value of the pixel of the replacement image;
wherein the second constraint relationship is: the element values of the pixels in the replacement image = element values of the pixels of the candidate image ×. A second scale parameter, the second scale parameter being determined according to the angle of adjustment of the camera.
6. The image rectification method according to claim 1, further comprising:
extracting image features of the first image;
and comparing the image characteristics of the first image with the image characteristics of a third image stored in an image data set, and judging whether the first image has an occluded area or not according to the comparison result.
7. The image rectification method according to claim 6, wherein the determining whether the first image has the occluded area according to the comparison result specifically includes:
if the number of comparison results indicating that the occluded area exists in the first image is not less than N in the comparison results of the first image and all images in the image data set, determining that the occluded area exists in the first image;
if the number of comparison results indicating that the occluded regions exist in the first image is smaller than N, determining that the occluded regions do not exist in the first image.
8. The image rectification method according to claim 1, wherein the determining a region corresponding to the occluded region in the second image includes:
determining left boundary coordinates and right boundary coordinates of an occluded area in the first image, taking the left boundary coordinates of the occluded area as left boundary coordinates of an area corresponding to the occluded area in the second image, and taking the right boundary coordinates of the occluded area as right boundary coordinates of an area corresponding to the occluded area in the second image;
determining the adjustment amount of the upper boundary coordinate and the lower boundary coordinate according to the adjustment angle of the camera and the focal length of the camera;
determining an upper boundary coordinate and a lower boundary coordinate of the occluded area in the first image, taking a value obtained by adding an adjustment amount to the upper boundary coordinate of the occluded area as an upper boundary coordinate of an area corresponding to the occluded area in the second image, and taking a value obtained by adding an adjustment amount to the lower boundary coordinate of the occluded area as a lower boundary coordinate of an area corresponding to the occluded area in the second image.
9. An image rectification apparatus characterized by comprising:
the area determining module is used for determining an occluded area in a first image shot by the camera when the camera has a stain;
the angle determining module is used for determining an offset angle according to the actual size information of the shielded area and a first constraint relation of the offset angle;
the camera control module is used for controlling the camera to adjust the shooting angle according to the offset angle through electronic equipment and shooting a second image, and the second image and the first image are shot by the same camera;
the image adjusting module is used for extracting a region image corresponding to the shielded region in the second image, and adjusting the extracted region image according to a second constraint relation between the shooting angle adjusted by the camera and the element value of the extracted region image to obtain a replacement image;
and the image correction module is used for replacing the image of the shielded area in the first image with the replacement image for image correction.
10. An electronic device, comprising: at least one processor; and (c) a second step of,
a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the image rectification method according to any one of claims 1 to 8.
11. A computer-readable storage medium storing a computer program, wherein the computer program is executed by a processor to implement the image rectification method according to any one of claims 1 to 8.
CN202211065428.5A 2019-12-06 2019-12-06 Image correction method and device, electronic equipment and storage medium Pending CN115334245A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211065428.5A CN115334245A (en) 2019-12-06 2019-12-06 Image correction method and device, electronic equipment and storage medium

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202211065428.5A CN115334245A (en) 2019-12-06 2019-12-06 Image correction method and device, electronic equipment and storage medium
CN201911241547.XA CN110971825A (en) 2019-12-06 2019-12-06 Image correction method, electronic device and storage medium

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
CN201911241547.XA Division CN110971825A (en) 2019-12-06 2019-12-06 Image correction method, electronic device and storage medium

Publications (1)

Publication Number Publication Date
CN115334245A true CN115334245A (en) 2022-11-11

Family

ID=70033284

Family Applications (2)

Application Number Title Priority Date Filing Date
CN202211065428.5A Pending CN115334245A (en) 2019-12-06 2019-12-06 Image correction method and device, electronic equipment and storage medium
CN201911241547.XA Pending CN110971825A (en) 2019-12-06 2019-12-06 Image correction method, electronic device and storage medium

Family Applications After (1)

Application Number Title Priority Date Filing Date
CN201911241547.XA Pending CN110971825A (en) 2019-12-06 2019-12-06 Image correction method, electronic device and storage medium

Country Status (1)

Country Link
CN (2) CN115334245A (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114866699B (en) * 2022-05-23 2024-11-19 Oppo广东移动通信有限公司 Image processing method and device, computer readable storage medium and electronic device

Citations (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040264806A1 (en) * 2003-06-24 2004-12-30 Microsoft Corporation System and method for de-noising multiple copies of a signal
US20050068446A1 (en) * 2003-09-30 2005-03-31 Eran Steinberg Automated statistical self-calibrating detection and removal of blemishes in digital images based on multiple occurrences of dust in images
US20070122056A1 (en) * 2003-09-30 2007-05-31 Fotonation Vision Limited Detection and Removal of Blemishes in digital images Utilizing Original Images of Defocused Scenes
US20070242936A1 (en) * 2006-04-18 2007-10-18 Fujitsu Limited Image shooting device with camera shake correction function, camera shake correction method and storage medium recording pre-process program for camera shake correction process
CN104580882A (en) * 2014-11-03 2015-04-29 宇龙计算机通信科技(深圳)有限公司 Photographing method and device
CN105227832A (en) * 2015-09-09 2016-01-06 厦门美图之家科技有限公司 A kind of self-timer method based on critical point detection, self-heterodyne system and camera terminal
US20160094824A1 (en) * 2014-09-25 2016-03-31 Sony Corporation Image processing method, image processing apparatus and electronic device
CN107133925A (en) * 2017-04-12 2017-09-05 新疆林业科学院现代林业研究所 A kind of spectrum image bearing calibration for automatically extracting control point
CN107360354A (en) * 2017-07-31 2017-11-17 广东欧珀移动通信有限公司 Photographing method, device, mobile terminal and computer-readable storage medium
CN107395979A (en) * 2017-08-14 2017-11-24 天津帕比特科技有限公司 The image-pickup method and system of hollow out shelter are removed based on multi-angled shooting
WO2018149323A1 (en) * 2017-02-16 2018-08-23 腾讯科技(深圳)有限公司 Method of detecting photographic direction shift, device, apparatus, and data storage medium
CN108833785A (en) * 2018-07-03 2018-11-16 清华-伯克利深圳学院筹备办公室 Multi-view image fusion method, device, computer equipment and storage medium
CN109035185A (en) * 2018-06-29 2018-12-18 努比亚技术有限公司 A kind of image processing method and terminal
CN110266952A (en) * 2019-06-28 2019-09-20 Oppo广东移动通信有限公司 Image processing method, image processing apparatus, electronic device, and storage medium

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB2335105B (en) * 1998-07-25 2000-02-23 Loyaltop Ltd Composite image method and apparatus
CN101266685A (en) * 2007-03-14 2008-09-17 中国科学院自动化研究所 A Method of Removing Irrelevant Images Based on Multiple Photos
CN104079811B (en) * 2014-07-24 2017-09-26 广东欧珀移动通信有限公司 A kind of method and device that barrier is filtered out when taking pictures
CN109600543B (en) * 2017-09-30 2021-01-22 京东方科技集团股份有限公司 Method for capturing panoramic images with mobile device and mobile device
CN109389550B (en) * 2018-09-17 2023-12-26 联想(北京)有限公司 Data processing method, device and computing equipment

Patent Citations (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040264806A1 (en) * 2003-06-24 2004-12-30 Microsoft Corporation System and method for de-noising multiple copies of a signal
US20050068446A1 (en) * 2003-09-30 2005-03-31 Eran Steinberg Automated statistical self-calibrating detection and removal of blemishes in digital images based on multiple occurrences of dust in images
US20070122056A1 (en) * 2003-09-30 2007-05-31 Fotonation Vision Limited Detection and Removal of Blemishes in digital images Utilizing Original Images of Defocused Scenes
US20070242936A1 (en) * 2006-04-18 2007-10-18 Fujitsu Limited Image shooting device with camera shake correction function, camera shake correction method and storage medium recording pre-process program for camera shake correction process
US20160094824A1 (en) * 2014-09-25 2016-03-31 Sony Corporation Image processing method, image processing apparatus and electronic device
CN104580882A (en) * 2014-11-03 2015-04-29 宇龙计算机通信科技(深圳)有限公司 Photographing method and device
CN105227832A (en) * 2015-09-09 2016-01-06 厦门美图之家科技有限公司 A kind of self-timer method based on critical point detection, self-heterodyne system and camera terminal
WO2018149323A1 (en) * 2017-02-16 2018-08-23 腾讯科技(深圳)有限公司 Method of detecting photographic direction shift, device, apparatus, and data storage medium
CN108447146A (en) * 2017-02-16 2018-08-24 腾讯科技(深圳)有限公司 Shooting direction bias detecting method and device
CN107133925A (en) * 2017-04-12 2017-09-05 新疆林业科学院现代林业研究所 A kind of spectrum image bearing calibration for automatically extracting control point
CN107360354A (en) * 2017-07-31 2017-11-17 广东欧珀移动通信有限公司 Photographing method, device, mobile terminal and computer-readable storage medium
CN107395979A (en) * 2017-08-14 2017-11-24 天津帕比特科技有限公司 The image-pickup method and system of hollow out shelter are removed based on multi-angled shooting
CN109035185A (en) * 2018-06-29 2018-12-18 努比亚技术有限公司 A kind of image processing method and terminal
CN108833785A (en) * 2018-07-03 2018-11-16 清华-伯克利深圳学院筹备办公室 Multi-view image fusion method, device, computer equipment and storage medium
CN110266952A (en) * 2019-06-28 2019-09-20 Oppo广东移动通信有限公司 Image processing method, image processing apparatus, electronic device, and storage medium

Also Published As

Publication number Publication date
CN110971825A (en) 2020-04-07

Similar Documents

Publication Publication Date Title
US20210004952A1 (en) Method for image processing, non-transitory computer readable storage medium, and electronic device
US12307683B2 (en) Subject detecting method and device, electronic device, and non-transitory computer-readable storage medium
CN104809710B (en) Image de-noising method and the device using this method
CN111932587B (en) Image processing method and device, electronic equipment and computer readable storage medium
CN108833785A (en) Multi-view image fusion method, device, computer equipment and storage medium
US20190289207A1 (en) Fast scan-type panoramic image synthesis method and device
KR20200023651A (en) Preview photo blurring method and apparatus and storage medium
CN110866486B (en) Subject detection method and apparatus, electronic device, computer-readable storage medium
US20220309627A1 (en) Face image straight line processing method, terminal device and storage medium
JP2014187610A (en) Image processing device, image processing method, program, and imaging device
WO2020098325A1 (en) Image synthesis method, electronic device and storage medium
CN101315664A (en) Text Image Preprocessing Method for Text Recognition
US20250024137A1 (en) Information processing apparatus, information processing method, and information processing program
CN116308992A (en) Image processing method and device, electronic device, computer-readable storage medium
CN113938578B (en) Image blurring method, storage medium and terminal equipment
CN115334245A (en) Image correction method and device, electronic equipment and storage medium
CN111885371A (en) Image occlusion detection method and device, electronic equipment and computer readable medium
CN111340714A (en) Moire pattern processing method and device and electronic equipment
US11044396B2 (en) Image processing apparatus for calculating a composite ratio of each area based on a contrast value of images, control method of image processing apparatus, and computer-readable storage medium
CN118644429B (en) Camera preset position correction method, device, equipment and medium
CN113395434B (en) Preview image blurring method, storage medium and terminal equipment
CN117392161B (en) Calibration plate corner point for long-distance large perspective distortion and corner point number determination method
CN113971689B (en) Image registration method and related device
CN115134521B (en) Video shooting anti-shake method, device, equipment and storage medium
US20140368701A1 (en) Cloning image data patch in hole of pixel array (patch and clone)

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20221111

RJ01 Rejection of invention patent application after publication