CN107564047B - Image processing method and device, electronic equipment and computer readable storage medium - Google Patents

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

Info

Publication number
CN107564047B
CN107564047B CN201710817254.6A CN201710817254A CN107564047B CN 107564047 B CN107564047 B CN 107564047B CN 201710817254 A CN201710817254 A CN 201710817254A CN 107564047 B CN107564047 B CN 107564047B
Authority
CN
China
Prior art keywords
pixel
value
sub
gray
determining
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710817254.6A
Other languages
Chinese (zh)
Other versions
CN107564047A (en
Inventor
杨松
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Xiaomi Mobile Software Co Ltd
Original Assignee
Beijing Xiaomi Mobile Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Xiaomi Mobile Software Co Ltd filed Critical Beijing Xiaomi Mobile Software Co Ltd
Priority to CN201710817254.6A priority Critical patent/CN107564047B/en
Publication of CN107564047A publication Critical patent/CN107564047A/en
Application granted granted Critical
Publication of CN107564047B publication Critical patent/CN107564047B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Image Processing (AREA)

Abstract

The present disclosure relates to an image processing method, the method comprising: determining a pixel with minimum chroma in the image as a reference pixel; determining an average gray value of the reference pixels; determining an adjustment value according to the gray value of the sub-pixel in the reference pixel and the average gray value; and adjusting the gray value of the sub-pixel of the pixel in the image according to the adjusting value. According to the embodiment of the disclosure, the determined adjustment value can represent the shift of the pixel chromaticity of the corresponding sub-pixel under the influence of the ambient light through the gray value, so that the gray value of the sub-pixel of the pixel in the image is adjusted through the adjustment value, the sub-pixel can emit light according to the adjusted gray value, the shift of the chromaticity can be eliminated to a certain extent, and further the elimination of the shift of the chromaticity of the whole image is realized.

Description

Image processing method and device, electronic equipment and computer readable storage medium
Technical Field
The present disclosure relates to the field of image processing technologies, and in particular, to an image processing method and apparatus, an electronic device, and a computer-readable storage medium.
Background
In the process of shooting images, due to the influence of factors such as ambient light, the obtained images have color cast to some extent, for example, images shot under sunlight are yellow or red to some extent.
The above problem causes a difference between the photographed image and the actual image, which affects the photographing experience.
Disclosure of Invention
The present disclosure provides an image processing method and apparatus, an electronic device, and a computer-readable storage medium to solve the disadvantages of the related art.
According to a first aspect of embodiments of the present disclosure, there is provided an image processing method, including:
determining a pixel with minimum chroma in the image as a reference pixel;
determining an average gray value of the reference pixels;
determining an adjustment value according to the gray value of the sub-pixel in the reference pixel and the average gray value;
and adjusting the gray value of the sub-pixel of the pixel in the image according to the adjusting value.
Optionally, the determining that the pixel with the minimum chroma in the image is the reference pixel includes:
determining, for a pixel in the image, a first grayscale value of a red subpixel, a second grayscale value of a blue subpixel, and a third grayscale value of a green subpixel in the pixel;
calculating a first absolute value of a difference between the first gray scale value and the second gray scale value, a second absolute value of a difference between the first gray scale value and the third gray scale value, a third absolute value of a difference between the second gray scale value and the third gray scale value, and calculating a sum of the first absolute value, the second absolute value, and the third absolute value;
and determining the pixel with the minimum sum as the reference pixel in the pixels of the image.
Optionally, the determining, for a pixel in the image, a first gray scale value of a red sub-pixel, a second gray scale value of a blue sub-pixel, and a third gray scale value of a green sub-pixel in the pixel comprises:
detecting a face region in the image;
positioning face key points in the face area;
determining a human eye region according to the human face key points;
for a pixel in the human eye region, a first gray scale value of a red sub-pixel, a second gray scale value of a blue sub-pixel, and a green sub-pixel of the pixel are determined.
Optionally, the determining an adjustment value according to the gray value of the sub-pixel in the reference pixel and the average gray value includes:
and determining the adjusting value according to the difference between the gray value of the sub-pixel in the reference pixel and the average gray value.
Optionally, the adjusting the gray scale value of the sub-pixel of the pixel in the image according to the adjustment value includes:
calculating the difference value between the gray value of the sub-pixel of the pixel and the adjusting value;
and taking the difference value as the gray value of the adjusted sub-pixel of the pixel.
Optionally, the determining an adjustment value according to the gray value of the sub-pixel in the reference pixel and the average gray value includes:
determining a first adjustment value according to the gray value of the red sub-pixel in the reference pixel and the average gray value, determining a second adjustment value according to the gray value of the green sub-pixel in the reference pixel and the average gray value, and determining a third adjustment value according to the gray value of the blue sub-pixel in the reference pixel and the average gray value;
the adjusting the gray value of the sub-pixels of the pixels in the image according to the adjusting value comprises:
and adjusting the gray value of the red sub-pixel of the pixel according to the first adjusting value, adjusting the gray value of the green sub-pixel of the pixel according to the second adjusting value, and adjusting the gray value of the blue sub-pixel of the pixel according to the third adjusting value.
According to a second aspect of the embodiments of the present disclosure, there is provided an image processing apparatus including:
a pixel determination module configured to determine a pixel with minimum chroma in the image as a reference pixel;
a mean determination module configured to determine a mean gray value of the reference pixel;
an adjustment value determination module configured to determine an adjustment value from the gray value of the sub-pixel in the reference pixel and the average gray value;
an adjusting module configured to adjust a gray value of a sub-pixel of a pixel in the image according to the adjustment value.
Optionally, the pixel determination module includes:
a gray value determination sub-module configured to determine, for a pixel in the image, a first gray value of a red sub-pixel, a second gray value of a blue sub-pixel, and a third gray value of a green sub-pixel of the pixel;
a calculation submodule configured to calculate a first absolute value of a difference between the first gray scale value and the second gray scale value, a second absolute value of a difference between the first gray scale value and the third gray scale value, a third absolute value of a difference between the second gray scale value and the third gray scale value, and a sum of the first absolute value, the second absolute value, and the third absolute value;
a pixel determination sub-module configured to determine a pixel of the image in which the sum is smallest as the reference pixel.
Optionally, the pixel determination module further comprises:
a face detection sub-module configured to detect a face region in the image;
a key point determination submodule configured to locate face key points in the face region;
a human eye determination submodule configured to determine a human eye region from the human face key points;
wherein the gray value determination sub-module is configured to determine, for pixels in the human eye region, a first gray value of a red sub-pixel, a second gray value of a blue sub-pixel and a green sub-pixel of the pixels.
Optionally, the adjustment value determination module is configured to determine the adjustment value from a difference between a gray value of a sub-pixel in the reference pixel and the average gray value.
Optionally, the adjusting module is configured to calculate a difference between a gray value of a sub-pixel of the pixel and the adjustment value; and taking the difference value as the gray value of the adjusted sub-pixel of the pixel.
Optionally, the adjustment value determining module is configured to determine a first adjustment value according to the gray-scale value of the red sub-pixel in the reference pixel and the average gray-scale value, determine a second adjustment value according to the gray-scale value of the green sub-pixel in the reference pixel and the average gray-scale value, and determine a third adjustment value according to the gray-scale value of the blue sub-pixel in the reference pixel and the average gray-scale value;
the adjusting module is configured to adjust the gray-scale value of the red sub-pixel of the pixel according to the first adjusting value, adjust the gray-scale value of the green sub-pixel of the pixel according to the second adjusting value, and adjust the gray-scale value of the blue sub-pixel of the pixel according to the third adjusting value.
According to a third aspect of the embodiments of the present disclosure, there is provided an electronic apparatus including:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to:
determining a pixel with minimum chroma in the image as a reference pixel;
determining an average gray value of the reference pixels;
determining an adjustment value according to the gray value of the sub-pixel in the reference pixel and the average gray value;
and adjusting the gray value of the sub-pixel of the pixel in the image according to the adjusting value.
According to a fourth aspect of embodiments of the present disclosure, there is provided a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of:
determining a pixel with minimum chroma in the image as a reference pixel;
determining an average gray value of the reference pixels;
determining an adjustment value according to the gray value of the sub-pixel in the reference pixel and the average gray value;
and adjusting the gray value of the sub-pixel of the pixel in the image according to the adjusting value.
The technical scheme provided by the embodiment of the disclosure can have the following beneficial effects:
according to the embodiment, the determined adjustment value can represent the deviation of the pixel chromaticity of the corresponding sub-pixel under the influence of the ambient light through the gray scale value, so that the gray scale value of the sub-pixel of the pixel in the image is adjusted through the adjustment value, the sub-pixel can emit light according to the adjusted gray scale value, the chromaticity deviation can be eliminated to a certain extent, and further the elimination of the chromaticity deviation of the whole image is realized.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure.
FIG. 1 is a schematic flow chart diagram illustrating an image processing method in accordance with an exemplary embodiment.
FIG. 2 is a schematic flow chart diagram illustrating one type of determining a reference pixel in accordance with an exemplary embodiment.
FIG. 3 is a schematic flow chart diagram illustrating another method for determining reference pixels in accordance with an illustrative embodiment.
FIG. 4 is a schematic diagram illustrating a face keypoint, according to an example embodiment.
FIG. 5 is a schematic diagram illustrating a region of a human eye according to an exemplary embodiment.
FIG. 6 is a schematic diagram illustrating a comparison of pre-processed and post-processed images according to an exemplary embodiment.
FIG. 7 is a schematic flow chart diagram illustrating another method for determining reference pixels in accordance with an illustrative embodiment.
FIG. 8 is a schematic flow chart diagram illustrating another method for determining reference pixels in accordance with an illustrative embodiment.
FIG. 9 is another schematic flow chart diagram illustrating the determination of an adjustment value in accordance with an exemplary embodiment.
Fig. 10 is a schematic block diagram illustrating an image processing apparatus according to an exemplary embodiment.
FIG. 11 is a schematic block diagram illustrating a pixel determination module in accordance with an exemplary embodiment.
FIG. 12 is a schematic block diagram illustrating another pixel determination module in accordance with an exemplary embodiment.
FIG. 13 is a schematic block diagram illustrating an apparatus for image processing in accordance with an exemplary embodiment.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
FIG. 1 is a schematic flow chart diagram illustrating an image processing method in accordance with an exemplary embodiment. The method shown in the embodiment can be applied to cameras and video cameras, and can also be applied to electronic equipment with an image acquisition function, such as mobile phones and tablet computers.
As shown in fig. 1, the image processing method includes the steps of:
in step S1, the pixel with the smallest chromaticity in the image is determined as the reference pixel.
In one embodiment, ideally, the pixel with the smallest chromaticity is gray, white or black, however, in practical cases, under the influence of ambient light, the pixel in the image has more or less some colors, and in case that the pixel includes a red sub-pixel, a green sub-pixel and a blue sub-pixel, and the areas of the three sub-pixels are the same, the color of the pixel mainly depends on the gray value of each sub-pixel, and the larger the gray value indicates that the sub-pixel emits more light, so the chromaticity of the pixel can be determined by calculating the difference of the gray values of every two sub-pixels.
For example, if the gray scale value of the red sub-pixel is R, the gray scale value of the green sub-pixel is G, and the gray scale value of the blue sub-pixel is B, the sum of the differences D | + | R-B | + | G-B |, and then the pixel with the smallest D among all the pixels of the image is taken as the reference pixel.
In step S2, an average gray value of the reference pixels is determined.
In one embodiment, the average gray scale of the reference pixelsThe value may be equal to the mean of the sum of the grey values of each sub-pixel in the reference pixel, RrefIs the gray value of the red sub-pixel, GrefIs the gray value of the green sub-pixel, BrefIs the gray value of the blue sub-pixel, then the average gray value C of the reference pixelref=(Rref+Gref+Bref)/3。
In step S3, an adjustment value is determined according to the gray value of the sub-pixel in the reference pixel and the average gray value.
The pixel with a large chromaticity has a large chromaticity shift when it is affected by ambient light, and the pixel with a small chromaticity has a small velocity shift when it is affected by ambient light. For example, for a green pixel, its color in the image is yellow if it is in red ambient light, and for a black pixel, its color in the image hardly sees a change in chromaticity if it is in red ambient light, and still looks substantially black.
Therefore, in an embodiment, the determined average gray value of the reference pixel with the smallest chromaticity is closer to the gray value of the reference pixel in an actual situation (i.e. when the influence of the ambient light is removed), and further, the difference between the gray value of the sub-pixel and the average gray value, i.e. the above adjustment value, can be used to represent the difference between the gray value of the sub-pixel and the gray value of the sub-pixel in the image in the actual situation. The difference in gray scale values is further related to the chromaticity shift of the pixel, for example, it is determined that the gray scale value of the red sub-pixel in the image is larger than the gray scale value of the red sub-pixel in the actual situation, and then the pixel is shifted to red in the image. Therefore, according to the above adjustment value, the chromaticity shift of the sub-pixel of the corresponding color in the image under the influence of the ambient light can be determined.
The adjustment value may be a difference or a ratio of a gray value of a pixel in the image and a gray value of a corresponding pixel in an actual situation.
In step S4, the gray scale value of the sub-pixels of the pixels in the image is adjusted according to the adjustment value. The pixels in the image include the reference pixels and other pixels except the reference pixels.
In one embodiment, the determined adjustment value may represent the shift of the pixel chromaticity of the corresponding sub-pixel under the influence of the ambient light through a gray scale value, so that the adjustment value adjusts the gray scale value of the sub-pixel of the pixel in the image, so that the sub-pixel emits light according to the adjusted gray scale value, the shift of chromaticity can be eliminated to a certain extent, and the elimination of the shift of chromaticity of the whole image is further achieved.
FIG. 2 is a schematic flow chart diagram illustrating one type of determining a reference pixel in accordance with an exemplary embodiment. As shown in fig. 2, on the basis of the embodiment shown in fig. 1, the determining that the pixel with the minimum chroma in the image is the reference pixel includes:
in step S11, determining, for a pixel in the image, a first grayscale value of a red subpixel, a second grayscale value of a blue subpixel, and a third grayscale value of a green subpixel in the pixel;
in step S12, calculating a first absolute value of a difference between the first gray scale value and the second gray scale value, a second absolute value of a difference between the first gray scale value and the third gray scale value, a third absolute value of a difference between the second gray scale value and the third gray scale value, and calculating a sum of the first absolute value, the second absolute value, and the third absolute value;
in step S13, the pixel with the smallest sum among the pixels of the image is determined as the reference pixel.
In one embodiment, the chromaticity of a pixel may be determined from the sum of the difference values of the gray scale values between each of the sub-pixels in the pixel, for example, in the case where the pixel includes a red sub-pixel, a green sub-pixel, and a blue sub-pixel, for each pixel in the image, a first gray scale value R of the red sub-pixel, a second gray scale value G of the green sub-pixel, and a third gray scale value B of the blue sub-pixel may be determined.
Further, the sum D ═ R-G | + | R-B | + | G-B |, of the first absolute value, the second absolute value, and the third absolute value may be calculated, wherein the closer to R, G and B, the smaller D represents the smaller chromaticity of the corresponding pixel, that is, the more toward black, white, or black, and thus, the chromaticity of the pixel may be determined according to D. Then, the pixel with the smallest D among all the pixels of the image is taken as the reference pixel.
FIG. 3 is a schematic flow chart diagram illustrating another method for determining reference pixels in accordance with an illustrative embodiment. As shown in fig. 3, on the basis of the embodiment shown in fig. 2, the determining, for a pixel in the image, a first gray scale value of a red sub-pixel, a second gray scale value of a blue sub-pixel, and a third gray scale value of a green sub-pixel in the pixel includes:
in step S111, a face region in the image is detected.
In one embodiment, when the image is acquired, a face region in the image may be detected first, that is, a position of the face region in the image may be determined, for example, by using algorithms such as Adaboost, fast-rcnn, and the like.
In step S112, face key points in the face region are located.
FIG. 4 is a schematic diagram illustrating a face keypoint, according to an example embodiment.
In one embodiment, after detecting a face region in an image, face key points in the face region may be located, as shown in fig. 4, where the face key points include points on contours such as a face contour, an eye contour, an eyebrow contour, a lip contour, a nose contour, and an eye contour, and the face key points may be determined by using an algorithm such as AAM (Active application Model), SDM (supervised depth method), or CNN (Convolutional Neural Network).
In step S113, the human eye region is determined according to the human face key points.
FIG. 5 is a schematic diagram illustrating a region of a human eye according to an exemplary embodiment.
In one embodiment, after determining the key points of the human face, the key points of the human face may be connected, then the connection lines corresponding to the pre-stored shapes of the human eyes are determined, and the corresponding regions are determined as regions of the human eyes, for example, as shown in fig. 5.
In step S114, for the pixels in the human eye region, a first gray scale value of a red sub-pixel, a second gray scale value of a blue sub-pixel, and a green sub-pixel of the pixels are determined.
In one embodiment, since it is necessary to determine the pixel with the smallest chromaticity in the image as the reference pixel, that is, determine the pixel with the color closest to black, white or gray in the image, and for the image with the human face, the pupil in the human eye is generally black, and the sclera (white) is generally white, the reference pixel can be determined in the human eye region without performing judgment on all pixels in the image, which is beneficial to reducing the amount of calculation.
FIG. 6 is a schematic diagram illustrating a comparison of pre-processed and post-processed images according to an exemplary embodiment.
As shown in fig. 6, the image before processing is yellow due to the influence of the ambient light, and the image after processing can eliminate the influence of the ambient light to some extent, so that the image appears in a color in practical situations, for example, a wall behind a person changes from light yellow to light blue.
FIG. 7 is a schematic flow chart diagram illustrating another method for determining reference pixels in accordance with an illustrative embodiment. As shown in fig. 7, on the basis of the embodiment shown in fig. 1, the determining an adjustment value according to the gray-scale value of the sub-pixel in the reference pixel and the average gray-scale value includes:
in step S31, the adjustment value is determined according to the difference between the gray value of the sub-pixel in the reference pixel and the average gray value.
In one embodiment, the adjustment value may be a difference or ratio of the gray value of a pixel in the image and the gray value of the corresponding pixel in actual conditions, and by calculating the difference as the adjustment value, the calculation process is simple compared to calculating the ratio, and subsequent adjustment according to the adjustment value is facilitated. E.g. for the red sub-pixel in the reference pixelR=Rref-CrefAccordingly, the adjustment amount D of the green sub-pixel in the reference pixelG=Gref-CrefAdjustment D of the green sub-pixel in the reference pixelB=Bref-Cref
FIG. 8 is a schematic flow chart diagram illustrating another method for determining reference pixels in accordance with an illustrative embodiment. As shown in fig. 8, on the basis of the embodiment shown in fig. 1, the adjusting the gray scale value of the sub-pixel of the pixel in the image according to the adjustment value includes:
in step S41, calculating a difference between the gray-scale value of the sub-pixel of the pixel and the adjustment value;
in step S42, the difference is used as the adjusted gray scale value of the sub-pixel of the pixel.
In one embodiment, in the case that the adjustment value is a difference between the gray value of the sub-pixel in the reference pixel and the average gray value, when adjusting the sub-pixel of the pixel, the adjustment may be performed by calculating the difference between the gray value of the sub-pixel of the pixel and the adjustment value, which is beneficial to simplifying the calculation process. For example, the adjusted gray value R for the red sub-pixel in the pixelresult=Rsrc-DRWherein R issrcThe gray scale value of the red sub-pixel in the sub-pixel before adjustment is correspondingly adjusted to the gray scale value G of the green sub-pixel in the pixelresult=Gsrc-DGGray value B adjusted by blue sub-pixel in pixelresult=Bsrc-DBWherein G issrcFor the gray-scale value before adjustment of the green sub-pixel in the sub-pixel, BsrcThe gray scale value before adjustment is given to the green sub-pixel in the sub-pixel.
FIG. 9 is another schematic flow chart diagram illustrating the determination of an adjustment value in accordance with an exemplary embodiment. As shown in fig. 9, on the basis of the embodiment shown in fig. 1, the determining an adjustment value according to the gray-scale value of the sub-pixel in the reference pixel and the average gray-scale value includes:
in step S32, determining a first adjustment value according to the gray-level value of the red sub-pixel in the reference pixel and the average gray-level value, determining a second adjustment value according to the gray-level value of the green sub-pixel in the reference pixel and the average gray-level value, and determining a third adjustment value according to the gray-level value of the blue sub-pixel in the reference pixel and the average gray-level value;
the adjusting the gray value of the sub-pixels of the pixels in the image according to the adjusting value comprises:
in step S43, the gray-scale value of the red sub-pixel of the pixel is adjusted according to the first adjustment value, the gray-scale value of the green sub-pixel of the pixel is adjusted according to the second adjustment value, and the gray-scale value of the blue sub-pixel of the pixel is adjusted according to the third adjustment value.
In one embodiment, since the sub-pixels of different colors are affected by the ambient light, the chromaticity shift is different, i.e., the adjustment values are different. Therefore, the adjustment values can be respectively calculated for the sub-pixels with different colors in the reference pixel, so that when the sub-pixels in the pixels are adjusted, the adjustment is performed according to the adjustment values corresponding to the sub-pixels with the corresponding colors, and the accuracy of the adjustment is improved.
Corresponding to the embodiment of the image processing method, the disclosure also provides an embodiment of the image processing device.
Fig. 10 is a schematic block diagram illustrating an image processing apparatus according to an exemplary embodiment. Referring to fig. 10, the apparatus includes:
a pixel determining module 1 configured to determine a pixel with minimum chroma in an image as a reference pixel;
a mean determination module 2 configured to determine a mean gray value of the reference pixel;
an adjustment value determination module 3 configured to determine an adjustment value from the gray value of the sub-pixel in the reference pixel and the average gray value;
an adjusting module 4 configured to adjust the gray-scale value of the sub-pixels of the pixels in the image according to the adjustment value.
FIG. 11 is a schematic block diagram illustrating a pixel determination module in accordance with an exemplary embodiment. As shown in fig. 11, based on the embodiment shown in fig. 10, the pixel determining module 1 includes:
a gray value determination sub-module 11 configured to determine, for a pixel in the image, a first gray value of a red sub-pixel, a second gray value of a blue sub-pixel, and a third gray value of a green sub-pixel of the pixel;
a calculation submodule 12 configured to calculate a first absolute value of a difference between the first gray scale value and the second gray scale value, a second absolute value of a difference between the first gray scale value and the third gray scale value, a third absolute value of a difference between the second gray scale value and the third gray scale value, and a sum of the first absolute value, the second absolute value, and the third absolute value;
a pixel determination submodule 13 configured to determine the pixel of the image, the pixel of which the sum is the smallest, as the reference pixel.
FIG. 12 is a schematic block diagram illustrating another pixel determination module in accordance with an exemplary embodiment. As shown in fig. 12, based on the embodiment shown in fig. 11, the pixel determining module 1 further includes:
a face detection sub-module 14 configured to detect a face region in the image;
a keypoint determination submodule 15 configured to locate face keypoints in the face region;
a human eye determination submodule 16 configured to determine a human eye region according to the human face key points;
wherein the gray value determination submodule 11 is configured to determine, for pixels in the human eye region, a first gray value of a red sub-pixel, a second gray value of a blue sub-pixel and a green sub-pixel of the pixels.
Optionally, the adjustment value determination module is configured to determine the adjustment value from a difference between a gray value of a sub-pixel in the reference pixel and the average gray value.
Optionally, the adjusting module is configured to calculate a difference between a gray value of a sub-pixel of the pixel and the adjustment value; and taking the difference value as the gray value of the adjusted sub-pixel of the pixel.
Optionally, the adjustment value determining module is configured to determine a first adjustment value according to the gray-scale value of the red sub-pixel in the reference pixel and the average gray-scale value, determine a second adjustment value according to the gray-scale value of the green sub-pixel in the reference pixel and the average gray-scale value, and determine a third adjustment value according to the gray-scale value of the blue sub-pixel in the reference pixel and the average gray-scale value;
the adjusting module is configured to adjust the gray-scale value of the red sub-pixel of the pixel according to the first adjusting value, adjust the gray-scale value of the green sub-pixel of the pixel according to the second adjusting value, and adjust the gray-scale value of the blue sub-pixel of the pixel according to the third adjusting value.
With regard to the apparatus in the above embodiments, the specific manner in which each module performs operations has been described in detail in the embodiments of the related method, and will not be described in detail here.
For the device embodiments, since they substantially correspond to the method embodiments, reference may be made to the partial description of the method embodiments for relevant points. The above-described embodiments of the apparatus are merely illustrative, wherein the modules described as separate parts may or may not be physically separate, and the parts displayed as modules may or may not be physical modules, may be located in one place, or may be distributed on a plurality of network modules. Some or all of the modules can be selected according to actual needs to achieve the purpose of the disclosed solution. One of ordinary skill in the art can understand and implement it without inventive effort.
The present disclosure also proposes an electronic device, comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to:
determining a pixel with minimum chroma in the image as a reference pixel;
determining an average gray value of the reference pixels;
determining an adjustment value according to the gray value of the sub-pixel in the reference pixel and the average gray value;
and adjusting the gray value of the sub-pixel of the pixel in the image according to the adjusting value.
The present disclosure also proposes a computer-readable storage medium, on which a computer program is stored, which program, when executed by a processor, realizes the steps of:
determining a pixel with minimum chroma in the image as a reference pixel;
determining an average gray value of the reference pixels;
determining an adjustment value according to the gray value of the sub-pixel in the reference pixel and the average gray value;
and adjusting the gray value of the sub-pixel of the pixel in the image according to the adjusting value.
Fig. 13 is a schematic block diagram illustrating an apparatus 1300 for image processing according to an exemplary embodiment. For example, apparatus 1300 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, an exercise device, a personal digital assistant, and so forth.
Referring to fig. 13, the apparatus 1300 may include one or more of the following components: a processing component 1302, a memory 1304, a power component 1306, a multimedia component 1308, an audio component 1310, an input/output (I/O) interface 1312, a sensor component 1314, and a communication component 1316.
The processing component 1302 generally controls overall operation of the device 1300, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing component 1302 may include one or more processors 1320 to execute instructions to perform all or part of the steps of the methods described above. Further, the processing component 1302 can include one or more modules that facilitate interaction between the processing component 1302 and other components. For example, the processing component 1302 may include a multimedia module to facilitate interaction between the multimedia component 1308 and the processing component 1302.
The memory 1304 is configured to store various types of data to support operations at the apparatus 1300. Examples of such data include instructions for any application or method operating on device 1300, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 1304 may be implemented by any type or combination of volatile or non-volatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
Power supply component 1306 provides power to the various components of device 1300. Power components 1306 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for device 1300.
The multimedia component 1308 includes a screen between the device 1300 and the user that provides an output interface. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 1308 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the apparatus 1300 is in an operation mode, such as a photographing mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 1310 is configured to output and/or input audio signals. For example, the audio component 1310 includes a Microphone (MIC) configured to receive external audio signals when the apparatus 1300 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may further be stored in the memory 1304 or transmitted via the communication component 1316. In some embodiments, the audio component 1310 also includes a speaker for outputting audio signals.
The I/O interface 1312 provides an interface between the processing component 1302 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor assembly 1314 includes one or more sensors for providing various aspects of state assessment for the device 1300. For example, the sensor assembly 1314 may detect the open/closed state of the device 1300, the relative positioning of components, such as a display and keypad of the device 1300, the sensor assembly 1314 may also detect a change in the position of the device 1300 or a component of the device 1300, the presence or absence of user contact with the device 1300, orientation or acceleration/deceleration of the device 1300, and a change in the temperature of the device 1300. The sensor assembly 1314 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 1314 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 1314 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 1316 is configured to facilitate communications between the apparatus 1300 and other devices in a wired or wireless manner. The apparatus 1300 may access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 1316 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communications component 1316 also includes a Near Field Communications (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the apparatus 1300 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the above-described methods.
In an exemplary embodiment, a non-transitory computer readable storage medium comprising instructions, such as the memory 1304 comprising instructions, executable by the processor 1320 of the apparatus 1300 to perform the method described above is also provided. For example, the non-transitory computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (12)

1. An image processing method, comprising:
determining a single pixel with minimum chroma in the image as a reference pixel;
determining an average gray value of a plurality of sub-pixels in the reference pixel;
determining an adjustment value of each sub-pixel according to the gray value of each sub-pixel in the reference pixel and the average gray value;
adjusting the gray value of the sub-pixels of the pixels in the image according to the adjusting value;
the determining that the single pixel with the minimum chroma in the image is the reference pixel comprises the following steps:
detecting a face region in the image;
positioning face key points in the face area;
determining a human eye region according to the human face key points;
for the pixels in the human eye region, determining a single pixel with the smallest chroma in the pixels as the reference pixel.
2. The method of claim 1, wherein determining the pixel with the smallest chroma in the image as the reference pixel comprises:
determining, for a pixel in the human eye region, a first grayscale value of a red subpixel, a second grayscale value of a blue subpixel, and a third grayscale value of a green subpixel in the pixel;
calculating a first absolute value of a difference between the first gray scale value and the second gray scale value, a second absolute value of a difference between the first gray scale value and the third gray scale value, a third absolute value of a difference between the second gray scale value and the third gray scale value, and calculating a sum of the first absolute value, the second absolute value, and the third absolute value;
and determining the pixel with the minimum sum as the reference pixel in the pixels of the image.
3. The method of claim 1, wherein determining an adjustment value from the gray scale value of the sub-pixel in the reference pixel and the average gray scale value comprises:
and determining the adjusting value according to the difference between the gray value of the sub-pixel in the reference pixel and the average gray value.
4. The method of claim 3, wherein adjusting the gray scale values of the sub-pixels of the pixels in the image according to the adjustment value comprises:
calculating the difference value between the gray value of the sub-pixel of the pixel and the adjusting value;
and taking the difference value as the gray value of the adjusted sub-pixel of the pixel.
5. The method of any one of claims 1 to 4, wherein said determining an adjustment value from the gray value of the sub-pixel in the reference pixel and the average gray value comprises:
determining a first adjustment value according to the gray value of the red sub-pixel in the reference pixel and the average gray value, determining a second adjustment value according to the gray value of the green sub-pixel in the reference pixel and the average gray value, and determining a third adjustment value according to the gray value of the blue sub-pixel in the reference pixel and the average gray value;
the adjusting the gray value of the sub-pixels of the pixels in the image according to the adjusting value comprises:
and adjusting the gray value of the red sub-pixel of the pixel according to the first adjusting value, adjusting the gray value of the green sub-pixel of the pixel according to the second adjusting value, and adjusting the gray value of the blue sub-pixel of the pixel according to the third adjusting value.
6. An image processing apparatus characterized by comprising:
a pixel determination module configured to determine a single pixel with the smallest chroma in the image as a reference pixel;
a mean determination module configured to determine an average gray value of a plurality of sub-pixels in the reference pixel;
an adjustment value determination module configured to determine an adjustment value for each sub-pixel in the reference pixel according to the gray value of each sub-pixel and the average gray value;
an adjusting module configured to adjust a gray value of a sub-pixel of a pixel in the image according to the adjustment value;
the pixel determination module includes:
a face detection sub-module configured to detect a face region in the image;
a key point determination submodule configured to locate face key points in the face region;
a human eye determination submodule configured to determine a human eye region from the human face key points; and for the pixels in the human eye region, determining a single pixel with the minimum chroma in the pixels as a reference pixel.
7. The apparatus of claim 6, wherein the pixel determination module further comprises:
a gray value determination sub-module configured to determine, for pixels in the human eye region, a first gray value of a red sub-pixel, a second gray value of a blue sub-pixel, and a third gray value of a green sub-pixel of the pixels;
a calculation submodule configured to calculate a first absolute value of a difference between the first gray scale value and the second gray scale value, a second absolute value of a difference between the first gray scale value and the third gray scale value, a third absolute value of a difference between the second gray scale value and the third gray scale value, and a sum of the first absolute value, the second absolute value, and the third absolute value;
a pixel determination sub-module configured to determine a pixel of the image in which the sum is smallest as the reference pixel.
8. The apparatus of claim 6, wherein the adjustment value determination module is configured to determine the adjustment value from a difference between a gray value of a sub-pixel in the reference pixel and the average gray value.
9. The apparatus of claim 8, wherein the adjustment module is configured to calculate a difference between a gray value of a sub-pixel of the pixel and the adjustment value; and taking the difference value as the gray value of the adjusted sub-pixel of the pixel.
10. The apparatus according to any of claims 6 to 9, wherein the adjustment value determining module is configured to determine a first adjustment value based on a gray value of a red sub-pixel in the reference pixel and the average gray value, to determine a second adjustment value based on a gray value of a green sub-pixel in the reference pixel and the average gray value, and to determine a third adjustment value based on a gray value of a blue sub-pixel in the reference pixel and the average gray value;
the adjusting module is configured to adjust the gray-scale value of the red sub-pixel of the pixel according to the first adjusting value, adjust the gray-scale value of the green sub-pixel of the pixel according to the second adjusting value, and adjust the gray-scale value of the blue sub-pixel of the pixel according to the third adjusting value.
11. An electronic device, comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to perform the method of any of claims 1 to 5.
12. A computer-readable storage medium, on which a computer program is stored, which program, when being executed by a processor, is adapted to carry out the method according to any one of claims 1 to 5.
CN201710817254.6A 2017-09-12 2017-09-12 Image processing method and device, electronic equipment and computer readable storage medium Active CN107564047B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710817254.6A CN107564047B (en) 2017-09-12 2017-09-12 Image processing method and device, electronic equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710817254.6A CN107564047B (en) 2017-09-12 2017-09-12 Image processing method and device, electronic equipment and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN107564047A CN107564047A (en) 2018-01-09
CN107564047B true CN107564047B (en) 2020-10-20

Family

ID=60979675

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710817254.6A Active CN107564047B (en) 2017-09-12 2017-09-12 Image processing method and device, electronic equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN107564047B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109886921A (en) * 2019-01-16 2019-06-14 新而锐电子科技(上海)有限公司 Crack size measure, device and electronic equipment based on digital picture
CN110349530B (en) * 2019-06-12 2021-07-23 北海惠科光电技术有限公司 Character boundary processing method, display panel and computer readable storage medium
JP2023177478A (en) * 2022-06-02 2023-12-14 Tvs Regza株式会社 Image display device and program

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102893292A (en) * 2010-04-30 2013-01-23 诺基亚公司 Method, apparatus and computer program product for compensating eye color defects
CN102938843A (en) * 2012-11-22 2013-02-20 华为技术有限公司 Image processing method, image processing device and imaging device
CN103139572A (en) * 2011-11-24 2013-06-05 比亚迪股份有限公司 Sensitization device and method and device for white balance of sensitization device
CN103227928A (en) * 2013-03-29 2013-07-31 华为技术有限公司 White balance adjusting method and device
CN104036467A (en) * 2014-06-18 2014-09-10 北京航空航天大学 Image color cast correction method based on channel gain coefficient weighting
CN104424626A (en) * 2013-09-09 2015-03-18 联发科技(新加坡)私人有限公司 Method and associated apparatus for correcting color artifact of image
CN105933687A (en) * 2016-07-04 2016-09-07 凌云光技术集团有限责任公司 Automatic white balance processing method and device for images
CN106131441A (en) * 2016-09-06 2016-11-16 北京小米移动软件有限公司 Photographic method and device, electronic equipment
CN107135384A (en) * 2017-05-19 2017-09-05 中国科学院深圳先进技术研究院 White balance adjusting method, device, image processing terminal and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7126644B2 (en) * 2003-07-07 2006-10-24 Destiny Technology Corporation Rapid white balance method for color digital images

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102893292A (en) * 2010-04-30 2013-01-23 诺基亚公司 Method, apparatus and computer program product for compensating eye color defects
CN103139572A (en) * 2011-11-24 2013-06-05 比亚迪股份有限公司 Sensitization device and method and device for white balance of sensitization device
CN102938843A (en) * 2012-11-22 2013-02-20 华为技术有限公司 Image processing method, image processing device and imaging device
CN103227928A (en) * 2013-03-29 2013-07-31 华为技术有限公司 White balance adjusting method and device
CN104424626A (en) * 2013-09-09 2015-03-18 联发科技(新加坡)私人有限公司 Method and associated apparatus for correcting color artifact of image
CN104036467A (en) * 2014-06-18 2014-09-10 北京航空航天大学 Image color cast correction method based on channel gain coefficient weighting
CN105933687A (en) * 2016-07-04 2016-09-07 凌云光技术集团有限责任公司 Automatic white balance processing method and device for images
CN106131441A (en) * 2016-09-06 2016-11-16 北京小米移动软件有限公司 Photographic method and device, electronic equipment
CN107135384A (en) * 2017-05-19 2017-09-05 中国科学院深圳先进技术研究院 White balance adjusting method, device, image processing terminal and storage medium

Also Published As

Publication number Publication date
CN107564047A (en) 2018-01-09

Similar Documents

Publication Publication Date Title
US9674395B2 (en) Methods and apparatuses for generating photograph
CN108470322B (en) Method and device for processing face image and readable storage medium
US11061202B2 (en) Methods and devices for adjusting lens position
US20160027191A1 (en) Method and device for adjusting skin color
CN107944367B (en) Face key point detection method and device
EP3208745B1 (en) Method and apparatus for identifying picture type
US20180165802A1 (en) Image processing method and apparatus, and storage medium
CN107967459B (en) Convolution processing method, convolution processing device and storage medium
CN108154466B (en) Image processing method and device
CN107730448B (en) Beautifying method and device based on image processing
US10109248B2 (en) Method and device for adjusting liquid crystal display
CN107564047B (en) Image processing method and device, electronic equipment and computer readable storage medium
CN107403144B (en) Mouth positioning method and device
CN105678296B (en) Method and device for determining character inclination angle
CN111611034A (en) Screen display adjusting method and device and storage medium
CN107845094B (en) Image character detection method and device and computer readable storage medium
CN107424130B (en) Picture beautifying method and device
CN110796617B (en) Face image enhancement method and device and electronic equipment
CN109167921B (en) Shooting method, shooting device, shooting terminal and storage medium
US9665925B2 (en) Method and terminal device for retargeting images
CN107563957B (en) Eye image processing method and device
CN104536713B (en) Method and device for displaying characters in image
CN105472228B (en) Image processing method and device and terminal
CN106469446B (en) Depth image segmentation method and segmentation device
CN112033527A (en) Ambient brightness detection method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant