Image processing method and apparatus

By constructing a mask image and correcting the brightness values, the problem of white and black border defects in the enhanced image was solved, thus improving the user experience without reducing clarity.

CN114119390BActive Publication Date: 2026-02-06VIVO MOBILE COMM CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111251144.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-26
Publication Date
2026-02-06
Estimated Expiration
2042-02-06

AI Technical Summary

Technical Problem

Existing technologies often leave white or black borders in the enhanced image after enhancing the original image, which affects the user's visual experience. Furthermore, reducing the enhancement parameters to avoid these flaws can lead to a decrease in clarity and a poor user experience.

Method used

By acquiring the brightness difference map between the original image and the enhanced image, a mask image is constructed to filter out defective pixels. The brightness value is then corrected using a preset formula to generate a target image with the defects removed, while maintaining image clarity.

Benefits of technology

It quickly and efficiently removes imperfections from enhanced images, ensuring that the user's visual experience is not affected and maintaining image clarity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114119390B_ABST
    Figure CN114119390B_ABST
Patent Text Reader

Abstract

The application discloses an image processing method and device, and belongs to the technical field of image processing. The method comprises the following steps: acquiring a first image and obtaining a second image according to the first image, wherein the second image is an image with defects obtained after the first image is subjected to preset image enhancement processing; obtaining a mask image according to a brightness difference value image of the first image and the second image, wherein the mask image is used for screening pixels with defects in the second image; and generating a target image according to the mask image, the first image and the second image, wherein the target image is an image with the defects in the second image removed.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the technical field of image processing, and more particularly, relates to an image processing method and device. BACKGROUND

[0002] At present, in order to improve user experience, after an original image is captured by an electronic device, for example, a mobile phone, the original image can be automatically enhanced to generate an enhanced image with better visual perception.

[0003] However, the enhanced image obtained after the original image is enhanced often has defects, which also affects the user's visual perception. For example, after the original image is sharpened, although a high-definition enhanced image can be obtained, the enhanced image may have white edge defects and / or black edge defects, that is, the texture edge region of the image may be too bright or too dark.

[0004] In order to solve the defects in the enhanced image, the related art generally reduces the parameters related to the enhancement to avoid defects in the enhanced image. However, the enhanced image obtained by this method often has the problem of poor user visual perception. SUMMARY

[0005] The purpose of the embodiments of the present application is to provide an image processing method and device that can efficiently generate a target image without reducing user visual perception.

[0006] To solve the above technical problems, the present application is implemented as follows:

[0007] In a first aspect, the embodiments of the present application provide an image processing method, which comprises:

[0008] obtaining a first image and a second image according to the first image, wherein the second image is an image with defects obtained by performing a preset image enhancement on the first image;

[0009] obtaining a mask image according to a brightness difference image of the first image and the second image, wherein the mask image is used to screen pixels with defects in the second image;

[0010] generating a target image according to the mask image, the first image and the second image, wherein the target image is an image without the defects in the second image.

[0011] In a second aspect, the embodiments of the present application provide an image processing device, which comprises:

[0012] obtain a first image and obtain a second image according to the first image, wherein the second image is an image with defects obtained after the first image is subjected to a preset image enhancement processing;

[0013] obtain a mask image according to a luminance difference value image of the first image and the second image, wherein the mask image is used to screen pixels with the defects in the second image;

[0014] generate a target image according to the mask image, the first image and the second image, wherein the target image is an image without the defects in the second image.

[0015] In a third aspect, an electronic device is provided, which includes a processor, a memory, and a program or instructions stored in the memory and executable on the processor, and the program or instructions, when executed by the processor, implement the steps of the method according to the first aspect.

[0016] In a fourth aspect, a readable storage medium is provided, which stores a program or instructions, and the program or instructions, when executed by a processor, implement the steps of the method according to the first aspect.

[0017] In a fifth aspect, a chip is provided, which includes a processor and a communication interface, the communication interface is coupled to the processor, and the processor is configured to execute a program or instructions to implement the method according to the first aspect.

[0018] In the embodiments of the present application, for the original first image and the second image with defects obtained after the first image is subjected to a preset image enhancement processing, a mask image used to screen pixels with defects in the second image is obtained according to a luminance difference value image of the first image and the second image, and then the defects in the second image can be quickly and efficiently removed on the premise of maintaining the image definition according to the mask image and the first image, so as to generate a target image with better visual perception of users. BRIEF DESCRIPTION OF DRAWINGS

[0019] The accompanying drawings incorporated in and forming a part of the specification illustrate embodiments of the present application and, together with the description, serve to explain the principles of the application.

[0020] Figure 1 is a step flowchart of an image processing method provided by the present embodiment;

[0021] Figure 2a is a schematic diagram of the first image provided by the present embodiment;

[0022] Figure 2b is a schematic diagram of a second image provided by the embodiment;

[0023] Figure 2c is a schematic diagram of a target image provided by the embodiment;

[0024] Figure 3 is a structural schematic diagram of an image processing apparatus provided by the embodiment;

[0025] Figure 4 is a structural schematic diagram of an electronic device provided by the embodiment;

[0026] Figure 5 is a hardware structural schematic diagram of another electronic device provided by the embodiment. DETAILED DESCRIPTION

[0027] The technical solutions in the embodiments of the present application will be clearly described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some, but not all of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art belong to the scope of protection of the present application.

[0028] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally of a kind and do not limit the number of objects, for example, the first object can be one or more. In addition, "and / or" in the specification and claims indicates at least one of the connected objects, and the character " / ", generally indicates that the objects before and after are in a "or" relationship.

[0029] The image processing method provided by the embodiments of the present application will be described in detail below with reference to the drawings, specific embodiments and application scenarios.

[0030] Please refer to Figure 1 , which is a flowchart of an image processing method provided by the embodiments of the present application. The method can be applied in an electronic device, which can be a mobile phone, a tablet computer, a notebook computer, etc. As Figure 1 shown, the method can include steps S1100-S1300, which will be described in detail below.

[0031] S1100, a first image is obtained and a second image is obtained according to the first image, wherein the second image is an image with defects obtained after a preset image enhancement processing is performed on the first image.

[0032] The first image is an original image without any processing. The first image can be a static or dynamic image, or a video frame in a video.

[0033] The second image is an image with defects obtained by performing a preset image enhancement processing on the first image.

[0034] It should be noted that the preset image enhancement processing can be image sharpening processing, or image reconstruction processing, etc.

[0035] In the embodiments of the present disclosure, the preset image enhancement processing is taken as image sharpening processing for example without special instructions. In one embodiment, the image sharpening processing can be processing based on differential method, high-frequency emphasis filtering method, etc. For example, the differential method can be gradient method, Sobel operator method, Laplace operator method, etc. Since the prior art has detailed description on how to perform image sharpening processing, no further description is given here.

[0036] It should be further noted that the defects in the second image can be at least one of black edge defects and white edge defects. The black edge defect refers to an area where the texture edge on the dark side of the image is abnormally darkened. The white edge defect refers to an area where the texture edge on the bright side of the image is abnormally brightened. The white edge defect or the black edge defect is generally caused by over-enhancement of strong texture when performing image enhancement processing, such as image sharpening processing.

[0037] In addition, in the present embodiment, the initial image format of the first image and the second image is taken as RGB format for example without special instructions.

[0038] Specifically, in the field of image processing, the color of a pixel in an image can be described using RGB (Red, Green, Blue) color model. In the RGB color model, R (Red) represents red, G (Green) represents green, and B (Blue) represents blue. The image format of an image whose pixel color is described using RGB color model can be simply referred to as RGB format. In addition, the color of a pixel in an image can also be described using YUV color model. In the YUV color model, Y represents brightness, i.e. the brightness of a pixel; U and V represent the chroma of a pixel, which are used to specify the color of a pixel. In specific implementation, the image can be converted between RGB format and YUV format through a preset formula, and the specific conversion method is not described here.

[0039] After obtaining the first image and the second image in S1100, S1200 is performed to obtain a mask image according to a brightness difference map of the first image and the second image, where the mask image is used to screen pixels with the defect in the second image.

[0040] Please refer to Figure 2a and Figure 2b which are schematic diagrams of the first image and the second image provided by the embodiment, as Figure 2a shown in the oval frame, the original first image without processing has the problems of image blur and unclear texture details; and after image sharpening processing, as Figure 2b shown in the oval frame in FIG. 2, the image sharpness is improved, but the texture edges of the image have obvious black edge defects and white edge defects. Figure 2b

[0041] In the related art, in order to remove the defects in the enhanced image, that is, the second image in the embodiment of the present disclosure, the image enhancement processing related parameters are usually reduced to remove the defects in the image by sacrificing the user visual experience, which has the problem of poor user experience.

[0042] For example, when the first image is subjected to image sharpening processing, in order to remove the white edge or black edge defects in the second image, the sharpening parameter of the image sharpening processing can be reduced to obtain a second image without defects or with unobvious defects. Although the second image obtained in this way does not have defects, its sharpness will decrease, which may affect the user's visual experience.

[0043] Of course, in order to not affect the user's visual experience, the defect area in the first image can be detected first, and the second image without defects can be obtained by reducing the parameter coefficient, but this method involves complex defect detection processing, and has the problems of high computational complexity and low timeliness.

[0044] To solve the above problems, so that the electronic device can conveniently and efficiently obtain a target image without affecting the user's visual experience. In the embodiment of the present disclosure, for the first image and the second image, the electronic device can not need to reduce the related parameters of the image enhancement processing, nor need to detect the defect area in the first image, but use the first image and the second image as input, construct a mask image for screening pixels with defects in the second image, and use a preset defect removal formula based on the mask image to obtain a target image. The following will explain in detail how to construct the mask image.

[0045] ​In one embodiment, the obtaining the mask image according to the luminance difference image of the first image and the second image comprises: obtaining an initial image format of the first image and the second image; in a case where the initial image format is a non-YUV format, performing YUV format conversion processing on the first image and the second image respectively to obtain a converted first image and a converted second image; and obtaining the mask image according to a luminance difference image of the converted first image and the converted second image.

[0046] Specifically, since it is not convenient to obtain the luminance of pixels from an image in RGB format or other image formats, in order to facilitate processing, in the embodiments of the present disclosure, YUV format conversion processing is first performed on the first image and the second image in a non-YUV format, so as to use the Y channel, i.e. the luminance channel, of the converted first image and the converted second image to conveniently obtain the first luminance image and the second luminance image corresponding to the first image and the second image respectively.

[0047] For the convenience of description, in the embodiments of the present disclosure, I ori represents the first image, i.e. the original image, I shp represents the second image, i.e. the image with defects obtained after a preset image enhancement processing; and correspondingly, Y ori represents the first luminance image, Y shp represents the second luminance image, UV ori represents the first chrominance image corresponding to the first image, and UV shp represents the second chrominance image corresponding to the second image.

[0048] After the first luminance image and the second luminance image are obtained, the mask image can be constructed according to a luminance difference image constituted by the difference between the first luminance image and the second luminance image.

[0049] In one embodiment, the obtaining the mask image according to the luminance difference image of the first image and the second image comprises: obtaining a first luminance image corresponding to the first image, and obtaining a second luminance image corresponding to the second image; obtaining a luminance difference image by calculating the difference between the second luminance image and the first luminance image; setting the value of a pixel in the luminance difference image whose value is greater than a preset threshold value to a first preset value, and setting the value of a pixel in the luminance difference image whose value is not greater than the preset threshold value to a second preset value, to obtain the mask image.

[0050] In the following description, unless otherwise specified, the preset threshold value is 0, the first preset value can be 1, and the second preset value can be 0, which are used as examples. Of course, the values of the preset threshold value, the first preset value and the second preset value can also be set as needed, which are not specially limited here.

[0051] Specifically, after converting the first image into YUV format, the pixel value in the Y channel of the first image is the brightness value of each pixel in the first image; the pixel value in the Y channel of the second image is the brightness value of each pixel in the second image; and Y shp Subtract Y ori The obtained brightness difference graph D ori , which can be used to represent the enhanced image information after the above-mentioned preset image enhancement processing, for example, image sharpening processing. The brightness difference graph includes not only the effective information enhanced for the weak texture, i.e., the blurred area of the first image, but also the defects such as black edge defects and white edge defects that cause discomfort to the user's vision.

[0052] Since the white edge defect in the image is the area where the gray value on the bright side of the image texture edge abnormally increases, and the area where all image gray values decrease or remain unchanged will not have a white edge, in the obtained brightness difference graph D ori , the pixel values greater than 0 can be set to 1 to identify that the pixel has a white edge defect and needs to be removed. ori

[0053] Since the black edge defect is the area where the gray value on the dark side of the image texture edge abnormally decreases, and the area where all gray values increase will not have a black edge, in the obtained brightness difference graph D ori , the pixel values not greater than 0 can be set to 0 to identify that the pixel has a black edge defect and needs to be removed. ori

[0054] According to the above setting of the value in the brightness difference graph D ori , a mask image for screening the pixels with defects, for example, black edge defects and white edge defects, from the first image and the second image can be obtained. It should be noted that in specific implementation, the mask image can also be designed in a similar manner as described above for other defects other than black edge defects and white edge defects, which will not be described here.

[0055] After S1200, S1300 is performed to generate a target image according to the mask image, the first image, and the second image, wherein the target image is an image in which the defects in the second image are removed.

[0056] ​​In one embodiment, the generating the target image according to the mask image, the first image and the second image comprises: screening the first image according to the mask image to obtain an initial first pixel, and screening the second image to obtain a second pixel corresponding to the first pixel and having a flaw; obtaining a correction value according to a first luminance value of the first pixel and a second luminance value of the second pixel, wherein the correction value is used to remove the flaw of the second pixel; obtaining a target pixel after removing the flaw according to the first luminance value and the correction value; and generating the target image according to the target pixel and a third pixel in the second image and not having the flaw.

[0057] Specifically, according to the mask image obtained in S1200, the pixels having the flaw, for example, white edge flaw or black edge flaw, can be screened from the first image and the second image. The original pixel luminance value of the pixel in the first image, that is, the first luminance value Y ori , and the enhanced pixel luminance value in the second image, that is, the second luminance value Y shp , are corrected by using the preset white edge removal formula or the preset black edge removal formula, so that the flaw in the pixel is removed, and the pixel after removing the flaw is restored to the second image, thereby quickly and efficiently generating the target image which does not affect the visual perception of the user.

[0058] Specifically, Y opt represents the luminance value of the target pixel after removing the flaw, Y opt can be calculated using the following formula: opt Y ori =Y ori +correction value.

[0059] As known from the above description, the white edge flaw is caused by the abnormal increase of the pixel luminance, and the black edge flaw is caused by the abnormal decrease of the pixel luminance. Therefore, the difference between the luminance values of the corresponding first pixel and second pixel can be reduced or increased by calculating the correction value on the basis of the first luminance value Y ori , so that the white edge flaw or the black edge flaw is removed.

[0060] In one embodiment, the obtaining the correction value according to the first luminance value of the first pixel and the second luminance value of the second pixel comprises: calculating the difference between the second luminance value and the first luminance value; obtaining a correction weight according to the second luminance value and the first luminance value; and taking the product of the difference and the correction weight as the correction value.

[0061] That is, the correction value=(Y shp -Y ori ) * correction weight.

[0062] Therefore, by quickly and accurately calculating the correction weight, the pixels with defects in the second image can be removed to obtain the target image.

[0063] In one embodiment, the obtaining the correction weight according to the second luminance value and the first luminance value comprises: determining a defect type of the defect existing in the second pixel according to the value corresponding to the second pixel in the mask image; and obtaining the correction weight according to the defect type, the second luminance value and the first luminance value.

[0064] Specifically, the calculation method of the correction weight for removing the defect existing in the second pixel is different according to the defect type of the defect existing in the second pixel, and therefore, the defect type of the defect existing in the second pixel can be obtained first, and then the correction weight for removing the defect existing in the second pixel can be calculated according to the defect type. The determination of the defect type of the defect existing in the second pixel and the calculation of the correction weight under different defect types are described below.

[0065] In one embodiment, the determining the defect type of the defect existing in the second pixel according to the value corresponding to the second pixel in the mask image comprises: determining that the defect type is a white edge defect when the value is the first preset value; and determining that the defect type is a black edge defect when the value is the second preset threshold value.

[0066] Since the mask image is obtained by processing the luminance difference image of the first image and the second image, and the value of the pixel in the mask image can represent whether the pixel at the corresponding position in the second image is subjected to the over-enhancement processing and thus has the defect, after the first pixel and the second pixel are obtained from the first image and the second image according to the mask image, the defect type of the defect existing in the second pixel can be determined according to the value corresponding to the second pixel in the mask image.

[0067] For example, when the second pixel is the pixel at the position (20, 30) in the second image, if the value of the pixel at the position (20, 30) in the mask image is the first preset threshold value, for example, 1, it can be determined that the defect type of the defect existing in the second pixel is a white edge defect.

[0068] In one embodiment, the obtaining the correction weight according to the defect type, the second luminance value and the first luminance value comprises: calculating a first ratio of the product of the second luminance value and the first luminance value and a third preset value when the defect type is a white edge defect; and obtaining the correction weight according to the first ratio.

[0069] Since the value range of the pixel brightness value in the YUV format is 0-255, the correction weight can be calculated by using the following formula when removing the white edge defect existing in the second image:

[0070] Correction weight = (1-(Y shp *Y ori ) / 255*255) λ ;

[0071] That is, the initial value of the correction weight is set to 1, and after obtaining the first ratio, the correction weight can be obtained by adaptively adjusting the difference between the initial value and the first ratio using the coefficient λ. It should be noted that in specific implementation, the initial value of the coefficient λ can be 1, and the value range thereof is between 0 and 1. The value of the coefficient λ can be set according to the characteristics of the image, which is not specially limited here.

[0072] Since the brightness value of the pixel with the white edge defect existing in the second image is usually abnormally large, the correction weight obtained by the above calculation will be a decimal between 0 and 1. After reducing the difference between the original first pixel and the enhanced second pixel by the correction weight, the white edge defect existing in the second pixel can be quickly reduced or even removed.

[0073] The above describes in detail how to calculate the corresponding correction weight when the defect existing in the second image is a white edge defect. The following describes how to calculate the correction weight for removing the black edge defect existing in the second image.

[0074] In an embodiment, the correction weight is obtained according to the defect type, the second brightness value and the first brightness value, including: in the case that the defect type is a black edge defect, calculating a second ratio of the second brightness value to the first brightness value; and obtaining the correction weight according to the second ratio.

[0075] Specifically, the calculation method of the correction weight can be represented by using the following formula:

[0076] Correction weight = (Y shp / Y ori ) θ ;

[0077] Wherein, θ is a coefficient for adaptively adjusting the second ratio, the initial value of which can be 1, and the value range thereof is between 0 and 1. The value of the coefficient θ can be set according to the characteristics of the image, which is not specially limited here.

[0078] Since the luminance value of the pixel with black border defect in the second image is usually abnormally small, the correction weight obtained by the above calculation will be a small number between 0 and 1. After the luminance difference between the original first pixel and the enhanced second pixel is amplified by the correction weight, the black border defect of the second pixel can be quickly reduced or even removed.

[0079] According to the above description, the luminance value of the target pixel after removing the defect can be represented as Y opt In the embodiment of the present disclosure, the formula for removing the white border defect in the second image can be represented as Y opt = Y opt + (Y ori -Y shp )*(1-(Y ori *Y shp ) / 255*255) ori λ ; and the formula for removing the black border defect in the second image can be represented as Y opt = Y ori + (Y shp -Y ori )*(Y shp / Y ori ) θ .

[0080] In specific implementation, at least one of the above formulas can be used to quickly and accurately remove the white border defect and / or the black border defect that may exist in the second image, so as to obtain a target image that does not affect the visual perception of the user.

[0081] Specifically, after Y opt is calculated by using at least one of the above formulas, the YUV format target image can be generated by combining the color difference value UV shp of the pixel in the second image.

[0082] In one embodiment, when the initial image format of the second image is a non-YUV format, for example, an RGB format, the YUV format target image obtained by the above processing can also be converted into the initial image format, for example, an RGB format.

[0083] Please refer to Figure 2c , which is a schematic diagram of the target image provided by the embodiment. As shown in the block in Figure 2c , according to the image processing method provided by the embodiment of the present disclosure, compared with the second image shown in Figure 2b , the target image not only does not lose the image clarity, but also significantly removes the black border defect and the white border defect in the image.

[0084] ​It should be noted that the image processing method provided in the embodiments of the present application can be executed by an image processing device, or a control module in the image processing device for executing the image processing method. The image processing device executes the image processing method in the embodiments of the present application as an example to illustrate the image processing method provided in the embodiments of the present application.

[0085] Corresponding to the above embodiments, referring to Figure 3 The embodiments of the present application also provide an image processing device 300, comprising:

[0086] An initial image obtaining module 310 is configured to acquire a first image and obtain a second image according to the first image, wherein the second image is an image with defects obtained after the first image is subjected to a preset image enhancement processing.

[0087] A mask image obtaining module 320 is configured to obtain a mask image according to a luminance difference value image of the first image and the second image, wherein the mask image is used to screen pixels with the defects in the second image.

[0088] A target image generating module 330 is configured to generate a target image according to the mask image, the first image and the second image, wherein the target image is an image with the defects removed from the second image.

[0089] In one embodiment, the mask image obtaining module 320 is specifically configured to: acquire a first luminance image corresponding to the first image, and acquire a second luminance image corresponding to the second image; obtain the luminance difference value image by calculating a difference value between the second luminance image and the first luminance image; set a value of a pixel with a value greater than a preset threshold value in the luminance difference value image to a first preset value, and set a value of a pixel with a value not greater than the preset threshold value in the luminance difference value image to a second preset value, to obtain the mask image.

[0090] In one embodiment, the target image generating module 330 is specifically configured to: screen an initial first pixel from the first image according to the mask image, and screen a second pixel with the defects corresponding to the first pixel from the second image; obtain a correction value according to a first luminance value of the first pixel and a second luminance value of the second pixel, wherein the correction value is used to remove the defects existing in the second pixel; obtain a target pixel after the defects are removed according to the first luminance value and the correction value; and generate the target image according to the target pixel and a third pixel without the defects in the second image.

[0091] In one embodiment, the target image generation module 330 is specifically configured to: calculate a difference value between the second luminance value and the first luminance value; obtain a correction weight according to the second luminance value and the first luminance value; and take a product of the difference value and the correction weight as the correction value.

[0092] In one embodiment, the target image generation module 330 is specifically configured to: determine a defect type of the defect where the second pixel exists according to a value corresponding to the second pixel in the mask image; and obtain the correction weight according to the defect type, the second luminance value and the first luminance value.

[0093] In one embodiment, the target image generation module 330 is specifically configured to: determine that the defect type is a white edge defect when the value is the first preset value; and determine that the defect type is a black edge defect when the value is the second preset threshold value.

[0094] In one embodiment, the target image generation module 330 is specifically configured to: when the defect type is a white edge defect, calculate first position information of a pixel with the first preset value in the mask image; obtain the first pixel from the first image and the second pixel from the second image according to the first position information; and obtain a first ratio of a product of the second luminance value and the first luminance value and a third preset value; and obtain the correction weight according to the first ratio.

[0095] In one embodiment, the target image generation module 330 is specifically configured to: when the defect type is a black edge defect, calculate second position information of a pixel with the second preset value in the mask image; obtain the first pixel from the first image and the second pixel from the second image according to the second position information; obtain a second ratio of the second luminance value and the first luminance value; and obtain the correction weight according to the second ratio.

[0096] In one embodiment, the mask image obtaining module 320 is specifically configured to: obtain an initial image format of the first image and the second image; perform YUV format conversion processing on the first image and the second image respectively to obtain a converted first image and a converted second image when the initial image format is a non-YUV format; and obtain the mask image according to a luminance difference value image of the converted first image and the converted second image.

[0097] In this embodiment, the device 300 further comprises a conversion module specifically configured to: convert the target image from a YUV format to the initial image format.

[0098] The image processing apparatus 300 in the embodiments of the present application can be an apparatus, or a component in a terminal, an integrated circuit, or a chip. The apparatus can be a mobile electronic device or a non-mobile electronic device. Exemplarily, the mobile electronic device can be a mobile phone, a tablet computer, a notebook computer, a palm computer, a vehicle-mounted electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc., and the non-mobile electronic device can be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), a teller machine, or a self-service machine, etc., which are not limited in the embodiments of the present application.

[0099] The image processing apparatus in the embodiments of the present application can be an apparatus with an operating system. The operating system can be an Android operating system, an ios operating system, or other possible operating systems, which are not limited in the embodiments of the present application.

[0100] The image processing apparatus provided in the embodiments of the present application can implement each process of the above-mentioned method embodiments, and thus details are not described herein again.

[0101] Corresponding to the above-mentioned embodiments, optionally, as shown in Figure 4 The embodiments of the present application also provide an electronic device 400, which includes a processor 401, a memory 402, a program or instructions stored in the memory 402 and executable on the processor 401. The program or instructions are executed by the processor 401 to implement each process of the above-mentioned image processing method embodiments, and achieve the same technical effects. Details are not described herein again to avoid repetition.

[0102] It should be noted that the electronic device in the embodiments of the present application includes the above-mentioned mobile electronic device and non-mobile electronic device.

[0103] Figure 5 A hardware structure schematic diagram of an electronic device for implementing the embodiments of the present application.

[0104] The electronic device 1000 includes, but is not limited to, a radio frequency unit 1001, a network module 1002, an audio output unit 1003, an input unit 1004, a sensor 1005, a display unit 1006, a user input unit 1007, an interface unit 1008, a memory 1009, and a processor 1010, etc.

[0105] Those skilled in the art can understand that the electronic device 1000 can also include a power supply (such as a battery) for supplying power to various components, and the power supply can be logically connected to the processor 1010 through a power management system, so that the power management system can realize functions such as management of charging, discharging, and power consumption management. Figure 5 The electronic device structure shown in the figure does not constitute a limitation on the electronic device, and the electronic device can include more or fewer components than shown, or combine certain components, or different component arrangements, which will not be described here.

[0106] The processor 1010 is configured to obtain a first image and obtain a second image according to the first image, where the second image is an image with defects obtained by performing a preset image enhancement process on the first image; obtain a mask image according to a luminance difference value map of the first image and the second image, where the mask image is used to screen pixels with defects in the second image; and generate a target image according to the mask image, the first image, and the second image, where the target image is an image with the defects in the second image removed.

[0107] In one embodiment, the processor 1010 is further configured to obtain a first luminance map corresponding to the first image, and obtain a second luminance map corresponding to the second image; obtain the luminance difference value map by calculating a difference value between the second luminance map and the first luminance map; set a value of a pixel with a value greater than a preset threshold value in the luminance difference value map to a first preset value, and set a value of a pixel with a value not greater than the preset threshold value in the luminance difference value map to a second preset value, to obtain the mask image.

[0108] In one embodiment, the processor 1010 is further configured to screen an initial first pixel from the first image according to the mask image, and screen a second pixel with the defects corresponding to the first pixel from the second image; obtain a correction value according to a first luminance value of the first pixel and a second luminance value of the second pixel, where the correction value is used to remove the defects in the second pixel; obtain a target pixel after the defects are removed according to the first luminance value and the correction value; and generate the target image according to the target pixel and a third pixel without the defects in the second image.

[0109] In one embodiment, the processor 1010 is further configured to calculate a difference value between the second luminance value and the first luminance value; obtain a correction weight according to the second luminance value and the first luminance value; and take a product of the difference value and the correction weight as the correction value.

[0110] In an embodiment, the processor 1010 is further configured to determine a defect type of the defect where the second pixel exists according to a value corresponding to the second pixel in the mask image; and obtain the correction weight according to the defect type, the second luminance value and the first luminance value.

[0111] In an embodiment, the processor 1010 is further configured to determine that the defect type is a white edge defect when the value is the first preset value; and determine that the defect type is a black edge defect when the value is the second preset threshold.

[0112] In an embodiment, the processor 1010 is further configured to calculate a first ratio of a product of the second luminance value and the first luminance value and a third preset value when the defect type is the white edge defect; and obtain the correction weight according to the first ratio.

[0113] In an embodiment, the processor 1010 is further configured to calculate a second ratio of the second luminance value and the first luminance value when the defect type is the black edge defect; and obtain the correction weight according to the second ratio.

[0114] In an embodiment, the processor 1010 is further configured to obtain an initial image format of the first image and the second image; perform YUV format conversion processing on the first image and the second image respectively to obtain a converted first image and a converted second image when the initial image format is not a YUV format; and obtain the mask image according to a luminance difference image of the converted first image and the converted second image.

[0115] In an embodiment, the processor 1010 is further configured to convert the target image from a YUV format to the initial image format.

[0116] It should be understood that in the embodiments of the present application, the input unit 1004 can include a graphics processing unit (GPU) 10041 and a microphone 10042. The graphics processing unit 10041 processes image data of a still picture or a video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The display unit 1006 can include a display panel 10061, which can be configured in the form of a liquid crystal display, an organic light-emitting diode, etc. The user input unit 1007 includes a touch panel 10071 and other input devices 10072. The touch panel 10071 is also called a touch screen. The touch panel 10071 can include two parts of a touch detection device and a touch controller. The other input devices 10072 can include, but are not limited to, a physical keyboard, function keys (such as volume control keys, on-off keys, etc.), a trackball, a mouse, a joystick, and the like, which are not described here. The memory 1009 can be used to store software programs and various data, including but not limited to application programs and operating systems. The processor 1010 can integrate an application processor and a modem processor, wherein the application processor mainly processes operating systems, user interfaces and application programs, etc., and the modem processor mainly processes wireless communication. It can be understood that the above-mentioned modem processor can also not be integrated into the processor 1010.

[0117] The embodiments of the present application also provide a readable storage medium, which stores programs or instructions, and the programs or instructions are executed by a processor to realize the processes of the above-mentioned image processing method embodiments and achieve the same technical effects. To avoid repetition, details are not described here.

[0118] The processor is the processor in the electronic device described in the above-mentioned embodiments. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0119] The embodiments of the present application further provide a chip, which includes a processor and a communication interface. The communication interface is coupled with the processor. The processor is used to run programs or instructions to realize the processes of the above-mentioned image processing method embodiments and achieve the same technical effects. To avoid repetition, details are not described here.

[0120] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip, etc.

[0121] It should be noted that, in the present document, the terms "comprises", "comprising", or any other variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can include other elements not expressly listed or inherent to such process, method, article, or apparatus. An element proceeded by "comprises... a" does not, without more constraints, exclude the presence of additional identical elements in the process, method, article, or apparatus that comprises the element. Furthermore, it is to be understood that the method and apparatus of the present application can be carried out by more than one process, method, article, or apparatus either simultaneously, concurrently, or with intervening action that are carried out at the same time, either in a simultaneous fashion or in a fashion that is interleaved in time. For example, the described methods can be performed in a different order from that described, and / or various steps can be combined or omitted, and / or additional steps can be added, without departing from the scope of the present application. Also, features described with respect to certain examples can be combined in other examples.

[0122] From the above description of the embodiments, it is apparent that the above-mentioned method can be realized by means of software and necessary universal hardware platform, of course, it can also be realized by hardware, but in many cases, the former is a better embodiment. Based on such understanding, the technical solution of the present application can be embodied in the form of computer software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a plurality of instructions for making a terminal (which can be a mobile phone, computer, server, or network equipment, etc.) execute the method described in various embodiments of the present application.

[0123] The embodiments of the present application are described above in conjunction with the drawings, but the present application is not limited to the above-mentioned specific embodiments, and the above-mentioned specific embodiments are only illustrative, not restrictive, and those skilled in the art can make many forms under the inspiration of the present application without departing from the scope of the present application and the scope protected by the claims.

Claims

1. An image processing method, characterized by, The method comprises: obtaining a first image and obtaining a second image according to the first image, wherein the second image is an image with defects obtained after the first image is subjected to preset image enhancement processing; obtaining a mask image according to a luminance difference value map of the first image and the second image, wherein the mask image is used to screen pixels with defects in the second image; screening an initial first pixel from the first image and a second pixel with defects corresponding to the first pixel from the second image according to the mask image; obtaining a correction value according to a first luminance value of the first pixel and a second luminance value of the second pixel, wherein the correction value is used to remove the defects in the second pixel, the correction value is a product of a correction weight and a difference between the second luminance value and the first luminance value, in the case of a white edge defect type, the correction weight is determined according to a first ratio of a product of the second luminance value and the first luminance value to a third preset value, in the case of a black edge defect type, the correction weight is determined according to a second ratio of the second luminance value to the first luminance value; obtaining a target pixel after the defects are removed according to the first luminance value and the correction value; generating a target image according to the target pixel and a third pixel without defects in the second image, wherein the target image is an image with the defects removed from the second image.

2. The method of claim 1, wherein, The method further comprises: determining a defect type of the defects in the second pixel according to a value corresponding to the second pixel in the mask image. The method further comprises: in the case that the value is the first preset value, determining that the defect type is a white edge defect type; 3. The method of claim 1, wherein, in the case that the value is the second preset value, determining that the defect type is a black edge defect type. The method further comprises:

4. The method of claim 3, wherein, obtaining an initial image format of the first image and the second image; in the case that the initial image format is a non-YUV format, performing YUV format conversion processing on the first image and the second image respectively to obtain a converted first image and a converted second image. ​ 5. The method of claim 1, wherein, ​ ​ ​ The mask image is obtained according to a luminance difference map of the converted first image and the converted second image.

6. The method of claim 5, wherein, After the target image is generated, the method further includes: Converting the target image from a YUV format to the initial image format.

7. An image processing apparatus characterized by comprising: The device includes: An initial image obtaining module is configured to acquire a first image and obtain a second image according to the first image, wherein the second image is an image with defects obtained by performing a preset image enhancement process on the first image. A mask image obtaining module is configured to obtain a mask image according to a luminance difference map of the first image and the second image, wherein the mask image is used to screen pixels with the defects in the second image. A target image generating module is configured to screen an initial first pixel from the first image according to the mask image, screen a second pixel with the defects corresponding to the first pixel from the second image, obtain a correction value according to a first luminance value of the first pixel and a second luminance value of the second pixel, wherein the correction value is used to remove the defects of the second pixel, the correction value is a product of a correction weight and a difference between the second luminance value and the first luminance value, in a case where a defect type is a white edge defect, the correction weight is determined according to a first ratio of a product of the second luminance value and the first luminance value to a third preset value, in a case where the defect type is a black edge defect, the correction weight is determined according to a second ratio of the second luminance value to the first luminance value, obtain a target pixel after the defects are removed according to the first luminance value and the correction value, and generate a target image according to the target pixel and a third pixel without the defects in the second image, wherein the target image is an image with the defects removed from the second image.

Citation Information

Patent Citations

  • Image processing method and device

    CN108090876A

  • Image quality detection method based on image processing and related device

    CN111739014A