Image processing method and device, electronic equipment and storage medium
By correcting the pixel points in the highlight area in the image and using the color values of adjacent pixel points to correct, the problem of color deviation in the highlight area after white balance processing is solved, and the image color restoration is achieved.
Patent Information
- Application Number
- CN202311775990.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-21
- Publication Date
- 2025-06-24
AI Technical Summary
After the image is white balanced, the color of the highlight area is likely to deviate from the true color.
By acquiring the image to be corrected after white balance processing, the pixel points in the highlight region are identified and the pixel points are corrected according to the initial color value of the adjacent pixel points. The specific method includes sliding in the image using a sliding window, determining whether the target pixel point is in the highlight area, and modifying the color value of the target pixel point according to the initial color value of some pixel points in the sliding window.
The color value of the corrected image in the highlight region is close to the initial color value of its adjacent pixel points, thereby restoring the true color of the image, solving the problem of color cast in the highlight region after white balance processing.
Smart Images

Figure CN120201315A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image processing technologies, and in particular, to an image processing method, apparatus, electronic device, and storage medium. Background Art
[0002] After an image acquisition device acquires an image, in order to restore the true color of the image, white balance processing is usually performed on the image to calibrate the color of the image. However, after the white balance processing of the image, the highlight area that should originally be white in the image is likely to deviate from the true color of the image. Summary of the Invention
[0003] To overcome the problems existing in the related art, the present disclosure provides an image processing method, apparatus, electronic device, and storage medium.
[0004] According to a first aspect of the present disclosure, an image processing method is provided, and the image processing method includes:
[0005] Obtain a to-be-corrected image after white balance processing;
[0006] Use the pixel points in the highlight area of the to-be-corrected image as to-be-corrected pixel points, and correct the initial color values of the to-be-corrected pixel points according to the initial color values of the pixel points adjacent to the to-be-corrected pixel points.
[0007] In some embodiments of the present disclosure, using the pixel points in the highlight area of the to-be-corrected image as to-be-corrected pixel points, and correcting the initial color values of the to-be-corrected pixel points according to the initial color values of the pixel points adjacent to the to-be-corrected pixel points includes:
[0008] Slide a sliding window in the to-be-corrected image, and use the pixel points at a preset position in the sliding window as target pixel points;
[0009] Determine whether the target pixel points are in the highlight area, and use the target pixel points in the highlight area as the to-be-corrected pixel points;
[0010] Correct the initial color values of the to-be-corrected pixel points according to the initial color values of at least some pixel points in the sliding window.
[0011] In some embodiments of the present disclosure, the pixel points of the to-be-corrected image include blue pixel points, green pixel points, and red pixel points;
[0012] The determining whether the target pixel points are in the highlight area includes:
[0013] If the target pixel is a green pixel, when the initial color value of the target pixel is greater than the color threshold, it is determined that the target pixel is in the high-light area;
[0014] If the target pixel is a red pixel or a blue pixel, when the initial color value of at least one green pixel in the sliding window is greater than the color threshold, it is determined that the target pixel is in the high-light area.
[0015] In some embodiments of the present disclosure, the color threshold is determined according to the bit depth of the image to be corrected.
[0016] In some embodiments of the present disclosure, correcting the initial color value of the pixel to be corrected according to the initial color values of at least some of the pixels in the sliding window includes:
[0017] Obtaining the gain value of each pixel in the sliding window during the white balance processing, and taking the color of the pixel with the largest gain value as the target color;
[0018] Determining whether each pixel in the sliding window is in an overexposed state;
[0019] If each pixel in the sliding window is in an overexposed state, determine the target color value of the pixel to be corrected according to the initial color values of the pixels with the target color in the sliding window.
[0020] In some embodiments of the present disclosure, correcting the initial color value of the pixel to be corrected according to the initial color values of at least some of the pixels in the sliding window further includes:
[0021] If some of the pixels in the sliding window are in an overexposed state, determine the target color value of the pixel to be corrected according to the initial color values of the pixels with the target color in the sliding window and the initial color value of the pixel to be corrected.
[0022] In some embodiments of the present disclosure, determining the target color value of the pixel to be corrected according to the initial color values of the pixels with the target color in the sliding window and the initial color value of the pixel to be corrected includes:
[0023] Determining a correction parameter according to the initial color values of the pixels with the target color in the sliding window and the initial color value of the pixel to be corrected;
[0024] Taking the sum of the correction parameter and the initial color value of the pixel to be corrected as the target color value of the pixel to be corrected.
[0025] In some embodiments of the present disclosure, determining whether each pixel point in the sliding window is in an overexposed state includes:
[0026] When, in the sliding window, the average value of the initial color values of the pixel points having the target color is greater than the initial color value of the green pixel points, and there is an initial color value of another pixel point other than the pixel points having the target color and the green pixel points that is greater than the initial color value of the green pixel points, it is determined that each pixel point in the sliding window is in an overexposed state.
[0027] In some embodiments of the present disclosure, if it is determined that not all pixel points in the sliding window are in an overexposed state, the method of correcting the initial color value of the pixel point to be corrected according to the initial color values of at least some pixel points in the sliding window further includes:
[0028] When, in the sliding window, there is an initial color value of a pixel point having the target color that is greater than the initial color value of the green pixel points, and there is an initial color value of another pixel point other than the pixel points having the target color and the green pixel points that is less than the initial color value of the green pixel points, it is determined that some pixel points in the sliding window are in an overexposed state.
[0029] In some embodiments of the present disclosure, before sliding the sliding window in the image to be corrected, the image processing method further includes:
[0030] Performing boundary filling on the image to be corrected.
[0031] In some embodiments of the present disclosure, before performing the white balance processing, the image processing method further includes:
[0032] Increasing the bit depth of the image that has not undergone the white balance processing.
[0033] According to a second aspect of the present disclosure, there is provided an image processing apparatus, including:
[0034] An acquisition module, configured to acquire an image to be corrected after white balance processing;
[0035] A correction module, configured to use the pixel points in the highlight area of the image to be corrected as pixel points to be corrected, and correct the initial color value of the pixel points to be corrected according to the initial color values of the pixel points adjacent to the pixel points to be corrected.
[0036] According to a third aspect of the present disclosure, there is provided an electronic device, including:
[0037] A processor;
[0038] A memory for storing executable instructions of a processor;
[0039] Wherein, the processor is configured to execute the image processing method provided in the first aspect of the present disclosure.
[0040] According to the fourth aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium, which enables an electronic device to execute the image processing method provided in the first aspect of the present disclosure when the instructions in the storage medium are executed by a processor of the electronic device.
[0041] The technical solutions provided by the embodiments of the present disclosure may include the following beneficial effects: taking the pixel points in the highlight area of the image to be corrected after white balance processing as the pixel points to be corrected, and using the initial color values of the pixel points adjacent to the pixel points to be corrected to correct the initial color values of the pixel points to be corrected, which can make the color values of the corrected pixel points to be corrected close to the initial color values of the adjacent pixel points, thereby correcting the color cast phenomenon after white balance processing in the highlight area and restoring the true color of the image. In addition, the method provided by the present disclosure performs image processing on the image to be corrected itself, without the participation of other images, and the correction operation is simple and the correction efficiency is high.
[0042] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] The accompanying drawings herein are incorporated into the specification and form a part of the specification, showing embodiments consistent with the present invention and used together with the specification to explain the principles of the present invention.
[0044] Figure 1 is a flowchart of an image processing method shown according to an exemplary embodiment.
[0045] Figure 2 is a schematic diagram of an image to be corrected shown according to an exemplary embodiment.
[0046] Figures 3a to 3d is a schematic diagram of the arrangement of pixel points in a sliding window shown according to an exemplary embodiment.
[0047] Figure 4 is a general flowchart of an image processing method shown according to an exemplary embodiment.
[0048] Figure 5 is a schematic diagram of an image processing apparatus shown according to an exemplary embodiment.
[0049] Figure 6 is a schematic diagram of an electronic device shown according to an exemplary embodiment. DETAILED DESCRIPTION
[0050] Exemplary embodiments will be described in detail herein, and examples thereof are shown in the accompanying drawings. When the following description refers to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. On the contrary, they are merely examples of apparatuses and methods consistent with some aspects of the present invention as detailed in the appended claims.
[0051] After an image acquisition device acquires an image, in order to restore the true color of the image, white balance processing is usually performed on the image to calibrate the color of the image. However, during the white balance processing, usually by statistically analyzing the information in the image, calibration coefficients for the red pixel points and blue pixel points in the image are calculated, and the white balance calibration of the image is performed through the calibration coefficients of the red pixel points and blue pixel points. Therefore, after the white balance processing of the image, the highlight area that should originally be white in the image is prone to deviate from the true color of the area due to the calibration of the red pixel points and blue pixel points.
[0052] In view of this, the present disclosure provides an image processing method. In the to-be-corrected image after white balance processing, the pixel points in the highlight area are used as the to-be-corrected pixel points, and the initial color value of the to-be-corrected pixel points is corrected by using the initial color values of the pixel points adjacent to the to-be-corrected pixel points, which can make the color value of the corrected to-be-corrected pixel points close to the initial color values of the adjacent pixel points, thereby correcting the color deviation phenomenon after white balance processing in the highlight area and restoring the true color of the image. In addition, the image processing method provided by the present disclosure performs image processing on the to-be-corrected image itself without the participation of other images, and the correction operation is simple and the correction efficiency is high.
[0053] An exemplary embodiment of the present disclosure provides an image processing method, referring to Figure 1 as shown, Figure 1 is a flowchart of an image processing method shown according to an exemplary embodiment. The image processing method includes the following steps:
[0054] Step S100: Obtain a to-be-corrected image after white balance processing;
[0055] Step S200: Use the pixel points in the highlight area of the to-be-corrected image as the to-be-corrected pixel points, and correct the initial color value of the to-be-corrected pixel points according to the initial color values of the pixel points adjacent to the to-be-corrected pixel points.
[0056] In step S100, during the process of a camera, the CMOS image sensor or CCD image sensor of a mobile phone, etc., which are image acquisition devices, taking a picture of a certain scene, when the shutter is pressed and exposure starts, each photosensitive element of the image sensor converts the captured light source signal into an electrical signal. After the exposure ends, the image sensor is turned off. By measuring the intensity of the electrical signal corresponding to each photosensitive element, the electrical signal quantity is converted into a digital value to obtain a raw image. Since each photosensitive element on the image sensor cannot distinguish the quantity of each color, in order to capture a color image, each photosensitive element is provided with a color filter so that each photosensitive element only captures one of the three primary colors. Therefore, the raw image can include red (R), green (G), and blue (B) pixel points. The raw image is an image in raw format, and the raw image in raw format contains the original color information of the object. Since the image sensor does not have color adaptability, the color information in the raw image in raw format is not accurate. By performing white balance processing on the raw image in raw format, the color information in the raw image in raw format is made to be close to the human eye's visual color, reducing the color difference between the image color and the human eye's vision.
[0057] Since when performing white balance processing on the raw image in raw format, it is by statistically analyzing the information of the raw image in raw format and calculating the gain value for red pixel points (R gain ) and the gain value for blue pixel points (B gain ), multiplying the gain values with the color values of the red pixel points and the blue pixel points in the original raw image respectively to obtain the image after white balance calibration, that is, the image to be corrected. It can be understood that the color value of a pixel point is the digital value converted from the electrical signal value during the image recording process, that is, the pixel value. The image to be corrected can be obtained in the white balance processing module in the image acquisition device.
[0058] It can be understood that since the original raw-format image is usually acquired by an image sensor with a color filter placed on each photosensitive element, and the color filter array (CFA) of the image sensor usually adopts a Bayer array (Bayer array, which consists of alternately arranged green-red and blue-green filters). At the same time, considering that the human eye is more sensitive to colors in the green band, the weight of green pixels is usually increased in the Bayer array to increase the sampling of green information. Therefore, the Bayer array usually contains 50% green information, 25% red information, and 25% blue information each. Based on the different arrangements of color filters in different image sensors, the arrangement formats of R, G, and B pixels in the original raw-format image are different, and can include GRBG format, RGGB format, BGGR format, and GBRG format. Since white balance processing is performed on the original raw-format image, the image to be corrected after white balance processing is also an image in raw format. Refer to Figure 2 , Figure 2 exemplarily shows a schematic diagram of the image to be corrected in raw format, and the pixels in the image to be corrected exemplarily adopt the BGGR format.
[0059] In some examples, since the precision of the pixel values of the pixels in the image is determined by the bit depth of the image, and since white balance processing needs to perform gain on the pixel values of the pixels, after white balance processing, the pixel values of the pixels may overflow the upper limit determined by the current bit depth, affecting the white balance processing and the subsequent effect of correcting the image. For example, for a 12-bit raw-format image, the pixel value of the pixels in the image is 2^12 = 4096, and the range of the pixel value of each pixel is [0 - 4095]. When the original pixel value of a certain pixel in the image without white balance processing is 4095 and the gain coefficient of white balance for it is 1.3, after white balance processing, its pixel value is 4095 * 1.3 = 5324. Since 5324 > 4095, the data is limited by the bit depth of the image, and the pixel value of this pixel overflows, which is equivalent to the white balance processing of this pixel being ineffective.
[0060] To avoid the situation where the pixel values of the pixels in the above-mentioned image overflow, before performing white balance processing on the image, the bit depth of the image that has not undergone white balance processing can be increased to raise the upper limit of the pixel values of the image. For example, when the bit depth of the image that has not undergone white balance processing is 12 bits, its bit depth is increased to 16 bits. At this time, the pixel value of each pixel in the image is 2^16 = 65536, and the range of the pixel value of each pixel is [0 - 65535]. In this way, even if the original pixel value of a pixel in the image before white balance processing is 4095 and the gain coefficient of white balance for it is 1.3, the pixel value after white balance processing is 5324, which is much smaller than 65535. The pixel value of this pixel does not overflow, and this pixel can be normally gain-adjusted for white balance processing, which also makes the subsequent image correction more accurate.
[0061] In step S200, referring to Figure 2 , since the image to be corrected includes multiple pixels and the image to be corrected has undergone white balance processing, in the image to be corrected, the initial color value of the red pixel is equal to the product of the original pixel value (the digital value converted from the electrical signal value during the image recording process) and R gain , and the initial color value of the blue pixel is equal to the product of the original pixel value (the digital value converted from the electrical signal value during the image recording process) and B gain . In the image to be corrected, in the high-light areas such as white lamp tubes and overexposed sky areas, it should originally appear white. However, due to the gain of the white balance processing for the red and blue pixels and the non-gain of the green pixel, a deviation occurs between the initial color values of the red pixel, the blue pixel and the initial color value of the green pixel, resulting in the color of the high-light area in the image to be corrected deviating from the true color that should be presented.
[0062] In this embodiment, by detecting each pixel in the image to be corrected, it is determined whether each pixel is in the high-light area. The pixels in the high-light area are used as the pixels to be corrected, and the pixel values of the pixels to be corrected are corrected so that the color of the high-light area is close to the true color that it should present. Since in the image to be corrected, the pixel arrays of each color are arranged, when correcting the pixels to be corrected in the high-light area, the initial color values of other pixels adjacent to the pixels to be corrected are used as a reference to correct the initial color values of the pixels to be corrected, so that after correction, the pixel values of the pixels to be corrected are close to the pixel values of other adjacent pixels, that is, in the high-light area, R pixel value ≈ G pixel value ≈ B pixel value, thereby correcting the color cast phenomenon in the high-light area to the true color that it should present and realizing the color restoration of the color cast phenomenon.
[0063] It can be understood that the pixels adjacent to the pixel to be corrected can be multiple pixels in the four directions of up, down, left, and right of the pixel to be corrected with the pixel to be corrected as the center, or multiple pixels in the upper left, lower left, upper right, and lower right directions of the pixel to be corrected, or multiple pixels surrounding the pixel to be corrected. Exemplarily, when correcting the initial color value of the pixel to be corrected using the initial color values of the pixels adjacent to the pixel to be corrected, the average value of the initial color values of multiple adjacent pixels can be calculated to correct the initial color value of the pixel to be corrected; the median value of the initial color values of multiple adjacent pixels can also be used to correct the initial color value of the pixel to be corrected; or, a weighted calculation can be performed on the initial color values of multiple adjacent pixels to correct the initial color value of the pixel to be corrected, and so on, as long as the corrected color value of the pixel to be corrected is close to the initial color value of the adjacent pixel.
[0064] It should be noted that the timing of the correction operation on the pixel to be corrected in the present disclosure is not limited. It can be during the process of detecting each pixel in the image to be corrected to determine whether it is in a high-light area. After determining that a certain pixel is in a high-light area, the correction operation on the pixel to be corrected is immediately performed. Or, it can also be after determining all the pixels to be corrected in the high-light area in the image to be corrected, and then uniformly correcting each pixel to be corrected in the high-light area.
[0065] In an exemplary embodiment, in step S200 of the image processing method provided in the above embodiment, the pixels in the high-light area in the image to be corrected are used as the pixels to be corrected, and the initial color value of the pixel to be corrected is corrected according to the initial color values of the pixels adjacent to the pixel to be corrected, including:
[0066] Step S210: Slide a sliding window in the image to be corrected, and use the pixel at a preset position in the sliding window as the target pixel;
[0067] Step S220: Determine whether the target pixel is in a high-light area, and use the target pixel in the high-light area as the pixel to be corrected;
[0068] Step S230: Correct the initial color value of the pixel to be corrected according to the initial color values of at least some pixels in the sliding window.
[0069] In step S210, a sliding window is used to select pixel points in the image to be corrected, so as to determine whether the pixel points in the image to be corrected are in the high-light region. At the same time, after determining that the target pixel point in the sliding window is the pixel point to be corrected, the sliding window can also limit the number of pixel points adjacent to the pixel point to be corrected. The sliding window can be a sliding window of any shape such as a square, a regular hexagon, a circle, etc. At the same time, the size of the sliding window can also be selected according to requirements. In some examples, a square sliding window can be selected, and the size of the sliding window can be 3*3 or 4*4. Refer to Figure 2 as shown Figure 2 The thick dashed line in shows a 3*3 square sliding window. Among them, the sliding window can be a virtual window range, and it slides under the control of the background according to the content of the image to be corrected.
[0070] When the sliding window slides in the image to be corrected, it can slide in any direction in the image to be corrected, so that each pixel point in the image to be corrected can be at a preset position within the sliding window as the target pixel point. For example, when the sliding window is square, the sliding window can slide left and right, up and down, or along the diagonal direction of the sliding window. At the same time, it should be noted that when the sliding window slides, the sliding step of the sliding window is greater than or equal to 1, that is, it moves at least one pixel point in one slide. Of course, it can be understood that the sliding window can also move multiple pixel points in one slide, which is not limited in this disclosure.
[0071] Since the sliding window can include multiple pixel points, before correcting the image to be corrected, the pixel point at the preset position within the sliding window is determined as the pixel point that needs to be judged whether it is in the high-light region. Before the image to be corrected is completed, the shape, size, and determined preset position of the sliding window do not change to avoid missing the selection of pixel points in the image to be corrected. It can be understood that the preset position can be any position within the sliding window selected based on requirements. In some examples, the preset position within the sliding window can be the central position within the sliding window, that is, the pixel point located at the central position within the sliding window is used as the target pixel point, so that when the target pixel point is determined as the pixel point to be corrected, there are multiple pixel points surrounding the pixel point to be corrected, which is convenient for correcting the initial color value of the pixel point to be corrected.
[0072] In step S220, after determining the target pixel point, it is determined whether the target pixel point is in the high-light region of the image to be corrected. Since each target pixel point has an initial color value, and the other pixel points in the sliding window also have their corresponding initial color values, and the image to be corrected also has information such as bit depth and brightness value threshold, in some examples, in the process of determining whether the target pixel point is in the high-light region, it can be determined whether the target pixel point is in the high-light region based on the information included in the image to be corrected and the initial color value of the target pixel point. In other examples, in the process of determining whether the target pixel point is in the high-light region, the information included in the image to be corrected and the initial color values of the other pixel points in the sliding window can be used to assist in determining whether the target pixel point is in the high-light region.
[0073] When it is determined that the target pixel point in the sliding window is in the high-light region, it is determined that the target pixel point is the pixel point to be corrected that needs to be corrected. For example, it can be marked to facilitate subsequent correction of the initial color value of the pixel point to be corrected.
[0074] In step S230, since in addition to the target pixel point determined to be the pixel point to be corrected in the sliding window, there are other pixel points, and these pixel points are adjacent to the pixel point to be corrected in terms of spatial position, therefore, the other pixel points in the sliding window except the pixel point to be corrected can be used as the pixel points adjacent to the pixel point to be corrected.
[0075] When correcting the initial color value of the pixel point to be corrected, the initial color values of some pixel points in the sliding window can be selected to correct the initial color value of the pixel point to be corrected based on information such as the color of the pixel point to be corrected, the overexposure situation of the pixel point to be corrected, and the overexposure situations of the other pixel points in the sliding window, or the initial color values of all pixel points in the sliding window can be selected to correct the initial color value of the pixel point to be corrected.
[0076] In some possible implementation manners, since there are boundaries for the pixel points in the image to be corrected, when the sliding window slides in the image to be corrected, it may not be possible to make the pixel points in the edge region of the image to be corrected located at the preset positions in the sliding window, that is, it is not possible to make the pixel points in the edge region be used as target pixel points to determine whether they are in the high-light region. Therefore, before the sliding window slides in the image to be corrected, boundary filling can be performed on the image to be corrected so that the pixel points in the edge region of each image to be corrected can be used as target pixel points to facilitate subsequent correction of the target pixel point.
[0077] The present disclosure places no restrictions on the method of boundary filling. In some examples, for instance, a specified constant pixel value used for filling the image edge can be adopted to perform edge filling on the image to be corrected. In other examples, the pixel values of the row or column closest to the boundary in the image to be corrected can be copied and filled to the outer edge of the image to be corrected to perform edge filling on the image to be corrected. In still other examples, mirror filling can be used to perform edge filling on the image to be corrected.
[0078] In some possible implementation manners, in step S220 provided in the above embodiment, determining whether the target pixel point is in the highlight area includes:
[0079] Step S221: If the target pixel point is a green pixel point, when the initial color value of the target pixel point is greater than the color threshold, it is determined that the target pixel point is in the highlight area;
[0080] Step S222: If the target pixel point is a red pixel point or a blue pixel point, when the initial color value of at least one green pixel point in the sliding window is greater than the color threshold, it is determined that the target pixel point is in the highlight area.
[0081] As described in the above embodiment, the image to be corrected is an image in raw format, and the pixel points included therein include blue pixel points, green pixel points, and red pixel points. At the same time, the initial color values of the blue pixel points and red pixel points in the image to be corrected are pixel values after white balance gain, while the initial color value of the green pixel point is still the original pixel value in the image. Therefore, when determining whether the target pixel point in the sliding window is in the highlight area, the initial color value of the green pixel point in the sliding window can be used for judgment.
[0082] When determining whether the target pixel point is in the highlight area, the initial color value of the green pixel point in the sliding window can be compared with the color threshold used as the judgment benchmark to complete the judgment. The color threshold can be the upper limit value of the pixel value preset by the designer in the image capture device, and it can be obtained when determining whether the pixel point is in the highlight area.
[0083] In step S221, when the target pixel point is a green pixel point, the initial color value of the target pixel point can be directly used for judgment. The initial color value of the target pixel point is compared with the color threshold. When the initial color value of the target pixel point is greater than the color threshold, it is determined that the target pixel point is in the highlight area, and the target pixel point can be used as the pixel point to be corrected. When the initial color value of the target pixel point is less than or equal to the color threshold, it is determined that the target pixel point is not in the highlight area, and the target pixel point may not be corrected.
[0084] In some examples, when the sliding window is a 3*3 square, refer to Figures 3a to 3d as shown in Figures 3a to 3d which shows the pixel distribution when the pixel at the center position of the sliding window is a target pixel of different colors. When the target pixel is a green pixel, refer to Figures 3a to 3b to compare the initial color value of the target pixel at the center position with the color threshold to complete the determination of whether the target pixel is in a highlight area.
[0085] In step S222, when the target pixel is a red pixel or a blue pixel, the initial color value of the green pixel in the sliding window where the target pixel is located can be directly obtained, and the initial color value of each green pixel is compared with the color threshold to determine whether the target pixel is in a highlight area. As long as there is at least one initial color value of the green pixel in the sliding window that is greater than the color threshold, it is determined that the target pixel with the color of red or blue is in the highlight area. When the initial color values of all the green pixels in the sliding window are less than or equal to the color threshold, it is determined that the target pixel is not in the highlight area, and the target pixel may not be corrected. In some examples, when the sliding window is a 3*3 square and the target pixel is a red pixel or a blue pixel, refer to Figure 3c and Figure 3d as shown in
[0086] to compare the initial color value of each green pixel in the sliding window with the color threshold to complete the determination of whether the target pixel at the center position is in a highlight area.
[0087] It can be understood that steps S221 and S222 are different ways of determining whether the target pixel is in a highlight area based on different colors of the target pixel, that is, steps S221 and S222 are parallel and are executed based on the color of the target pixel.
[0088] In some examples, the color threshold is expressed as:
[0089] X = a * raw_TH - b
[0090] Where X is the color threshold, a and b are coefficient values determined based on empirical values or the pixel value distribution in the image to be corrected, and raw_TH is the upper limit value of the pixel value determined based on the bit depth of the image to be corrected.
[0091] It can be understood that since the bit depth of the image is usually increased before white balance processing of the image, that is, the bit depth of the image to be corrected after white balance processing is also increased, the pixel values of some pixel points in the image to be corrected may exceed the upper limit of the original bit depth. Therefore, when determining the color threshold, the current bit depth of the image to be corrected is used for calculation to make the judgment accuracy of whether the pixel point is in the highlight area higher.
[0092] In an exemplary embodiment, in step S230 provided in the above embodiment, according to the initial color values of at least some pixel points in the sliding window, correcting the initial color value of the pixel point to be corrected includes:
[0093] Step S231: Obtain the gain values of each pixel point in the sliding window during white balance processing, and use the color of the pixel point with the largest gain value as the target color;
[0094] Step S232: Determine whether each pixel point in the sliding window is in an overexposed state;
[0095] Step S233: If each pixel point in the sliding window is in an overexposed state, determine the target color value of the pixel point to be corrected according to the initial color values of the pixel points with the target color in the sliding window.
[0096] In this embodiment, when it is determined that the target pixel point in the sliding window is in the highlight area of the image to be corrected, after taking this target pixel point as the pixel point to be corrected, based on the situation of each pixel point in the sliding window, select the initial color values of some or all pixel points in the sliding window to correct the initial color value of the pixel point to be corrected.
[0097] Since the true color that the highlight area of the image should originally present is white, that is, in the highlight area, R pixel value ≈ G pixel value ≈ B pixel value. In the image to be corrected, the red pixel points and blue pixel points are gain-adjusted during white balance processing. Of course, the gain can be positive gain or negative gain, which causes the initial color values of the red pixel points and blue pixel points to deviate from the initial color value of the green pixel points.
[0098] When correcting the pixels to be corrected, determine the pixel (red pixel or blue pixel) of the color that receives the maximum gain during white balance processing in the sliding window, and use this color as the target color. The initial color value of the pixel corresponding to the target color must be greater than the initial color values of the pixels of other colors in the sliding window. Therefore, based on the initial color value of the pixel corresponding to the target color, correct the initial color value of the pixel to be corrected to be close to the initial color value of the pixel corresponding to the target color, so that the R pixel value ≈ G pixel value ≈ B pixel value in the highlight area, so that the highlight area of the image will not be color-biased when displayed, and the image presents the correct color.
[0099] Of course, it can be understood that when the color of the pixel to be corrected is exactly the target color, and the initial color value of the pixel to be corrected is greater than the pixel values of the pixels of other colors in the sliding window, there is no need to correct the pixel to be corrected, that is, the initial color value of the pixel of the target color is equal to the target color value of the pixel to be corrected. The sliding window slides to correct the initial color values of other pixels around the pixel.
[0100] In step S231, based on the sliding window where the pixel to be corrected is located, obtain the gain value obtained by each pixel during white balance processing from the white balance module of the image acquisition device, and use the color of the pixel with the largest gain value as the target color. That is, in the sliding window, the initial color value of the pixel of the target color is the maximum value. Since in a raw format image, white balance processing performs gain on red pixels and blue pixels, when R gain >B gain , red is used as the target color, and the initial color value of the red pixel in the sliding window is larger; when B gain >R gain , blue is used as the target color, and the initial color value of the blue pixel in the sliding window is larger.
[0101] In step S232, in the image to be corrected, it may be that the highlight area is color-biased because the red pixels, blue pixels, and green pixels are all overexposed, or it may be that the highlight area is color-biased because one or two of the red pixels, blue pixels, and green pixels are overexposed. Therefore, when correcting the pixel to be corrected, it is also necessary to determine the overexposure situation of each pixel in the sliding window, so as to perform different corrections on the pixel to be corrected based on different overexposure situations.
[0102] First, it is determined whether each pixel point in the sliding window is in an overexposed state. Since the initial color value of the green pixel points in the sliding window is the one without white balance processing gain, when determining whether a pixel point is in a high-light state, the initial color value of the green pixel points is also used for judgment. Therefore, the initial color value of each pixel point in the sliding window can be compared with the initial color value of any one green pixel point in the sliding window to determine whether each pixel point in the sliding window is in an overexposed state.
[0103] For example, in some examples, when the initial color value of the green pixel point is the minimum value among the initial color values of each pixel point in the sliding window, it is determined that each pixel point is in an overexposed state. For another example, in some other examples, when there is an initial color value of a red pixel point in the sliding window greater than the initial color value of the green pixel point, and there is an initial color value of a blue pixel point greater than the initial color value of the green pixel point, it is determined that each pixel point is in an overexposed state.
[0104] For another example, in some other examples, since in the sliding window, the initial color value of the pixel points of the target color is the maximum value, when in the sliding window, the average value of the initial color values of the pixel points with the target color is greater than the initial color value of the green pixel point, and there is an initial color value of a pixel point other than the pixel points of the target color and the green pixel point greater than the initial color value of the green pixel point, it can be determined that each pixel point in the sliding window is in an overexposed state.
[0105] For example, when R gain >B gain At this time, red is used as the target color. When the average value of the initial color values of the R pixel points in the sliding window > the initial color value of the G pixel point, and there is an initial color value of a B pixel point > the initial color value of the G pixel point, it is determined that each pixel point in the sliding window where the pixel point to be corrected is located is in an overexposed state. For another example, when B gain >R gain At this time, blue is used as the target color. When the average value of the initial color values of the B pixel points in the sliding window > the initial color value of the G pixel point, and there is an initial color value of an R pixel point > the initial color value of the G pixel point, it is determined that each pixel point in the sliding window where the pixel point to be corrected is located is in an overexposed state.
[0106] In step S233, when it is determined that all pixel points in the sliding window are in an overexposed state, directly use the initial color values of the pixel points with the target color in the sliding window as a reference to correct the initial color value of the pixel point to be corrected, and determine the target color value of the pixel point to be corrected. For example, in some examples, the maximum value of the initial color values of the pixel points with the target color in the sliding window can be used as the target color value of the pixel point to be corrected. In other examples, the median of the initial color values of the pixel points with the target color in the sliding window can also be used as the target color value of the pixel point to be corrected. In other examples, the average value of the initial color values of the pixel points with the target color in the sliding window can also be used as the target color value of the pixel point to be corrected.
[0107] When all pixel points in the sliding window are in an overexposed state, combined with Figures 3a to 3d , a detailed description of the correction of the pixel point to be corrected is given. In this example, the average value of the initial color values of the pixel points with the target color in the sliding window is used as the target color value of the pixel point to be corrected.
[0108] In some examples, referring to Figures 3a to 3b , when red is the target color and the pixel point to be corrected at the center position of the sliding window is a green pixel point, since there are two red pixel points in the sliding window, it is determined that the target color value of the pixel point to be corrected is equal to the average value of the initial color values of the two red pixel points. In some examples, referring to Figure 3c , when red is the target color and the pixel point to be corrected at the center position of the sliding window is a blue pixel point, since there are four red pixel points in the sliding window, it is determined that the target color value of the pixel point to be corrected is equal to the average value of the initial color values of the four red pixel points. In some examples, referring to Figure 3d , when red is the target color and the pixel point to be corrected at the center position of the sliding window is a red pixel point, and there is only one red pixel point in the sliding window, then there is no need to correct this pixel point to be corrected, that is, the initial color value of the pixel point of the target color is equal to the target color value of the pixel point to be corrected.
[0109] In some examples, referring to Figures 3a to 3b , when blue is the target color and the pixel point to be corrected at the center position of the sliding window is a green pixel point, since there are two blue pixel points in the sliding window, it is determined that the target color value of the pixel point to be corrected is equal to the average value of the initial color values of the two blue pixel points. In some examples, referring to Figure 3d, when blue is the target color and the pixel point to be corrected at the center position of the sliding window is a red pixel point, since there are four blue pixel points in the sliding window, it is determined that the target color value of the pixel point to be corrected is equal to the average of the initial color values of the four blue pixel points. In some examples, refer to Figure 3c , when blue is the target color and the pixel point to be corrected at the center position of the sliding window is a blue pixel point, and there is only one blue pixel point in the sliding window, there is no need to correct this pixel point to be corrected, that is, the initial color value of the pixel point of the target color is equal to the target color value of the pixel point to be corrected.
[0110] In an exemplary embodiment, in step S230 provided in the above embodiment, after the judgment process of step S232, if it is determined that not all pixel points in the sliding window are in the overexposed state, in step S230, according to the initial color values of at least some pixel points in the sliding window, correcting the initial color value of the pixel point to be corrected further includes:
[0111] Step S234, determine whether there are some pixel points in the sliding window that are in the overexposed state.
[0112] Since the initial color value of the green pixel point in the sliding window is not white balance gain-adjusted, when judging whether a pixel point is in the highlight state, the initial color value of the green pixel point is also used for judgment. Therefore, the initial color value of each pixel point in the sliding window can be compared with the initial color value of any one green pixel point in the sliding window to determine whether only some pixel points in the sliding window are in the overexposed state. When there are some pixel points in the sliding window that are in the overexposed state, the pixel point to be corrected is further corrected. When there are no pixel points in the sliding window that are in the overexposed state, there is no need to correct the pixel point to be corrected.
[0113] For example, in some examples, when the initial color value of a pixel point in the sliding window is less than the initial color value of the green pixel point, it is determined that only some pixel points in the sliding window are in the overexposed state. For another example, in other examples, since the initial color value of the pixel point of the target color in the sliding window is the maximum value, when there is a pixel point with the target color in the sliding window whose initial color value is greater than the initial color value of the green pixel point, and there is a pixel point other than the pixel point of the target color and the green pixel point whose initial color value is less than the initial color value of the green pixel point, it can be determined that some pixel points in the sliding window are in the overexposed state.
[0114] For example, when R gain >B gainWhen red is the target color, when there is an initial color value of an R pixel point > the initial color value of a G pixel point in the sliding window, and there is an initial color value of a B pixel point < the initial color value of a G pixel point, it is determined that only some of the pixel points in the sliding window where the pixel point to be corrected is located are in the overexposed state. For another example, when B gain >R gain When blue is the target color, when the average value of the initial color values of a B pixel point in the sliding window > the initial color value of a G pixel point, and there is an initial color value of an R pixel point < the initial color value of a G pixel point, it is determined that only some of the pixel points in the sliding window where the pixel point to be corrected is located are in the overexposed state.
[0115] In an exemplary embodiment, in step S230 provided in the above embodiment, after the judgment process of step S234, if it is determined that not all pixel points in the sliding window are in the overexposed state and it is determined that there are some pixel points in the sliding window in the overexposed state, in step S230, correcting the initial color value of the pixel point to be corrected according to the initial color values of at least some pixel points in the sliding window further includes:
[0116] Step S235: If some pixel points in the sliding window are in the overexposed state, determine the target color value of the pixel point to be corrected according to the initial color values of the pixel points with the target color in the sliding window and the initial color value of the pixel point to be corrected.
[0117] In this embodiment, when it is determined that only some pixel points in the sliding window are in the overexposed state, it may be that the pixel points with the target color in the sliding window are in the overexposed state, or it may be that the pixel points with the target color and the pixel point to be corrected in the sliding window are in the overexposed state. When correcting the pixel point to be corrected, it is necessary to consider the pixel points that are not overexposed in the sliding window. Therefore, it is necessary to simultaneously use the initial color values of the pixel points with the target color in the sliding window and the initial color value of the pixel point to be corrected to determine a correction coefficient and fine-tune the initial color value of the pixel point to be corrected to determine the target color value of the pixel point to be corrected.
[0118] For example, in some examples, the maximum / average / median of the initial color values of the pixel points with the target color in the sliding window can be selected, the difference between the maximum / average / median and the initial color value of the pixel point to be corrected is calculated, and based on the magnitude of the difference, a correction coefficient is determined. The correction coefficient is multiplied by the initial color value of the pixel point to be corrected, and the product is used as the target color value of the pixel point to be corrected. In other examples, the maximum / average / median of the initial color values of the pixel points with the target color in the sliding window can be selected, the difference between the maximum / average / median and the initial color value of the pixel point to be corrected is calculated, and the sum of the difference and the initial color value of the pixel point to be corrected is used as the target color value of the pixel point to be corrected.
[0119] In some possible implementation manners, in step S235 provided in the above embodiment, according to the initial color values of the pixel points with the target color in the sliding window and the initial color value of the pixel point to be corrected, determining the target color value of the pixel point to be corrected includes:
[0120] Step S101: Determine a correction parameter according to the initial color values of the pixel points with the target color in the sliding window and the initial color value of the pixel point to be corrected;
[0121] Step S102: Use the sum of the correction parameter and the initial color value of the pixel point to be corrected as the target color value of the pixel point to be corrected.
[0122] In this embodiment, the correction parameter is the coefficient for correcting the pixel point to be corrected. In some examples, the method for obtaining the correction parameter can be, for example, selecting the maximum / average / median of the initial color values of the pixel points with the target color in the sliding window, calculating the difference between the maximum / average / median and the initial color value of the pixel point to be corrected, and using the difference as the correction parameter.
[0123] In other examples, the correction parameter also needs to consider the color of the pixel point to be corrected itself. For pixel points to be corrected with different colors, due to reasons such as the sensitivity of the human eye, the weight coefficients during their correction may be different. That is to say, each pixel point to be corrected with a certain color can be correspondingly set with a correction weight coefficient. Therefore, the maximum / average / median of the initial color values of the pixel points with the target color in the sliding window can be selected, the difference between the maximum / average / median and the initial color value of the pixel point to be corrected is calculated, the difference is multiplied by the correction weight coefficient corresponding to the color of the pixel point to be corrected, and the obtained product is used as the correction coefficient.
[0124] Further, after determining the correction parameter, the initial color value of the pixel to be corrected is corrected based on the correction coefficient. Exemplarily, the sum of the correction parameter and the initial color value of the pixel to be corrected is used as the target color value of the pixel to be corrected, completing the correction of the pixel to be corrected.
[0125] When there are some overexposed pixels in the sliding window, in combination with Figures 3a to 3d , the correction of the pixel to be corrected is described in detail. In this example, the average value of the initial color values of the pixels with the target color in the sliding window is calculated, the difference between the average value and the initial color value of the pixel to be corrected is calculated, the difference is multiplied by the correction weight coefficient corresponding to the color of the pixel to be corrected, and the obtained product is used as the correction coefficient. Further, the sum of the correction parameter and the initial color value of the pixel to be corrected is used as the target color value of the pixel to be corrected.
[0126] In some examples, referring to Figures 3a to 3b , when red is the target color and the pixel to be corrected at the center position of the sliding window is a green pixel, since there are two red pixels in the sliding window, the correction coefficient can be expressed as: w1((R1 + R2) / 2 - G), where R1 and R2 are the initial color values of the two red pixels in the sliding window, G is the color value of the pixel to be corrected, and w1 is the correction weight coefficient corresponding to the green pixel. Then the target color value of the pixel to be corrected can be expressed as: w1((R1 + R2) / 2 - G) + G.
[0127] In some examples, referring to Figure 3c , when red is the target color and the pixel to be corrected at the center position of the sliding window is a blue pixel, since there are four red pixels in the sliding window, the correction coefficient can be expressed as: w2((R1 + R2 + R3 + R4) / 4 - B), where R1, R2, R3, and R4 are the initial color values of the four red pixels in the sliding window, B is the color value of the pixel to be corrected, and w2 is the correction weight coefficient corresponding to the blue pixel. Then the target color value of the pixel to be corrected can be expressed as: w2((R1 + R2 + R3 + R4) / 4 - B) + B.
[0128] In some examples, referring to Figure 3d , when red is the target color and the pixel to be corrected at the center position of the sliding window is a red pixel, there is only one red pixel in the sliding window, so there is no need to correct this pixel to be corrected, that is, the initial color value of the pixel with the target color is equal to the target color value of the pixel to be corrected.
[0129] In some examples, referring to Figures 3a to 3bWhen blue is the target color and the pixel point to be corrected at the center position of the sliding window is a green pixel point, since there are two blue pixel points in the sliding window, the correction coefficient can be expressed as: w1((B1 + B2) / 2 - G), where B1 and B2 are the initial color values of the two blue pixel points in the sliding window, G is the color value of the pixel point to be corrected, and w1 is the correction weight coefficient corresponding to the green pixel point. Then the target color value of the pixel point to be corrected can be expressed as: w1((B1 + B2) / 2 - G) + G.
[0130] In some examples, refer to Figure 3d When blue is the target color and the pixel point to be corrected at the center position of the sliding window is a red pixel point, since there are four blue pixel points in the sliding window, the correction coefficient can be expressed as: w3((B1 + B2 + B3 + B4) / 4 - R), where B1, B2, B3, and B4 are the initial color values of the four blue pixel points in the sliding window, R is the color value of the pixel point to be corrected, and w3 is the correction weight coefficient corresponding to the red pixel point. Then the target color value of the pixel point to be corrected can be expressed as: w3((B1 + B2 + B3 + B4) / 4 - R) + R.
[0131] In some examples, refer to Figure 3c When blue is the target color and the pixel point to be corrected at the center position of the sliding window is a blue pixel point, there is only one blue pixel point in the sliding window, so there is no need to correct this pixel point to be corrected, that is, the initial color value of the pixel point of the target color is equal to the target color value of the pixel point to be corrected.
[0132] It can be understood that after each pixel point to be corrected is corrected, that is, after obtaining the target color value of each pixel point to be corrected, the target color value is stored. In the subsequent process of correcting other pixel points, although the sliding window includes pixel points that have been corrected, the initial color value of the corrected pixel point is still used for correction. After all the pixel points to be corrected in the highlight area of the image to be corrected are corrected, the target color value corresponding to each pixel point to be corrected is called for display.
[0133] The overall working process of the technical solution of the present disclosure will be described below. Refer to Figure 4 As shown in Figure 4 is the overall flowchart of the image processing method provided by an exemplary embodiment of the present disclosure. The image processing method provided by the present disclosure includes the following steps:
[0134] S1. Increase the bit depth of the image without white balance processing.
[0135] S2. Obtain the image to be corrected after white balance processing.
[0136] S3. Perform boundary filling on the image to be corrected.
[0137] S4. Slide a sliding window over the image to be corrected, and use the pixel points at preset positions within the sliding window as target pixel points.
[0138] S5. Determine whether the target pixel points are in a high - light area;
[0139] If so, execute S6; if not, execute S12.
[0140] S6. Use the target pixel points in the high - light area as the pixel points to be corrected.
[0141] S7. Obtain the gain values of each pixel point in the sliding window during white - balance processing, and use the color of the pixel point with the maximum gain value as the target color.
[0142] S8. Determine whether all pixel points in the sliding window are in an over - exposure state;
[0143] If so, execute S9; if not, execute S10.
[0144] S9. Determine the target color value of the pixel point to be corrected according to the initial color values of the pixel points with the target color in the sliding window.
[0145] S10. Determine whether some pixel points in the sliding window are in an over - exposure state;
[0146] If so, execute S11; if not, execute S12.
[0147] S11. Determine the target color value of the pixel point to be corrected according to the initial color values of the pixel points with the target color in the sliding window and the initial color value of the pixel point to be corrected.
[0148] S12. Do not correct the target pixel points.
[0149] In one exemplary embodiment, the present disclosure exemplarily provides an image processing apparatus, which is configured to be capable of executing the image processing method in the above - mentioned embodiment, as Figure 5 shown, Figure 5 is a block diagram of the image processing apparatus shown in an exemplary embodiment. The image processing apparatus includes the following modules:
[0150] An acquisition module 100, which is configured to acquire the image to be corrected after white - balance processing;
[0151] The correction module 200 is configured to use the pixel points in the highlight area of the image to be corrected as the pixel points to be corrected, and correct the initial color value of the pixel points to be corrected according to the initial color values of the pixel points adjacent to the pixel points to be corrected.
[0152] In an exemplary embodiment, the correction module 200 is configured to:
[0153] Slide a sliding window over the image to be corrected, and use the pixel points at a preset position within the sliding window as the target pixel points;
[0154] Determine whether the target pixel points are in the highlight area, and use the target pixel points in the highlight area as the pixel points to be corrected;
[0155] Correct the initial color value of the pixel points to be corrected according to the initial color values of at least some of the pixel points in the sliding window.
[0156] In an exemplary embodiment, the correction module 200 is configured to:
[0157] If the target pixel point is a green pixel point, when the initial color value of the target pixel point is greater than the color threshold, it is determined that the target pixel point is in the highlight area;
[0158] If the target pixel point is a red pixel point or a blue pixel point, when the initial color value of at least one green pixel point in the sliding window is greater than the color threshold, it is determined that the target pixel point is in the highlight area.
[0159] In some possible implementation manners, the correction module 200 is further configured to:
[0160] Obtain the gain values of the pixel points in the sliding window during white balance processing, and use the color of the pixel point with the largest gain value as the target color;
[0161] Determine whether all the pixel points in the sliding window are in the overexposed state;
[0162] If all the pixel points in the sliding window are in the overexposed state, determine the target color value of the pixel points to be corrected according to the initial color values of the pixel points with the target color in the sliding window.
[0163] In some possible implementation manners, the correction module 200 is further configured to:
[0164] If some of the pixel points in the sliding window are in the overexposed state, determine the target color value of the pixel points to be corrected according to the initial color values of the pixel points with the target color in the sliding window and the initial color value of the pixel points to be corrected.
[0165] In an exemplary embodiment, the correction module 200 is further configured to:
[0166] Determine a correction parameter according to the initial color values of the pixel points with the target color in the sliding window and the initial color value of the pixel point to be corrected;
[0167] Use the sum of the correction parameter and the initial color value of the pixel point to be corrected as the target color value of the pixel point to be corrected.
[0168] In an exemplary embodiment, the correction module 200 is further configured to:
[0169] When, in the sliding window, the average value of the initial color values of the pixel points with the target color is greater than the initial color value of the green pixel points, and there is an initial color value of another pixel point other than the pixel points with the target color and the green pixel points that is greater than the initial color value of the green pixel points, determine that all the pixel points in the sliding window are in an overexposed state.
[0170] In an exemplary embodiment, if it is determined that not all the pixel points in the sliding window are in an overexposed state, the correction module 200 is further configured to:
[0171] When, in the sliding window, there is an initial color value of a pixel point with the target color that is greater than the initial color value of the green pixel points, and there is an initial color value of another pixel point other than the pixel points with the target color and the green pixel points that is less than the initial color value of the green pixel points, determine that some of the pixel points in the sliding window are in an overexposed state.
[0172] In an exemplary embodiment, before using the sliding window to slide in the image to be corrected, the image processing device is further configured to:
[0173] Perform boundary filling on the image to be corrected.
[0174] In an exemplary embodiment, before performing white balance processing, the image processing device is further configured to:
[0175] Increase the bit depth of the image that has not undergone white balance processing.
[0176] Regarding the device in the above embodiments, the specific manners in which each module performs operations have been described in detail in the embodiments related to the method, and will not be elaborated here.
[0177] Figure 6 is a block diagram of an electronic device 600 for performing an image processing method shown according to an exemplary embodiment. The electronic device 600 may be, for example, a device such as a camera, a mobile phone, a tablet computer, a laptop computer, a smart watch, etc. that is provided with an image acquisition device. Refer to Figure 6, the electronic device 600 may include one or more of the following components: a processing component 602, a memory 604, a power component 606, a multimedia component 608, an audio component 610, an input / output (I / O) interface 612, a sensor component 614, and a communication component 616.
[0178] The processing component 602 generally controls the overall operation of the electronic device 600, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing component 602 may include one or more processors 620 to execute instructions to complete all or part of the steps of the above-described image processing method. In addition, the processing component 602 may include one or more modules to facilitate the interaction between the processing component 602 and other components. For example, the processing component 602 may include a multimedia module to facilitate the interaction between the multimedia component 608 and the processing component 602.
[0179] The memory 604 is configured to store various types of data to support the operation of the electronic device 600. Examples of such data include instructions for any application or method operating on the electronic device 600, contact data, phone book data, messages, pictures, videos, etc. The memory 604 may be implemented by any type of volatile or non-volatile storage device or a combination thereof, 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, a magnetic disk, or an optical disk.
[0180] The power component 606 provides power to the various components of the electronic device 600. The power component 606 may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power for the electronic device 600.
[0181] The multimedia component 608 includes a screen that provides an output interface between the electronic device 600 and the user. 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 can be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors can sense not only the boundaries of touch or swipe actions but also detect the duration and pressure associated with the touch or swipe operations. In some embodiments, the multimedia component 608 includes a front camera and / or a rear camera. When the electronic device 600 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera can receive external multimedia data. Each of the front camera and the rear camera can be a fixed optical lens system or have a focal length and optical zoom capabilities.
[0182] The audio component 610 is configured to output and / or input audio signals. For example, the audio component 610 includes a microphone (MIC) that is configured to receive external audio signals when the electronic device 600 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals can be further stored in the memory 604 or transmitted via the communication component 616. In some embodiments, the audio component 610 further includes a speaker for outputting audio signals.
[0183] The I / O interface 612 provides an interface between the processing component 602 and a peripheral interface module, which can be a keyboard, a click wheel, buttons, etc. These buttons can include but are not limited to: a home button, a volume button, a power button, and a lock button.
[0184] The sensor component 614 includes one or more sensors for providing an assessment of various aspects of the state of the electronic device 600. For example, the sensor component 614 can detect the on / off state of the electronic device 600, the relative positioning of components, such as the display and keypad of the electronic device 600. The sensor component 614 can also detect a change in the position of the electronic device 600 or a component of the electronic device 600, the presence or absence of user contact with the electronic device 600, the orientation or acceleration / deceleration of the electronic device 600, and a change in the temperature of the electronic device 600. The sensor component 614 can include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor component 614 can also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor component 614 can further include an acceleration sensor, a gyro sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0185] The communication component 616 is configured to facilitate communication between the electronic device 600 and other devices in a wired or wireless manner. The electronic device 600 can access a communication standard-based wireless network, such as WiFi, 2G, or 3G, or a combination thereof. In an exemplary embodiment, the communication component 616 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 616 further includes a Near Field Communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on Radio Frequency Identification (RFID) technology, Infrared Data Association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
[0186] In an exemplary embodiment, the electronic device 600 can 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, microcontrollers, microprocessors, or other electronic components for performing the above image processing method.
[0187] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions, such as a memory 604 including instructions, is also provided. The above instructions can be executed by a processor 620 of the electronic device 600 to complete the above image processing method. For example, the non-transitory computer-readable storage medium can be a ROM, Random Access Memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.
[0188] Those skilled in the art will readily conceive of other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present invention that follow the general principles of the present invention and include known common knowledge or conventional technical means in the technical field not disclosed in this disclosure. The specification and embodiments are only to be regarded as exemplary, and the true scope and spirit of the present invention are pointed out by the following claims.
[0189] It should be understood that the present invention is not limited to the exact structures described above and shown in the drawings, and various modifications and changes can be made without departing from its scope. The scope of the present invention is only limited by the appended claims.
Claims
1. An image processing method, characterized in that, The described image processing method includes: Obtaining the image to be corrected after white balance processing; Taking the pixel points in the high - light area of the image to be corrected as the pixel points to be corrected, and correcting the initial color value of the pixel points to be corrected according to the initial color values of the pixel points adjacent to the pixel points to be corrected.
2. The image processing method according to claim 1, wherein Taking the pixel points in the high - light area of the image to be corrected as the pixel points to be corrected, and correcting the initial color value of the pixel points to be corrected according to the initial color values of the pixel points adjacent to the pixel points to be corrected, including: Sliding a sliding window in the image to be corrected, and taking the pixel points at a preset position within the sliding window as target pixel points; Determining whether the target pixel points are in the high - light area, and taking the target pixel points in the high - light area as the pixel points to be corrected; Correcting the initial color value of the pixel points to be corrected according to the initial color values of at least some pixel points in the sliding window.
3. The image processing method according to claim 2, wherein The pixel points of the image to be corrected include blue pixel points, green pixel points, and red pixel points; The determining whether the target pixel points are in the high - light area includes: If the target pixel point is a green pixel point, when the initial color value of the target pixel point is greater than the color threshold, it is determined that the target pixel point is in the high - light area; If the target pixel point is a red pixel point or a blue pixel point, when the initial color value of at least one green pixel point in the sliding window is greater than the color threshold, it is determined that the target pixel point is in the high - light area.
4. The image processing method according to claim 3, wherein The color threshold is determined according to the bit depth of the image to be corrected.
5. The image processing method according to claim 3, wherein The correcting the initial color value of the pixel points to be corrected according to the initial color values of at least some pixel points in the sliding window includes: Obtaining the gain values of each pixel point in the sliding window during the white balance processing, and taking the color of the pixel point with the largest gain value as the target color; Determining whether each pixel point in the sliding window is in an over - exposure state; If each pixel point in the sliding window is in an over - exposure state, determining the target color value of the pixel point to be corrected according to the initial color values of the pixel points with the target color in the sliding window.
6. The image processing method according to claim 5, wherein The correcting the initial color value of the pixel points to be corrected according to the initial color values of at least some pixel points in the sliding window further includes: If some pixel points in the sliding window are in an over - exposure state, determining the target color value of the pixel point to be corrected according to the initial color values of the pixel points with the target color in the sliding window and the initial color value of the pixel point to be corrected.
7. The image processing method according to claim 6, wherein The determining the target color value of the pixel point to be corrected according to the initial color values of the pixel points with the target color in the sliding window and the initial color value of the pixel point to be corrected includes: Determining a correction parameter according to the initial color values of the pixel points with the target color in the sliding window and the initial color value of the pixel point to be corrected; Taking the sum of the correction parameter and the initial color value of the pixel point to be corrected as the target color value of the pixel point to be corrected.
8. The image processing method according to claim 5, characterized in that, Determining whether each of the pixel points in the sliding window is in an overexposed state includes: When, in the sliding window, the average value of the initial color values of the pixel points having the target color is greater than the initial color value of the green pixel points, and there is an initial color value of another pixel point other than the pixel points of the target color and the green pixel points that is greater than the initial color value of the green pixel points, it is determined that each of the pixel points in the sliding window is in an overexposed state.
9. The image processing method according to claim 5, wherein If it is determined that not all of the pixel points in the sliding window are in an overexposed state, and the initial color value of the pixel point to be corrected is corrected according to the initial color values of at least some of the pixel points in the sliding window, it further includes: When, in the sliding window, there is an initial color value of a pixel point having the target color that is greater than the initial color value of the green pixel points, and there is an initial color value of another pixel point other than the pixel points of the target color and the green pixel points that is less than the initial color value of the green pixel points, it is determined that some of the pixel points in the sliding window are in an overexposed state.
10. The image processing method according to claim 2, wherein Before the sliding window is slid in the image to be corrected, the image processing method further includes: Performing boundary filling on the image to be corrected.
11. The image processing method according to any one of claims 1 to 10, characterized in that, Before performing the white balance processing, the image processing method further includes: Increasing the bit depth of the image on which the white balance processing has not been performed.
12. An image processing apparatus, characterized in that, The image processing apparatus includes: An acquisition module configured to acquire the image to be corrected after white balance processing; A correction module configured to use the pixel points in the highlight area of the image to be corrected as the pixel points to be corrected, and correct the initial color value of the pixel points to be corrected according to the initial color values of the pixel points adjacent to the pixel points to be corrected.
13. An electronic device, characterized in that, including: A processor; A memory for storing executable instructions of the processor; Wherein, the processor is configured to execute the image processing method according to any one of claims 1 to 11.
14. A non-transitory computer-readable storage medium, characterized in that, When the instructions in the storage medium are executed by the processor of the electronic device, the electronic device is enabled to execute the image processing method according to any one of claims 1 to 11.