WO2021129806A1 - Image processing method, apparatus, electronic device, and readable storage medium - Google Patents

Image processing method, apparatus, electronic device, and readable storage medium Download PDF

Info

Publication number
WO2021129806A1
WO2021129806A1 PCT/CN2020/139403 CN2020139403W WO2021129806A1 WO 2021129806 A1 WO2021129806 A1 WO 2021129806A1 CN 2020139403 W CN2020139403 W CN 2020139403W WO 2021129806 A1 WO2021129806 A1 WO 2021129806A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
area
processed
scene
specular reflection
Prior art date
Application number
PCT/CN2020/139403
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 WO2021129806A1 publication Critical patent/WO2021129806A1/en

Links

Images

Classifications

    • G06T5/94
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/80Camera processing pipelines; Components thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/10Image acquisition
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/50Constructional details
    • H04N23/55Optical parts specially adapted for electronic image sensors; Mounting thereof

Definitions

  • This application relates to the field of image processing technology, and in particular to an image processing method, device, electronic equipment, and readable storage medium.
  • the image obtained by the camera will include the pattern reflected by the object.
  • the pattern reflected by the object generally includes patterns that the user does not want to appear in the image. For example, if a user takes a selfie with a smart phone while wearing sunglasses, he will see the phone in the obtained image.
  • This application provides an image processing method, device, electronic equipment, and readable storage medium.
  • an embodiment of the present application provides an image processing method applied to an electronic device.
  • the method includes: obtaining a to-be-processed image; detecting the to-be-processed image to determine the specular reflection area in the to-be-processed image ; According to the reference image, the pattern in the specular reflection area is replaced or corrected to modify the pattern in the specular reflection area.
  • the image to be processed is obtained based on the first shooting direction
  • the detecting the image to be processed to determine the specular reflection area in the image to be processed includes: obtaining a scene image, wherein , The scene image is obtained by shooting in a second shooting direction in the target environment where the image to be processed is obtained, the relationship between the second shooting direction and the first shooting direction and the difference between the incident light and the reflected light The relationship is the same; scene matching is performed between the scene image and the image to be processed; if there is an area similar to the scene of the scene image in the image to be processed, the area is regarded as the specular reflection area.
  • the electronic device stores an object recognition model
  • the detecting the to-be-processed image and determining the specular reflection area in the to-be-processed image includes: using the object recognition model Object recognition is performed on the to-be-processed image to determine whether the to-be-processed image includes an object with specular reflection; if so, the area where the object with specular reflection is located is taken as the specular reflection area.
  • the detecting the to-be-processed image and determining the specular reflection area in the to-be-processed image includes: receiving a selection operation input by a user, and taking the area corresponding to the selection operation as The specular reflection area.
  • the replacing or correcting the pattern in the specular reflection area according to the reference image to modify the pattern in the specular reflection area includes: changing the pattern in the specular reflection area Replace with the pattern in the reference image; or, according to the matching result of the pattern in the specular reflection area and the pattern in the scene area, obtain the first pattern in the specular reflection area that is different from the pattern in the scene area.
  • the scene area Is an area where the scene image is similar to the specular reflection area
  • the image to be processed is obtained based on the first shooting direction
  • the scene image is taken in the second shooting direction in the target environment where the image to be processed is obtained, so
  • the relationship between the second imaging direction and the first imaging direction is the same as the relationship between incident light and reflected light.
  • an embodiment of the present application provides an image processing device, which is applied to electronic equipment, and the device includes: an obtaining module for obtaining a to-be-processed image; a detection module for detecting the to-be-processed image and determining The specular reflection area in the image to be processed; a processing module for replacing or correcting the pattern in the specular reflection area according to a reference image to modify the pattern in the specular reflection area.
  • the image to be processed is obtained based on the first shooting direction
  • the detection module is used to: obtain a scene image, wherein the scene image is in the first environment where the image to be processed is obtained. It is obtained by shooting in a second shooting direction, and the relationship between the second shooting direction and the first shooting direction is the same as the relationship between incident light and reflected light; performing scene matching between the scene image and the image to be processed; If there is an area similar to the scene of the scene image in the image to be processed, the area is regarded as the specular reflection area.
  • an object recognition model is stored in the electronic device, and the detection module is configured to: perform object recognition on the to-be-processed image through the object recognition model to determine whether the image is in the to-be-processed image Whether an object with specular reflection is included; if it exists, the area where the object with specular reflection is located is taken as the specular reflection area.
  • the detection module is configured to: receive a selection operation input by a user, and use an area corresponding to the selection operation as the specular reflection area.
  • the processing module is configured to: replace the pattern in the specular reflection area with the pattern in the reference image; or, according to the pattern in the specular reflection area and the scene area
  • a first area in the specular reflection area with a pattern different from that of the scene area a second area in the scene area with a pattern different from the pattern in the specular reflection area is obtained, and all The pattern in the first area is replaced with the pattern in the second area, wherein the scene area is an area where the scene image is similar to the scene of the specular reflection area, and the image to be processed is obtained based on the first shooting direction
  • the scene image is captured in a second shooting direction in the target environment where the image to be processed is obtained, and the relationship between the second shooting direction and the first shooting direction and the relationship between incident light and reflected light the same.
  • an embodiment of the present application provides an electronic device including a processor and a memory, the memory stores machine executable instructions that can be executed by the processor, and the processor can execute the machine executable instructions In order to realize the image processing method described in any one of the foregoing embodiments.
  • an embodiment of the present application provides a readable storage medium having a computer program stored thereon, and the computer program, when executed by a processor, implements the image processing method according to any one of the foregoing embodiments.
  • the image processing method, device, electronic device, and readable storage medium provided by the embodiments of the application detect the obtained image to be processed, determine the specular reflection area in the image to be processed, and then use the reference image to determine the specular reflection area Perform replacement or correction processing on the pattern in to change the pattern in the specular reflection area. In this way, patterns that the user does not want to appear in the image can be removed, thereby improving image quality and improving user experience.
  • Fig. 1 is a schematic block diagram of an electronic device provided by an embodiment of the present application.
  • Fig. 2 is a schematic flowchart of an image processing method provided by an embodiment of the present application.
  • FIG. 3 is a schematic flowchart of the sub-steps included in step S120 in FIG. 2.
  • FIG. 4 is a schematic diagram of the relationship between the first shooting direction and the second shooting direction provided by an embodiment of the present application.
  • Fig. 5 is a schematic block diagram of an image processing apparatus provided by an embodiment of the present application.
  • Icons 100-electronic equipment; 110-memory; 120-processor; 130-communication unit; 200-image processing device; 210-acquisition module; 220-detection module; 230-processing module.
  • first and “second” and other relational terms are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply one of these entities or operations. There is any such actual relationship or order between.
  • the terms “include”, “include” or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes those that are not explicitly listed Other elements of, or also include elements inherent to this process, method, article or equipment. If there are no more restrictions, the element defined by the sentence “including a" does not exclude the existence of other same elements in the process, method, article, or equipment that includes the element.
  • FIG. 1 is a block diagram of an electronic device 100 according to an embodiment of the present application.
  • the electronic device 100 may be, but is not limited to, a smart phone, a video camera, a computer, and the like.
  • the electronic device 100 may include a memory 110, a processor 120, and a communication unit 130.
  • the components of the memory 110, the processor 120, and the communication unit 130 are directly or indirectly electrically connected to each other to realize data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines.
  • the memory 110 is used to store programs or data.
  • the memory 110 may be, but is not limited to, a random access memory (Random Access Memory, RAM), a read only memory (Read Only Memory, ROM), and a programmable read-only memory (Programmable Read-Only Memory, PROM). Erasable Programmable Read-Only Memory (EPROM), Electric Erasable Programmable Read-Only Memory (EEPROM), etc.
  • RAM Random Access Memory
  • ROM read only memory
  • PROM programmable read-only memory
  • PROM Programmable Read-Only Memory
  • EPROM Erasable Programmable Read-Only Memory
  • EEPROM Electric Erasable Programmable Read-Only Memory
  • the processor 120 is used to read/write data or programs stored in the memory 110 and execute corresponding functions.
  • an image processing device 200 is stored in the memory 110, and the image processing device 200 includes at least one software function module that can be stored in the memory 110 in the form of software or firmware.
  • the processor 120 executes various functional applications and data processing by running software programs and modules stored in the memory 110, such as the image processing apparatus 200 in the embodiment of the present application, and thus realizes the image processing in the embodiment of the present application. method.
  • the communication unit 130 is used to establish a communication connection between the electronic device 100 and other communication terminals through a network, and is used to send and receive data through the network.
  • FIG. 1 is only a schematic structural diagram of the electronic device 100, and the electronic device 100 may also include more or fewer components than those shown in FIG. Configuration.
  • the components shown in FIG. 1 can be implemented by hardware, software, or a combination thereof.
  • FIG. 2 is a schematic flowchart of an image processing method provided by an embodiment of the present application. The method is applied to the electronic device 100. The following describes the implementation process of the image processing method.
  • step S110 an image to be processed is obtained.
  • Step S120 Detect the image to be processed, and determine the specular reflection area in the image to be processed.
  • step S130 the pattern in the specular reflection area is replaced or corrected according to the reference image, so as to change the pattern in the specular reflection area.
  • the pattern in the specular reflection area is replaced or corrected according to the reference image to complete the modification of the pattern in the specular reflection area.
  • the electronic device 100 may include a first camera, and the image to be processed is captured by the first camera.
  • the electronic device 100 obtains the image to be processed by receiving an image sent by another device.
  • the electronic device 100 may also obtain the to-be-processed image in other ways.
  • the specular reflection area can be obtained in the following manner. Please refer to FIG. 3, which is a schematic flowchart of the sub-steps included in step S120 in FIG. 2.
  • Step S120 may include sub-step S121 to sub-step S123.
  • sub-step S121 a scene image is obtained.
  • Sub-step S122 performing scene matching between the scene image and the image to be processed.
  • sub-step S123 if there is an area similar to the scene of the scene image in the image to be processed, use this area as the specular reflection area.
  • the image to be processed is obtained based on a first shooting direction, and the scene image is obtained by shooting in a second shooting direction in the target environment where the image to be processed is obtained.
  • the relationship between the first shooting directions is the same as the relationship between incident light and reflected light.
  • the light When light hits the reflective surface, the light is reflected by the reflective surface to the original medium.
  • the incident light and the reflected light are located on both sides of the normal of the reflective surface, and the incident angle is equal to the reflection angle. That is to say, when the image to be processed captured in the first shooting direction includes the specular reflection area, the scene image is captured in the second shooting direction. As shown in FIG.
  • the first shooting direction and the second shooting direction are located at On both sides of the normal of the reflecting surface, the angle 1 between the first shooting direction and the normal is the same or close to the angle 2 between the second shooting direction and the normal.
  • the reflection surface in FIG. 4 represents the actual reflection surface corresponding to the specular reflection area in the image to be processed.
  • the reflective surface in FIG. 4 represents the reflective surface of the lens.
  • the first shooting direction is perpendicular to the reflecting surface, the second shooting direction is opposite to the first shooting direction.
  • the electronic device 100 or the device that obtains the image to be processed by shooting may include a first camera and a second camera with opposite shooting directions. After the image to be processed is obtained through the first camera, the image to be processed may be adjusted The shooting direction of the second camera, so that the scene image is obtained through the second camera.
  • the electronic device 100 includes a front camera and a rear camera. After the user takes a selfie with the front camera, the image obtained by the front camera can be used as the image to be processed, and the shooting direction of the rear camera can be adjusted to obtain the scene image in the second shooting direction. image.
  • the camera that has obtained the image to be processed may be adjusted from the first shooting direction to the second shooting direction, and then shooting again, and the image obtained by shooting again is used as the Describe the scene image.
  • scene matching may be performed on the scene image and the image to be processed to obtain the scene similarity, and it is determined whether the image to be processed includes an area similar to the scene image according to the scene similarity. If the scene similarity is not greater than the preset similarity, it can be determined that the image to be processed does not include specular reflection objects. If the scene similarity is greater than the preset similarity, it can be determined that the image to be processed includes an area similar to the scene image, and the area where the scene of the image to be processed is similar to the scene image in the scene image is used as the mirror Reflective area.
  • scene matching can be achieved through feature matching in the image. For example, if there is a cuboid building in a certain area of the image to be processed, and there is also a cuboid building in the scene image, it can be determined that the area where the cuboid building is in the image to be processed is Specular reflection area.
  • the second shooting direction can be directly determined, then according to the second shooting direction and the current shooting direction, prompt information of angle movement is displayed, so that the user can directly change the shooting direction according to the information. Adjust to the second shooting direction.
  • the user can be based on the specular reflection area in the to-be-processed image. Adjust the direction of the pattern corresponding to the actual scene, and then obtain an image in the adjusted direction. Then, according to the scene similarity and the scene similarity between the newly obtained image and the image to be processed, prompt information of the angle movement is displayed. This adjustment action is repeated, so that the user gradually adjusts the shooting direction to the second shooting direction, so as to obtain the scene image.
  • the image corresponding to the scene similarity is the scene image obtained in the second shooting direction, and the image to be processed corresponds to the scene similarity
  • the area is the specular reflection area.
  • the missing part can be determined , And prompt the user to move based on the missing part. For example, if a part of the pattern in the image to be processed is the same as the pattern on the left side of the newly acquired image, but the current scene similarity is lower than the preset similarity, it can be determined that the scene on the right side is missing. The user is prompted to move the shooting direction to the right; if the surrounding area is missing, the user is prompted to step back.
  • the user can also determine which part is missing (for example, the right scene or the left scene), and then the electronic device 100 prompts the user with a specific movement mode (for example, to the right or to the left) according to the missing part determined by the user.
  • the shooting direction is adjusted, and then the shooting direction is adjusted to the second shooting direction to obtain the scene image.
  • the image obtained at a certain time may be directly used as the scene at random And determining that the specular reflection area is not included in the to-be-processed image.
  • the user can adjust the direction according to the actual scene corresponding to the pattern in the specular reflection area in the image to be processed, and then obtain it from a different angle.
  • Multiple images so that the multiple images are combined into one image including the complete scene, that is, an image including the scene image is obtained.
  • prompt information for prompting the user to take multiple images at different angles according to the actual scene can also be displayed, so as to synthesize the image including the scene image, and then according to the scene
  • the image of the image and the image to be processed are matched to determine the specular reflection area.
  • common mirror-reflected objects are model-trained through machine learning to obtain a trained object recognition model, and the object recognition model It is stored in the electronic device 100.
  • the electronic device 100 can perform object recognition on the image to be processed through the object recognition model. If the specularly reflected object is not recognized, it can be determined that the to-be-processed image does not include the specularly reflected object. If an object with specular reflection is identified, it can be determined that the image to be processed includes an object with specular reflection, and the area where the object with specular reflection is located is regarded as the specular reflection area.
  • the electronic device 100 may also receive a selection operation input by the user for enclosing an area, and use the area corresponding to the selection operation as the specular reflection area.
  • the electronic device 100 may also determine the specular reflection area through at least two of the above three detection schemes. For example, if the specular reflection area obtained by scene matching or recognition through the object recognition model and the area corresponding to the user's selection operation are obtained, the area corresponding to the user's selection operation is taken as the specular reflection area of the image to be processed.
  • the user can be prompted to input the selection operation, and the area specified by the user's selection operation is used as the waiting area. Process the specular reflection area in the image.
  • the pattern in the specular reflection area may be replaced with the pattern in the reference image, so as to remove the patterns in the specular reflection area that the user does not want to be displayed.
  • the reference image may be the scene image, or may be an image completely unrelated to the target environment in which the image to be processed is obtained.
  • a user uses a smartphone to take a selfie in front of the four logos A, B, C, and D while wearing sunglasses.
  • the sunglasses can reflect A, B, and C.
  • the patterns on the sunglasses are the mobile phone and the two logos C and D. That is to say, the patterns in the specular reflection area of the image to be processed are the mobile phone and C, D. D two logos.
  • the reference image is a scene image with four logos of A, B, C, and D
  • the scene image can be scaled down according to the requirements, and all the patterns in the specular reflection area are replaced according to the reduced scene image, so that the replaced
  • the patterns in the specular reflection area are four marks A, B, C, and D.
  • the reference image can also be an image with a mountain peak or sea pattern, that is, it has nothing to do with the four marks A, B, C, and D, and then all the patterns in the specular reflection area are replaced according to the image in the same manner.
  • the mobile phone pattern in the image to be processed can be removed.
  • an area similar to the specular reflection area in the scene image may be used as a scene area.
  • the scene area may be the scene image or a part of the scene image, which is determined according to actual conditions.
  • the pattern in the specular reflection area is matched with the pattern in the scene area to obtain a first area in which the pattern in the specular reflection area is different from the pattern in the scene area, the pattern in the scene area and the pattern in the scene area.
  • the second area with a different pattern in the specular reflection area.
  • a user uses a smartphone to take a selfie in front of the four logos A, B, C, and D while wearing sunglasses.
  • the sunglasses can reflect A, B, and C.
  • the patterns on the sunglasses are the mobile phone and the two logos C and D. That is to say, the patterns in the specular reflection area of the image to be processed are the mobile phone and C, D. D two logos.
  • the pattern in the specular reflection area is not a mobile phone, but the A and B logos.
  • the image processing apparatus 200 may use the components of the electronic device 100 shown in FIG. structure. Further, please refer to FIG. 5, which is a block diagram of an image processing apparatus 200 provided by an embodiment of the present application. It should be noted that the basic principles and technical effects of the image processing device 200 provided in this embodiment are the same as those in the above embodiments. For a brief description, for parts not mentioned in this embodiment, please refer to the above embodiments. In the corresponding content.
  • the image processing device 200 includes: an obtaining module 210, a detection module 220, and a processing module 230.
  • the obtaining module 210 is used to obtain an image to be processed.
  • the detection module 220 is configured to detect the image to be processed and determine the specular reflection area in the image to be processed.
  • the processing module 230 is configured to perform replacement or correction processing on the pattern in the specular reflection area according to the reference image, so as to modify the pattern in the specular reflection area.
  • the image to be processed is obtained based on the first shooting direction
  • the detection module 220 is configured to: obtain a scene image, wherein the scene image is obtained when the image to be processed is obtained.
  • the target environment is captured in a second shooting direction, and the relationship between the second shooting direction and the first shooting direction is the same as the relationship between incident light and reflected light;
  • the image is processed for scene matching; if there is an area similar to the scene of the scene image in the image to be processed, the area is regarded as the specular reflection area.
  • an object recognition model is stored in the electronic device 100, and the detection module 220 is configured to perform object recognition on the image to be processed through the object recognition model to It is determined whether the image to be processed includes an object with specular reflection; if it exists, the area where the object with specular reflection is located is taken as the specular reflection area.
  • the detection module 220 is configured to receive a selection operation input by a user, and use an area corresponding to the selection operation as the specular reflection area.
  • the processing module 230 is configured to: replace the pattern in the specular reflection area with the pattern in the reference image; or, according to the pattern in the specular reflection area
  • the pattern and the pattern in the scene area are matched to obtain a first area where the pattern in the specular reflection area is different from the pattern in the scene area, and the second area where the pattern in the scene area is different from the pattern in the specular reflection area is obtained.
  • the above-mentioned modules can be stored in the memory 110 shown in FIG. 1 in the form of software or firmware (Firmware) or solidified in the operating system (OS) of the electronic device 100, and can be processed by the processing shown in FIG. 1 ⁇ 120 executes.
  • data, program codes, etc. required to execute the above-mentioned modules may be stored in the memory 110.
  • the embodiments of the present application provide an image processing method, device, electronic device, and readable storage medium. After the image to be processed is obtained, the image to be processed is detected, the specular reflection area in the image to be processed is determined, and then the pattern in the specular reflection area is replaced or corrected according to the reference image to change the specular reflection area In the pattern. In this way, patterns that the user does not want to appear in the image can be removed, thereby improving image quality and improving user experience.
  • each block in the flowchart or block diagram may represent a module, program segment, or part of the code, and the module, program segment, or part of the code contains one or more functions for realizing the specified logic function.
  • Executable instructions may also occur in a different order from the order marked in the drawings.
  • each block in the block diagram and/or flowchart, and the combination of the blocks in the block diagram and/or flowchart can be implemented by a dedicated hardware-based system that performs the specified functions or actions Or it can be realized by a combination of dedicated hardware and computer instructions.
  • the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist alone, or two or more modules may be integrated to form an independent part.
  • the function is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer readable storage medium.
  • the technical solution of the present application essentially or the part that contributes to the existing technology or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including Several instructions are used to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in the various embodiments of the present application.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disks or optical disks and other media that can store program codes. .

Abstract

The present application relates to the technical field of image processing and provides an image processing method, an apparatus, an electronic device, and a readable storage medium. Detection is performed on an obtained image to be processed, a specular reflection region within the image to be processed is determined, and substitution or modification is subsequently performed on a pattern within the specular reflection region according to a reference image, so as to alter the pattern within the specular reflection region.

Description

图像处理方法、装置、电子设备及可读存储介质Image processing method, device, electronic equipment and readable storage medium
交叉引用cross reference
本发明要求在2019年12月26日提交中国专利局、申请号为201911363993.8、发明名称为“图像处理方法、装置、电子设备及可读存储介质”的中国专利申请的优先权,上述申请的全部内容通过引用结合在本发明中。The present invention claims the priority of a Chinese patent application filed with the Chinese Patent Office, the application number is 201911363993.8, and the invention title is "Image processing methods, devices, electronic equipment and readable storage media" on December 26, 2019. All of the above applications The content is incorporated in the present invention by reference.
技术领域Technical field
本申请涉及图像处理技术领域,具体而言,涉及一种图像处理方法、装置、电子设备及可读存储介质。This application relates to the field of image processing technology, and in particular to an image processing method, device, electronic equipment, and readable storage medium.
背景技术Background technique
随着科技的不断进步,越来越多的设备都具有照相功能。当用户在拍摄时,若摄像头的拍摄范围内有存在镜面反射的物体,由于该物体能够反射出图案,因此通过该摄像头获得的图像中会包括该物体反射出的图案。该物体反射的图案中一般会包括用户不希望出现在图像中的图案。比如,用户利用智能手机在佩戴墨镜的情况下自拍,会从得到的图像中看到手机。With the continuous advancement of technology, more and more devices have camera functions. When the user is shooting, if there is an object with specular reflection in the shooting range of the camera, since the object can reflect a pattern, the image obtained by the camera will include the pattern reflected by the object. The pattern reflected by the object generally includes patterns that the user does not want to appear in the image. For example, if a user takes a selfie with a smart phone while wearing sunglasses, he will see the phone in the obtained image.
发明内容Summary of the invention
本申请提供一种图像处理方法、装置、电子设备和可读存储介质。This application provides an image processing method, device, electronic equipment, and readable storage medium.
本申请实施例采用的技术方案如下:The technical solutions adopted in the embodiments of this application are as follows:
第一方面,本申请实施例提供一种图像处理方法,应用于电子设备,所述方法包括:获得待处理图像;对所述待处理图像进行检测,确定所述待处理图像中的镜面反射区域;根据参考图像对所述镜面反射区域中的图案进行替换或修正处理,以更改所述镜面反射区域中的图案。In a first aspect, an embodiment of the present application provides an image processing method applied to an electronic device. The method includes: obtaining a to-be-processed image; detecting the to-be-processed image to determine the specular reflection area in the to-be-processed image ; According to the reference image, the pattern in the specular reflection area is replaced or corrected to modify the pattern in the specular reflection area.
在可选的实施方式中,所述待处理图像基于第一拍摄方向得到,所述对所述待处理图像进行检测,确定所述待处理图像中的镜面反射区域,包括:获得场景图像,其中,所述场景图像在获得所述待处理图像的目标环境中以第二拍摄方向拍摄得到,所述第二拍摄方向与所述第一拍摄方向之间的关系和入射光与反射光之间的关系相同;将所述场景图像与所述待处理图像进行场景匹配;若所述待处理图像中存在与所述场景图像场景相似的区域,则将该区域作为所述镜面反射区域。In an optional embodiment, the image to be processed is obtained based on the first shooting direction, and the detecting the image to be processed to determine the specular reflection area in the image to be processed includes: obtaining a scene image, wherein , The scene image is obtained by shooting in a second shooting direction in the target environment where the image to be processed is obtained, the relationship between the second shooting direction and the first shooting direction and the difference between the incident light and the reflected light The relationship is the same; scene matching is performed between the scene image and the image to be processed; if there is an area similar to the scene of the scene image in the image to be processed, the area is regarded as the specular reflection area.
在可选的实施方式中,所述电子设备中存储有物体识别模型,所述对所述待处理图像进行检测,确定所述待处理图像中的镜面反射区域,包括:通过所述物体识别模型对所述待处理图像进行物体识别,以判断所述待处理图像中是否包括存在镜面反射的物体;若存在,则将存在镜面反射的物体所在的区域作为所述镜面反射区域。In an optional embodiment, the electronic device stores an object recognition model, and the detecting the to-be-processed image and determining the specular reflection area in the to-be-processed image includes: using the object recognition model Object recognition is performed on the to-be-processed image to determine whether the to-be-processed image includes an object with specular reflection; if so, the area where the object with specular reflection is located is taken as the specular reflection area.
在可选的实施方式中,所述对所述待处理图像进行检测,确定所述待处理图像中的镜面反射区域,包括:接收用户输入的选择操作,并将所述选择操作对应的区域作为所述镜面反射区域。In an alternative embodiment, the detecting the to-be-processed image and determining the specular reflection area in the to-be-processed image includes: receiving a selection operation input by a user, and taking the area corresponding to the selection operation as The specular reflection area.
在可选的实施方式中,所述根据参考图像对所述镜面反射区域中的图案进行替换或修正处理,以更改所述镜面反射区域中的图案,包括:将所述镜 面反射区域中的图案替换为所述参考图像中的图案;或者,根据所述镜面反射区域中的图案和场景区域中的图案的匹配结果,得到所述镜面反射区域中图案与所述场景区域的图案不同的第一区域、所述场景区域中图案与所述镜面反射区域中的图案不同的第二区域,并将所述第一区域中的图案替换为所述第二区域中的图案,其中,所述场景区域为场景图像与所述镜面反射区域场景相似的区域,所述待处理图像基于第一拍摄方向得到,所述场景图像在获得所述待处理图像的目标环境中以第二拍摄方向拍摄得到,所述第二拍摄方向与所述第一拍摄方向之间的关系和入射光与反射光之间的关系相同。In an optional embodiment, the replacing or correcting the pattern in the specular reflection area according to the reference image to modify the pattern in the specular reflection area includes: changing the pattern in the specular reflection area Replace with the pattern in the reference image; or, according to the matching result of the pattern in the specular reflection area and the pattern in the scene area, obtain the first pattern in the specular reflection area that is different from the pattern in the scene area. Area, a second area where the pattern in the scene area is different from the pattern in the specular reflection area, and the pattern in the first area is replaced with the pattern in the second area, wherein the scene area Is an area where the scene image is similar to the specular reflection area, the image to be processed is obtained based on the first shooting direction, and the scene image is taken in the second shooting direction in the target environment where the image to be processed is obtained, so The relationship between the second imaging direction and the first imaging direction is the same as the relationship between incident light and reflected light.
第二方面,本申请实施例提供一种图像处理装置,应用于电子设备,所述装置包括:获得模块,用于获得待处理图像;检测模块,用于对所述待处理图像进行检测,确定所述待处理图像中的镜面反射区域;处理模块,用于根据参考图像对所述镜面反射区域中的图案进行替换或修正处理,以更改所述镜面反射区域中的图案。In a second aspect, an embodiment of the present application provides an image processing device, which is applied to electronic equipment, and the device includes: an obtaining module for obtaining a to-be-processed image; a detection module for detecting the to-be-processed image and determining The specular reflection area in the image to be processed; a processing module for replacing or correcting the pattern in the specular reflection area according to a reference image to modify the pattern in the specular reflection area.
在可选的实施方式中,所述待处理图像基于第一拍摄方向得到,所述检测模块用于:获得场景图像,其中,所述场景图像在获得所述待处理图像的目标环境中以第二拍摄方向拍摄得到,所述第二拍摄方向与所述第一拍摄方向之间的关系和入射光与反射光之间的关系相同;将所述场景图像与所述待处理图像进行场景匹配;若所述待处理图像中存在与所述场景图像场景相似的区域,则将该区域作为所述镜面反射区域。In an optional implementation manner, the image to be processed is obtained based on the first shooting direction, and the detection module is used to: obtain a scene image, wherein the scene image is in the first environment where the image to be processed is obtained. It is obtained by shooting in a second shooting direction, and the relationship between the second shooting direction and the first shooting direction is the same as the relationship between incident light and reflected light; performing scene matching between the scene image and the image to be processed; If there is an area similar to the scene of the scene image in the image to be processed, the area is regarded as the specular reflection area.
在可选的实施方式中,所述电子设备中存储有物体识别模型,所述检测模块用于:通过所述物体识别模型对所述待处理图像进行物体识别,以判断所述待处理图像中是否包括存在镜面反射的物体;若存在,则将存在镜面反 射的物体所在的区域作为所述镜面反射区域。In an optional implementation manner, an object recognition model is stored in the electronic device, and the detection module is configured to: perform object recognition on the to-be-processed image through the object recognition model to determine whether the image is in the to-be-processed image Whether an object with specular reflection is included; if it exists, the area where the object with specular reflection is located is taken as the specular reflection area.
在可选的实施方式中,所述检测模块用于:接收用户输入的选择操作,并将所述选择操作对应的区域作为所述镜面反射区域。In an optional implementation manner, the detection module is configured to: receive a selection operation input by a user, and use an area corresponding to the selection operation as the specular reflection area.
在可选的实施方式中,所述处理模块用于:将所述镜面反射区域中的图案替换为所述参考图像中的图案;或者,根据所述镜面反射区域中的图案和场景区域中的图案的匹配结果,得到所述镜面反射区域中图案与所述场景区域的图案不同的第一区域、所述场景区域中图案与所述镜面反射区域中的图案不同的第二区域,并将所述第一区域中的图案替换为所述第二区域中的图案,其中,所述场景区域为场景图像与所述镜面反射区域场景相似的区域,所述待处理图像基于第一拍摄方向得到,所述场景图像在获得所述待处理图像的目标环境中以第二拍摄方向拍摄得到,所述第二拍摄方向与所述第一拍摄方向之间的关系和入射光与反射光之间的关系相同。In an alternative embodiment, the processing module is configured to: replace the pattern in the specular reflection area with the pattern in the reference image; or, according to the pattern in the specular reflection area and the scene area As a result of pattern matching, a first area in the specular reflection area with a pattern different from that of the scene area, a second area in the scene area with a pattern different from the pattern in the specular reflection area is obtained, and all The pattern in the first area is replaced with the pattern in the second area, wherein the scene area is an area where the scene image is similar to the scene of the specular reflection area, and the image to be processed is obtained based on the first shooting direction, The scene image is captured in a second shooting direction in the target environment where the image to be processed is obtained, and the relationship between the second shooting direction and the first shooting direction and the relationship between incident light and reflected light the same.
第三方面,本申请实施例提供一种电子设备,包括处理器和存储器,所述存储器存储有能够被所述处理器执行的机器可执行指令,所述处理器可执行所述机器可执行指令以实现前述实施方式中任一项所述的图像处理方法。In a third aspect, an embodiment of the present application provides an electronic device including a processor and a memory, the memory stores machine executable instructions that can be executed by the processor, and the processor can execute the machine executable instructions In order to realize the image processing method described in any one of the foregoing embodiments.
第四方面,本申请实施例提供一种可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现如前述实施方式中任一项所述的图像处理方法。In a fourth aspect, an embodiment of the present application provides a readable storage medium having a computer program stored thereon, and the computer program, when executed by a processor, implements the image processing method according to any one of the foregoing embodiments.
本申请实施例提供的图像处理方法、装置、电子设备及可读存储介质,对获得的待处理图像进行检测,确定所述待处理图像中的镜面反射区域,然后根据参考图像对该镜面反射区域中的图案进行替换或修正处理,以更改镜 面反射区域中的图案。由此,可将用户不希望出现在图像中的图案进行去除,从而提高图像质量,改善用户体验。The image processing method, device, electronic device, and readable storage medium provided by the embodiments of the application detect the obtained image to be processed, determine the specular reflection area in the image to be processed, and then use the reference image to determine the specular reflection area Perform replacement or correction processing on the pattern in to change the pattern in the specular reflection area. In this way, patterns that the user does not want to appear in the image can be removed, thereby improving image quality and improving user experience.
为使本申请的上述目的、特征和优点能更明显易懂,下文特举较佳实施例,并配合所附附图,作详细说明如下。In order to make the above-mentioned objectives, features and advantages of the present application more obvious and understandable, preferred embodiments are specifically described below in conjunction with the accompanying drawings, which are described in detail as follows.
附图说明Description of the drawings
为了更清楚地说明本申请实施例的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,应当理解,以下附图仅示出了本申请的某些实施例,因此不应被看作是对范围的限定,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他相关的附图。In order to more clearly describe the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings that need to be used in the embodiments. It should be understood that the following drawings only show certain embodiments of the present application, and therefore do not It should be regarded as a limitation of the scope. For those of ordinary skill in the art, other related drawings can be obtained based on these drawings without creative work.
图1是本申请实施例提供的电子设备的方框示意图。Fig. 1 is a schematic block diagram of an electronic device provided by an embodiment of the present application.
图2是本申请实施例提供的图像处理方法的流程示意图。Fig. 2 is a schematic flowchart of an image processing method provided by an embodiment of the present application.
图3是图2中步骤S120包括的子步骤的一种流程示意图。FIG. 3 is a schematic flowchart of the sub-steps included in step S120 in FIG. 2.
图4是本申请实施例提供的第一拍摄方向与第二拍摄方向的关系示意图。FIG. 4 is a schematic diagram of the relationship between the first shooting direction and the second shooting direction provided by an embodiment of the present application.
图5是本申请实施例提供的图像处理装置的方框示意图。Fig. 5 is a schematic block diagram of an image processing apparatus provided by an embodiment of the present application.
图标:100-电子设备;110-存储器;120-处理器;130-通信单元;200-图像处理装置;210-获得模块;220-检测模块;230-处理模块。Icons: 100-electronic equipment; 110-memory; 120-processor; 130-communication unit; 200-image processing device; 210-acquisition module; 220-detection module; 230-processing module.
具体实施方式Detailed ways
下面将结合本申请实施例中附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不 是全部的实施例。通常在此处附图中描述和示出的本申请实施例的组件可以以各种不同的配置来布置和设计。The following will clearly and completely describe the technical solutions in the embodiments of the present application in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application generally described and shown in the drawings herein may be arranged and designed in various different configurations.
因此,以下对在附图中提供的本申请的实施例的详细描述并非旨在限制要求保护的本申请的范围,而是仅仅表示本申请的选定实施例。基于本申请的实施例,本领域技术人员在没有做出创造性劳动的前提下所获得的所有其他实施例,都属于本申请保护的范围。Therefore, the following detailed description of the embodiments of the application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely represents selected embodiments of the application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative work shall fall within the protection scope of the present application.
需要说明的是,术语“第一”和“第二”等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should be noted that the terms "first" and "second" and other relational terms are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply one of these entities or operations. There is any such actual relationship or order between. Moreover, the terms "include", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes those that are not explicitly listed Other elements of, or also include elements inherent to this process, method, article or equipment. If there are no more restrictions, the element defined by the sentence "including a..." does not exclude the existence of other same elements in the process, method, article, or equipment that includes the element.
请参照图1,图1是本申请实施例提供的电子设备100的方框示意图。所述电子设备100可以是,但不限于,智能手机、摄像机、电脑等。所述电子设备100可以包括存储器110、处理器120及通信单元130。所述存储器110、处理器120以及通信单元130各元件相互之间直接或间接地电性连接,以实现数据的传输或交互。例如,这些元件相互之间可通过一条或多条通讯总线或信号线实现电性连接。Please refer to FIG. 1, which is a block diagram of an electronic device 100 according to an embodiment of the present application. The electronic device 100 may be, but is not limited to, a smart phone, a video camera, a computer, and the like. The electronic device 100 may include a memory 110, a processor 120, and a communication unit 130. The components of the memory 110, the processor 120, and the communication unit 130 are directly or indirectly electrically connected to each other to realize data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines.
其中,存储器110用于存储程序或者数据。所述存储器110可以是,但不限于,随机存取存储器(Random Access Memory,RAM),只读存储器(Read Only Memory,ROM),可编程只读存储器(Programmable Read-Only Memory,PROM),可擦除只读存储器(Erasable Programmable Read-Only Memory,EPROM),电可擦除只读存储器(Electric Erasable Programmable Read-Only Memory,EEPROM)等。Among them, the memory 110 is used to store programs or data. The memory 110 may be, but is not limited to, a random access memory (Random Access Memory, RAM), a read only memory (Read Only Memory, ROM), and a programmable read-only memory (Programmable Read-Only Memory, PROM). Erasable Programmable Read-Only Memory (EPROM), Electric Erasable Programmable Read-Only Memory (EEPROM), etc.
处理器120用于读/写存储器110中存储的数据或程序,并执行相应地功能。比如,存储器110中存储有图像处理装置200,所述图像处理装置200 包括至少一个可以软件或固件(firmware)的形式存储于所述存储器110中的软件功能模块。所述处理器120通过运行存储在存储器110内的软件程序以及模块,如本申请实施例中的图像处理装置200,从而执行各种功能应用以及数据处理,即实现本申请实施例中的图像处理方法。The processor 120 is used to read/write data or programs stored in the memory 110 and execute corresponding functions. For example, an image processing device 200 is stored in the memory 110, and the image processing device 200 includes at least one software function module that can be stored in the memory 110 in the form of software or firmware. The processor 120 executes various functional applications and data processing by running software programs and modules stored in the memory 110, such as the image processing apparatus 200 in the embodiment of the present application, and thus realizes the image processing in the embodiment of the present application. method.
通信单元130用于通过网络建立所述电子设备100与其它通信终端之间的通信连接,并用于通过所述网络收发数据。The communication unit 130 is used to establish a communication connection between the electronic device 100 and other communication terminals through a network, and is used to send and receive data through the network.
应当理解的是,图1所示的结构仅为电子设备100的结构示意图,所述电子设备100还可包括比图1中所示更多或者更少的组件,或者具有与图1所示不同的配置。图1中所示的各组件可以采用硬件、软件或其组合实现。It should be understood that the structure shown in FIG. 1 is only a schematic structural diagram of the electronic device 100, and the electronic device 100 may also include more or fewer components than those shown in FIG. Configuration. The components shown in FIG. 1 can be implemented by hardware, software, or a combination thereof.
请参照图2,图2是本申请实施例提供的图像处理方法的流程示意图。所述方法应用于电子设备100。下面对图像处理方法的实现流程进行阐述。Please refer to FIG. 2, which is a schematic flowchart of an image processing method provided by an embodiment of the present application. The method is applied to the electronic device 100. The following describes the implementation process of the image processing method.
步骤S110,获得待处理图像。In step S110, an image to be processed is obtained.
步骤S120,对所述待处理图像进行检测,确定所述待处理图像中的镜面反射区域。Step S120: Detect the image to be processed, and determine the specular reflection area in the image to be processed.
步骤S130,根据参考图像对所述镜面反射区域中的图案进行替换或修正处理,以更改所述镜面反射区域中的图案。In step S130, the pattern in the specular reflection area is replaced or corrected according to the reference image, so as to change the pattern in the specular reflection area.
在本实施例中,在检测确定待处理图像中的镜面反射区域后,根据参考图像对该镜面反射区域中的图案进行替换或修正处理,以完成对该镜面反射区域中图案的更改。由此,可将用户不希望出现在图像中的图案去除,从而提高图像质量,改善用户体验。In this embodiment, after detecting and determining the specular reflection area in the image to be processed, the pattern in the specular reflection area is replaced or corrected according to the reference image to complete the modification of the pattern in the specular reflection area. As a result, patterns that the user does not want to appear in the image can be removed, thereby improving image quality and improving user experience.
可选地,在本实施例中,所述电子设备100中可以包括第一摄像头,通过该第一摄像头拍摄得到所述待处理图像。或者,所述电子设备100通过接收其他设备发送图像的方式,获得所述待处理图像。当然可以理解的是,所述电子设备100也可以通过其他方式获得所述待处理图像。Optionally, in this embodiment, the electronic device 100 may include a first camera, and the image to be processed is captured by the first camera. Alternatively, the electronic device 100 obtains the image to be processed by receiving an image sent by another device. Of course, it can be understood that the electronic device 100 may also obtain the to-be-processed image in other ways.
在本实施例的一种实施方式中,可通过以下方式获得所述镜面反射区域。请参照图3,图3是图2中步骤S120包括的子步骤的一种流程示意图。步骤S120可以包括子步骤S121~子步骤S123。In an implementation of this embodiment, the specular reflection area can be obtained in the following manner. Please refer to FIG. 3, which is a schematic flowchart of the sub-steps included in step S120 in FIG. 2. Step S120 may include sub-step S121 to sub-step S123.
子步骤S121,获得场景图像。In sub-step S121, a scene image is obtained.
子步骤S122,将所述场景图像与所述待处理图像进行场景匹配。Sub-step S122, performing scene matching between the scene image and the image to be processed.
子步骤S123,若所述待处理图像中存在与所述场景图像场景相似的区域,则将该区域作为所述镜面反射区域。In sub-step S123, if there is an area similar to the scene of the scene image in the image to be processed, use this area as the specular reflection area.
在本实施例中,所述待处理图像基于第一拍摄方向得到,所述场景图像是在获得所述待处理图像的目标环境中以第二拍摄方向拍摄得到,所述第二拍摄方向与所述第一拍摄方向之间的关系和入射光与反射光之间的关系相同。当光射到反射面上时,光被反射面反射到原介质,入射光和反射光位于反射面的法线两侧,入射角等于反射角。也就是说,当以第一拍摄方向拍摄得到的待处理图像中包括镜面反射区域时,则以第二拍摄方向拍摄得到场景图像,如图4所示,第一拍摄方向与第二拍摄方向位于反射面的法线的两侧,且第一拍摄方向与法线之间的夹角角1与第二拍摄方向与法线之间的夹角角2大小相同或接近。其中,图4中的反射面表示待处理图像中的镜面反射区域对应的实际反射面。比如,若待处理图像中包括墨镜的镜片,则图4中的反射面表示镜片的反射面。当然可以理解的是,若第一拍摄方向垂直于反射面,则第二拍摄方向与第一拍摄方向相反。In this embodiment, the image to be processed is obtained based on a first shooting direction, and the scene image is obtained by shooting in a second shooting direction in the target environment where the image to be processed is obtained. The relationship between the first shooting directions is the same as the relationship between incident light and reflected light. When light hits the reflective surface, the light is reflected by the reflective surface to the original medium. The incident light and the reflected light are located on both sides of the normal of the reflective surface, and the incident angle is equal to the reflection angle. That is to say, when the image to be processed captured in the first shooting direction includes the specular reflection area, the scene image is captured in the second shooting direction. As shown in FIG. 4, the first shooting direction and the second shooting direction are located at On both sides of the normal of the reflecting surface, the angle 1 between the first shooting direction and the normal is the same or close to the angle 2 between the second shooting direction and the normal. Wherein, the reflection surface in FIG. 4 represents the actual reflection surface corresponding to the specular reflection area in the image to be processed. For example, if the image to be processed includes the lens of sunglasses, the reflective surface in FIG. 4 represents the reflective surface of the lens. Of course, it can be understood that if the first shooting direction is perpendicular to the reflecting surface, the second shooting direction is opposite to the first shooting direction.
可选地,所述电子设备100或经拍摄得到所述待处理图像的设备可包括拍摄方向相反的第一摄像头及第二摄像头,在通过第一摄像头获得所述待处理图像后,可通过调整所述第二摄像头的拍摄方向,从而通过所述第二摄像头获得所述场景图像。Optionally, the electronic device 100 or the device that obtains the image to be processed by shooting may include a first camera and a second camera with opposite shooting directions. After the image to be processed is obtained through the first camera, the image to be processed may be adjusted The shooting direction of the second camera, so that the scene image is obtained through the second camera.
比如,所述电子设备100包括前置摄像头及后置摄像头。当用户通过前置摄像头自拍后,可将通过前置摄像头获得的图像作为所述待处理图像,并调整后置摄像头的拍摄方向,以在所述第二拍摄方向获得可作为所述场景图像的图像。For example, the electronic device 100 includes a front camera and a rear camera. After the user takes a selfie with the front camera, the image obtained by the front camera can be used as the image to be processed, and the shooting direction of the rear camera can be adjusted to obtain the scene image in the second shooting direction. image.
可选地,也可以在获得所述待处理图像后,将已获得所述待处理图像的摄像头由第一拍摄方向调整至第二拍摄方向,然后再次拍摄,并将再次拍摄得到的图像作为所述场景图像。Optionally, after obtaining the image to be processed, the camera that has obtained the image to be processed may be adjusted from the first shooting direction to the second shooting direction, and then shooting again, and the image obtained by shooting again is used as the Describe the scene image.
在获得所述场景图像后,可将该场景图像与待处理图像进行场景匹配, 得到场景相似度,并根据场景相似度判断所述待处理图像中是否包括与所述场景图像相似的区域。若场景相似度不大于预设相似度,则可确定所述待处理图像中不包括存在镜面反射的物体。若场景相似度大于预设相似度,则可确定所述待处理图像中包括与所述场景图像相似的区域,并将所述待处理图像与所述场景图像中场景相似的区域作为所述镜面反射区域。After the scene image is obtained, scene matching may be performed on the scene image and the image to be processed to obtain the scene similarity, and it is determined whether the image to be processed includes an area similar to the scene image according to the scene similarity. If the scene similarity is not greater than the preset similarity, it can be determined that the image to be processed does not include specular reflection objects. If the scene similarity is greater than the preset similarity, it can be determined that the image to be processed includes an area similar to the scene image, and the area where the scene of the image to be processed is similar to the scene image in the scene image is used as the mirror Reflective area.
其中,可通过图像中的特征匹配实现场景匹配。比如,若所述待处理图像的某块区域中存在一栋长方体的建筑物,所述场景图像中也存在一栋长方体的建筑物,则可确定该待处理图像中长方体建筑物所在的区域为镜面反射区域。Among them, scene matching can be achieved through feature matching in the image. For example, if there is a cuboid building in a certain area of the image to be processed, and there is also a cuboid building in the scene image, it can be determined that the area where the cuboid building is in the image to be processed is Specular reflection area.
可选地,在本实施例中,若可直接确定所述第二拍摄方向,则根据所述第二拍摄方向及当前拍摄方向,显示角度移动提示信息,以使用户根据该信息将拍摄方向直接调整至所述第二拍摄方向。Optionally, in this embodiment, if the second shooting direction can be directly determined, then according to the second shooting direction and the current shooting direction, prompt information of angle movement is displayed, so that the user can directly change the shooting direction according to the information. Adjust to the second shooting direction.
可选地,在本实施例中,若不能直接确定所述第二拍摄方向,在以第一拍摄方向获得所述待处理图像后,可由用户根据所述待处理图像中的镜面反射区域中的图案对应的实际场景来调整方向,然后在调整后的方向下获得一图像。接着,根据新获得的图像与待处理图像的场景相似部分及场景相似度,显示角度移动提示信息。重复该调整动作,以使用户逐渐将拍摄方向调整至所述第二拍摄方向,从而获得所述场景图像。其中,当场景相似度大于所述预设相似度时,可确定该场景相似度对应的图像是在所述第二拍摄方向获得的场景图像,所述待处理图像中与该场景相似度对应的区域为所述镜面反射区域。Optionally, in this embodiment, if the second shooting direction cannot be directly determined, after obtaining the to-be-processed image in the first shooting direction, the user can be based on the specular reflection area in the to-be-processed image. Adjust the direction of the pattern corresponding to the actual scene, and then obtain an image in the adjusted direction. Then, according to the scene similarity and the scene similarity between the newly obtained image and the image to be processed, prompt information of the angle movement is displayed. This adjustment action is repeated, so that the user gradually adjusts the shooting direction to the second shooting direction, so as to obtain the scene image. Wherein, when the scene similarity is greater than the preset similarity, it can be determined that the image corresponding to the scene similarity is the scene image obtained in the second shooting direction, and the image to be processed corresponds to the scene similarity The area is the specular reflection area.
比如,若新获得的图像与所述待处理图像的场景相似度低于所述预设相似度,且该新获得的图像与所述待处理图像有一部分场景匹配,则可以确定出缺失的部分,并根据缺失的部分提示用户移动。例如,若所述待处理图像中有一部分图案与所述新获得的图像的左侧的图案相同,但目前的场景相似度低于所述预设相似度,则可以确定缺失右侧的场景,则提示用户将拍摄方向向右移动;若四周都缺失,则提示用户后退一些。当然也可以由用户确定缺失哪部分(比如,右侧场景或左侧场景),然后所述电子设备100根据用户确定的缺失部分提示用户具体的移动方式(比如,向右或向左),从而对拍摄 方向进行调整,进而将拍摄方向调整至所述第二拍摄方向,以获得所述场景图像。For example, if the scene similarity between the newly obtained image and the image to be processed is lower than the preset similarity, and the newly obtained image and the image to be processed have a partial scene match, the missing part can be determined , And prompt the user to move based on the missing part. For example, if a part of the pattern in the image to be processed is the same as the pattern on the left side of the newly acquired image, but the current scene similarity is lower than the preset similarity, it can be determined that the scene on the right side is missing. The user is prompted to move the shooting direction to the right; if the surrounding area is missing, the user is prompted to step back. Of course, the user can also determine which part is missing (for example, the right scene or the left scene), and then the electronic device 100 prompts the user with a specific movement mode (for example, to the right or to the left) according to the missing part determined by the user. The shooting direction is adjusted, and then the shooting direction is adjusted to the second shooting direction to obtain the scene image.
可选地,若调整预设次数或调整了预设角度后,仍未获得对应的场景相似度大于所述预设相似度的场景图像,则可直接随机将某次获得的图像作为所述场景图像,并确定所述待处理图像中不包括所述镜面反射区域。Optionally, if after adjusting the preset number of times or adjusting the preset angle, a scene image with a corresponding scene similarity greater than the preset similarity is still not obtained, the image obtained at a certain time may be directly used as the scene at random And determining that the specular reflection area is not included in the to-be-processed image.
可选地,在本实施例中,若不能直接确定所述第二拍摄方向,可由用户根据所述待处理图像中的镜面反射区域中的图案对应的实际场景来调整方向,然后以不同角度获得多张图像,以便将该多张图像合成一张包括完整场景的图像,即,获得包括场景图像的图像。或者,在确定出缺失的部分(比如,确定四周缺失)时,也可以显示用于提示用户根据实际场景以不同角度拍摄多张图像的提示信息,以便合成包括场景图像的图像,进而根据包括场景图像的图像及待处理图像通过场景匹配确定出所述镜面反射区域。Optionally, in this embodiment, if the second shooting direction cannot be determined directly, the user can adjust the direction according to the actual scene corresponding to the pattern in the specular reflection area in the image to be processed, and then obtain it from a different angle. Multiple images, so that the multiple images are combined into one image including the complete scene, that is, an image including the scene image is obtained. Or, when the missing part is determined (for example, it is determined that the surrounding area is missing), prompt information for prompting the user to take multiple images at different angles according to the actual scene can also be displayed, so as to synthesize the image including the scene image, and then according to the scene The image of the image and the image to be processed are matched to determine the specular reflection area.
在本实施例中的另一种实施方式中,通过机器学习对常见的存在镜面反射的物体(比如,墨镜、瞳孔等)进行模型训练,得到训练好的物体识别模型,并将该物体识别模型存储在所述电子设备100中。所述电子设备100可通过所述物体识别模型对所述待处理图像进行物体识别。若未识别出存在镜面反射的物体,则可确定所述待处理图像中不包括存在镜面反射的物体。若识别出存在镜面反射的物体,则可确定所述待处理图像中包括存在镜面反射的物体,并将该存在镜面反射的物体所在的区域作为所述镜面反射区域。In another implementation manner in this embodiment, common mirror-reflected objects (such as sunglasses, pupils, etc.) are model-trained through machine learning to obtain a trained object recognition model, and the object recognition model It is stored in the electronic device 100. The electronic device 100 can perform object recognition on the image to be processed through the object recognition model. If the specularly reflected object is not recognized, it can be determined that the to-be-processed image does not include the specularly reflected object. If an object with specular reflection is identified, it can be determined that the image to be processed includes an object with specular reflection, and the area where the object with specular reflection is located is regarded as the specular reflection area.
在本实施例的另一种实施方式中,所述电子设备100还可以接收用户输入的用于圈定区域的选择操作,并将该选择操作对应的区域作为所述镜面反射区域。In another implementation of this embodiment, the electronic device 100 may also receive a selection operation input by the user for enclosing an area, and use the area corresponding to the selection operation as the specular reflection area.
在本实施例的另一种实施方式中,所述电子设备100还可以通过以上三种检测方案中的至少两种确定出所述镜面反射区域。比如,若获得了经场景匹配或通过物体识别模型识别得到的镜面反射区域、以及用户的选择操作对应的区域,则将用户的选择操作对应的区域作为该待处理图像的镜面反射区域。In another implementation manner of this embodiment, the electronic device 100 may also determine the specular reflection area through at least two of the above three detection schemes. For example, if the specular reflection area obtained by scene matching or recognition through the object recognition model and the area corresponding to the user's selection operation are obtained, the area corresponding to the user's selection operation is taken as the specular reflection area of the image to be processed.
若先分别通过场景匹配、物体识别模型进行识别确定出镜面反射区域, 且两种方式得到的镜面反射区域不同,则可提示用户输入选择操作,并将用户的选择操作指定的区域作为所述待处理图像中的镜面反射区域。If the specular reflection area is determined by scene matching and object recognition model recognition, and the specular reflection area obtained by the two methods is different, the user can be prompted to input the selection operation, and the area specified by the user's selection operation is used as the waiting area. Process the specular reflection area in the image.
在确定出所述镜面反射区域后,可将该镜面反射区域中的图案替换为所述参考图像中的图案,从而去除所述镜面反射区域中用户不希望被显示的图案。可选地,该参考图像可以是所述场景图像,也可以是与获得所述待处理图像的目标环境完全无关的图像。After the specular reflection area is determined, the pattern in the specular reflection area may be replaced with the pattern in the reference image, so as to remove the patterns in the specular reflection area that the user does not want to be displayed. Optionally, the reference image may be the scene image, or may be an image completely unrelated to the target environment in which the image to be processed is obtained.
比如,一用户在佩戴墨镜的情况下在A、B、C、D四个标识前利用智能手机自拍,正常情况下(墨镜与标识之间无遮挡时),墨镜可反射出A、B、C、D这四个标识,由于手机的遮挡,导致墨镜上的图案为手机以及C、D两个标识,也就是说,获得的待处理图像的所述镜面反射区域中的图案为手机以及C、D两个标识。若参考图像是图案为A、B、C、D四个标识的场景图像,可按照需求比例缩小场景图像,并根据缩小后的场景图像对镜面反射区域中的图案进行全部替换,使得替换后的镜面反射区域中的图案为A、B、C、D四个标识。所述参考图像还可以是图案为山峰或大海的图像,即与A、B、C、D四个标识无关,然后根据该图像按照相同方式对镜面反射区域中的图案进行全部替换。由此,可去除所述待处理图像中的手机图案。For example, a user uses a smartphone to take a selfie in front of the four logos A, B, C, and D while wearing sunglasses. Under normal circumstances (when there is no block between the sunglasses and the logo), the sunglasses can reflect A, B, and C. Due to the occlusion of the mobile phone, the patterns on the sunglasses are the mobile phone and the two logos C and D. That is to say, the patterns in the specular reflection area of the image to be processed are the mobile phone and C, D. D two logos. If the reference image is a scene image with four logos of A, B, C, and D, the scene image can be scaled down according to the requirements, and all the patterns in the specular reflection area are replaced according to the reduced scene image, so that the replaced The patterns in the specular reflection area are four marks A, B, C, and D. The reference image can also be an image with a mountain peak or sea pattern, that is, it has nothing to do with the four marks A, B, C, and D, and then all the patterns in the specular reflection area are replaced according to the image in the same manner. Thus, the mobile phone pattern in the image to be processed can be removed.
在确定出所述镜面反射区域后,可将所述场景图像中与所述镜面反射区域场景相似的区域作为场景区域。其中,所述场景区域可以是所述场景图像,也可以是所述场景图像的一部分,根据实际情况确定。然后,将所述镜面反射区域中的图案与所述场景区域中的图案进行匹配,得到所述镜面反射区域中图案与所述场景区域的图案不同的第一区域、所述场景区域中图案与所述镜面反射区域中的图案不同的第二区域。接着将第一区域中的图案替换为所述第二区域中的图案。由此,可去除原本镜面反射区域中第一区域中的图案。After the specular reflection area is determined, an area similar to the specular reflection area in the scene image may be used as a scene area. Wherein, the scene area may be the scene image or a part of the scene image, which is determined according to actual conditions. Then, the pattern in the specular reflection area is matched with the pattern in the scene area to obtain a first area in which the pattern in the specular reflection area is different from the pattern in the scene area, the pattern in the scene area and the pattern in the scene area. The second area with a different pattern in the specular reflection area. Then replace the pattern in the first area with the pattern in the second area. In this way, the pattern in the first area in the original specular reflection area can be removed.
比如,一用户在佩戴墨镜的情况下在A、B、C、D四个标识前利用智能手机自拍,正常情况下(墨镜与标识之间无遮挡时),墨镜可反射出A、B、C、D这四个标识,由于手机的遮挡,导致墨镜上的图案为手机以及C、D两个标识,也就是说,获得的待处理图像的所述镜面反射区域中的图案为手机以及C、D两个标识。通过镜面反射区域与所述场景区域的图案匹配,可确定所述镜面反射区域中手机所在的区域为第一区域、A和B标识所在的区域 为第二区域,将第一区域中的图案替换为第二区域中的图案后,待处理图像的第一区域中的图案不是手机,而是A和B标识。For example, a user uses a smartphone to take a selfie in front of the four logos A, B, C, and D while wearing sunglasses. Under normal circumstances (when there is no block between the sunglasses and the logo), the sunglasses can reflect A, B, and C. Due to the occlusion of the mobile phone, the patterns on the sunglasses are the mobile phone and the two logos C and D. That is to say, the patterns in the specular reflection area of the image to be processed are the mobile phone and C, D. D two logos. By matching the pattern of the specular reflection area with the scene area, it can be determined that the area where the mobile phone is located in the specular reflection area is the first area, and the area where the A and B marks are located is the second area, and the pattern in the first area is replaced After being the pattern in the second area, the pattern in the first area of the image to be processed is not a mobile phone, but the A and B logos.
为了执行上述实施例及各个可能的方式中的相应步骤,下面给出一种图像处理装置200的实现方式,可选地,该图像处理装置200可以采用上述图1所示的电子设备100的器件结构。进一步地,请参阅图5,图5是本申请实施例提供的图像处理装置200的方框示意图。需要说明的是,本实施例所提供的图像处理装置200,其基本原理及产生的技术效果和上述实施例相同,为简要描述,本实施例部分未提及之处,可参考上述的实施例中相应内容。从功能上划分,该图像处理装置200包括:获得模块210、检测模块220及处理模块230。In order to perform the corresponding steps in the above-mentioned embodiment and each possible manner, an implementation manner of the image processing apparatus 200 is given below. Optionally, the image processing apparatus 200 may use the components of the electronic device 100 shown in FIG. structure. Further, please refer to FIG. 5, which is a block diagram of an image processing apparatus 200 provided by an embodiment of the present application. It should be noted that the basic principles and technical effects of the image processing device 200 provided in this embodiment are the same as those in the above embodiments. For a brief description, for parts not mentioned in this embodiment, please refer to the above embodiments. In the corresponding content. In terms of functions, the image processing device 200 includes: an obtaining module 210, a detection module 220, and a processing module 230.
所述获得模块210,用于获得待处理图像。The obtaining module 210 is used to obtain an image to be processed.
所述检测模块220,用于对所述待处理图像进行检测,确定所述待处理图像中的镜面反射区域。The detection module 220 is configured to detect the image to be processed and determine the specular reflection area in the image to be processed.
所述处理模块230,用于根据参考图像对所述镜面反射区域中的图案进行替换或修正处理,以更改所述镜面反射区域中的图案。The processing module 230 is configured to perform replacement or correction processing on the pattern in the specular reflection area according to the reference image, so as to modify the pattern in the specular reflection area.
可选地,在本实施例的实施方式中,所述待处理图像基于第一拍摄方向得到,所述检测模块220用于:获得场景图像,其中,所述场景图像在获得所述待处理图像的目标环境中以第二拍摄方向拍摄得到,所述第二拍摄方向与所述第一拍摄方向之间的关系和入射光与反射光之间的关系相同;将所述场景图像与所述待处理图像进行场景匹配;若所述待处理图像中存在与所述场景图像场景相似的区域,则将该区域作为所述镜面反射区域。Optionally, in the implementation of this embodiment, the image to be processed is obtained based on the first shooting direction, and the detection module 220 is configured to: obtain a scene image, wherein the scene image is obtained when the image to be processed is obtained. The target environment is captured in a second shooting direction, and the relationship between the second shooting direction and the first shooting direction is the same as the relationship between incident light and reflected light; The image is processed for scene matching; if there is an area similar to the scene of the scene image in the image to be processed, the area is regarded as the specular reflection area.
可选地,在本实施例的实施方式中,所述电子设备100中存储有物体识别模型,所述检测模块220用于:通过所述物体识别模型对所述待处理图像进行物体识别,以判断所述待处理图像中是否包括存在镜面反射的物体;若存在,则将存在镜面反射的物体所在的区域作为所述镜面反射区域。Optionally, in the implementation of this embodiment, an object recognition model is stored in the electronic device 100, and the detection module 220 is configured to perform object recognition on the image to be processed through the object recognition model to It is determined whether the image to be processed includes an object with specular reflection; if it exists, the area where the object with specular reflection is located is taken as the specular reflection area.
可选地,在本实施例的实施方式中,所述检测模块220用于:接收用户输入的选择操作,并将所述选择操作对应的区域作为所述镜面反射区域。Optionally, in the implementation of this embodiment, the detection module 220 is configured to receive a selection operation input by a user, and use an area corresponding to the selection operation as the specular reflection area.
可选地,在本实施例的实施方式中,所述处理模块230用于:将所述镜 面反射区域中的图案替换为所述参考图像中的图案;或者,根据所述镜面反射区域中的图案和场景区域中的图案的匹配结果,得到所述镜面反射区域中图案与所述场景区域的图案不同的第一区域、所述场景区域中图案与所述镜面反射区域中的图案不同的第二区域,并将所述第一区域中的图案替换为所述第二区域中的图案,其中,所述场景区域为场景图像与所述镜面反射区域场景相似的区域。Optionally, in the implementation of this embodiment, the processing module 230 is configured to: replace the pattern in the specular reflection area with the pattern in the reference image; or, according to the pattern in the specular reflection area The pattern and the pattern in the scene area are matched to obtain a first area where the pattern in the specular reflection area is different from the pattern in the scene area, and the second area where the pattern in the scene area is different from the pattern in the specular reflection area is obtained. Second area, and replacing the pattern in the first area with the pattern in the second area, wherein the scene area is an area where the scene image is similar to the specular reflection area.
可选地,上述模块可以软件或固件(Firmware)的形式存储于图1所示的存储器110中或固化于该电子设备100的操作系统(Operating System,OS)中,并可由图1中的处理器120执行。同时,执行上述模块所需的数据、程序的代码等可以存储在存储器110中。Optionally, the above-mentioned modules can be stored in the memory 110 shown in FIG. 1 in the form of software or firmware (Firmware) or solidified in the operating system (OS) of the electronic device 100, and can be processed by the processing shown in FIG. 1器120 executes. At the same time, data, program codes, etc. required to execute the above-mentioned modules may be stored in the memory 110.
综上所述,本申请实施例提供一种图像处理方法、装置、电子设备及可读存储介质。在获得待处理图像后,对该待处理图像进行检测,确定所述待处理图像中的镜面反射区域,然后根据参考图像对该镜面反射区域中的图案进行替换或修正处理,以更改镜面反射区域中的图案。由此,可将用户不希望出现在图像中的图案进行去除,从而提高图像质量,改善用户体验。In summary, the embodiments of the present application provide an image processing method, device, electronic device, and readable storage medium. After the image to be processed is obtained, the image to be processed is detected, the specular reflection area in the image to be processed is determined, and then the pattern in the specular reflection area is replaced or corrected according to the reference image to change the specular reflection area In the pattern. In this way, patterns that the user does not want to appear in the image can be removed, thereby improving image quality and improving user experience.
在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,也可以通过其它的方式实现。以上所描述的装置实施例仅仅是示意性的,例如,附图中的流程图和框图显示了根据本申请的多个实施例的装置、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段或代码的一部分,所述模块、程序段或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现方式中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个连续的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或动作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。In the several embodiments provided in this application, it should be understood that the disclosed device and method may also be implemented in other ways. The device embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings show the possible implementation architectures, functions, and functions of the devices, methods, and computer program products according to multiple embodiments of the present application. operating. In this regard, each block in the flowchart or block diagram may represent a module, program segment, or part of the code, and the module, program segment, or part of the code contains one or more functions for realizing the specified logic function. Executable instructions. It should also be noted that in some alternative implementations, the functions marked in the block may also occur in a different order from the order marked in the drawings. For example, two consecutive blocks can actually be executed substantially in parallel, or they can sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and/or flowchart, and the combination of the blocks in the block diagram and/or flowchart, can be implemented by a dedicated hardware-based system that performs the specified functions or actions Or it can be realized by a combination of dedicated hardware and computer instructions.
另外,在本申请各个实施例中的各功能模块可以集成在一起形成一个独立的部分,也可以是各个模块单独存在,也可以两个或两个以上模块集成形 成一个独立的部分。In addition, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist alone, or two or more modules may be integrated to form an independent part.
所述功能如果以软件功能模块的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。If the function is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on this understanding, the technical solution of the present application essentially or the part that contributes to the existing technology or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including Several instructions are used to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disks or optical disks and other media that can store program codes. .
以上所述仅为本申请的优选实施例而已,并不用于限制本申请,对于本领域的技术人员来说,本申请可以有各种更改和变化。凡在本申请的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。The above descriptions are only preferred embodiments of the application, and are not intended to limit the application. For those skilled in the art, the application can have various modifications and changes. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this application shall be included in the protection scope of this application.

Claims (14)

  1. 一种图像处理方法,其特征在于,应用于电子设备,所述方法包括:An image processing method, characterized in that it is applied to an electronic device, and the method includes:
    获得待处理图像;Obtain the image to be processed;
    对所述待处理图像进行检测,确定所述待处理图像中的镜面反射区域;Detecting the image to be processed, and determining the specular reflection area in the image to be processed;
    根据参考图像对所述镜面反射区域中的图案进行替换或修正处理,以更改所述镜面反射区域中的图案。The pattern in the specular reflection area is replaced or corrected according to the reference image to modify the pattern in the specular reflection area.
  2. 根据权利要求1所述的方法,其特征在于,所述待处理图像基于第一拍摄方向得到,所述对所述待处理图像进行检测,确定所述待处理图像中的镜面反射区域,包括:The method according to claim 1, wherein the image to be processed is obtained based on a first shooting direction, and the detecting the image to be processed to determine the specular reflection area in the image to be processed comprises:
    获得场景图像,其中,所述场景图像在获得所述待处理图像的目标环境中以第二拍摄方向拍摄得到,所述第二拍摄方向与所述第一拍摄方向之间的关系和入射光与反射光之间的关系相同;A scene image is obtained, wherein the scene image is obtained by shooting in a second shooting direction in the target environment where the image to be processed is obtained, and the relationship between the second shooting direction and the first shooting direction and the incident light The relationship between reflected light is the same;
    将所述场景图像与所述待处理图像进行场景匹配;Performing scene matching between the scene image and the image to be processed;
    若所述待处理图像中存在与所述场景图像场景相似的区域,则将该区域作为所述镜面反射区域。If there is an area similar to the scene of the scene image in the image to be processed, the area is regarded as the specular reflection area.
  3. 根据权利要求2所述的方法,其特征在于,所述电子设备包括拍摄方向相反的第一摄像头及第二摄像头,所述获得场景图像,包括:The method according to claim 2, wherein the electronic device comprises a first camera and a second camera with opposite shooting directions, and said obtaining a scene image comprises:
    在通过所述第一摄像头获得所述待处理图像的情况下,调整所述第二摄像头的拍摄方向,以及通过调整后的所述第二摄像头获得所述场景图像。In the case where the image to be processed is obtained through the first camera, the shooting direction of the second camera is adjusted, and the scene image is obtained through the adjusted second camera.
  4. 根据权利要求2所述的方法,其特征在于,所述电子设备中存储有物体识别模型,所述对所述待处理图像进行检测,确定所述待处理图像中的镜面反射区域,包括:The method according to claim 2, wherein the object recognition model is stored in the electronic device, and the detecting the to-be-processed image to determine the specular reflection area in the to-be-processed image comprises:
    将所述场景图像与所述待处理图像进行场景匹配,得到场景相似度;Performing scene matching between the scene image and the image to be processed to obtain scene similarity;
    若所述场景相似度大于预设相似度,则将所述待处理图像中与所述场景图像相似的区域作为所述镜面反射区域。If the scene similarity is greater than the preset similarity, an area similar to the scene image in the to-be-processed image is used as the specular reflection area.
  5. 根据权利要求1所述的方法,其特征在于,所述电子设备中存储有物体识别模型,所述对所述待处理图像进行检测,确定所述待处理图像中的镜面反射区域,包括:The method according to claim 1, wherein the object recognition model is stored in the electronic device, and the detecting the image to be processed to determine the specular reflection area in the image to be processed comprises:
    通过所述物体识别模型对所述待处理图像进行物体识别,以判断所述待处理图像中是否包括存在镜面反射的物体;Performing object recognition on the image to be processed by using the object recognition model to determine whether the image to be processed includes an object with specular reflection;
    若存在,则将存在镜面反射的物体所在的区域作为所述镜面反射区域。If it exists, the area where the object with specular reflection is located is taken as the specular reflection area.
  6. 根据权利要求1所述的方法,其特征在于,所述对所述待处理图像进行检测,确定所述待处理图像中的镜面反射区域,包括:The method according to claim 1, wherein the detecting the image to be processed and determining the specular reflection area in the image to be processed comprises:
    接收用户输入的选择操作,并将所述选择操作对应的区域作为所述镜面反射区域。The selection operation input by the user is received, and the area corresponding to the selection operation is used as the specular reflection area.
  7. 根据权利要求1-6中任意一项所述的方法,其特征在于,所述根据参考图像对所述镜面反射区域中的图案进行替换或修正处理,以更改所述镜面反射区域中的图案,包括:The method according to any one of claims 1 to 6, wherein the pattern in the specular reflection area is replaced or corrected according to a reference image to change the pattern in the specular reflection area, include:
    将所述镜面反射区域中的图案替换为所述参考图像中的图案;或者,Replace the pattern in the specular reflection area with the pattern in the reference image; or,
    根据所述镜面反射区域中的图案和场景区域中的图案的匹配结果,得到所述镜面反射区域中图案与所述场景区域的图案不同的第一区域、所述场景区域中图案与所述镜面反射区域中的图案不同的第二区域,并将所述第一区域中的图案替换为所述第二区域中的图案,其中,所述场景区域为场景图像与所述镜面反射区域场景相似的区域,所述待处理图像基于第一拍摄方向得到,所述场景图像在获得所述待处理图像的目标环境中以第二拍摄方向拍摄得到,所述第二拍摄方向与所述第一拍摄方向之间的关系和入射光与反射光之间的关系相同。According to the matching result of the pattern in the specular reflection area and the pattern in the scene area, a first area in which the pattern in the specular reflection area is different from the pattern in the scene area, the pattern in the scene area and the mirror surface are obtained. Reflect a second area with a different pattern in the reflection area, and replace the pattern in the first area with the pattern in the second area, wherein the scene area is a scene image of a scene similar to that of the specular reflection area Area, the image to be processed is obtained based on a first shooting direction, the scene image is shot in a second shooting direction in the target environment where the image to be processed is obtained, and the second shooting direction is the same as the first shooting direction The relationship between is the same as that between incident light and reflected light.
  8. 一种图像处理装置,其特征在于,应用于电子设备,所述装置包括:An image processing device, characterized in that it is applied to electronic equipment, and the device includes:
    获得模块,用于获得待处理图像;The obtaining module is used to obtain the image to be processed;
    检测模块,用于对所述待处理图像进行检测,确定所述待处理图像中的镜面反射区域;The detection module is used to detect the image to be processed and determine the specular reflection area in the image to be processed;
    处理模块,用于根据参考图像对所述镜面反射区域中的图案进行替换或修正处理,以更改所述镜面反射区域中的图案。The processing module is used for replacing or correcting the pattern in the specular reflection area according to the reference image, so as to change the pattern in the specular reflection area.
  9. 根据权利要求8所述的装置,其特征在于,所述待处理图像基于第一拍摄方向得到,所述检测模块用于:The device according to claim 8, wherein the image to be processed is obtained based on a first shooting direction, and the detection module is configured to:
    获得场景图像,其中,所述场景图像在获得所述待处理图像的目标环境中以第二拍摄方向拍摄得到,所述第二拍摄方向与所述第一拍摄方向之间的关系和入射光与反射光之间的关系相同;A scene image is obtained, wherein the scene image is obtained by shooting in a second shooting direction in the target environment where the image to be processed is obtained, and the relationship between the second shooting direction and the first shooting direction and the incident light The relationship between reflected light is the same;
    将所述场景图像与所述待处理图像进行场景匹配;Performing scene matching between the scene image and the image to be processed;
    若所述待处理图像中存在与所述场景图像场景相似的区域,则将该区域作为所述镜面反射区域。If there is an area similar to the scene of the scene image in the image to be processed, the area is regarded as the specular reflection area.
  10. 根据权利要求8所述的装置,其特征在于,所述电子设备中存储有物体识别模型,所述检测模块用于:The apparatus according to claim 8, wherein the electronic device stores an object recognition model, and the detection module is used for:
    通过所述物体识别模型对所述待处理图像进行物体识别,以判断所述待处理图像中是否包括存在镜面反射的物体;Performing object recognition on the image to be processed by using the object recognition model to determine whether the image to be processed includes an object with specular reflection;
    若存在,则将存在镜面反射的物体所在的区域作为所述镜面反射区域。If it exists, the area where the object with specular reflection is located is taken as the specular reflection area.
  11. 根据权利要求8所述的装置,其特征在于,所述检测模块用于:The device according to claim 8, wherein the detection module is used for:
    接收用户输入的选择操作,并将所述选择操作对应的区域作为所述镜面反射区域。The selection operation input by the user is received, and the area corresponding to the selection operation is used as the specular reflection area.
  12. 根据权利要求8-11中任意一项所述的装置,其特征在于,所述处理模块具体:The device according to any one of claims 8-11, wherein the processing module is specifically:
    将所述镜面反射区域中的图案替换为所述参考图像中的图案;或者,Replace the pattern in the specular reflection area with the pattern in the reference image; or,
    根据所述镜面反射区域中的图案和场景区域中的图案的匹配结果,得到所述镜面反射区域中图案与所述场景区域的图案不同的第一区域、所述场景区域中图案与所述镜面反射区域中的图案不同的第二区域,并将所述第一区域中的图案替换为所述第二区域中的图案,其中,所述场景区域为场景图像与所述镜面反射区域场景相似的区域,所述待处理图像基于第一拍摄方向得到,所述场景图像在获得所述待处理图像的目标环境中以第二拍摄方向拍摄得到,所述第二拍摄方向与所述第一拍摄方向之间的关系和入射光与反射光 之间的关系相同。According to the matching result of the pattern in the specular reflection area and the pattern in the scene area, a first area in which the pattern in the specular reflection area is different from the pattern in the scene area, the pattern in the scene area and the mirror surface are obtained. Reflect a second area with a different pattern in the reflection area, and replace the pattern in the first area with the pattern in the second area, wherein the scene area is a scene image of a scene similar to that of the specular reflection area Region, the image to be processed is obtained based on a first shooting direction, the scene image is shot in a second shooting direction in the target environment where the image to be processed is obtained, and the second shooting direction is the same as the first shooting direction The relationship between is the same as that between incident light and reflected light.
  13. 一种电子设备,其特征在于,包括处理器和存储器,所述存储器存储有能够被所述处理器执行的机器可执行指令,所述处理器可执行所述机器可执行指令以实现权利要求1-7中任一项所述的图像处理方法。An electronic device, comprising a processor and a memory, the memory storing machine executable instructions that can be executed by the processor, and the processor can execute the machine executable instructions to implement claim 1 -7 The image processing method described in any one.
  14. 一种可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1-7中任一项所述的图像处理方法。A readable storage medium with a computer program stored thereon, wherein the computer program implements the image processing method according to any one of claims 1-7 when the computer program is executed by a processor.
PCT/CN2020/139403 2019-12-26 2020-12-25 Image processing method, apparatus, electronic device, and readable storage medium WO2021129806A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201911363993.8A CN113055579B (en) 2019-12-26 2019-12-26 Image processing method and device, electronic equipment and readable storage medium
CN201911363993.8 2019-12-26

Publications (1)

Publication Number Publication Date
WO2021129806A1 true WO2021129806A1 (en) 2021-07-01

Family

ID=76505881

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/139403 WO2021129806A1 (en) 2019-12-26 2020-12-25 Image processing method, apparatus, electronic device, and readable storage medium

Country Status (2)

Country Link
CN (1) CN113055579B (en)
WO (1) WO2021129806A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114125276A (en) * 2021-11-11 2022-03-01 广东维沃软件技术有限公司 Image processing method and device

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 (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101147157A (en) * 2005-01-26 2008-03-19 数字逻辑扫描公司 Data reader and methods for imaging targets subject to specular reflection
KR20090093223A (en) * 2008-02-29 2009-09-02 홍익대학교 산학협력단 Removal Eye Glasses using Variable Mask and Inpainting for Improved Performance of Face Recognition System
CN105046250A (en) * 2015-09-06 2015-11-11 广州广电运通金融电子股份有限公司 Glasses elimination method for face recognition
CN108564540A (en) * 2018-03-05 2018-09-21 广东欧珀移动通信有限公司 Remove image processing method, device and the terminal device that eyeglass is reflective in image

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101147157A (en) * 2005-01-26 2008-03-19 数字逻辑扫描公司 Data reader and methods for imaging targets subject to specular reflection
KR20090093223A (en) * 2008-02-29 2009-09-02 홍익대학교 산학협력단 Removal Eye Glasses using Variable Mask and Inpainting for Improved Performance of Face Recognition System
CN105046250A (en) * 2015-09-06 2015-11-11 广州广电运通金融电子股份有限公司 Glasses elimination method for face recognition
CN108564540A (en) * 2018-03-05 2018-09-21 广东欧珀移动通信有限公司 Remove image processing method, device and the terminal device that eyeglass is reflective in image

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114125276A (en) * 2021-11-11 2022-03-01 广东维沃软件技术有限公司 Image processing method and device

Also Published As

Publication number Publication date
CN113055579A (en) 2021-06-29
CN113055579B (en) 2022-02-01

Similar Documents

Publication Publication Date Title
CN106133649B (en) It is tracked using the eye gaze that binocular gaze constrains
TWI808987B (en) Apparatus and method of five dimensional (5d) video stabilization with camera and gyroscope fusion
US10284817B2 (en) Device for and method of corneal imaging
US10237473B2 (en) Depth map calculation in a stereo camera system
WO2021129806A1 (en) Image processing method, apparatus, electronic device, and readable storage medium
US10021381B2 (en) Camera pose estimation
CN108765340B (en) Blurred image processing method and device and terminal equipment
US11048913B2 (en) Focusing method, device and computer apparatus for realizing clear human face
CN110785996B (en) Dynamic control of camera resources in a device with multiple displays
US20180077359A1 (en) Image processing method and apparatus and terminal device
WO2016197657A1 (en) Photographing processing method and apparatus
US10652474B2 (en) Method for adjusting an angle of an element of a photographing unit and a head mounted display
WO2022111461A1 (en) Recognition method and apparatus, and electronic device
WO2019080061A1 (en) Camera device-based occlusion detection and repair device, and occlusion detection and repair method therefor
US8064655B2 (en) Face image detection device, face image detection method and imaging apparatus
KR102021363B1 (en) Curved display apparatus and operation method thereof
JP2010134489A (en) Visual line detection device and method, and program
CN116940917A (en) Reducing light leakage via external gaze detection
JP2005346012A (en) Display device, display method, and program
WO2020255766A1 (en) Information processing device, information processing method, program, projection device, and information processing system
CN105681592A (en) Imaging device, imaging method and electronic device
CN111371992A (en) Image capturing quality control method, system, device, and storage medium
KR101995985B1 (en) Method and Apparatus for Providing Eye-contact Function to Multiple Points of Presence using Stereo Image in Video Conference System
CN113168004B (en) Calibration of mobile electronic devices connected to user-wearable headsets
JP2006024141A (en) Image processor and image processing method and program

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: 20905321

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 02/11/2022)

122 Ep: pct application non-entry in european phase

Ref document number: 20905321

Country of ref document: EP

Kind code of ref document: A1