WO2023160075A1 - Image inpainting method and apparatus, and device and medium - Google Patents

Image inpainting method and apparatus, and device and medium Download PDF

Info

Publication number
WO2023160075A1
WO2023160075A1 PCT/CN2022/134873 CN2022134873W WO2023160075A1 WO 2023160075 A1 WO2023160075 A1 WO 2023160075A1 CN 2022134873 W CN2022134873 W CN 2022134873W WO 2023160075 A1 WO2023160075 A1 WO 2023160075A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
area
lens
lens area
environment
Prior art date
Application number
PCT/CN2022/134873
Other languages
French (fr)
Chinese (zh)
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 WO2023160075A1 publication Critical patent/WO2023160075A1/en

Links

Images

Classifications

    • G06T5/77
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/12Edge-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30196Human being; Person
    • G06T2207/30201Face

Definitions

  • the present disclosure relates to the technical field of image processing, and in particular to an image restoration method, device, equipment and medium.
  • the face image in the vehicle can be analyzed to obtain the attributes and states of objects such as drivers or passengers.
  • the fatigue detection algorithm is likely to output wrong state detection results due to the reflection of the glasses. Missing or false positives about the driver's state will increase driving risks and affect user experience.
  • the embodiments of the present disclosure provide at least one image restoration method, device, device and medium.
  • an image restoration method comprising:
  • the image of the lens area is repaired to obtain a repaired target image.
  • the determining the reflective area in the lens area image according to the matching result of the lens area image and the environment image includes: combining the lens area image with the environment image Matching is performed to determine the marked area in the environment image that matches the lens area image; extracting the feature profile of the marked area; using the feature profile of the marked area to segment the lens area image to obtain the reflective areas.
  • the method includes: performing glasses recognition on the facial image, and determining glasses worn by the target object in the facial image Image of the lens area in glasses.
  • the determining the reflective area in the lens area image according to the matching result of the lens area image and the environment image includes: responding to determining that there is reflection in the lens area image According to the matching result of the lens area image and the environment image, the reflective area in the lens area image is determined.
  • the determining that there is a reflection phenomenon in the lens area image includes: in response to the existence of an image area that successfully matches the lens area image and the environment image, determining There are reflections.
  • the determining that there is a reflection phenomenon in the lens area image includes: determining a first area in the lens area image whose pixel brightness value is greater than or equal to a preset brightness threshold; in response to the The area ratio of the first area to the lens area image satisfies a preset area condition, and it is determined that there is a reflection phenomenon in the lens area image.
  • the determining that there is a reflection phenomenon in the lens area image includes: determining a first area in the lens area image whose pixel brightness value is greater than or equal to a preset brightness threshold; in response to the The eye area in the lens area is blocked by the first area, and it is determined that there is reflection phenomenon in the image of the lens area.
  • the acquiring the facial image of the target object and the environment image including the surrounding environment of the target object includes: acquiring the facial image of the target object in the vehicle captured by the first camera; acquiring The environment image collected by the second camera, the environment image includes an external environment image of the vehicle.
  • the method further includes: based on the target image, identifying the The state of the target object.
  • an image restoration device comprising:
  • An image acquisition module configured to acquire a face image of the target object and an environment image including the surrounding environment of the target object, the face image including a lens area image of glasses worn by the target object;
  • a reflective area determining module configured to determine the reflective area in the lens area image according to the matching result of the lens area image and the environment image;
  • the image processing module is configured to repair the image of the lens area according to the reflective area to obtain a repaired target image.
  • the reflective area determining module is specifically configured to: match the lens area image with the environment image, and determine a mark in the environment image that matches the lens area image region; extracting the characteristic contour of the marked region; performing region segmentation on the lens region image by using the characteristic contour of the marked region to obtain the reflective region.
  • the image acquisition module is further configured to: perform glasses recognition on the facial image, and determine the An image of the lens area in the glasses worn by the target subject.
  • the reflective area determining module is specifically configured to: in response to determining that there is a reflective phenomenon in the lens area image, according to the matching result of the lens area image and the environment image, determine the reflective areas in the image of the lens area described above.
  • the reflective area determination module when used to determine that there is a reflective phenomenon in the lens area image, it is specifically configured to: respond to the successful matching between the lens area image and the environment image In the image area of the lens, it is determined that there is a reflection phenomenon in the image of the lens area.
  • the reflective area determination module when used to determine that there is a reflective phenomenon in the image of the lens area, it is specifically used to: determine that the pixel brightness value in the image of the lens area is greater than or equal to a preset The first area of the brightness threshold; in response to the area ratio of the first area to the lens area image meeting a preset area condition, it is determined that there is a reflection phenomenon in the lens area image.
  • the reflective area determination module when used to determine that there is a reflective phenomenon in the image of the lens area, it is specifically used to: determine that the pixel brightness value in the image of the lens area is greater than or equal to a preset A first area of the brightness threshold; in response to the eye area in the lens area being blocked by the first area, it is determined that there is a reflection phenomenon in the image of the lens area.
  • the image acquisition module is specifically configured to: acquire the face image of the target object in the vehicle captured by the first camera; acquire the environment image captured by the second camera, and the environment image An image of the external environment of the vehicle is included.
  • the device further includes a state recognition module, configured to, after repairing the lens area image and obtaining the repaired target image: identify the target object based on the target image state.
  • an electronic device in a third aspect, includes a memory and a processor, the memory is used to store computer instructions executable on the processor, and the processor is used to implement the present disclosure when executing the computer instructions.
  • a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the image restoration method described in any embodiment of the present disclosure is implemented.
  • the image repair method provided by the technical solution of the embodiment of the present disclosure can accurately find the reflective area in the glasses by matching the lens area image in the glasses worn by the target object with the environment image of the surrounding environment, so that the image can be detected based on the position and shape of the reflective area. and other information to repair the image of the lens area, so as to achieve a better effect of weakening or eliminating the reflection in the image of the lens area.
  • the occluded face information of the target object is restored in the repaired target image, which reduces the impact of the reflection on the lens on the algorithm in the subsequent application and improves the accuracy of the subsequent algorithm.
  • Fig. 1 is a flowchart of an image restoration method shown in at least one embodiment of the present disclosure
  • Fig. 2 is a flowchart of another image restoration method shown in at least one embodiment of the present disclosure
  • Fig. 3 is a flowchart of another image restoration method shown in at least one embodiment of the present disclosure.
  • Fig. 4 is a block diagram of an image restoration device shown in at least one embodiment of the present disclosure.
  • Fig. 5 is a block diagram of another image restoration device shown in at least one embodiment of the present disclosure.
  • Fig. 6 is a schematic diagram of a hardware structure of an electronic device according to at least one embodiment of the present disclosure.
  • first, second, third, etc. may be used in this specification to describe various information, the information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of this specification, first information may also be called second information, and similarly, second information may also be called first information. Depending on the context, the word “if” as used herein may be interpreted as “at” or “when” or “in response to a determination.”
  • FIG. 1 is a flowchart of an image restoration method shown in at least one embodiment of the present disclosure, and the method may include the following steps:
  • step 102 a face image of the target object and an environment image including the surrounding environment of the target object are acquired.
  • the face image includes a lens area image of glasses worn by the target object.
  • the target object wears glasses
  • the lens area image is an image of the area where the lens in the glasses is located.
  • the environment image captured by at least one camera can be obtained.
  • the multiple environment images can be images of environments in different orientations around the target object.
  • This embodiment does not limit the manner of acquiring the face image of the target object and the environment image of the surrounding environment of the target object.
  • different acquisition methods may be used. The following are examples of several acquisition methods:
  • the face image of the target object can be based on the image collected by the front camera of the mobile phone on the face of the target object, and the environment image can be based on the image captured by the rear camera of the mobile phone in front of the target object.
  • Images collected from the environment For example, a face image and an environment image of a target object may be acquired based on an image captured by a camera.
  • the face image of the target object when the target object is inside the vehicle, the face image of the target object can be collected based on the camera inside the vehicle, and the environment image outside the vehicle can be collected based on the camera outside the vehicle or facing outside the vehicle.
  • the collection time of the face image and the environment image may be at the same time or different time.
  • the face image and the environment image with the same acquisition time or adjacent acquisition time may be used.
  • step 104 the reflective area in the lens area image is determined according to the matching result of the lens area image and the environment image.
  • the lens in the glasses worn by the target object has reflective phenomenon
  • the image of the scene in the surrounding environment reflected by the lens will appear in the lens area image, and the area where the image is located in the lens area image is the reflective area.
  • the lens region image can be matched with the environment image to find a region with high similarity in the two images, and then determine the reflective region in the lens region image according to the region with high similarity.
  • the lens has reflections, when reflecting the surrounding scenery, due to various factors such as the reflection angle, the curvature of the lens, and the material of the lens, generally speaking, the image of the scene in the reflective area is compared with the environment image.
  • the scene image in the image will change in shape, color, etc.
  • the similarity condition may be a similarity requirement on the shape of the region, the pixel value, and the like.
  • the reflection area in the lens area image is determined according to a matching result between the lens area image and the environment image. In this implementation manner, it may first be determined whether there is a reflection phenomenon in the image of the lens area. When there is a reflection phenomenon, then determine the reflection area in the image of the lens area, so as to reduce unnecessary consumption of computing resources.
  • the following examples illustrate several methods for determining whether there is a reflection phenomenon in the image of the lens area, but it can be understood that the specific implementation is not limited to the following examples:
  • the image of the lens area is still first matched with the image of the environment. If the similarity between the image of a certain part or all of the image of the lens area and the image of a certain local area of the environment image satisfies the set condition, then it is determined that there is an image area that successfully matches the image of the lens area and the environment image, and the lens area There are reflections in the image. Then the reflective area can be determined according to the successfully matched image area.
  • the image area of the lens due to reflection is likely to have a higher brightness value than other parts without reflection.
  • the first area in the image of the lens area whose pixel brightness value is greater than or equal to a preset brightness threshold may be determined.
  • the area ratio of the first area to the lens area image satisfies the preset area condition, for example, when the area ratio of the first area to the lens area image is greater than or equal to 10%, it indicates that there is reflection phenomenon in the lens area image.
  • the area ratio of the first area to the image of the lens area does not meet the preset area condition, it means that there may be no reflection phenomenon on the lens or the reflection area is too small to ignore the reflection phenomenon. In other examples, it may also be determined directly according to the area size of the first area whether there is a reflection phenomenon in the image of the lens area.
  • the first area in the lens area image whose pixel brightness values are greater than or equal to a preset brightness threshold may be determined.
  • the reflection on the lens does not affect the image of the eye behind the lens, the reflection can be ignored. And if the reflection on the lens blocks the eye area, the reflection cannot be ignored.
  • step 106 the lens area image is repaired according to the reflective area to obtain a repaired target image.
  • the image restoration technology can be used to repair the reflective area in the image of the lens area, eliminate or weaken the impact caused by the reflection, and obtain the image of the non-reflective lens area, that is, the target after repair image.
  • the image reflected by the lens may be superimposed and mixed with the image of the face area of the target object behind the lens, making it difficult to identify the face information of the target object.
  • information such as the structural shape of the reflective area and the edge color of the reflective area can be used to infer the information content of the reflective area, and then the reflective area can be filled.
  • the image information in the area where the reflective area matches the environment image can be used as a reference to repair the reflective area and restore the image behind the lens.
  • This embodiment does not limit the restoration algorithm specifically used in the above restoration process, for example, an image quality enhancement algorithm, a picture completion algorithm, a super-resolution technology, and the like.
  • a neural network model for image restoration can be pre-trained, and the reflective area, lens area image, and environment image are input into the neural network model, and an inpainted target image is output.
  • the neural network can predict the face information of the target object in the lens area image by learning the image information of the non-reflective area around the reflective area and learning the batch image samples.
  • the image repair method provided by the technical solution of the embodiment of the present disclosure can accurately find the reflective area in the glasses by matching the lens area image in the glasses worn by the target object with the environment image of the surrounding environment, so that the image can be detected based on the position and shape of the reflective area. and other information to repair the image of the lens area.
  • the traditional reflection repair method since the specific position of the reflection area cannot be determined, the image of the lens area can only be roughly repaired as a whole. Compared with the traditional reflection restoration method, this method better realizes the effect of weakening or eliminating the reflection in the image of the lens area.
  • the occluded face information of the target object is restored in the repaired target image, especially the information of the eye area, which reduces the impact of the reflection on the lens on the algorithm in the subsequent application and improves the accuracy of the subsequent algorithm.
  • Fig. 2 is another image restoration method provided by at least one embodiment of the present disclosure, and the method may include the following processing, wherein the same steps as the flow in Fig. 1 will not be described in detail again.
  • step 202 a face image of the target object and an environment image including the surrounding environment of the target object are acquired.
  • the face image includes a lens area image of glasses worn by the target object.
  • the image restoration method in this embodiment can be used as a preprocessing step of various image recognition algorithms, for example, it can be applied to various cabin vision algorithms.
  • step 204 the lens area image is matched with the environment image, and a marked area in the environment image that matches the lens area image is determined.
  • the lens area image can be matched with the environment image. If the similarity between a certain part in the lens area image and a certain area in the environment image satisfies certain conditions, then the area in the environment image is determined is the marked area that matches the image of the lens area.
  • the marked area contains scenes in the known environment, such as houses, trees, and so on.
  • step 206 the feature contour of the marked area is extracted.
  • the feature contour is a group or several groups of interconnected curves that outline the scene in the marked area, and these curves are composed of a series of edge points.
  • the marked area includes a tree and an electric pole
  • the extracted feature contours include the outline of the above-mentioned tree and the contour of an electric pole.
  • This embodiment is not limited to the specific manner of extracting the feature contour of the marked area, for example, image segmentation, edge detection and other manners may be used for extraction.
  • step 208 the image of the lens area is segmented using the characteristic contour of the marked area to obtain the reflective area.
  • This embodiment does not limit the specific manner used for region segmentation.
  • the extracted feature contour can be used as a region mask, and the region mask covers the region within the range of the feature contour.
  • the feature contour of the combination of the above-mentioned outline of a tree and the outline of a utility pole can be used as an area mask, or it can be used as two area masks respectively, that is, an area mask corresponding to a tree and an electric pole corresponding to An area mask of .
  • an area mask corresponding to a tree and an electric pole corresponding to An area mask of According to the shape of the area covered by the area mask, an area similar to the shape is fitted in the image of the lens area, and the reflective area is obtained by segmentation.
  • multiple reflective areas can be divided.
  • the feature contour can be used as the detection target, and the target detection is performed in the lens region image to obtain the region contour with the highest confidence, and the reflective region is segmented from the lens region image according to the region contour.
  • the part in the image of the lens area is directly determined as the reflective area.
  • Such a method is faster than the method of this embodiment in speed, but the accuracy of the determined reflective area is not as high as that of the method of this embodiment.
  • the image presented in the lens area image is a mixture of the image of the environment reflected by the lens and the image of the target subject's face area behind the lens, so that it is difficult to separate the real image from the lens area image when matching. reflective area.
  • step 210 the lens area image is repaired according to the reflective area to obtain a repaired target image.
  • the image restoration method finds the marked area in the environment image that matches the image in the lens area image by matching the lens area image in the glasses worn by the target object with the environment image including the surrounding environment. Since the marked area is an area in the exact and clear environment image, the feature outline extracted based on the marked area will be clearer and more reliable, and closer to the shape of the actual scene in the environment, and the reflection of the lens reflection is exactly the scene in the environment. In this way, the reflective area obtained through feature contour segmentation is closer to the actual reflective area on the lens, so that the image of the lens area can be repaired based on information such as the position and shape of the reflective area.
  • the occluded face information of the target object is restored in the repaired target image, especially the information of the eye area, which reduces the impact of the reflection on the lens on the algorithm in the subsequent application and improves the accuracy of the subsequent algorithm.
  • Fig. 3 provides the image restoration method of another embodiment of the present disclosure, and this method can be applied to the field of intelligent cabin, for example, can be by DMS (Driver Monitoring System, driver monitoring system), OMS (Occupancy Monitoring System, passenger monitoring system ), executed by the intelligent driving system or the cloud, etc., including the following processing, wherein the same steps as those shown in Fig. 1 and Fig. 2 will not be described in detail again.
  • DMS Driver Monitoring System, driver monitoring system
  • OMS Occupancy Monitoring System, passenger monitoring system
  • step 302 the face image of the target object in the vehicle captured by the first camera is acquired.
  • the first camera may be a camera facing the interior of the vehicle, and the first camera captures images inside the vehicle to obtain an image inside the vehicle, and performs image analysis on the image inside the vehicle to obtain a face image of the target object.
  • Target objects can be drivers, passengers, safety officers, etc. in the vehicle.
  • step 304 glasses recognition is performed on the face image, and an image of a lens area in glasses worn by the target object in the face image is determined.
  • glasses detection may be performed on the face image first, and if glasses are detected, glasses recognition may be further performed on the face image to obtain an image of the lens area in the glasses worn by the target object.
  • Another example is to directly perform glasses recognition on the facial image, determine whether the target object wears glasses, and obtain an image of the lens area in the glasses worn by the target object when it is determined that the target object wears glasses.
  • step 306 the environment image captured by the second camera is acquired, and the environment image includes an external environment image of the vehicle.
  • the second camera may be a camera facing outside the vehicle, and the second camera captures an environmental image outside the vehicle to obtain an environmental image.
  • the environment image contains data of at least one camera, or data of multiple cameras.
  • the method in this embodiment can be used to restore the driver's face image collected by the DMS.
  • the second camera can use the vehicle's front-facing camera and/or side-view camera, and the captured environmental images include the front and/or side of the vehicle external environment.
  • a surround-view camera facing the outside of the vehicle can be used, and the captured environment image includes a panoramic image outside the vehicle.
  • step 308 the lens area image is matched with the environment image, and a marked area in the environment image that matches the lens area image is determined.
  • the image of the image of the lens area matches a certain area of the image outside the vehicle of the environment image, mark the area outside the vehicle as a marked area.
  • step 310 the feature contour of the marked region is extracted to obtain a region mask.
  • the feature contour of the marked region is extracted, and the feature contour is used as a region mask.
  • step 312 the region image of the lens region is segmented by using the region mask to obtain the reflective region.
  • step 314 the lens area image is repaired according to the reflective area to obtain a repaired target image.
  • step 316 the state of the target object is identified based on the target image.
  • the state of the target object may represent the emotional or physical state of the target object, specifically, may include at least one of the following: normal state, fatigue state, and distraction state.
  • the target image that is, the image of the repaired lens area
  • the state recognition model can be a pre-trained neural network model, which can recognize the state of the target object based on closed eyes, distance between eyelids, fast blinking speed, gaze direction, and jumping movement.
  • the target image may be filled into the facial image to obtain a repaired facial image.
  • the face image is input to the state recognition model, and the state recognition model can combine the features of the eyes and other features of the face, such as yawning of the mouth, changes in facial expressions, etc., to recognize the state of the target object.
  • the eye-related state of the target object can be identified based on the repaired target image. Specifically, eye features can be extracted from the target image to identify the direction of sight of the target object or the state of eye opening and closing, and the length of time for the sight of the target object to maintain one direction or the duration of eye closure can be detected according to the video stream to determine whether the target object is Being distracted or fatigued, or determining the target object's level of distraction or fatigue.
  • the image can be pre-processed through the lens reflection elimination technology, and then poured into the algorithm module to improve the accuracy and availability of the recognition algorithm.
  • the detection accuracy will be significantly reduced due to the reduction of feature information on the image, that is, false positives or missed negatives.
  • the method of this embodiment can segment and restore the reflection of the lens according to the outline of the scene outside the vehicle, restore the key information required by the fatigue monitoring algorithm, and improve the accuracy of the vision algorithm inside the vehicle.
  • FIG. 4 the figure is a block diagram of an image restoration device shown in at least one embodiment of the present disclosure, and the device includes:
  • the image acquisition module 41 is configured to acquire a face image of the target object and an environment image including the surrounding environment of the target object, the face image including a lens area image of glasses worn by the target object.
  • the reflective area determination module 42 is configured to determine the reflective area in the lens area image according to the matching result of the lens area image and the environment image.
  • the image processing module 43 is configured to repair the image of the lens area according to the reflective area to obtain a repaired target image.
  • the reflective area determination module 42 is specifically configured to: match the lens area image with the environment image, determine a marked area in the environment image that matches the lens area image; extract The characteristic contour of the marked area; using the characteristic contour of the marked area to segment the image of the lens area to obtain the reflective area.
  • the image acquisition module 41 is further configured to: perform glasses recognition on the facial image after acquiring the facial image of the target object, and determine the location of the target object in the facial image. Image of the lens area in the worn glasses.
  • the reflective area determination module 42 is specifically configured to: determine the lens area according to the matching result between the lens area image and the environment image in response to determining that there is a reflective phenomenon in the lens area image Reflective areas in the image.
  • the reflective area determination module 42 when used to determine that there is a reflective phenomenon in the lens area image, it is specifically configured to: respond to the existence of an image area that successfully matches the lens area image and the environment image , to determine that there is a reflection phenomenon in the image of the lens area.
  • the reflective area determination module 42 when used to determine that there is a reflective phenomenon in the image of the lens area, it is specifically used to: determine that the pixel brightness value in the image of the lens area is greater than or equal to a preset brightness threshold The first area: in response to the area ratio of the first area in the lens area image meeting a preset area condition, determine that there is a reflection phenomenon in the lens area image.
  • the reflective area determination module 42 when used to determine that there is a reflective phenomenon in the image of the lens area, it is specifically used to: determine that the pixel brightness value in the image of the lens area is greater than or equal to a preset brightness threshold First area: in response to the eye area in the lens area being blocked by the first area, determine that there is a reflection phenomenon in the image of the lens area.
  • the image acquisition module 41 is specifically configured to: acquire the face image of the target object in the vehicle captured by the first camera; acquire the environment image captured by the second camera, the environment image includes the An image of the vehicle's external environment.
  • the device further includes a state recognition module 44, configured to, after repairing the image of the lens area and obtaining the repaired target image: based on the target image, identify the The state of the target object.
  • An embodiment of the present disclosure also provides an electronic device. As shown in FIG.
  • the device 62 is configured to implement the image restoration method described in any embodiment of the present disclosure when executing the computer instructions.
  • An embodiment of the present disclosure further provides a computer program product, the product includes a computer program/instruction, and when the computer program/instruction is executed by a processor, the image restoration method described in any embodiment of the present disclosure is implemented.
  • An embodiment of the present disclosure further provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the image restoration method described in any embodiment of the present disclosure is implemented.
  • the device embodiment since it basically corresponds to the method embodiment, for related parts, please refer to the part description of the method embodiment.
  • the device embodiments described above are only illustrative, and the modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, they may be located in One place, or it can be distributed to multiple network modules. Part or all of the modules can be selected according to actual needs to achieve the purpose of the solution in this specification. It can be understood and implemented by those skilled in the art without creative effort.

Abstract

Provided in the embodiments of the present disclosure are an image inpainting method and apparatus, and a device and a medium. The method comprises: acquiring a facial image of a target object and an environment image, which comprises the surrounding environment of the target object, wherein the facial image includes a spectacle lens area image of glasses worn by the target object; according to a matching result of the spectacle lens area image and the environment image, determining a light reflection area in the spectacle lens area image; and according to the light reflection area, inpainting the spectacle lens area image, so as to obtain an inpainted target image. By means of the present method, a spectacle lens area image can be inpainted on the basis of a light reflection area, thereby achieving a better light reflection cancellation effect.

Description

图像修复方法、装置、设备和介质Image restoration method, device, equipment and medium
相关申请的交叉引用Cross References to Related Applications
本专利申请要求于2022年2月28日提交的、申请号为202210188238.6的中国专利申请的优先权,该申请以引用的方式并入文本中。This patent application claims priority to Chinese Patent Application No. 202210188238.6 filed on February 28, 2022, which is incorporated herein by reference.
技术领域technical field
本公开涉及图像处理技术领域,具体涉及一种图像修复方法、装置、设备和介质。The present disclosure relates to the technical field of image processing, and in particular to an image restoration method, device, equipment and medium.
背景技术Background technique
在很多依赖视觉算法的领域中,通过人脸识别或者对人脸进行检测分析,获取相关信息。但是若人戴着眼镜,很可能由于镜片反光,导致脸部的信息被遮挡,影响识别精度,使得算法失效。In many fields that rely on visual algorithms, relevant information can be obtained through face recognition or face detection and analysis. However, if a person wears glasses, it is likely that the face information will be blocked due to the reflection of the lens, which will affect the recognition accuracy and make the algorithm invalid.
示例性的,在为人们的交通出行带来极大便利的智能车舱技术中,可以对车内的人脸图像进行分析,得到关于驾驶员或者乘客等对象的属性和状态。Exemplarily, in the smart cabin technology that brings great convenience to people's transportation, the face image in the vehicle can be analyzed to obtain the attributes and states of objects such as drivers or passengers.
比如,通过判别驾驶员的眼睛睁开与闭合,来识别驾驶员是否疲劳。For example, by judging whether the driver's eyes are open or closed, it is possible to identify whether the driver is tired.
当驾驶员佩戴眼镜时,疲劳检测算法很可能由于眼镜反光而输出错误的状态检测结果,关于驾驶员状态的漏报或误报会增加行驶风险,影响用户体验。When the driver wears glasses, the fatigue detection algorithm is likely to output wrong state detection results due to the reflection of the glasses. Missing or false positives about the driver's state will increase driving risks and affect user experience.
发明内容Contents of the invention
有鉴于此,本公开实施例提供至少一种图像修复方法、装置、设备和介质。In view of this, the embodiments of the present disclosure provide at least one image restoration method, device, device and medium.
具体地,本公开实施例是通过如下技术方案实现的:Specifically, the embodiments of the present disclosure are achieved through the following technical solutions:
第一方面,提供一种图像修复方法,所述方法包括:In a first aspect, an image restoration method is provided, the method comprising:
获取目标对象的脸部图像、以及包括所述目标对象周边环境的环境图像,所述脸部图像包含所述目标对象所佩戴的眼镜的镜片区域图像;Acquiring a face image of the target object and an environment image including the surrounding environment of the target object, the face image including a lens area image of glasses worn by the target object;
根据所述镜片区域图像与所述环境图像的匹配结果,确定所述镜片区域图像中的反光区域;determining a reflective area in the lens area image according to a matching result between the lens area image and the environment image;
根据所述反光区域,对所述镜片区域图像进行修复,得到修复后的目标图像。According to the reflective area, the image of the lens area is repaired to obtain a repaired target image.
在一些可选的实施例中,所述根据所述镜片区域图像与所述环境图像的匹配结果,确定所述镜片区域图像中的反光区域,包括:将所述镜片区域图像与所述环境图像进行匹配,确定所述环境图像中与所述镜片区域图像相匹配的标记区域;提取所述标记区域的特征轮廓;利用所述标记区域的特征轮廓对所述镜片区域图像进行区域分割,得到所述反光区域。In some optional embodiments, the determining the reflective area in the lens area image according to the matching result of the lens area image and the environment image includes: combining the lens area image with the environment image Matching is performed to determine the marked area in the environment image that matches the lens area image; extracting the feature profile of the marked area; using the feature profile of the marked area to segment the lens area image to obtain the reflective areas.
在一些可选的实施例中,在所述获取目标对象的脸部图像之后,所述方法包括:对所述脸部图像进行眼镜识别,确定所述脸部图像中所述目标对象所佩戴的眼镜中的镜片区域图像。In some optional embodiments, after the facial image of the target object is acquired, the method includes: performing glasses recognition on the facial image, and determining glasses worn by the target object in the facial image Image of the lens area in glasses.
在一些可选的实施例中,所述根据所述镜片区域图像与所述环境图像的匹配结果,确定所述镜片区域图像中的反光区域,包括:响应于确定所述镜片区域图像中存在反光现象,根据所述镜片区域图像与所述环境图像的匹配结果,确定所述镜片区域图像中的反光区域。In some optional embodiments, the determining the reflective area in the lens area image according to the matching result of the lens area image and the environment image includes: responding to determining that there is reflection in the lens area image According to the matching result of the lens area image and the environment image, the reflective area in the lens area image is determined.
在一些可选的实施例中,所述确定所述镜片区域图像中存在反光现象,包括:响应于所述镜片区域图像与所述环境图像存在匹配成功的图像区域,确定所述镜片区域图像中存在反光现象。In some optional embodiments, the determining that there is a reflection phenomenon in the lens area image includes: in response to the existence of an image area that successfully matches the lens area image and the environment image, determining There are reflections.
在一些可选的实施例中,所述确定所述镜片区域图像中存在反光现象,包括:确定所述镜片区域图像中像素亮度值大于或等于预设亮度阈值的第一区域;响应于所述第一区域占所述镜片区域图像的面积比例满足预设面积条件,确定所述镜片区域图像中存在反光现象。In some optional embodiments, the determining that there is a reflection phenomenon in the lens area image includes: determining a first area in the lens area image whose pixel brightness value is greater than or equal to a preset brightness threshold; in response to the The area ratio of the first area to the lens area image satisfies a preset area condition, and it is determined that there is a reflection phenomenon in the lens area image.
在一些可选的实施例中,所述确定所述镜片区域图像中存在反光现象,包括:确定所述镜片区域图像中像素亮度值大于或等于预设亮度阈值的第一区域;响应于所述镜片区域中的眼睛区域被所述第一区域遮挡,确定所述镜片区域图像中存在反光现象。In some optional embodiments, the determining that there is a reflection phenomenon in the lens area image includes: determining a first area in the lens area image whose pixel brightness value is greater than or equal to a preset brightness threshold; in response to the The eye area in the lens area is blocked by the first area, and it is determined that there is reflection phenomenon in the image of the lens area.
在一些可选的实施例中,所述获取目标对象的脸部图像、以及包括所述目标对象周边环境的环境图像,包括:获取第一摄像头采集的车辆内的目标对象的脸部图像;获取第二摄像头采集的所述环境图像,所述环境图像包括所述车辆的外部环境图像。In some optional embodiments, the acquiring the facial image of the target object and the environment image including the surrounding environment of the target object includes: acquiring the facial image of the target object in the vehicle captured by the first camera; acquiring The environment image collected by the second camera, the environment image includes an external environment image of the vehicle.
在一些可选的实施例中,在所述根据所述反光区域,对所述镜片区域图像进行修复,得到修复后的目标图像之后,所述方法还包括:基于所述目标图像,识别所述目标对象的状态。In some optional embodiments, after the image of the lens region is repaired according to the reflective region to obtain the repaired target image, the method further includes: based on the target image, identifying the The state of the target object.
第二方面,提供一种图像修复装置,所述装置包括:In a second aspect, an image restoration device is provided, the device comprising:
图像获取模块,用于获取目标对象的脸部图像、以及包括所述目标对象周边环境的环境图像,所述脸部图像包含所述目标对象所佩戴的眼镜的镜片区域图像;An image acquisition module, configured to acquire a face image of the target object and an environment image including the surrounding environment of the target object, the face image including a lens area image of glasses worn by the target object;
反光区域确定模块,用于根据所述镜片区域图像与所述环境图像的匹配结果,确定所述镜片区域图像中的反光区域;A reflective area determining module, configured to determine the reflective area in the lens area image according to the matching result of the lens area image and the environment image;
图像处理模块,用于根据所述反光区域,对所述镜片区域图像进行修复,得到修复后的目标图像。The image processing module is configured to repair the image of the lens area according to the reflective area to obtain a repaired target image.
在一些可选的实施例中,所述反光区域确定模块,具体用于:将所述镜片区域图像 与所述环境图像进行匹配,确定所述环境图像中与所述镜片区域图像相匹配的标记区域;提取所述标记区域的特征轮廓;利用所述标记区域的特征轮廓对所述镜片区域图像进行区域分割,得到所述反光区域。In some optional embodiments, the reflective area determining module is specifically configured to: match the lens area image with the environment image, and determine a mark in the environment image that matches the lens area image region; extracting the characteristic contour of the marked region; performing region segmentation on the lens region image by using the characteristic contour of the marked region to obtain the reflective region.
在一些可选的实施例中,所述图像获取模块,在所述获取目标对象的脸部图像之后,还用于:对所述脸部图像进行眼镜识别,确定所述脸部图像中所述目标对象所佩戴的眼镜中的镜片区域图像。In some optional embodiments, after the facial image of the target object is acquired, the image acquisition module is further configured to: perform glasses recognition on the facial image, and determine the An image of the lens area in the glasses worn by the target subject.
在一些可选的实施例中,所述反光区域确定模块,具体用于:响应于确定所述镜片区域图像中存在反光现象,根据所述镜片区域图像与所述环境图像的匹配结果,确定所述镜片区域图像中的反光区域。In some optional embodiments, the reflective area determining module is specifically configured to: in response to determining that there is a reflective phenomenon in the lens area image, according to the matching result of the lens area image and the environment image, determine the reflective areas in the image of the lens area described above.
在一些可选的实施例中,所述反光区域确定模块,在用于确定所述镜片区域图像中存在反光现象时,具体用于:响应于所述镜片区域图像与所述环境图像存在匹配成功的图像区域,确定所述镜片区域图像中存在反光现象。In some optional embodiments, when the reflective area determination module is used to determine that there is a reflective phenomenon in the lens area image, it is specifically configured to: respond to the successful matching between the lens area image and the environment image In the image area of the lens, it is determined that there is a reflection phenomenon in the image of the lens area.
在一些可选的实施例中,所述反光区域确定模块,在用于确定所述镜片区域图像中存在反光现象时,具体用于:确定所述镜片区域图像中像素亮度值大于或等于预设亮度阈值的第一区域;响应于所述第一区域占所述镜片区域图像的面积比例满足预设面积条件,确定所述镜片区域图像中存在反光现象。In some optional embodiments, when the reflective area determination module is used to determine that there is a reflective phenomenon in the image of the lens area, it is specifically used to: determine that the pixel brightness value in the image of the lens area is greater than or equal to a preset The first area of the brightness threshold; in response to the area ratio of the first area to the lens area image meeting a preset area condition, it is determined that there is a reflection phenomenon in the lens area image.
在一些可选的实施例中,所述反光区域确定模块,在用于确定所述镜片区域图像中存在反光现象时,具体用于:确定所述镜片区域图像中像素亮度值大于或等于预设亮度阈值的第一区域;响应于所述镜片区域中的眼睛区域被所述第一区域遮挡,确定所述镜片区域图像中存在反光现象。In some optional embodiments, when the reflective area determination module is used to determine that there is a reflective phenomenon in the image of the lens area, it is specifically used to: determine that the pixel brightness value in the image of the lens area is greater than or equal to a preset A first area of the brightness threshold; in response to the eye area in the lens area being blocked by the first area, it is determined that there is a reflection phenomenon in the image of the lens area.
在一些可选的实施例中,所述图像获取模块,具体用于:获取第一摄像头采集的车辆内的目标对象的脸部图像;获取第二摄像头采集的所述环境图像,所述环境图像包括所述车辆的外部环境图像。In some optional embodiments, the image acquisition module is specifically configured to: acquire the face image of the target object in the vehicle captured by the first camera; acquire the environment image captured by the second camera, and the environment image An image of the external environment of the vehicle is included.
在一些可选的实施例中,所述装置还包括状态识别模块,用于在对所述镜片区域图像进行修复,得到修复后的目标图像之后:基于所述目标图像,识别所述目标对象的状态。In some optional embodiments, the device further includes a state recognition module, configured to, after repairing the lens area image and obtaining the repaired target image: identify the target object based on the target image state.
第三方面,提供一种电子设备,所述设备包括存储器、处理器,所述存储器用于存储可在处理器上运行的计算机指令,所述处理器用于在执行所述计算机指令时实现本公开任一实施例所述的图像修复方法。In a third aspect, an electronic device is provided, the device includes a memory and a processor, the memory is used to store computer instructions executable on the processor, and the processor is used to implement the present disclosure when executing the computer instructions The image restoration method described in any one of the embodiments.
第四方面,提供一种计算机可读存储介质,其上存储有计算机程序,所述程序被处理器执行时实现本公开任一实施例所述的图像修复方法。In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the image restoration method described in any embodiment of the present disclosure is implemented.
本公开实施例的技术方案提供的图像修复方法,通过匹配目标对象佩戴的眼镜中的镜片区域图像与周围环境的环境图像,能够精确找到眼镜中的反光区域,从而能够基于反光区域的位置、形状等信息对镜片区域图像进行修复,实现了更好地对镜片区域图像中的反光进行减弱或消除的效果。修复后的目标图像中还原出了目标对象被遮挡的脸部信息,降低了镜片上的反光对于后续应用中算法的影响,提升了后续算法的准确度。The image repair method provided by the technical solution of the embodiment of the present disclosure can accurately find the reflective area in the glasses by matching the lens area image in the glasses worn by the target object with the environment image of the surrounding environment, so that the image can be detected based on the position and shape of the reflective area. and other information to repair the image of the lens area, so as to achieve a better effect of weakening or eliminating the reflection in the image of the lens area. The occluded face information of the target object is restored in the repaired target image, which reduces the impact of the reflection on the lens on the algorithm in the subsequent application and improves the accuracy of the subsequent algorithm.
附图说明Description of drawings
为了更清楚地说明本公开一个或多个实施例或相关技术中的技术方案,下面将对实施例或相关技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本公开一个或多个实施例中记载的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in one or more embodiments of the present disclosure or related technologies, the following will briefly introduce the drawings that need to be used in the descriptions of the embodiments or related technologies. Obviously, the accompanying drawings in the following description The drawings are only some embodiments described in one or more embodiments of the present disclosure, and those skilled in the art can obtain other drawings based on these drawings without any creative effort.
图1是本公开至少一个实施例示出的一种图像修复方法的流程图;Fig. 1 is a flowchart of an image restoration method shown in at least one embodiment of the present disclosure;
图2是本公开至少一个实施例示出的另一种图像修复方法的流程图;Fig. 2 is a flowchart of another image restoration method shown in at least one embodiment of the present disclosure;
图3是本公开至少一个实施例示出的又一种图像修复方法的流程图;Fig. 3 is a flowchart of another image restoration method shown in at least one embodiment of the present disclosure;
图4是本公开至少一个实施例示出的一种图像修复装置的框图;Fig. 4 is a block diagram of an image restoration device shown in at least one embodiment of the present disclosure;
图5是本公开至少一个实施例示出的另一种图像修复装置的框图;Fig. 5 is a block diagram of another image restoration device shown in at least one embodiment of the present disclosure;
图6是本公开至少一个实施例示出的一种电子设备的硬件结构示意图。Fig. 6 is a schematic diagram of a hardware structure of an electronic device according to at least one embodiment of the present disclosure.
具体实施方式Detailed ways
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本说明书相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本说明书的一些方面相一致的装置和方法的例子。Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numerals in different drawings refer to the same or similar elements unless otherwise indicated. The implementations described in the following exemplary examples do not represent all implementations consistent with this specification. Rather, they are merely examples of apparatuses and methods consistent with aspects of the present specification as recited in the appended claims.
在本说明书使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本说明书。在本说明书和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。还应当理解,本文中使用的术语“和/或”是指并包含一个或多个相关联的列出项目的任何或所有可能组合。The terms used in this specification are for the purpose of describing particular embodiments only, and are not intended to limit the specification. As used in this specification and the appended claims, the singular forms "a", "the", and "the" are intended to include the plural forms as well, unless the context clearly dictates otherwise. It should also be understood that the term "and/or" as used herein refers to and includes any and all possible combinations of one or more of the associated listed items.
应当理解,尽管在本说明书可能采用术语第一、第二、第三等来描述各种信息,但这些信息不应限于这些术语。这些术语仅用来将同一类型的信息彼此区分开。例如,在不脱离本说明书范围的情况下,第一信息也可以被称为第二信息,类似地,第二信息也可以被称为第一信息。取决于语境,如在此所使用的词语“如果”可以被解释成为“在……时”或“当……时”或“响应于确定”。It should be understood that although the terms first, second, third, etc. may be used in this specification to describe various information, the information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of this specification, first information may also be called second information, and similarly, second information may also be called first information. Depending on the context, the word "if" as used herein may be interpreted as "at" or "when" or "in response to a determination."
如图1所示,图1是本公开至少一个实施例示出的一种图像修复方法的流程图,该方法可以包括以下步骤:As shown in FIG. 1, FIG. 1 is a flowchart of an image restoration method shown in at least one embodiment of the present disclosure, and the method may include the following steps:
在步骤102中,获取目标对象的脸部图像、以及包括所述目标对象周边环境的环境图像。In step 102, a face image of the target object and an environment image including the surrounding environment of the target object are acquired.
其中,脸部图像包含目标对象所佩戴的眼镜的镜片区域图像。本实施例中,目标对象佩戴有眼镜,镜片区域图像为该眼镜中的镜片所在的区域的图像。Wherein, the face image includes a lens area image of glasses worn by the target object. In this embodiment, the target object wears glasses, and the lens area image is an image of the area where the lens in the glasses is located.
本步骤中,可以获取到至少一个摄像头采集的环境图像,当环境图像为多个时,多个环境图像可以是包含目标对象周边的不同方位的环境的图像。In this step, the environment image captured by at least one camera can be obtained. When there are multiple environment images, the multiple environment images can be images of environments in different orientations around the target object.
本实施例不限制对目标对象的脸部图像以及目标对象周边环境的环境图像的获取方式。当目标对象处于不同的应用场景时,可以采用不同的获取方式。如下示例几种获取方式:This embodiment does not limit the manner of acquiring the face image of the target object and the environment image of the surrounding environment of the target object. When the target object is in different application scenarios, different acquisition methods may be used. The following are examples of several acquisition methods:
比如,当目标对象使用手机进行自拍时,目标对象的脸部图像可以是基于手机的前置摄像头对目标对象的面部采集到的图像,环境图像可以是基于手机的后置摄像头对目标对象前方的环境采集到的图像。比如,可以基于一个摄像头拍摄到的图像中,获取其中的目标对象的脸部图像以及环境图像。又比如,在目标对象处于车辆内时,可以基于车辆内的摄像头采集目标对象的脸部图像,基于车辆外或者面向车辆外的摄像头采集车外的环境图像。For example, when the target object uses a mobile phone to take a selfie, the face image of the target object can be based on the image collected by the front camera of the mobile phone on the face of the target object, and the environment image can be based on the image captured by the rear camera of the mobile phone in front of the target object. Images collected from the environment. For example, a face image and an environment image of a target object may be acquired based on an image captured by a camera. For another example, when the target object is inside the vehicle, the face image of the target object can be collected based on the camera inside the vehicle, and the environment image outside the vehicle can be collected based on the camera outside the vehicle or facing outside the vehicle.
需要说明的是,脸部图像和环境图像的采集时间可以是同时刻,也可以是不同时刻。当目标对象为在环境中移动的对象时,可以使用采集时间相同或者采集时间邻近的脸部图像和环境图像。It should be noted that the collection time of the face image and the environment image may be at the same time or different time. When the target object is an object moving in the environment, the face image and the environment image with the same acquisition time or adjacent acquisition time may be used.
在步骤104中,根据所述镜片区域图像与所述环境图像的匹配结果,确定所述镜片区域图像中的反光区域。In step 104, the reflective area in the lens area image is determined according to the matching result of the lens area image and the environment image.
当目标对象所佩戴的眼镜中的镜片存在反光现象时,镜片区域图像中会出现镜片反射出的周围环境中景物的影像,镜片区域图像中的该影像所在的区域为反光区域。When the lens in the glasses worn by the target object has reflective phenomenon, the image of the scene in the surrounding environment reflected by the lens will appear in the lens area image, and the area where the image is located in the lens area image is the reflective area.
本步骤中,可以将镜片区域图像与环境图像进行匹配,找出两幅图像当中相似度高的区域,进而根据该相似度高的区域确定镜片区域图像中的反光区域。In this step, the lens region image can be matched with the environment image to find a region with high similarity in the two images, and then determine the reflective region in the lens region image according to the region with high similarity.
比如,将镜片区域图像与环境图像进行匹配,若存在镜片区域图像中某个部分与环境图像中的某一个区域之间的相似度满足一定条件,直接将镜片区域图像中的该部分确定为反光区域。For example, match the lens area image with the environment image. If the similarity between a certain part in the lens area image and a certain area in the environment image meets certain conditions, directly determine this part in the lens area image as reflection area.
需要说明的是,镜片存在反光现象的情况下,在反射周围的景物时,由于反射角度、镜片的弯曲弧度、以及镜片的材质等种种因素,一般来说,反光区域中景物影像相比环 境图像中的景物影像会有形状、色彩等方面的改变。将镜片区域图像与环境图像进行匹配,比对寻找其中相似度高的区域时,本领域技术人员可以考虑到上述因素的影响进行设定相似度条件。示例性的,相似度条件可以是对区域的形状、像素值等方面的相似度要求。It should be noted that when the lens has reflections, when reflecting the surrounding scenery, due to various factors such as the reflection angle, the curvature of the lens, and the material of the lens, generally speaking, the image of the scene in the reflective area is compared with the environment image. The scene image in the image will change in shape, color, etc. When matching the lens area image with the environment image, and looking for an area with high similarity, those skilled in the art can set the similarity condition in consideration of the influence of the above factors. Exemplarily, the similarity condition may be a similarity requirement on the shape of the region, the pixel value, and the like.
在一种实施方式中,响应于确定所述镜片区域图像中存在反光现象,根据所述镜片区域图像与所述环境图像的匹配结果,确定所述镜片区域图像中的反光区域。该实施方式中可以先确定镜片区域图像中是否存在反光现象。当存在反光现象时,再确定镜片区域图像中的反光区域,以减少不必要的计算资源消耗。如下示例几种确定镜片区域图像中是否存在反光现象的方法,但可以理解的是,具体实施中并不局限于如下的示例:In one embodiment, in response to determining that there is a reflection phenomenon in the lens area image, the reflection area in the lens area image is determined according to a matching result between the lens area image and the environment image. In this implementation manner, it may first be determined whether there is a reflection phenomenon in the image of the lens area. When there is a reflection phenomenon, then determine the reflection area in the image of the lens area, so as to reduce unnecessary consumption of computing resources. The following examples illustrate several methods for determining whether there is a reflection phenomenon in the image of the lens area, but it can be understood that the specific implementation is not limited to the following examples:
在一个示例中,可以响应于所述镜片区域图像与所述环境图像存在匹配成功的图像区域,确定所述镜片区域图像中存在反光现象。本例中,仍先将镜片区域图像与环境图像进行匹配。如果镜片区域图像中的某部分区域或全部区域的影像与环境图像的某一个局部区域的影像的相似度满足设定的条件,则确定镜片区域图像与环境图像存在匹配成功的图像区域,镜片区域图像中存在反光现象。之后可以根据该匹配成功的图像区域确定反光区域。如果镜片区域图像中的某部分区域或全部区域的影像与环境图像的某一个局部区域的影像的相似度不满足设定的条件,则确定镜片区域图像与环境图像不存在匹配成功的图像区域,镜片区域图像中不存在反光现象,可以不再进行之后的修复处理。In an example, it may be determined that there is a reflection phenomenon in the lens area image in response to an image area that successfully matches the lens area image and the environment image. In this example, the image of the lens area is still first matched with the image of the environment. If the similarity between the image of a certain part or all of the image of the lens area and the image of a certain local area of the environment image satisfies the set condition, then it is determined that there is an image area that successfully matches the image of the lens area and the environment image, and the lens area There are reflections in the image. Then the reflective area can be determined according to the successfully matched image area. If the similarity between the image of a certain part or all of the area in the lens area image and the image of a certain local area of the environment image does not meet the set condition, then it is determined that there is no image area that matches successfully between the lens area image and the environment image, There is no reflective phenomenon in the image of the lens area, and subsequent repair processing can no longer be performed.
在周围环境较亮的时候,镜片中因为反光出现的影像区域很可能会比没有反光的其他部分亮度值更高。在另一个示例中,可以根据所述镜片区域图像中的像素亮度值,确定镜片区域图像中是否存在反光现象。When the surrounding environment is bright, the image area of the lens due to reflection is likely to have a higher brightness value than other parts without reflection. In another example, it may be determined whether there is a reflection phenomenon in the lens area image according to the pixel brightness value in the lens area image.
比如,根据镜片区域图像中的像素亮度值,可以确定所述镜片区域图像中像素亮度值大于或等于预设亮度阈值的第一区域。响应于所述第一区域占所述镜片区域图像的面积比例满足预设面积条件,确定所述镜片区域图像中存在反光现象。将镜片区域图像中像素亮度值大于或等于预设亮度阈值的像素点组合成第一区域。当第一区域占镜片区域图像的面积比例满足预设面积条件时,比如,第一区域占镜片区域图像的面积比例大于或等于10%时,则说明镜片区域图像中存在反光现象。当第一区域占镜片区域图像的面积比例不满足预设面积条件时,则说明镜片上可能没有出现反光现象或者反光面积过小可以忽略该反光现象。在其他例子中,也可以直接根据第一区域的面积大小来判断镜片区域图像中是否存在反光现象。For example, according to the brightness values of pixels in the image of the lens area, the first area in the image of the lens area whose pixel brightness value is greater than or equal to a preset brightness threshold may be determined. In response to the area ratio of the first area in the lens area image meeting a preset area condition, it is determined that there is a reflection phenomenon in the lens area image. Combining pixels in the image of the lens area with pixel luminance values greater than or equal to a preset luminance threshold into a first area. When the area ratio of the first area to the lens area image satisfies the preset area condition, for example, when the area ratio of the first area to the lens area image is greater than or equal to 10%, it indicates that there is reflection phenomenon in the lens area image. When the area ratio of the first area to the image of the lens area does not meet the preset area condition, it means that there may be no reflection phenomenon on the lens or the reflection area is too small to ignore the reflection phenomenon. In other examples, it may also be determined directly according to the area size of the first area whether there is a reflection phenomenon in the image of the lens area.
又比如,根据镜片区域图像中的像素亮度值,可以确定所述镜片区域图像中像素亮度值大于或等于预设亮度阈值的第一区域。响应于镜片区域中的眼睛区域被所述第一区 域遮挡,确定所述镜片区域图像中存在反光现象。对于眼睛区域的后续算法而言,如果镜片上的反光并没有对镜片后眼睛的影像产生影响,则可以忽略掉该反光现象。而如果镜片上的反光遮挡了眼睛区域,则该反光现象不容忽略。将镜片区域图像中像素亮度值大于或等于预设亮度阈值的像素点组合成第一区域,当镜片区域图像中第一区域遮挡了眼睛区域,比如,可以是眼睛的轮廓不完整、镜片区域图像中第一区域之外的区域未检测到完整的目标对象的眼睛等,则认为镜片区域图像中存在反光现象且反光对目标对象的眼睛区域有影响,需要继续进行图像修复。当镜片区域图像中的眼睛区域未被第一区域遮挡,则认为镜片区域图像中不存在反光现象或者可以忽略该反光现象,不再进行后续的修复处理。For another example, according to the pixel brightness values in the lens area image, the first area in the lens area image whose pixel brightness values are greater than or equal to a preset brightness threshold may be determined. In response to the eye area in the lens area being blocked by the first area, it is determined that there is a glare phenomenon in the image of the lens area. For the subsequent algorithm of the eye area, if the reflection on the lens does not affect the image of the eye behind the lens, the reflection can be ignored. And if the reflection on the lens blocks the eye area, the reflection cannot be ignored. Combining pixels with pixel brightness values greater than or equal to the preset brightness threshold in the lens area image into the first area, when the first area in the lens area image blocks the eye area, for example, the outline of the eye may be incomplete, the lens area image If the complete eyes of the target object are not detected in the area other than the first area, it is considered that there is a reflection phenomenon in the image of the lens area and the reflection has an impact on the eye area of the target object, and image restoration needs to be continued. When the eye area in the lens area image is not blocked by the first area, it is considered that there is no reflection phenomenon in the lens area image or the reflection phenomenon can be ignored, and no subsequent repair processing is performed.
在步骤106中,根据所述反光区域,对所述镜片区域图像进行修复,得到修复后的目标图像。In step 106, the lens area image is repaired according to the reflective area to obtain a repaired target image.
本步骤中,可以根据反光区域提供的信息,利用影像修复技术,对镜片区域图像中的反光区域进行重点修复,消除或者减弱反光造成的影响,得到无反光的镜片区域图像,即修复后的目标图像。In this step, according to the information provided by the reflective area, the image restoration technology can be used to repair the reflective area in the image of the lens area, eliminate or weaken the impact caused by the reflection, and obtain the image of the non-reflective lens area, that is, the target after repair image.
在反光区域中,可能出现镜片反射的影像与镜片之后目标对象的脸部区域的影像叠加混合在一起,使得目标对象的脸部信息难以识别。在对镜片区域图像进行修复时,一方面,可以利用反光区域的结构形状以及反光区域的边缘色彩等信息,去推断反光区域的信息内容,然后对反光区域进行填补。另一方面,可以将反光区域在环境图像中相匹配的区域中的影像信息作为参照,对反光区域进行修补,恢复镜片背后的影像。In the reflective area, the image reflected by the lens may be superimposed and mixed with the image of the face area of the target object behind the lens, making it difficult to identify the face information of the target object. When repairing the image of the lens area, on the one hand, information such as the structural shape of the reflective area and the edge color of the reflective area can be used to infer the information content of the reflective area, and then the reflective area can be filled. On the other hand, the image information in the area where the reflective area matches the environment image can be used as a reference to repair the reflective area and restore the image behind the lens.
本实施例不限制在上述修复过程中具体所使用的修复算法,比如,画质增强算法,画面补全算法,超分技术等。在一个例子中,可以预先训练用于进行图像修复的神经网络模型,将反光区域、镜片区域图像以及环境图像输入该神经网络模型,输出修复后的目标图像。该神经网络可以通过对反光区域周边的非反光区域的图像信息的学习、以及对批量图像样本的学习来预测镜片区域图像中目标对象的脸部的信息。This embodiment does not limit the restoration algorithm specifically used in the above restoration process, for example, an image quality enhancement algorithm, a picture completion algorithm, a super-resolution technology, and the like. In one example, a neural network model for image restoration can be pre-trained, and the reflective area, lens area image, and environment image are input into the neural network model, and an inpainted target image is output. The neural network can predict the face information of the target object in the lens area image by learning the image information of the non-reflective area around the reflective area and learning the batch image samples.
本公开实施例的技术方案提供的图像修复方法,通过匹配目标对象佩戴的眼镜中的镜片区域图像与周围环境的环境图像,能够精确找到眼镜中的反光区域,从而能够基于反光区域的位置、形状等信息对镜片区域图像进行修复。传统的反光修复方法中,由于并不能确定反光区域的具体位置,只能粗略地对镜片区域图像整体进行修复。相较于传统的反光修复方法,本方法更好地实现了对镜片区域图像中的反光进行减弱或消除的效果。修复后的目标图像中还原出了目标对象被遮挡的脸部信息,特别是眼睛区域的信息,降低了镜片上的反光对于后续应用中算法的影响,提升了后续算法的准确度。The image repair method provided by the technical solution of the embodiment of the present disclosure can accurately find the reflective area in the glasses by matching the lens area image in the glasses worn by the target object with the environment image of the surrounding environment, so that the image can be detected based on the position and shape of the reflective area. and other information to repair the image of the lens area. In the traditional reflection repair method, since the specific position of the reflection area cannot be determined, the image of the lens area can only be roughly repaired as a whole. Compared with the traditional reflection restoration method, this method better realizes the effect of weakening or eliminating the reflection in the image of the lens area. The occluded face information of the target object is restored in the repaired target image, especially the information of the eye area, which reduces the impact of the reflection on the lens on the algorithm in the subsequent application and improves the accuracy of the subsequent algorithm.
图2为本公开至少一个实施例提供的另一种图像修复方法,该方法可以包括如下处理,其中,与图1的流程相同的步骤将不再详述。Fig. 2 is another image restoration method provided by at least one embodiment of the present disclosure, and the method may include the following processing, wherein the same steps as the flow in Fig. 1 will not be described in detail again.
在步骤202中,获取目标对象的脸部图像、以及包括所述目标对象周边环境的环境图像。In step 202, a face image of the target object and an environment image including the surrounding environment of the target object are acquired.
其中,脸部图像包含目标对象所佩戴的眼镜的镜片区域图像。本实施例中的图像修复方法可以作为各种图像识别算法的预处理步骤,比如,可以适用于多种车舱视觉算法。Wherein, the face image includes a lens area image of glasses worn by the target object. The image restoration method in this embodiment can be used as a preprocessing step of various image recognition algorithms, for example, it can be applied to various cabin vision algorithms.
在步骤204中,将所述镜片区域图像与所述环境图像进行匹配,确定所述环境图像中与所述镜片区域图像相匹配的标记区域。In step 204, the lens area image is matched with the environment image, and a marked area in the environment image that matches the lens area image is determined.
本步骤中,可以将镜片区域图像与环境图像进行匹配,若存在镜片区域图像中某个部分与环境图像中的某一个区域之间的相似度满足一定条件,则将环境图像中的该区域确定为与镜片区域图像相匹配的标记区域。该标记区域包含了已知的环境中的景象,比如,房子,树等。In this step, the lens area image can be matched with the environment image. If the similarity between a certain part in the lens area image and a certain area in the environment image satisfies certain conditions, then the area in the environment image is determined is the marked area that matches the image of the lens area. The marked area contains scenes in the known environment, such as houses, trees, and so on.
在步骤206中,提取所述标记区域的特征轮廓。In step 206, the feature contour of the marked area is extracted.
特征轮廓是勾勒出标记区域中景物的一组或几组相互连接的曲线,这些曲线由一系列边缘点组成。比如,该标记区域中包括一棵树和一个电线杆,提取到的特征轮廓包括上述一棵树的轮廓和一个电线杆的轮廓。The feature contour is a group or several groups of interconnected curves that outline the scene in the marked area, and these curves are composed of a series of edge points. For example, the marked area includes a tree and an electric pole, and the extracted feature contours include the outline of the above-mentioned tree and the contour of an electric pole.
本实施例不限制在提取标记区域的特征轮廓的具体方式,比如,可以采用图像分割、边缘检测等方式进行提取。This embodiment is not limited to the specific manner of extracting the feature contour of the marked area, for example, image segmentation, edge detection and other manners may be used for extraction.
在步骤208中,利用所述标记区域的特征轮廓对所述镜片区域图像进行区域分割,得到所述反光区域。In step 208, the image of the lens area is segmented using the characteristic contour of the marked area to obtain the reflective area.
本实施例不限制区域分割所使用的具体方式。This embodiment does not limit the specific manner used for region segmentation.
比如,可以将提取到的特征轮廓作为区域蒙版,该区域蒙版覆盖了特征轮廓范围以内的区域。延续上例,可以将上述一棵树的轮廓和一个电线杆的轮廓组合的特征轮廓作为一个区域蒙版,也可以分别作为两个区域蒙版,即树对应的一个区域蒙版和电线杆对应的一个区域蒙版。根据区域蒙版所覆盖的区域的形状,在镜片区域图像中拟合出与该形状相似的区域,分割得到反光区域。当区域蒙版有多个时,可以分割出多个反光区域。For example, the extracted feature contour can be used as a region mask, and the region mask covers the region within the range of the feature contour. Continuing the above example, the feature contour of the combination of the above-mentioned outline of a tree and the outline of a utility pole can be used as an area mask, or it can be used as two area masks respectively, that is, an area mask corresponding to a tree and an electric pole corresponding to An area mask of . According to the shape of the area covered by the area mask, an area similar to the shape is fitted in the image of the lens area, and the reflective area is obtained by segmentation. When there are multiple area masks, multiple reflective areas can be divided.
又比如,可以将特征轮廓作为检测目标,在镜片区域图像中进行目标检测,得到置信度最高的区域轮廓,根据该区域轮廓从镜片区域图像中分割得反光区域。For another example, the feature contour can be used as the detection target, and the target detection is performed in the lens region image to obtain the region contour with the highest confidence, and the reflective region is segmented from the lens region image according to the region contour.
需要说明的是,上个实施例示出的将镜片区域图像与环境图像进行匹配确定反光区域的方法中,若存在镜片区域图像中某个部分与环境图像中的某一个区域之间的相似度满足一定条件,直接将镜片区域图像中的该部分确定为反光区域。这样的方法速度上相 比于本实施例的方法较快,但是所确定的反光区域的准确度没有本实施例的方法高。原因是:在镜片区域图像中所呈现的影像是镜片反射的环境中影像和镜片之后目标对象的脸部区域的影像的混合影像,这样在进行匹配时,很难从镜片区域图像中分离出真实的反光区域。It should be noted that, in the method for matching the lens area image and the environment image shown in the previous embodiment to determine the reflective area, if there is a similarity between a certain part in the lens area image and a certain area in the environment image that satisfies Under certain conditions, the part in the image of the lens area is directly determined as the reflective area. Such a method is faster than the method of this embodiment in speed, but the accuracy of the determined reflective area is not as high as that of the method of this embodiment. The reason is that the image presented in the lens area image is a mixture of the image of the environment reflected by the lens and the image of the target subject's face area behind the lens, so that it is difficult to separate the real image from the lens area image when matching. reflective area.
在步骤210中,根据所述反光区域,对所述镜片区域图像进行修复,得到修复后的目标图像。In step 210, the lens area image is repaired according to the reflective area to obtain a repaired target image.
本公开实施例的技术方案提供的图像修复方法,通过匹配目标对象佩戴的眼镜中的镜片区域图像与包含周围环境的环境图像,找到环境图像中与镜片区域图像内影像相匹配的标记区域。由于标记区域是确切清晰的环境图像中的区域,基于标记区域提取到的特征轮廓也会更清晰可靠、更接近环境中实际景物的形状,而镜片反光的倒影正是环境中的景象。这样通过特征轮廓分割得到的反光区域更接近于镜片上实际的反光所在的区域,从而能够基于反光区域的位置、形状等信息对镜片区域图像进行修复。反光区域的准确度越高,给修复算法提供的信息越可靠,修复补全的效果也就越好。修复后的目标图像中还原出了目标对象被遮挡的脸部信息,特别是眼睛区域的信息,降低了镜片上的反光对于后续应用中算法的影响,提升了后续算法的准确度。The image restoration method provided by the technical solution of the embodiment of the present disclosure finds the marked area in the environment image that matches the image in the lens area image by matching the lens area image in the glasses worn by the target object with the environment image including the surrounding environment. Since the marked area is an area in the exact and clear environment image, the feature outline extracted based on the marked area will be clearer and more reliable, and closer to the shape of the actual scene in the environment, and the reflection of the lens reflection is exactly the scene in the environment. In this way, the reflective area obtained through feature contour segmentation is closer to the actual reflective area on the lens, so that the image of the lens area can be repaired based on information such as the position and shape of the reflective area. The higher the accuracy of the reflective area, the more reliable the information provided to the restoration algorithm, and the better the restoration and completion effect will be. The occluded face information of the target object is restored in the repaired target image, especially the information of the eye area, which reduces the impact of the reflection on the lens on the algorithm in the subsequent application and improves the accuracy of the subsequent algorithm.
图3提供了本公开另一实施例的图像修复方法,该方法可以应用于智能车舱领域,比如,可以由DMS(Driver Monitoring System,驾驶员监控系统),OMS(Occupancy Monitoring System,乘客监控系统),智能驾驶系统或者云端等执行,包括如下处理,其中,与图1和图2的流程相同的步骤将不再详述。Fig. 3 provides the image restoration method of another embodiment of the present disclosure, and this method can be applied to the field of intelligent cabin, for example, can be by DMS (Driver Monitoring System, driver monitoring system), OMS (Occupancy Monitoring System, passenger monitoring system ), executed by the intelligent driving system or the cloud, etc., including the following processing, wherein the same steps as those shown in Fig. 1 and Fig. 2 will not be described in detail again.
在步骤302中,获取第一摄像头采集的车辆内的目标对象的脸部图像。In step 302, the face image of the target object in the vehicle captured by the first camera is acquired.
比如,第一摄像头可以是朝向车内的摄像头,由第一摄像头捕捉车辆内部的影像得到车内图像,对车内图像进行图像分析,得到目标对象的脸部图像。目标对象可以是车辆内的驾驶员、乘客、安全员等。For example, the first camera may be a camera facing the interior of the vehicle, and the first camera captures images inside the vehicle to obtain an image inside the vehicle, and performs image analysis on the image inside the vehicle to obtain a face image of the target object. Target objects can be drivers, passengers, safety officers, etc. in the vehicle.
在步骤304中,对所述脸部图像进行眼镜识别,确定所述脸部图像中所述目标对象所佩戴的眼镜中的镜片区域图像。In step 304, glasses recognition is performed on the face image, and an image of a lens area in glasses worn by the target object in the face image is determined.
比如,可以先对脸部图像进行眼镜检测,若检测到眼镜,则进一步对脸部图像进行眼镜识别,识别得到目标对象所佩戴的眼镜中的镜片区域图像。For example, glasses detection may be performed on the face image first, and if glasses are detected, glasses recognition may be further performed on the face image to obtain an image of the lens area in the glasses worn by the target object.
又比如,直接对脸部图像进行眼镜识别,确定目标对象是否佩戴眼镜并在确定目标对象佩戴眼镜时得到目标对象所佩戴的眼镜中的镜片区域图像。Another example is to directly perform glasses recognition on the facial image, determine whether the target object wears glasses, and obtain an image of the lens area in the glasses worn by the target object when it is determined that the target object wears glasses.
在步骤306中,获取第二摄像头采集的所述环境图像,所述环境图像中包括所述车辆的外部环境图像。In step 306, the environment image captured by the second camera is acquired, and the environment image includes an external environment image of the vehicle.
比如,第二摄像头可以是朝向车外的摄像头,由第二摄像头捕捉车辆外部的环境影像,得到环境图像。环境图像至少包含一颗摄像头的数据,或者包含多颗摄像头的数据。For example, the second camera may be a camera facing outside the vehicle, and the second camera captures an environmental image outside the vehicle to obtain an environmental image. The environment image contains data of at least one camera, or data of multiple cameras.
在一个例子中,本实施例中的方法可以用于修复DMS采集的驾驶员的脸部图像。考虑到驾驶员眼镜的反光通常由车前方或侧方的景物成像形成,第二摄像头可以使用车辆的前向摄像头和/或侧视摄像头,捕捉到的环境图像中包括车辆前方和/或侧方的外部环境。或者可以使用朝向车外的环视摄像头,捕捉到的环境图像中包括车外全景图像。In an example, the method in this embodiment can be used to restore the driver's face image collected by the DMS. Considering that the reflection of the driver's glasses is usually formed by the imaging of the scene in front of or on the side of the vehicle, the second camera can use the vehicle's front-facing camera and/or side-view camera, and the captured environmental images include the front and/or side of the vehicle external environment. Alternatively, a surround-view camera facing the outside of the vehicle can be used, and the captured environment image includes a panoramic image outside the vehicle.
在步骤308中,将所述镜片区域图像与所述环境图像进行匹配,确定所述环境图像中与所述镜片区域图像相匹配的标记区域。In step 308, the lens area image is matched with the environment image, and a marked area in the environment image that matches the lens area image is determined.
比如,如果镜片区域图像的影像匹配到了环境图像的车外影像的某一个区域,标记该车外区域为标记区域。For example, if the image of the image of the lens area matches a certain area of the image outside the vehicle of the environment image, mark the area outside the vehicle as a marked area.
在步骤310中,提取所述标记区域的特征轮廓,得到区域蒙版。In step 310, the feature contour of the marked region is extracted to obtain a region mask.
提取该标记区域的特征轮廓,并将该特征轮廓作为区域蒙版。The feature contour of the marked region is extracted, and the feature contour is used as a region mask.
在步骤312中,利用所述区域蒙版对所述镜片区域图像进行区域分割,得到所述反光区域。In step 312, the region image of the lens region is segmented by using the region mask to obtain the reflective region.
在步骤314中,根据所述反光区域,对所述镜片区域图像进行修复,得到修复后的目标图像。In step 314, the lens area image is repaired according to the reflective area to obtain a repaired target image.
在步骤316中,基于所述目标图像,识别所述目标对象的状态。In step 316, the state of the target object is identified based on the target image.
其中,目标对象的状态可以表征目标对象的情绪或身体状态,具体地,可以包括如下至少一项:正常状态,疲劳状态,分心状态。Wherein, the state of the target object may represent the emotional or physical state of the target object, specifically, may include at least one of the following: normal state, fatigue state, and distraction state.
比如,可以将目标图像,即修复后的镜片区域影像输入状态识别模型。状态识别模型可以是预先训练得到的神经网络模型,能够基于闭眼、眼睑之间的距离、眨眼速度快、凝视方向和跳跃运动等识别出目标对象的状态。For example, the target image, that is, the image of the repaired lens area, can be input into the state recognition model. The state recognition model can be a pre-trained neural network model, which can recognize the state of the target object based on closed eyes, distance between eyelids, fast blinking speed, gaze direction, and jumping movement.
又比如,可以将目标图像填补到脸部图像,得到修复后的脸部图像。将脸部图像输入到状态识别模型,状态识别模型可以结合眼部的特征和脸部的其他特征,比如嘴巴打哈欠、面部表情变化等,识别出目标对象的状态。For another example, the target image may be filled into the facial image to obtain a repaired facial image. The face image is input to the state recognition model, and the state recognition model can combine the features of the eyes and other features of the face, such as yawning of the mouth, changes in facial expressions, etc., to recognize the state of the target object.
在一些实施例中,可以根据修复得到的目标图像,针对目标对象的眼部相关的状态进行识别。具体地,可以根据目标图像提取眼部特征以识别目标对象的视线方向或眼睛睁闭状态,根据视频流检测目标对象的视线维持一个方向的时间长度或眼睛闭合的持续时间,来判断目标对象是否处于分心或疲劳的状态,或者确定目标对象分心或疲劳的等级。In some embodiments, the eye-related state of the target object can be identified based on the repaired target image. Specifically, eye features can be extracted from the target image to identify the direction of sight of the target object or the state of eye opening and closing, and the length of time for the sight of the target object to maintain one direction or the duration of eye closure can be detected according to the video stream to determine whether the target object is Being distracted or fatigued, or determining the target object's level of distraction or fatigue.
本实施例中的图像修复方法,可以通过镜片反光消除技术预先对图像进行处理,然 后灌入算法模块,提高识别算法的准确度和可用度。以疲劳检测算法为例,在镜片反光的情况下会由于图像上特征信息的减少而导致检测精度显著降低,即误报或者漏报。本实施例的方法可以根据车外景物的轮廓对于镜片反光进行分割以及图像修复,还原疲劳监测算法所需要的关键信息,提高车内视觉算法的准确度。In the image repair method in this embodiment, the image can be pre-processed through the lens reflection elimination technology, and then poured into the algorithm module to improve the accuracy and availability of the recognition algorithm. Taking the fatigue detection algorithm as an example, in the case of reflective lenses, the detection accuracy will be significantly reduced due to the reduction of feature information on the image, that is, false positives or missed negatives. The method of this embodiment can segment and restore the reflection of the lens according to the outline of the scene outside the vehicle, restore the key information required by the fatigue monitoring algorithm, and improve the accuracy of the vision algorithm inside the vehicle.
如图4所示,图是本公开至少一个实施例示出的一种图像修复装置的框图,所述装置包括:As shown in FIG. 4, the figure is a block diagram of an image restoration device shown in at least one embodiment of the present disclosure, and the device includes:
图像获取模块41,用于获取目标对象的脸部图像、以及包括所述目标对象周边环境的环境图像,所述脸部图像包含所述目标对象所佩戴的眼镜的镜片区域图像。The image acquisition module 41 is configured to acquire a face image of the target object and an environment image including the surrounding environment of the target object, the face image including a lens area image of glasses worn by the target object.
反光区域确定模块42,用于根据所述镜片区域图像与所述环境图像的匹配结果,确定所述镜片区域图像中的反光区域。The reflective area determination module 42 is configured to determine the reflective area in the lens area image according to the matching result of the lens area image and the environment image.
图像处理模块43,用于根据所述反光区域,对所述镜片区域图像进行修复,得到修复后的目标图像。The image processing module 43 is configured to repair the image of the lens area according to the reflective area to obtain a repaired target image.
在一个例子中,所述反光区域确定模块42,具体用于:将所述镜片区域图像与所述环境图像进行匹配,确定所述环境图像中与所述镜片区域图像相匹配的标记区域;提取所述标记区域的特征轮廓;利用所述标记区域的特征轮廓对所述镜片区域图像进行区域分割,得到所述反光区域。In one example, the reflective area determination module 42 is specifically configured to: match the lens area image with the environment image, determine a marked area in the environment image that matches the lens area image; extract The characteristic contour of the marked area; using the characteristic contour of the marked area to segment the image of the lens area to obtain the reflective area.
在一个例子中,所述图像获取模块41,在所述获取目标对象的脸部图像之后,还用于:对所述脸部图像进行眼镜识别,确定所述脸部图像中所述目标对象所佩戴的眼镜中的镜片区域图像。In one example, the image acquisition module 41 is further configured to: perform glasses recognition on the facial image after acquiring the facial image of the target object, and determine the location of the target object in the facial image. Image of the lens area in the worn glasses.
在一个例子中,所述反光区域确定模块42,具体用于:响应于确定所述镜片区域图像中存在反光现象,根据所述镜片区域图像与所述环境图像的匹配结果,确定所述镜片区域图像中的反光区域。In an example, the reflective area determination module 42 is specifically configured to: determine the lens area according to the matching result between the lens area image and the environment image in response to determining that there is a reflective phenomenon in the lens area image Reflective areas in the image.
在一个例子中,所述反光区域确定模块42,在用于确定所述镜片区域图像中存在反光现象时,具体用于:响应于所述镜片区域图像与所述环境图像存在匹配成功的图像区域,确定所述镜片区域图像中存在反光现象。In an example, when the reflective area determination module 42 is used to determine that there is a reflective phenomenon in the lens area image, it is specifically configured to: respond to the existence of an image area that successfully matches the lens area image and the environment image , to determine that there is a reflection phenomenon in the image of the lens area.
在一个例子中,所述反光区域确定模块42,在用于确定所述镜片区域图像中存在反光现象时,具体用于:确定所述镜片区域图像中像素亮度值大于或等于预设亮度阈值的第一区域;响应于所述第一区域占所述镜片区域图像的面积比例满足预设面积条件,确定所述镜片区域图像中存在反光现象。In one example, when the reflective area determination module 42 is used to determine that there is a reflective phenomenon in the image of the lens area, it is specifically used to: determine that the pixel brightness value in the image of the lens area is greater than or equal to a preset brightness threshold The first area: in response to the area ratio of the first area in the lens area image meeting a preset area condition, determine that there is a reflection phenomenon in the lens area image.
在一个例子中,所述反光区域确定模块42,在用于确定所述镜片区域图像中存在反光现象时,具体用于:确定所述镜片区域图像中像素亮度值大于或等于预设亮度阈值 的第一区域;响应于所述镜片区域中的眼睛区域被所述第一区域遮挡,确定所述镜片区域图像中存在反光现象。In one example, when the reflective area determination module 42 is used to determine that there is a reflective phenomenon in the image of the lens area, it is specifically used to: determine that the pixel brightness value in the image of the lens area is greater than or equal to a preset brightness threshold First area: in response to the eye area in the lens area being blocked by the first area, determine that there is a reflection phenomenon in the image of the lens area.
在一个例子中,所述图像获取模块41,具体用于:获取第一摄像头采集的车辆内的目标对象的脸部图像;获取第二摄像头采集的所述环境图像,所述环境图像包括所述车辆的外部环境图像。In one example, the image acquisition module 41 is specifically configured to: acquire the face image of the target object in the vehicle captured by the first camera; acquire the environment image captured by the second camera, the environment image includes the An image of the vehicle's external environment.
在一个例子中,如图5所示,所述装置还包括状态识别模块44,用于在对所述镜片区域图像进行修复,得到修复后的目标图像之后:基于所述目标图像,识别所述目标对象的状态。In one example, as shown in FIG. 5 , the device further includes a state recognition module 44, configured to, after repairing the image of the lens area and obtaining the repaired target image: based on the target image, identify the The state of the target object.
上述装置中各个模块的功能和作用的实现过程具体详见上述方法中对应步骤的实现过程,在此不再赘述。For the implementation process of the functions and effects of each module in the above-mentioned device, please refer to the implementation process of the corresponding steps in the above-mentioned method for details, and details will not be repeated here.
本公开实施例还提供了一种电子设备,如图6所示,所述电子设备包括存储器61、处理器62,所述存储器61用于存储可在处理器上运行的计算机指令,所述处理器62用于在执行所述计算机指令时实现本公开任一实施例所述的图像修复方法。An embodiment of the present disclosure also provides an electronic device. As shown in FIG. The device 62 is configured to implement the image restoration method described in any embodiment of the present disclosure when executing the computer instructions.
本公开实施例还提供了一种计算机程序产品,该产品包括计算机程序/指令,该计算机程序/指令被处理器执行时实现本公开任一实施例所述的图像修复方法。An embodiment of the present disclosure further provides a computer program product, the product includes a computer program/instruction, and when the computer program/instruction is executed by a processor, the image restoration method described in any embodiment of the present disclosure is implemented.
本公开实施例还提供了一种计算机可读存储介质,其上存储有计算机程序,所述程序被处理器执行时实现本公开任一实施例所述的图像修复方法。An embodiment of the present disclosure further provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the image restoration method described in any embodiment of the present disclosure is implemented.
对于装置实施例而言,由于其基本对应于方法实施例,所以相关之处参见方法实施例的部分说明即可。以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理模块,即可以位于一个地方,或者也可以分布到多个网络模块上。可以根据实际的需要选择其中的部分或者全部模块来实现本说明书方案的目的。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。As for the device embodiment, since it basically corresponds to the method embodiment, for related parts, please refer to the part description of the method embodiment. The device embodiments described above are only illustrative, and the modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, they may be located in One place, or it can be distributed to multiple network modules. Part or all of the modules can be selected according to actual needs to achieve the purpose of the solution in this specification. It can be understood and implemented by those skilled in the art without creative effort.
上述对本说明书特定实施例进行了描述。其它实施例在所附权利要求书的范围内。在一些情况下,在权利要求书中记载的动作或步骤可以按照不同于实施例中的顺序来执行并且仍然可以实现期望的结果。另外,在附图中描绘的过程不一定要求示出的特定顺序或者连续顺序才能实现期望的结果。在某些实施方式中,多任务处理和并行处理也是可以的或者可能是有利的。The foregoing describes specific embodiments of this specification. Other implementations are within the scope of the following claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. Multitasking and parallel processing are also possible or may be advantageous in certain embodiments.
本领域技术人员在考虑说明书及实践这里申请的发明后,将容易想到本说明书的其它实施方案。本说明书旨在涵盖本说明书的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本说明书的一般性原理并包括本说明书未申请的本技术领域 中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本说明书的真正范围和精神由下面的权利要求指出。Other embodiments of the description will readily occur to those skilled in the art from consideration of the specification and practice of the invention claimed herein. This description is intended to cover any modification, use or adaptation of this description. These modifications, uses or adaptations follow the general principles of this description and include common knowledge or conventional technical means in this technical field for which this description does not apply . The specification and examples are to be considered exemplary only, with a true scope and spirit of the specification being indicated by the following claims.
应当理解的是,本说明书并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围进行各种修改和改变。本说明书的范围仅由所附的权利要求来限制。It should be understood that this specification is not limited to the precise constructions which have been described above and shown in the accompanying drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the specification is limited only by the appended claims.
以上所述仅为本说明书的较佳实施例而已,并不用以限制本说明书,凡在本说明书的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本说明书保护的范围之内。The above descriptions are only preferred embodiments of this specification, and are not intended to limit this specification. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of this specification shall be included in this specification. within the scope of protection.

Claims (12)

  1. 一种图像修复方法,包括:A method for image restoration, comprising:
    获取目标对象的脸部图像、以及包括所述目标对象周边环境的环境图像,所述脸部图像包含所述目标对象所佩戴的眼镜的镜片区域图像;Acquiring a face image of the target object and an environment image including the surrounding environment of the target object, the face image including a lens area image of glasses worn by the target object;
    根据所述镜片区域图像与所述环境图像的匹配结果,确定所述镜片区域图像中的反光区域;determining a reflective area in the lens area image according to a matching result between the lens area image and the environment image;
    根据所述反光区域,对所述镜片区域图像进行修复,得到修复后的目标图像。According to the reflective area, the image of the lens area is repaired to obtain a repaired target image.
  2. 根据权利要求1所述的方法,其特征在于,所述根据所述镜片区域图像与所述环境图像的匹配结果,确定所述镜片区域图像中的反光区域,包括:The method according to claim 1, wherein the determining the reflective area in the lens area image according to the matching result of the lens area image and the environment image comprises:
    将所述镜片区域图像与所述环境图像进行匹配,确定所述环境图像中与所述镜片区域图像相匹配的标记区域;matching the lens area image with the environment image, and determining a marked area in the environment image that matches the lens area image;
    提取所述标记区域的特征轮廓;extracting a feature profile of the marked region;
    利用所述标记区域的特征轮廓对所述镜片区域图像进行区域分割,得到所述反光区域。The reflective area is obtained by performing area segmentation on the lens area image by using the characteristic contour of the marked area.
  3. 根据权利要求1所述的方法,其特征在于,在所述获取目标对象的脸部图像之后,所述方法包括:The method according to claim 1, characterized in that, after the acquisition of the face image of the target object, the method comprises:
    对所述脸部图像进行眼镜识别,确定所述脸部图像中所述目标对象所佩戴的眼镜中的镜片区域图像。Glasses recognition is performed on the facial image, and an image of a lens area in the glasses worn by the target object in the facial image is determined.
  4. 根据权利要求1-3任一项所述的方法,其特征在于,所述根据所述镜片区域图像与所述环境图像的匹配结果,确定所述镜片区域图像中的反光区域,包括:The method according to any one of claims 1-3, wherein the determining the reflective area in the lens area image according to the matching result of the lens area image and the environment image comprises:
    响应于确定所述镜片区域图像中存在反光现象,根据所述镜片区域图像与所述环境图像的匹配结果,确定所述镜片区域图像中的反光区域。In response to determining that there is a reflection phenomenon in the lens area image, a reflection area in the lens area image is determined according to a matching result between the lens area image and the environment image.
  5. 根据权利要求4所述的方法,其特征在于,所述确定所述镜片区域图像中存在反光现象,包括:The method according to claim 4, wherein the determining that there is a reflection phenomenon in the image of the lens area comprises:
    响应于所述镜片区域图像与所述环境图像存在匹配成功的图像区域,确定所述镜片区域图像中存在反光现象。In response to an image area that successfully matches the lens area image and the environment image, it is determined that there is a reflection phenomenon in the lens area image.
  6. 根据权利要求4所述的方法,其特征在于,所述确定所述镜片区域图像中存在反光现象,包括:The method according to claim 4, wherein the determining that there is a reflection phenomenon in the image of the lens area comprises:
    确定所述镜片区域图像中像素亮度值大于或等于预设亮度阈值的第一区域;determining a first region in the lens region image whose pixel brightness value is greater than or equal to a preset brightness threshold;
    响应于所述第一区域占所述镜片区域图像的面积比例满足预设面积条件,确定所述镜片区域图像中存在反光现象。In response to the area ratio of the first area in the lens area image meeting a preset area condition, it is determined that there is a reflection phenomenon in the lens area image.
  7. 根据权利要求4所述的方法,其特征在于,所述确定所述镜片区域图像中存在反光现象,包括:The method according to claim 4, wherein the determining that there is a reflection phenomenon in the image of the lens area comprises:
    确定所述镜片区域图像中像素亮度值大于或等于预设亮度阈值的第一区域;determining a first region in the lens region image whose pixel brightness value is greater than or equal to a preset brightness threshold;
    响应于所述镜片区域中的眼睛区域被所述第一区域遮挡,确定所述镜片区域图像中存在反光现象。In response to the eye area in the lens area being blocked by the first area, it is determined that there is a reflection phenomenon in the image of the lens area.
  8. 根据权利要求1-7任一项所述的方法,其特征在于,所述获取目标对象的脸部图像、以及包括所述目标对象周边环境的环境图像,包括:The method according to any one of claims 1-7, wherein the acquiring the face image of the target object and the environment image including the surrounding environment of the target object includes:
    获取第一摄像头采集的车辆内的所述目标对象的脸部图像;Obtain the face image of the target object in the vehicle captured by the first camera;
    获取第二摄像头采集的所述环境图像,所述环境图像包括所述车辆的外部环境图像。Acquire the environment image captured by the second camera, where the environment image includes an external environment image of the vehicle.
  9. 根据权利要求1-8任一项所述的方法,其特征在于,在所述根据所述反光区域,对所述镜片区域图像进行修复,得到修复后的目标图像之后,所述方法还包括:The method according to any one of claims 1-8, characterized in that, after repairing the lens region image according to the reflective region to obtain the repaired target image, the method further includes:
    基于所述目标图像,识别所述目标对象的状态。A state of the target object is identified based on the target image.
  10. 一种图像修复装置,包括:An image restoration device, comprising:
    图像获取模块,用于获取目标对象的脸部图像、以及包括所述目标对象周边环境的环境图像,所述脸部图像包含所述目标对象所佩戴的眼镜的镜片区域图像;An image acquisition module, configured to acquire a face image of the target object and an environment image including the surrounding environment of the target object, the face image including a lens area image of glasses worn by the target object;
    反光区域确定模块,用于根据所述镜片区域图像与所述环境图像的匹配结果,确定所述镜片区域图像中的反光区域;A reflective area determining module, configured to determine the reflective area in the lens area image according to the matching result of the lens area image and the environment image;
    图像处理模块,用于根据所述反光区域,对所述镜片区域图像进行修复,得到修复后的目标图像。The image processing module is configured to repair the image of the lens area according to the reflective area to obtain a repaired target image.
  11. 一种电子设备,其特征在于,所述设备包括存储器、处理器,所述存储器用于存储可在处理器上运行的计算机指令,所述处理器用于在执行所述计算机指令时实现权利要求1至9任一项所述的方法。An electronic device, characterized in that the device comprises a memory and a processor, the memory is used to store computer instructions executable on the processor, and the processor is used to implement claim 1 when executing the computer instructions to the method described in any one of 9.
  12. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述程序被处理器执行时实现权利要求1至9任一项所述的方法。A computer-readable storage medium, on which a computer program is stored, wherein the program implements the method according to any one of claims 1 to 9 when the program is executed by a processor.
PCT/CN2022/134873 2022-02-28 2022-11-29 Image inpainting method and apparatus, and device and medium WO2023160075A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210188238.6 2022-02-28
CN202210188238.6A CN114565531A (en) 2022-02-28 2022-02-28 Image restoration method, device, equipment and medium

Publications (1)

Publication Number Publication Date
WO2023160075A1 true WO2023160075A1 (en) 2023-08-31

Family

ID=81716112

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/134873 WO2023160075A1 (en) 2022-02-28 2022-11-29 Image inpainting method and apparatus, and device and medium

Country Status (2)

Country Link
CN (1) CN114565531A (en)
WO (1) WO2023160075A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114565531A (en) * 2022-02-28 2022-05-31 上海商汤临港智能科技有限公司 Image restoration method, device, equipment and medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2018011681A (en) * 2016-07-20 2018-01-25 富士通株式会社 Visual line detection device, visual line detection program, and visual line detection method
CN108564540A (en) * 2018-03-05 2018-09-21 广东欧珀移动通信有限公司 Remove image processing method, device and the terminal device that eyeglass is reflective in image
CN111582005A (en) * 2019-02-18 2020-08-25 Oppo广东移动通信有限公司 Image processing method, image processing device, computer readable medium and electronic equipment
CN113055579A (en) * 2019-12-26 2021-06-29 深圳市万普拉斯科技有限公司 Image processing method and device, electronic equipment and readable storage medium
CN114565531A (en) * 2022-02-28 2022-05-31 上海商汤临港智能科技有限公司 Image restoration method, device, equipment and medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2018011681A (en) * 2016-07-20 2018-01-25 富士通株式会社 Visual line detection device, visual line detection program, and visual line detection method
CN108564540A (en) * 2018-03-05 2018-09-21 广东欧珀移动通信有限公司 Remove image processing method, device and the terminal device that eyeglass is reflective in image
CN111582005A (en) * 2019-02-18 2020-08-25 Oppo广东移动通信有限公司 Image processing method, image processing device, computer readable medium and electronic equipment
CN113055579A (en) * 2019-12-26 2021-06-29 深圳市万普拉斯科技有限公司 Image processing method and device, electronic equipment and readable storage medium
CN114565531A (en) * 2022-02-28 2022-05-31 上海商汤临港智能科技有限公司 Image restoration method, device, equipment and medium

Also Published As

Publication number Publication date
CN114565531A (en) 2022-05-31

Similar Documents

Publication Publication Date Title
CN107862299B (en) Living body face detection method based on near-infrared and visible light binocular cameras
WO2021016873A1 (en) Cascaded neural network-based attention detection method, computer device, and computer-readable storage medium
EP3338217A1 (en) Feature detection and masking in images based on color distributions
CN111062292B (en) Fatigue driving detection device and method
CN111652082B (en) Face living body detection method and device
WO2022083504A1 (en) Machine-learning model, methods and systems for removal of unwanted people from photographs
JP2003015816A (en) Face/visual line recognizing device using stereo camera
CN108416291B (en) Face detection and recognition method, device and system
CN111062328B (en) Image processing method and device and intelligent robot
Yuen et al. On looking at faces in an automobile: Issues, algorithms and evaluation on naturalistic driving dataset
CN111158491A (en) Gesture recognition man-machine interaction method applied to vehicle-mounted HUD
CN111914748B (en) Face recognition method, device, electronic equipment and computer readable storage medium
WO2023160075A1 (en) Image inpainting method and apparatus, and device and medium
CN111158457A (en) Vehicle-mounted HUD (head Up display) human-computer interaction system based on gesture recognition
CN111222444A (en) Augmented reality head-up display method and system considering emotion of driver
CN111814603A (en) Face recognition method, medium and electronic device
CN113781421A (en) Underwater-based target identification method, device and system
CN110047059B (en) Image processing method and device, electronic equipment and readable storage medium
CN114663863A (en) Image processing method, image processing device, electronic equipment and computer storage medium
CN112183200B (en) Eye movement tracking method and system based on video image
CN111738241B (en) Pupil detection method and device based on double cameras
Jacob Comparison of popular face detection and recognition techniques
KR20130126386A (en) Adaptive color detection method, face detection method and apparatus
JPH07311833A (en) Human face detecting device
CN114764944A (en) Pupil positioning method and device based on angular point detection

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22928335

Country of ref document: EP

Kind code of ref document: A1