An image processing apparatus, method, and imaging device

By obtaining the average color component ratio of the monochrome image, matching the target basic monochrome color temperature curve and introducing auxiliary color temperature curves when the error is unacceptable, the problem of white balance failure of single color images in the prior art is solved, and more accurate color temperature estimation and white balance processing are achieved.

CN115834855BActive Publication Date: 2025-07-04BEIJING ESWIN COMPUTING TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211284677.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-19
Publication Date
2025-07-04
Estimated Expiration
2042-10-19

AI Technical Summary

Technical Problem

In the prior art, when processing the number of colors is very small or a single color appears, the white balance often fails, resulting in image color distortion.

Method used

By obtaining the average color component ratio of the monochrome image, matching the target basic monochrome color temperature curve, and using the low-error area to perform preliminary color temperature estimation. If the error is unacceptable, an auxiliary color temperature curve is introduced to further correct it, and finally the white balance gain coefficient is calculated by interpolation of the neutral color temperature curve.

Benefits of technology

The color temperature estimation accuracy of a single color image is improved, the matching error of similar color temperature curves is eliminated, and the single color color casting problem is effectively solved, achieving more accurate white balance processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115834855B_ABST
    Figure CN115834855B_ABST
Patent Text Reader

Abstract

The present invention provides an image processing apparatus, method and imaging device, including: determining a target basic single-color temperature curve that matches the average color component ratio of a monochromatic image; when the average color component ratio is in a low error region, determining a white balance gain coefficient according to coordinate points and a preset neutral color temperature curve; when the average color component ratio is not in the low error region, determining a white balance gain coefficient according to coordinate points, a preset auxiliary color temperature curve and a neutral color temperature curve; processing the monochromatic image according to the white balance gain coefficient to obtain a target monochromatic image. The present invention can introduce a low error region calibrated on the basic single-color temperature curve, making a more accurate judgment on the preliminary estimation of the color temperature. Furthermore, by introducing the neutral color temperature curve and the auxiliary color temperature curve, the estimation of the color temperature is made more accurate, thus more effectively solving the problem of single-color color cast.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular, to an image processing apparatus, method, imaging device, electronic device, and computer-readable storage medium. Background Art

[0002] The basic concept of white balance is that regardless of any light source, a white object can be restored to white. In image processing, white balance can compensate for the color cast phenomenon that occurs when shooting under a specific light source by strengthening the corresponding complementary color, thereby solving the problem of image color cast.

[0003] Currently, the classic gray world method can be used to implement white balance processing. Specifically, it is assumed that for an image with a large number of color changes, the average values of the R (red), G (green), and B (blue) components tend to the same gray value. That is, according to the gray world assumption, the R, G, and B components are equal. Therefore, for the pixel points in the actual image whose pixel values deviate from this gray value, the white balance effect can be achieved by compensating the pixel values to make them return to this gray value.

[0004] However, in the current white balance processing method, when the number of colors in the processed image is extremely small or a single color appears (except for neutral colors), the white balance often fails, resulting in image color distortion. Summary of the Invention

[0005] Embodiments of the present invention provide an image processing apparatus, method, imaging device, electronic device, and computer-readable storage medium to solve the problem that the white balance often fails when the number of colors in the processed image is extremely small or a single color appears in the prior art.

[0006] In a first aspect, an embodiment of the present invention provides an image processing apparatus, where the apparatus includes:

[0007] A monochromatic image acquisition module, configured to acquire a monochromatic image and the average color component ratio of the monochromatic image;

[0008] A target curve determination module, configured to determine a target basic single-color temperature curve matching the average color component ratio according to the coordinate points formed by the average color component ratio and a preset basic single-color temperature curve;

[0009] A low error calculation module, configured to determine a white balance gain coefficient according to the coordinate points and a preset neutral color temperature curve when the coordinate points are in a low error region divided on the target basic single-color temperature curve;

[0010] A high-error calculation module, configured to determine a white balance gain coefficient according to the coordinate point, a preset auxiliary color temperature curve of a color system, and the neutral color temperature curve when the coordinate point is not in the low-error region;

[0011] A white balance module, configured to process the monochromatic image according to the white balance gain coefficient to obtain a target monochromatic image.

[0012] In a second aspect, an embodiment of the present invention provides an image processing method, including:

[0013] Obtain a monochromatic image and an average color component ratio of the monochromatic image;

[0014] Determine a target basic single-color temperature curve matching the average color component ratio according to the coordinate point formed by the average color component ratio and a preset basic single-color temperature curve of a color system;

[0015] When the coordinate point is in a low-error region divided on the target basic single-color temperature curve, determine a white balance gain coefficient according to the coordinate point and a preset neutral color temperature curve;

[0016] When the coordinate point is not in the low-error region, determine a white balance gain coefficient according to the coordinate point, a preset auxiliary color temperature curve of a color system, and the neutral color temperature curve;

[0017] Process the monochromatic image according to the white balance gain coefficient to obtain a target monochromatic image.

[0018] In a third aspect, an embodiment of the present invention provides an imaging device, including:

[0019] An image acquirer, configured to acquire a monochromatic image;

[0020] The image processing device as described above, configured to process the monochromatic image to obtain a target monochromatic image.

[0021] In a fourth aspect, an embodiment of the present invention further provides an electronic device, including a processor;

[0022] A memory for storing executable instructions of the processor;

[0023] Wherein, the processor is configured to execute the instructions to implement the method of the first aspect.

[0024] In a fifth aspect, an embodiment of the present invention further provides a computer-readable storage medium, when instructions in the computer-readable storage medium are executed by a processor of an electronic device, enabling the electronic device to execute the method of the first aspect.

[0025] In an embodiment of the present invention, the average color component ratio of the monochromatic image to be processed can be matched with a preset basic single-color temperature curve to find the target basic single-color temperature curve that matches the color of the current monochromatic image, so as to estimate the color temperature of the monochromatic image. Further, according to the low-error region divided in the target basic single-color temperature curve, it is determined whether the estimation error of the color temperature of the monochromatic image can be accepted. If not, the accurate color temperature is obtained by further correcting by introducing an auxiliary color temperature curve. Finally, the white balance gain coefficient of the monochromatic image is obtained by interpolation using the neutral color temperature curve. By introducing the low-error region calibrated on the basic single-color temperature curve, the present invention has a more accurate judgment on the preliminary estimation of the color temperature. Then, by introducing the neutral color temperature curve and the auxiliary color temperature curve, the color range for reference in color temperature estimation is wider, the color temperature estimation is more accurate, and the matching error of similar color temperature curves is eliminated as much as possible, thus more effectively solving the problem of single-color color cast.

[0026] The above description is only an overview of the technical solution of the present invention. In order to be able to understand the technical means of the present invention more clearly, it can be implemented according to the content of the specification. And in order to make the above and other objects, features and advantages of the present invention more obvious and understandable, the following specifically illustrates the embodiments of the present invention. Brief Description of the Drawings

[0027] Figure 1 is a color temperature curve diagram of a color system provided by the related art;

[0028] Figure 2 is a block diagram of an image processing device provided by an embodiment of the present invention;;

[0029] Figure 3 is a color temperature curve diagram of a color system provided by an embodiment of the present invention;

[0030] Figure 4 is a schematic diagram of a MacAdam ellipse provided by an embodiment of the present invention;;

[0031] Figure 5 is a schematic diagram of MacAdam ellipse grading provided by an embodiment of the present invention;

[0032] Figure 6 is a schematic diagram of the data distribution of the color component ratios at each color temperature of a pink color temperature curve provided by an embodiment of the present invention;

[0033] Figure 7 is a schematic diagram of an overall flowchart provided by an embodiment of the present invention;

[0034] Figure 8 is a step flowchart of an image processing method provided by an embodiment of the present invention;

[0035] Figure 9 is a block diagram of an imaging device provided by an embodiment of the present invention;

[0036] Figure 10 is a logic block diagram of an electronic device provided by an embodiment of the present invention;

[0037] Figure 11 is a logic block diagram of another electronic device provided by an embodiment of the present invention. Detailed implementation manners

[0038] Hereinafter, exemplary embodiments of the present invention will be described in more detail with reference to the accompanying drawings. Although the exemplary embodiments of the present invention are shown in the drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided so that the present invention can be more thoroughly understood and the scope of the present invention can be fully conveyed to those skilled in the art.

[0039] White balance aims to solve the problem of color cast in images. The color cast problem refers to the fact that when directly observed by the human eye under different light illuminations, the perception of the same color remains basically constant. For example, when looking at a white object during the day, it is perceived as white; when looking at a white object under dim light at night, it is still perceived as white without color cast differences. This is because humans have adapted to the colors of objects under different lights during the continuous growth process. However, image sensors do not have this adaptability. Due to the imbalance in the output of image sensors under different lighting conditions, the sensor output will show color distortion, resulting in adverse consequences such as the image being reddish or bluish. White balance is an effective means to deal with this color cast problem.

[0040] In order to solve the color cast problem in the case where the number of colors in the image is extremely small or a single color appears through white balance, a related technology can select 7 color temperature curves of color systems (red, green, blue, yellow, pink, cyan, gray). The color temperature curves of the color systems are obtained by fitting the color component ratios (R / G, B / G) under the corresponding colors. Then, the color component ratios of the image to be processed are statistically analyzed, and the target color temperature curve matching the image to be processed is found, that is, the color temperature curve corresponding to the color of the current image to be processed. Finally, based on the color component ratios of the image to be processed and the target color temperature curve, the white balance gain coefficient for realizing white balance is calculated through linear mapping.

[0041] Refer to Figure 1 , Figure 1It is a color temperature curve graph of a color system provided by the related art, which includes 7 color temperature curves of the color system provided by the above related art (red, green, blue, yellow, pink, cyan, gray). However, due to only 7 color temperature curves of the color system, the range of reference colors that can be characterized is too narrow, resulting in poor applicability in the actual application of this solution. In addition, the distance between some of the color temperature curves of the color system is relatively close, which is also likely to cause a large matching error during matching, reducing the white balance effect.

[0042] To solve this problem, the embodiment of the present invention can match the average color component ratio of the monochromatic image to be processed with a preset basic single-color system color temperature curve to find the target basic single-color system color temperature curve that matches the color of the current monochromatic image, thereby estimating the color temperature at which the monochromatic image is located. Further, according to the low-error area divided in the target basic single-color system color temperature curve, it is determined whether the estimation error of the color temperature at which the monochromatic image is located can be tolerated (whether the average color component ratio of the monochromatic image is in the low-error area). If it cannot be tolerated (the average color component ratio of the monochromatic image is in the low-error area), then the accurate color temperature is estimated by combining the auxiliary color system color temperature curve. Finally, the color temperature is mapped onto the neutral color system color temperature curve, and the white balance gain coefficient of the monochromatic image is obtained by using the interpolation method. If the estimation error of the color temperature at which the monochromatic image is located can be tolerated (the average color component ratio of the monochromatic image is not in the low-error area), then the color temperature is mapped onto the neutral color system color temperature curve, and the white balance gain coefficient of the monochromatic image is obtained by using the interpolation method. By introducing the low-error area calibrated on the basic single-color system color temperature curve, the present invention has a more accurate judgment on the preliminary estimation of the color temperature. Furthermore, by introducing the neutral color system color temperature curve and the auxiliary color system color temperature curve, the color range for reference during color temperature estimation is wider, the color temperature estimation is more accurate, and the matching error of similar color temperature curves is eliminated as much as possible, thereby more effectively solving the problem of single-color color cast.

[0043] Figure 2 , is a structural block diagram of an image processing device provided by an embodiment of the present invention, as Figure 2 shown, the device may include: a monochromatic image acquisition module 101, a target curve determination module 102, a low-error calculation module 103, a high-error calculation module 104, and a white balance module 105.

[0044] Among them, the monochromatic image acquisition module 101 is used to: acquire a monochromatic image and the average color component ratio of the monochromatic image.

[0045] In the embodiments of the present invention, a monochromatic image may be an image with a single color or an image with a single-color background having a relatively large area. For example, in the home improvement industry, it is necessary to photograph walls of different single colors, curtains of different single colors, etc. These photos can be used as monochromatic images; in the surveillance and shooting industry, it is necessary to record scenes with a single-color background, such as the sky, a large and empty square, etc. The video frames captured and recorded can also be used as monochromatic images. In order to accurately represent the photos in these scenarios, the monochromatic image should be as free of color cast as possible.

[0046] Specifically, the color component is the pixel value of a pixel point in the corresponding color channel. Generally speaking, the color channels may include a red channel (R), a green channel (G), and a blue channel (B). For example, for a pixel point of the orange color, its color component in the red channel is 255, its color component in the green channel is 116, and its color component in the blue channel is 21.

[0047] Specifically, the average color component ratio is obtained by statistically analyzing the color of a monochromatic image according to the color channels. After calculating the average color components of the entire image in each color channel, the ratio formed by the average color components of different color channels is obtained. The color system color temperature curve is a curve fitted from the color component ratio and is used to reflect the relationship between the color component ratios of this color at different color temperatures. The average color component ratio of a monochromatic image can be used to match the corresponding color system color temperature curve to estimate the color temperature value corresponding to the monochromatic image.

[0048] Optionally, the monochromatic image acquisition module may specifically include: an average pixel value calculation sub-module and a component ratio calculation sub-module.

[0049] The average pixel value calculation sub-module is used to obtain the average pixel values corresponding to each color channel in the monochromatic image. The average pixel values include: the first average pixel value of the red channel, the second average pixel value of the green channel, and the third average pixel value of the blue channel.

[0050] The component ratio calculation sub-module is used to use the ratio of the first average pixel value to the second average pixel value and the ratio of the third average pixel value to the second average pixel value as the average color component ratio.

[0051] In the embodiments of the present invention, in the specific process of determining the average color component ratio of a monochromatic image, the average pixel value calculation sub-module may first obtain the average pixel values corresponding to each color channel in the monochromatic image: the first average pixel value R avg , the second average pixel value G avg , and the third average pixel value B avg ; and then the component ratio calculation sub-module calculates the average color component ratio of the monochromatic image (Ravg / G avg ,B avg / G avg )。

[0052] It should be noted that for the original Bayer (Bayer) format image, there are four channels: R, Gr, Gb, and B. The G channel can be obtained by a simple linear calculation of Gr and Gb:

[0053] Because Therefore Thus, the average color component ratio is obtained

[0054] The target curve determination module 102 is configured to: determine a target base single-color temperature curve that matches the average color component ratio according to the coordinate points formed by the average color component ratio and a preset base single-color temperature curve of the color system.

[0055] Optionally, the base single-color temperature curve of the color system is obtained by fitting the average color component ratios of multiple base single colors, and the base single colors include: one or more of red, green, blue, aqua, pink, and yellow.

[0056] In the embodiment of the present invention, in order to initially determine the color temperature, the target curve determination module can define several base single-color temperature curves of common base single colors to help determine the target base single-color temperature curve closest to the current single-color image. After determining the target base single-color temperature curve, the current color temperature can be further estimated by combining the low-error region divided on the target base single-color temperature curve. The base single colors can include: one or more of red, green, blue, aqua, pink, and yellow.

[0057] Specifically, referring to Figure 3 , Figure 3 is a color system color temperature curve diagram provided by the embodiment of the present invention, which includes 6 base single-color temperature curves (red, green, blue, aqua, pink, yellow) and a neutral color system color temperature curve. It can be seen that the abscissa of the color temperature curve is the color component ratio (R / G), and the ordinate is the color component ratio (B / G). A point on or near the color temperature curve can be used to represent a color temperature value, and the average color component ratio of the single-color image is (R avg / G avg ,B avg / G avg ). Then, the average color component ratio of the single-color image can be used as a coordinate point in the coordinate system of the color system color temperature curve to find its corresponding position in the coordinate system.

[0058] Further, since there are multiple basic single-color temperature curves in the color temperature curve coordinate system of the color system, and the coordinate point corresponding to the average color component ratio in the color temperature curve coordinate system of the color system is determined, the matching degree between the average color component ratio of the monochrome image and each basic single-color temperature curve can be further calculated according to the projection distance between the coordinate point and each basic single-color temperature curve, and the basic single-color temperature curve with the largest matching degree is used as the target basic single-color temperature curve. Among them, the smaller the projection distance between the average color component ratio of the monochrome image and the basic single-color temperature curve, the greater the matching degree between the average color component ratio of the monochrome image and each basic single-color temperature curve.

[0059] Optionally, the target curve determination module may specifically include: a projection distance calculation sub-module and a screening sub-module.

[0060] The projection distance calculation sub-module is used to calculate the projection distance between the coordinate point and the basic single-color temperature curve.

[0061] The screening sub-module is used to use the basic single-color temperature curve with the smallest projection distance as the target basic single-color temperature curve.

[0062] In the embodiment of the present invention, since the smaller the projection distance between the coordinate point and the basic single-color temperature curve, the greater the matching degree between the average color component ratio of the monochrome image and each basic single-color temperature curve, the basic single-color temperature curve with the largest matching degree can be used as the target basic single-color temperature curve.

[0063] Specifically, the projection distance is the shortest distance from the coordinate point to the basic single-color temperature curve. Assuming a basic single-color temperature curve f(x), the point A(x, f(x)) on the basic single-color temperature curve f(x) from the coordinate point P(x0, y0) should be the point closest to the coordinate point P. The specific algorithm is to make the tangent line passing through point A on the basic single-color temperature curve f(x) perpendicular to AP, find the point A that satisfies this condition, and the projection distances L1, L2,..., L6 from the coordinate point to the 6 basic single-color temperature curves can be obtained. It should be noted that each basic single-color temperature curve has a certain definition interval, which is specifically related to the color temperature range, that is, the coordinate point may not be in the definition interval of each basic single-color temperature curve, so it is not necessary to calculate all the projection distances.

[0064] The low error calculation module 103 is used to determine the white balance gain coefficient according to the coordinate point and the preset neutral color temperature curve when the coordinate point is in the low error area divided on the target basic single-color temperature curve.

[0065] In the embodiments of the present invention, a low-error region can be preliminarily divided on the basic single-color temperature curve. The low-error region can be used to estimate whether the current color temperature estimation error is acceptable. When the average color component ratio of the monochromatic image is in the low-error region, it indicates that the current color temperature error is acceptable; when the average color component ratio of the monochromatic image is not in the low-error region, it indicates that the current color temperature error is not acceptable. Therefore, based on the overlapping relationship between the coordinate point formed by the average color component ratio of the monochromatic image and the low-error region divided on the target basic single-color temperature curve, a preliminary judgment can be made on the current color temperature estimation error, and then the error can be improved in the subsequent process to improve the calculation accuracy. Among them, the low-error region can be calibrated according to the color tolerance theory. For example, taking Figure 3 the pink color temperature curve in

[0066] as an example, the low-error region of the pink color temperature curve is a strip-shaped region, which is specifically calibrated according to the MacAdam color tolerance theory. Figure 3 When the coordinate point is in the low-error region divided on the target basic single-color temperature curve, the low-error calculation module can consider that the current target basic single-color temperature curve can be used to estimate the color temperature of the current single-color temperature scene, and the error is acceptable. At this time, a neutral color temperature curve (such as

[0067] the neutral color temperature curve in

[0068] used to represent the color temperature relationship corresponding to white and gray) can be introduced. By finding the color temperature value corresponding to the projection point of the coordinate point of the average color component ratio on the target basic single-color temperature curve and mapping this color temperature value to the neutral color temperature curve, the white balance gain coefficient is finally obtained by interpolation. Among them, mapping the initially estimated color temperature value to the neutral color temperature curve and calculating the white balance gain coefficient by interpolation means that, when the current color temperature estimation error is acceptable, the idea of the gray world method is directly used. For the color temperature deviating from the neutral color system gray value, it is compensated by interpolation to make it return to this gray value, and the effect of white balance can be achieved. The high-error calculation module 104 is used to determine the white balance gain coefficient according to the coordinate point, the preset auxiliary color temperature curve and the neutral color temperature curve when the coordinate point is not in the low-error region.

[0068] When the coordinate point is not in the low-error region divided on the target basic single-color temperature curve, the high-error calculation module can consider that the error is too large and unacceptable when the current target basic single-color temperature curve is used to estimate the color temperature of the current single-color temperature scene. At this time, the auxiliary color temperature curve corresponding to the auxiliary color system can be introduced. The auxiliary color system color is a color different from the basic single-color color and in a richer color range (such as one or more of dark brown, bright brown, sky blue, leaf green, blue flower color, blue green, orange, navy blue, dark red, purple, yellow green, orange yellow). The auxiliary color temperature curve can further accurately correct the error of the current color temperature estimate when the current color temperature estimate error is too large, return the error to an acceptable range, and finally map the corrected color temperature value to the neutral color temperature curve to obtain the white balance gain coefficient by interpolation, thereby improving the problem of large error in color temperature estimation.

[0069] The white balance module 105 is configured to process the monochromatic image according to the white balance gain coefficient to obtain a target monochromatic image.

[0070] In the embodiment of the present invention, after obtaining the white balance gain coefficient, the white balance module can, based on the components of the white balance gain coefficient corresponding to each color channel, multiply each pixel point of the monochromatic image by the balance gain coefficient component of the corresponding channel, so as to obtain the target monochromatic image after white balance processing. The target monochromatic image after white balance processing effectively solves the problem of color cast and has better effects compared with the related technologies.

[0071] Optionally, for the calculation of a white balance gain coefficient, the low-error calculation module includes: a first color temperature value calculation sub-module and a low-error coefficient calculation sub-module.

[0072] The first color temperature value calculation sub-module is configured to determine a first projection point of the coordinate point on the target basic single-color temperature curve and obtain a first color temperature value corresponding to the first projection point when the coordinate point is in the low-error region divided on the target basic single-color temperature curve.

[0073] Specifically, the low-error region divided on the basic single-color temperature curve is calibrated according to the MacAdam color tolerance theory. Next, the calibration of the low-error region will be described in detail:

[0074] In 1942, scientist MacAdam conducted a series of studies on color tolerance (used to evaluate the difference in light source colorimetry. First, the CIE1931 color coordinates x and y are calculated based on the relative spectrum and the tristimulus values of a 2° field of view, and then the ellipse parameters are determined according to the selected reference coordinate points, and the distance weighted by the ellipse coefficients is calculated). He conducted experiments on 25 colors and measured the just noticeable difference (the color tolerance corresponding to the color difference that the human eye can just perceive) in about 5 to 9 opposite directions at each color point. Recording the distance between the two points when they can just distinguish the color difference, the result is a series of ellipses with different areas and unequal major and minor axes, called MacAdam ellipses. Refer to Figure 4 , Figure 4 is a schematic diagram of a MacAdam ellipse provided by an embodiment of the present invention, which shows Figure 3 the MacAdam ellipse corresponding to the pink color temperature curve in Figure 5 . Further, refer to Figure 5 is a schematic diagram of MacAdam ellipse grading provided by an embodiment of the present invention. For the MacAdam ellipse in Figure 4 , in the CIE1931 chromaticity diagram, the MacAdam ellipse of the just noticeable difference is enlarged, and the ellipse is stepped (or graded). The distances from the center to the boundary of the obtained ellipses are different, but the color differences of the points on the ellipse are consistent. Among them, the 4 ellipses from the inside to the outside are the 1st level, 2nd level, 3rd level, and 4th level respectively.

[0075] Further, the MacAdam ellipse is used to represent the tolerable color difference (color tolerance) range. The calculation formula for the MacAdam ellipse at each step (level) is: l 2 = g 11 Δx 2 + 2g 12 ΔxΔy + g 22 Δy 2

[0076] Where:

[0077] Δx = (X - x);

[0078] Δy = (Y - y);

[0079]

[0080]

[0081]

[0082] X and Y represent points on a two-dimensional plane, and x, y, a, b, and θ represent the center x coordinate, center y coordinate, major axis of the ellipse, minor axis of the ellipse, and ellipse deflection angle of the color temperature ellipse respectively.

[0083] MacAdam ellipse theory is widely used in the color difference management of lighting sources. The color tolerance is represented by the distance weighted by the MacAdam ellipse coefficient, with the unit of standard deviation of color matching (SDCM). It can also be expressed in steps, that is, 1 standard deviation is 1 - SDCM or 1 - step. The original MacAdam ellipse has different orders according to the color difference tolerance. Generally, a color difference distance of 3 - step is considered the just - noticeable color difference. When calculating the color tolerance S of a certain color coordinate point (x, y) to the reference point (xc, yc) in the CIE1931 coordinate system, the formula is as follows:

[0084]

[0085] The original MacAdam ellipse is described in the CIE1931 chromaticity space, which is an uneven chromaticity space. Similarly, the R / G - B / G chromaticity space is also an uneven chromaticity space with the same properties. In both chromaticity spaces, it shows an elliptical distribution and has the same data distribution characteristics (in a two - dimensional plane, it is a Gaussian distribution in the shape of an ellipse). Points of the same color patch can also be considered to follow an elliptical Gaussian distribution in the R / G - B / G chromaticity space by statistically analyzing the R / G and B / G values of pixel points in the image. Further referring to Figure 6 , Figure 6 is a schematic diagram of the data distribution of the color component ratio at each color temperature of a pink - based color temperature curve provided by an embodiment of the present invention. The R / G - B / G data distribution at each color temperature of the pink - based color temperature curve can be seen to follow an elliptical Gaussian distribution.

[0086] Therefore, by means of the color tolerance theory based on the MacAdam ellipse, according to the characteristics of the R / G - B / G chromaticity space, by calibrating the data of the basic color system color patches in the standard color card at different color temperatures, the elliptical parameters of each basic color system color patch at different color temperatures can be calculated: the major axis, the minor axis, and the deviation angle. Then, according to the major and minor axes and the deviation angle of the color temperature ellipse at each color temperature, the coordinates of the low - error limit interval at each color temperature are obtained, and connecting them in sequence forms a low - error area. This is a calibration method for the low - error area.

[0087] At the same time, based on the color tolerance theory of the MacAdam ellipse, the control of color difference should be analyzed according to specific situations. A reasonable color difference standard should be set according to specific requirements, and an s - step MacAdam ellipse is set. By adjusting s, the size of the ellipse can be controlled. The confidence level of the ellipse represents the proportion of all measurement data that can be included. The higher the confidence level, the better. The s - step is defaulted to level 2, corresponding to the value of 1.6643. The values and confidence levels corresponding to different levels of s - step are shown in Table 1 below. Among them, such as Figure 3The shown strip-shaped area (the low-error area of the pink color temperature curve) is the major and minor axes and the deviation angle of each color temperature ellipse calculated from the color data of the pink color patches of the standard color card obtained at five color temperatures (five light sources in the light box: D75, D50, U35, A, H) when s-step = 2. Connecting each point gives the strip-shaped low-error area.

[0088] s-step numerical value confidence level 1 1.1790 50% 2 1.6643 75% 3 2.1459 90% 4 2.4477 95% 5 3.0348 99%

[0089] Table 1

[0090] In the embodiment of the present invention, when the average color component ratio of the monochromatic image is in the low-error area, it indicates that the current color temperature error is acceptable. At this time, the neutral color temperature curve can be directly introduced. By finding the color temperature value corresponding to the projection point of the coordinate point of the average color component ratio on the target basic single-color temperature curve, mapping this color temperature value to the neutral color temperature curve, and finally obtaining the white balance gain coefficient by interpolation.

[0091] Specifically, first, it is necessary to find the coordinate point of the average color component ratio The first projection point on the target basic single-color temperature curve Then, from this first projection point Estimate the first color temperature value of the current monochromatic image initially estimated based on the target basic single-color temperature curve.

[0092] Optionally, multiple reference points are marked on the basic single-color temperature curve. The first color temperature value calculation sub-module includes: a first reference point determination unit and a first interpolation calculation unit.

[0093] The first reference point determination unit is used to determine the two first reference points on the target basic single-color temperature curve that are closest to the first projection point.

[0094] The first interpolation calculation unit is used to perform interpolation calculation according to the distance between the first reference point and the first projection point to obtain the first color temperature value.

[0095] In the embodiment of the present invention, when estimating the first color temperature value through the target basic single-color temperature curve, the two first reference points on the target basic single-color temperature curve that are closest (adjacent) to the first projection point can be first determined by the first reference point determination unit, and then the distance between the first reference point and the first projection point can be calculated by the first interpolation calculation unit to obtain the first color temperature value by adjacent interpolation.

[0096] Specifically, referring to Figure 3 , it can be seen that there are different calibration points (points on or near the basic single-color temperature curve) on the basic single-color temperature curve, and different calibration points are used to represent different color temperature values. Assuming the first projection point For two adjacent first reference points D65 and D50 (the color temperature values corresponding to two experimental light sources respectively) on the target basic single-color temperature curve, the color temperature value of the first reference point D65 is 5000K, and the color temperature value of the first reference point D50 is 6500K. Specifically, the first color temperature value can be calculated by linear interpolation according to the distances between the first reference points D65 and D50 and the first projection point respectively. The calculation formula is as follows:

[0097]

[0098] where, T s , T D65 , T D50 are the color temperature values at the first projection points D65 and D50 respectively, and x D65 , x D50 , x s are the abscissa values at D65, D50, and the first projection point respectively.

[0099] The low error coefficient calculation sub-module is used to map the first color temperature value to the neutral color temperature curve and interpolate to obtain the white balance gain coefficients corresponding to each color channel.

[0100] In the embodiment of the present invention, when mapping the first color temperature value to the neutral color temperature curve, the color component ratios (R / G, B / G) corresponding to this color temperature can be interpolated and obtained according to two color temperature values adjacent to the projection point on the neutral color temperature curve, so as to calculate the white balance gain values of the corresponding red and blue channels.

[0101] Optionally, a plurality of reference points are marked on the basic single-color temperature curve. The low error coefficient calculation sub-module may specifically include: a second projection point determination unit and a low error coefficient calculation unit.

[0102] The second projection point determination unit is used to obtain the second projection point corresponding to the first color temperature value on the neutral color temperature curve.

[0103] The low error coefficient calculation unit is used to obtain the white balance gain coefficients of each color channel corresponding to the first color temperature value by interpolation according to two second reference points closest to the distance from the second projection on the neutral color temperature curve.

[0104] In the embodiments of the present invention, when specifically calculating the white balance gain coefficient, the second projection point determination unit can determine two second reference points adjacent to the second projection point corresponding to the first color temperature value on the neutral color temperature curve. Then, the low error coefficient calculation unit interpolates to calculate the white balance gain coefficient of each color channel corresponding to the first color temperature value. That is, under the condition that the color temperature estimation error is acceptable, using the idea of the gray world method, for the color temperature deviating from the gray value of the neutral color system, interpolation compensation is used to make it return to this gray value, and the effect of white balance can be achieved.

[0105] Optionally, the low error coefficient calculation unit may specifically include: a color component ratio calculation subunit and a low error coefficient calculation subunit.

[0106] The color component ratio calculation subunit is used to interpolate and calculate the color component ratio corresponding to the first color temperature value according to the second reference point. The color component ratio includes: a first ratio of the first pixel value of the red channel to the second pixel value of the green channel, and a second ratio of the third pixel value of the blue channel to the second pixel value of the green channel.

[0107] The low error coefficient calculation subunit is used to use the reciprocal of the first ratio as the white balance gain coefficient of the red channel, use 1 as the white balance gain coefficient of the green channel, and use the reciprocal of the second ratio as the white balance gain coefficient of the blue channel.

[0108] In the embodiments of the present invention, the specific implementation process of interpolating and calculating the white balance gain coefficient of each color channel corresponding to the first color temperature value according to the two second reference points closest to the second projection on the neutral color temperature curve can be that the color component ratio calculation subunit interpolates and calculates the color component ratio corresponding to the first color temperature value according to the distance between the second reference point and the second projection point. The color component ratio is the ratio of each color component in the three channels, including a first ratio of the first pixel value of the red channel to the second pixel value of the green channel (R s / G s ), and a second ratio of the third pixel value of the blue channel to the second pixel value of the green channel (B s / G s ).

[0109] Specifically, in the embodiments of the present invention, the low error coefficient calculation subunit can use the reciprocal of the first ratio (G s / R s ) as the white balance gain coefficient of the red channel, use 1 as the white balance gain coefficient of the green channel, and use the reciprocal of the second ratio (G s / B s ) as the white balance gain coefficient of the blue channel.

[0110] The above process will be described through a specific example: Assume that the second projection point is between two second reference points D65 and D50 (the color temperature range where it is located can be obtained according to to obtain the color temperature range where it is located, and find two adjacent second reference points on the color temperature curve). The two-color second reference points are respectively (x D65 , y D65 ), (x D50 , y D50 ), and the color temperature values are T D65 = 6500k, T D50 = 5000k, the first color temperature value Ts represented by. Then, further according to the following formula, the second projection point

[0111]

[0112]

[0113]

[0114] Among them, the white balance gain coefficient of the green channel is 1.

[0115] Optionally, for the calculation of another white balance gain coefficient, the high-error calculation module includes: a target curve screening sub-module, a second color temperature value calculation sub-module, and a high-error coefficient calculation sub-module.

[0116] The target curve screening sub-module is used to determine the target auxiliary color system color temperature curve that matches the coordinate point from multiple auxiliary color system color temperature curves when the coordinate point is not in the low-error area.

[0117] When the coordinate point is not in the low-error area divided by the target basic single color system color temperature curve, it can be considered that the error of the current target basic single color system color temperature curve for estimating the color temperature of the current single color temperature scene is too large and unacceptable. At this time, the auxiliary color system color temperature curve corresponding to the auxiliary color system can be introduced, and the target curve screening sub-module first finds the auxiliary color system color temperature curve that best matches the average color component ratio of the current single-color image. Specifically, the auxiliary color system color temperature curve with the smallest projection distance between the coordinate point of the average color component ratio and the auxiliary color system color temperature curve can be used as the target auxiliary color system color temperature curve that matches the single-color image.

[0118] Optionally, the target curve screening sub-module may specifically include: a projection distance calculation unit and a screening unit.

[0119] The projection distance calculation unit is used to calculate the projection distance between the coordinate point and the auxiliary color system color temperature curve.

[0120] A screening unit, configured to use the auxiliary color temperature curve with the minimum projection distance as the target auxiliary color temperature curve.

[0121] Specifically, the projection distance calculated by the projection distance calculation unit is the shortest distance from the coordinate point to the basic single-color temperature curve. Assuming an auxiliary single-color temperature curve f'(x), the point A(x, f'(x)) on the auxiliary single-color temperature curve f'(x) from the coordinate point P(x0, y0) should be the point closest to the coordinate point P. The specific algorithm is to make the tangent line passing through point A on the auxiliary single-color temperature curve f'(x) perpendicular to AP, and find the point A that satisfies this condition, so as to obtain the projection distances L1', L2',... from the coordinate point to multiple auxiliary single-color temperature curves. Then, the screening unit uses the auxiliary single-color temperature curve with the minimum projection distance as the target auxiliary single-color temperature curve.

[0122] It should be noted that each auxiliary single-color temperature curve has a certain definition interval, which is specifically related to the color temperature range. Generally, it can be the circumscribed rectangle of the auxiliary single-color temperature curve. Therefore, when determining the target auxiliary single-color temperature curve, it is possible to first determine all the auxiliary single-color temperature curves included in the definition interval where the coordinate point composed of the average color component ratio is located, and then calculate the projection distances from the coordinate point to all the auxiliary single-color temperature curves included in the definition interval, and select the target auxiliary single-color temperature curve according to the projection distance, which can effectively reduce the calculation amount.

[0123] A second color temperature value calculation sub-module, configured to determine a third projection point of the coordinate point on the target auxiliary color temperature curve, and obtain a second color temperature value corresponding to the third projection point.

[0124] In the embodiment of the present invention, when the coordinate point is not in the low error region, since the current color temperature estimation error is relatively large, the second color temperature value calculation sub-module can project the coordinate point onto the target auxiliary color temperature curve closest to the current color temperature, so as to further accurately correct the error of the current color temperature estimation through the target auxiliary color temperature curve, making the error return to an acceptable range, thereby improving the problem of large error in color temperature estimation.

[0125] Optionally, a plurality of reference points are marked on the basic single-color temperature curve. The second color temperature value calculation sub-module may specifically include: a third reference point determination unit and a second interpolation calculation unit.

[0126] The third reference point determination unit is configured to determine two third reference points on the target basic single-color temperature curve that are closest to the third projection point.

[0127] A second interpolation calculation unit, configured to perform interpolation calculation based on the distance between the third reference point and the third projection point to obtain the second color temperature value.

[0128] Specifically, since the coordinate point is not in the low-error region of the target basic single-color temperature curve, using the target basic single-color temperature curve for color temperature estimation will cause unacceptable error losses. In the embodiments of the present invention, an auxiliary color temperature curve is introduced. By mapping the coordinate point to the target auxiliary color temperature curve that best matches the current color temperature to obtain a third projection point, and then estimating an accurate second color temperature value for the third projection point according to the target auxiliary color temperature curve. Specifically, the third reference point determination unit can determine two third reference points on the target basic single-color temperature curve that are closest to the third projection point, and the second interpolation calculation unit performs interpolation calculation based on the distance between the third reference point and the third projection point to obtain the second color temperature value. This interpolation calculation process can specifically refer to the above-mentioned first reference point determination unit and first interpolation calculation unit, and will not be elaborated here.

[0129] A high error coefficient calculation sub-module, configured to map the second color temperature value to the neutral color temperature curve and interpolate to obtain the white balance gain coefficients corresponding to each color channel.

[0130] In the embodiments of the present invention, the high error coefficient calculation sub-module maps the accurately corrected second color temperature value through the target auxiliary color temperature curve to the neutral color temperature curve, and can continue to interpolate according to two color temperature values adjacent to the projection point on the neutral color temperature curve to obtain the color component ratio (R / G, B / G) corresponding to this color temperature, so as to calculate the white balance gain values of the corresponding red and blue channels.

[0131] Optionally, the high error coefficient calculation sub-module may specifically include: a fourth projection point determination unit, a color component ratio calculation unit, and a high error coefficient calculation unit.

[0132] The fourth projection point determination unit is configured to obtain a fourth projection point corresponding to the second color temperature value on the neutral color temperature curve.

[0133] The color component ratio calculation unit is configured to obtain, through interpolation calculation, a color component ratio corresponding to the second color temperature value according to the fourth projection point and two fourth reference points on the neutral color temperature curve that are closest to the fourth projection point. The color component ratio includes: a first ratio of a first pixel value of the red channel to a second pixel value of the green channel, and a second ratio of a third pixel value of the blue channel to the second pixel value of the green channel.

[0134] A high error coefficient calculation unit is configured to use the reciprocal of the first ratio as the white balance gain coefficient for the red channel, 1 as the white balance gain coefficient for the green channel, and the reciprocal of the second ratio as the white balance gain coefficient for the blue channel.

[0135] In an embodiment of the present invention, according to the two fourth reference points closest to the fourth projection on the neutral color temperature curve, the specific implementation process of obtaining the white balance gain coefficients of each color channel corresponding to the second color temperature value through interpolation calculation may be based on the distance between the fourth reference point and the fourth projection point, and through interpolation calculation, obtain the color component ratio corresponding to the second color temperature value. The color component ratio is the ratio of each color component in the three channels, including the first ratio (R s / G s ) of the first pixel value of the red channel to the second pixel value of the green channel, and the second ratio (B s / G s ) of the third pixel value of the blue channel to the second pixel value of the green channel.

[0136] Specifically, in an embodiment of the present invention, the reciprocal of the first ratio (G s / R s ) may be used as the white balance gain coefficient for the red channel, 1 as the white balance gain coefficient for the green channel, and the reciprocal of the second ratio (G s / B s ) as the white balance gain coefficient for the blue channel. This calculation process may specifically refer to the above-mentioned color component ratio calculation sub-unit and low error coefficient calculation sub-unit, and will not be elaborated here.

[0137] Optionally, the white balance gain coefficient includes: the gain coefficients respectively corresponding to each color channel. The white balance module includes:

[0138] A multiplication operation sub-module is configured to multiply the pixel values of each color channel in the monochromatic image by the corresponding gain coefficient respectively to obtain the target monochromatic image.

[0139] In an embodiment of the present invention, according to the obtained white balance gain values [the white balance gain coefficient R for the red channel gain , the white balance gain coefficient G for the green channel gain , the white balance gain coefficient B for the blue channel gain , multiply each point of the original image by the corresponding channel gains R gain , G gain , B gain respectively to obtain the image after white balance processing.

[0140] Specifically, the relationship between the surface colors of the same object under two lighting conditions can be described by a diagonal matrix transformation. Assume that the RGB values of the object perceived under illuminations E1 and E2 are (r 1 , g 1 , b 1 ) and (r 2 , g 2 , b 2 ), respectively. Then:

[0141]

[0142] In the above formula, D is a diagonal matrix. It can be seen from the above formula that the responses of the three color channels R, G, and B can be adjusted independently. Therefore, the corresponding diagonal matrix is constructed to perform color correction on each pixel point of the original image to be processed, and finally the image after white balance processing is obtained. The correction formula is as follows:

[0143]

[0144] Optionally, the device may further include:

[0145] A truncation module, configured to adjust the pixel value of a pixel point whose pixel value in the target image is greater than a preset threshold to the preset threshold.

[0146] In the embodiments of the present invention, after the white balance gain processing is performed on the monochromatic image, the pixel values of some pixel points may overflow, resulting in abnormal display of the target monochromatic image. Then, anti-overflow processing may be performed after the white balance gain processing. Specifically, a truncation means is adopted. For example, for an 8-bit target monochromatic image, after white balance processing, truncation operations are performed on pixel points whose pixel values exceed 255. For example, when the pixel value of a pixel point is greater than 255, it is set to 255.

[0147] Optionally, the basic single-color temperature curve is obtained by fitting the average color component ratios of multiple basic single colors, and the basic single colors include one or more of red, green, blue, aqua, pink, and yellow.

[0148] Optionally, the neutral color temperature curve is obtained by fitting the average color component ratios of at least one neutral color, and the neutral colors include white and / or gray.

[0149] Optionally, the auxiliary color temperature curve is obtained by fitting the average color component ratios of at least one auxiliary color, and the auxiliary colors include one or more of dark brown, light brown, sky blue, leaf green, blue flower color, blue green, orange, navy blue, dark red, purple, yellow green, and orange yellow.

[0150] In the embodiments of the present invention, the definitions of various colors can be based on the international standard 24-color card. The international standard 24-color card includes 4 rows * 6 columns = 24 colors. Among them, the basic single-color can be the color corresponding to the color patches in the third row of the international standard 24-color card; specifically, the neutral color can be the colors of the middle four color patches in the fourth row. The auxiliary colors can be the colors corresponding to the color patches in the first two rows of the international standard 24-color card.

[0151] Finally, referring to Figure 7 , Figure 7 FIG. Figure 7 is an overall flowchart of an embodiment of the present invention, including S1, inputting a single-color original image. S2, performing color statistics on the above original image, calculating the average values of the R, G, and B channels to obtain the average color component ratio. S3, according to the obtained average color component ratio, calculating the projection distance between it and the color temperature curves of each basic single-color system, and determining whether the average color component ratio is in the low-error region of the color temperature curve with the closest projection distance. If so, then S4, estimating the scene color temperature according to the projection point corresponding to the color temperature curve with the closest projection distance, and mapping it to the color temperature curve of the neutral color system, and interpolating to obtain the white balance gain coefficient. If not, then S5, estimating the scene color temperature according to the color temperature curve of the auxiliary color system within the average color component region in the auxiliary color system curve group, and mapping it to the color temperature curve of the neutral color system, and interpolating to obtain the white balance gain coefficient. After calculating the white balance gain, S6, performing color cast correction on the single-color original image to be corrected according to the obtained white balance gain.

[0152] In summary, in the embodiments of the present invention, the average color component ratio of the monochromatic image to be processed can be matched with the preset color temperature curve of the basic single-color system to find the target color temperature curve of the basic single-color system that matches the color of the current monochromatic image, so as to estimate the color temperature of the monochromatic image. Further, according to the low-error region divided in the target color temperature curve of the basic single-color system, it is determined whether the estimation error of the color temperature of the monochromatic image can be accepted. If not, the accurate color temperature is further corrected by introducing the color temperature curve of the auxiliary color system. Finally, the white balance gain coefficient of the monochromatic image is obtained by interpolation using the color temperature curve of the neutral color system. By introducing the low-error region calibrated on the color temperature curve of the basic single-color system, the present invention makes a more accurate judgment on the preliminary estimation of the color temperature. Furthermore, by introducing the color temperature curve of the neutral color system and the color temperature curve of the auxiliary color system, the color range for reference in color temperature estimation is wider, the estimation of the color temperature is more accurate, and the matching error of similar color temperature curves is eliminated as much as possible, thus more effectively solving the problem of color cast in a single color.

[0153] Figure 8 FIG. Figure 8 is a step flowchart of an image processing method provided by an embodiment of the present invention, and the method includes:

[0154] Step 201: Obtain a monochromatic image and the average color component ratio of the monochromatic image.

[0155] Step 202: Determine a target basic single-color temperature curve that matches the average color component ratio based on the coordinate points formed by the average color component ratio and a preset basic single-color temperature curve.

[0156] Step 203: When the coordinate point is in the low-error region divided by the target basic single-color temperature curve, determine a white balance gain coefficient based on the coordinate point and a preset neutral-color temperature curve.

[0157] Step 204: When the coordinate point is not in the low-error region, determine a white balance gain coefficient based on the coordinate point, a preset auxiliary color temperature curve, and the neutral-color temperature curve.

[0158] Step 205: Process the monochromatic image according to the white balance gain coefficient to obtain a target monochromatic image.

[0159] For the specific implementation of steps 201-205 in the embodiments of the present invention, reference may be specifically made to the corresponding descriptions of the monochromatic image acquisition module 101, the target curve determination module 102, the low-error calculation module 103, the high-error calculation module 104, and the white balance module 105 above, which will not be elaborated here.

[0160] Figure 9 It is a block diagram of an imaging device provided by an embodiment of the present invention. Based on the same inventive concept, the present invention also provides an imaging device, including:

[0161] An image collector 301 for obtaining a monochromatic image.

[0162] Such as Figure 1 The image processing device 302 as described above, and the image processing device is used to process the monochromatic image to obtain a target monochromatic image.

[0163] Among them, the image acquisition device 301 may be a complementary metal oxide semiconductor (CMOS) sensor, which can capture images.

[0164] The white balance method in the embodiments of the present invention is specifically implemented by the image processing device 302. The image processing device 302 may be an image signal processor (ISP). The ISP is an image processing chip and can be specifically applied in intelligent devices, such as smart phones, computers, monitoring devices, etc.

[0165] In summary, in the embodiments of the present invention, the average color component ratio of the monochromatic image to be processed can be matched with a preset basic single-color temperature curve to find the target basic single-color temperature curve that matches the color of the current monochromatic image, so as to estimate the color temperature of the monochromatic image. Further, according to the low-error region divided in the target basic single-color temperature curve, it is determined whether the estimation error of the color temperature of the monochromatic image can be accepted. If not, the accurate color temperature is obtained by further correction by introducing the auxiliary color temperature curve. Finally, the white balance gain coefficient of the monochromatic image is obtained by interpolation using the neutral color temperature curve. By introducing the low-error region calibrated on the basic single-color temperature curve, the present invention makes a more accurate judgment on the preliminary estimation of the color temperature. Then, by introducing the neutral color temperature curve and the auxiliary color temperature curve, the color range for reference in color temperature estimation is wider, the color temperature estimation is more accurate, and the matching error of similar color temperature curves is eliminated as much as possible, thus more effectively solving the problem of single-color color cast.

[0166] Figure 10 FIG. 4 is a block diagram of an electronic device 600 shown according to an exemplary embodiment. For example, the electronic device 600 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0167] Referring to Figure 10 FIG. 4, 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.

[0168] The processing component 602 generally controls the overall operation of the electronic device 600, such as operations associated with display, telephone calls, data communication, 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 methods. 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.

[0169] The memory 604 is used 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, multimedia, and the like. The memory 604 can 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.

[0170] The power supply component 606 provides power for various components of the electronic device 600. The power supply component 606 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the electronic device 600.

[0171] 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 not only sense the boundaries of touch or swipe actions but also detect the duration and pressure associated with the touch or swipe operation. 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 multimedia 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 focal length and optical zoom capabilities.

[0172] The audio component 610 is used to output and / or input audio signals. For example, the audio component 610 includes a microphone (MIC) that is used 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.

[0173] The I / O interface 612 provides an interface between the processing component 602 and a peripheral interface module, and the peripheral interface module can be a keyboard, a click wheel, buttons, and the like. These buttons can include, but are not limited to: a home button, a volume button, a start button, and a lock button.

[0174] The sensor assembly 614 includes one or more sensors for providing a status assessment of various aspects of the electronic device 600. For example, the sensor assembly 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 assembly 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 the temperature change of the electronic device 600. The sensor assembly 614 can include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 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 assembly 614 can further include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0175] The communication component 616 is used to facilitate communication between the electronic device 600 and other devices in a wired or wireless manner. The electronic device 600 can access a wireless network based on communication standards, such as WiFi, a carrier network (such as 2G, 3G, 4G, or 5G), 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.

[0176] 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 implementing an image processing method provided in the embodiments of the present application.

[0177] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 604 including instructions, and the above instructions can be executed by a processor 620 of the electronic device 600 to complete the above method. For example, the non-transitory storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device, etc.

[0178] Figure 11is a block diagram of an electronic device 700 shown in accordance with an exemplary embodiment. For example, the electronic device 700 may be provided as a server. Referring to Figure 11 , the electronic device 700 includes a processing component 722, which further includes one or more processors, and memory resources represented by a memory 732 for storing instructions executable by the processing component 722, such as application programs. The application programs stored in the memory 732 may include one or more modules each corresponding to a set of instructions. In addition, the processing component 722 is configured to execute instructions to perform an image processing method provided by an embodiment of the present application.

[0179] The electronic device 700 may also include a power component 726 configured to perform power management of the electronic device 700, a wired or wireless network interface 750 configured to connect the electronic device 700 to a network, and an input / output (I / O) interface 758. The electronic device 700 may operate based on an operating system stored in the memory 732, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSD TM or the like.

[0180] An embodiment of the present application also provides a computer program product, including a computer program, where the computer program, when executed by a processor, implements the image processing method described above.

[0181] Those skilled in the art will readily conceive of other embodiments of the present application after considering the specification and practicing the application disclosed herein. The present application is intended to cover any variations, uses, or adaptations of the present application, which follow the general principles of the present application and include common general knowledge or conventional technical means in the technical field not disclosed in the present disclosure. The specification and embodiments are to be considered as exemplary only, and the true scope and spirit of the present application are pointed out by the following claims.

[0182] It should be understood that the present application is not limited to the exact structures described above and shown in the drawings, and various modifications and changes may be made without departing from its scope. The scope of the present application is only limited by the appended claims.

Claims

1. An image processing apparatus, characterized in that, The device includes: a monochromatic image acquisition module, configured to acquire a monochromatic image and the average color component ratio of the monochromatic image; a target curve determination module, configured to determine a target basic monochromatic color temperature curve matching the average color component ratio according to the coordinate points formed by the average color component ratio and a preset basic monochromatic color temperature curve; a low error calculation module, configured to determine a white balance gain coefficient according to the coordinate points and a preset neutral color temperature curve when the coordinate points are in a low error region divided on the target basic monochromatic color temperature curve; the low error region is a region formed by connecting the defined interval coordinates determined by the color temperature ellipse parameters of the basic color system color blocks at different color temperatures; a high error calculation module, configured to determine a white balance gain coefficient according to the coordinate points, a preset auxiliary color system color temperature curve and the neutral color temperature curve when the coordinate points are not in the low error region; a white balance module, configured to process the monochromatic image according to the white balance gain coefficient to obtain a target monochromatic image.

2. The image processing apparatus according to claim 1, wherein The monochromatic image acquisition module includes: an average pixel value calculation sub-module, configured to acquire the average pixel value corresponding to each color channel in the monochromatic image, and the average pixel value includes: a first average pixel value of the red channel, a second average pixel value of the green channel and a third average pixel value of the blue channel; a component ratio calculation sub-module, configured to use the ratio of the first average pixel value to the second average pixel value and the ratio of the third average pixel value to the second average pixel value as the average color component ratio.

3. The image processing apparatus according to claim 1, wherein The target curve determination module includes: a projection distance calculation sub-module, configured to calculate the projection distance between the coordinate points and the basic monochromatic color temperature curve; a screening sub-module, configured to use the basic monochromatic color temperature curve with the minimum projection distance as the target basic monochromatic color temperature curve.

4. The image processing apparatus according to claim 1, wherein The white balance gain coefficient includes: the gain coefficients corresponding to each color channel respectively; The white balance module includes: a multiplication operation sub-module, configured to multiply the pixel values of each color channel in the monochromatic image by the corresponding gain coefficient to obtain the target monochromatic image.

5. The image processing apparatus according to claim 1, wherein The low error calculation module includes: a first color temperature value calculation sub-module, configured to determine a first projection point of the coordinate points on the target basic monochromatic color temperature curve and acquire a first color temperature value corresponding to the first projection point; a low error coefficient calculation sub-module, configured to map the first color temperature value to the neutral color temperature curve and interpolate to obtain the white balance gain coefficients corresponding to each color channel.

6. The image processing apparatus according to claim 5, wherein There are multiple reference points marked on the basic monochromatic color temperature curve, and the first color temperature value calculation sub-module includes: a first reference point determination unit, configured to determine two first reference points on the target basic monochromatic color temperature curve that are closest to the first projection point; a first interpolation calculation unit, configured to perform interpolation calculation according to the distance between the first reference point and the first projection point to obtain the first color temperature value.

7. The image processing apparatus according to claim 5, wherein Multiple reference points are marked on the neutral color temperature curve, and the low error coefficient calculation sub-module includes: A second projection point determination unit, configured to obtain a second projection point corresponding to the first color temperature value on the neutral color temperature curve; A low error coefficient calculation unit, configured to obtain the white balance gain coefficients of each color channel corresponding to the first color temperature value through interpolation calculation according to two second reference points on the neutral color temperature curve that are closest to the second projection; 8. The image processing apparatus according to claim 7, wherein The low error coefficient calculation unit includes: A color component ratio calculation sub-unit, configured to obtain a color component ratio corresponding to the first color temperature value through interpolation calculation according to the second reference point, where the color component ratio includes: a first ratio of a first pixel value of the red channel to a second pixel value of the green channel, and a second ratio of a third pixel value of the blue channel to the second pixel value of the green channel; A low error coefficient calculation sub-unit, configured to use the reciprocal of the first ratio as the white balance gain coefficient of the red channel, use 1 as the white balance gain coefficient of the green channel, and use the reciprocal of the second ratio as the white balance gain coefficient of the blue channel.

9. The image processing apparatus according to claim 1, wherein The high error calculation module includes: A target curve screening sub-module, configured to determine a target auxiliary color temperature curve that matches the coordinate point from multiple auxiliary color temperature curves; A second color temperature value calculation sub-module, configured to determine a third projection point of the coordinate point on the target auxiliary color temperature curve and obtain a second color temperature value corresponding to the third projection point; A high error coefficient calculation sub-module, configured to map the second color temperature value to the neutral color temperature curve and interpolate to obtain the white balance gain coefficients corresponding to each color channel.

10. The image processing apparatus according to claim 9, wherein The target curve screening sub-module includes: A projection distance calculation unit, configured to calculate the projection distance between the coordinate point and the auxiliary color temperature curve; A screening unit, configured to use the auxiliary color temperature curve with the minimum projection distance as the target auxiliary color temperature curve; Multiple reference points are marked on the basic single color temperature curve, and the second color temperature value calculation sub-module includes: A third reference point determination unit, configured to determine two third reference points on the target basic single color temperature curve that are closest to the third projection point; A second interpolation calculation unit, configured to perform interpolation calculation according to the distance between the third reference point and the third projection point to obtain the second color temperature value.

11. The image processing apparatus according to claim 9, wherein The high error coefficient calculation sub-module includes: A fourth projection point determination unit, configured to obtain a fourth projection point corresponding to the second color temperature value on the neutral color temperature curve; A color component ratio calculation unit, configured to obtain a color component ratio corresponding to the second color temperature value through interpolation calculation according to the fourth projection point and two fourth reference points on the neutral color temperature curve that are closest to the fourth projection point, where the color component ratio includes: a first ratio of a first pixel value of the red channel to a second pixel value of the green channel, and a second ratio of a third pixel value of the blue channel to the second pixel value of the green channel; A high error coefficient calculation unit is configured to use the reciprocal of the first ratio as the white balance gain coefficient for the red channel, use 1 as the white balance gain coefficient for the green channel, and use the reciprocal of the second ratio as the white balance gain coefficient for the blue channel.

12. The image processing apparatus according to claim 1, wherein The apparatus further includes: A truncation module is configured to, for the pixel points in the target monochrome image whose pixel values are greater than a preset threshold, adjust the pixel values of the pixel points to the preset threshold.

13. An image processing method, characterized in that, The method includes: Obtaining a monochrome image and the average color component ratio of the monochrome image; Determining a target basic monochromatic color temperature curve matching the average color component ratio according to the coordinate point formed by the average color component ratio and a preset basic monochromatic color temperature curve; When the coordinate point is in the low error region divided on the target basic monochromatic color temperature curve, determining a white balance gain coefficient according to the coordinate point and a preset neutral color temperature curve; the low error region is a region formed by connecting the defined interval coordinates determined by the color temperature ellipse parameters of the basic color blocks at different color temperatures; When the coordinate point is not in the low error region, determining a white balance gain coefficient according to the coordinate point, a preset auxiliary color temperature curve, and the neutral color temperature curve; Processing the monochrome image according to the white balance gain coefficient to obtain a target monochrome image.

14. An imaging device, characterized in that, Including: An image collector is configured to obtain a monochrome image; The image processing apparatus according to any one of claims 1-12, wherein the image processing apparatus is configured to process the monochrome image to obtain a target monochrome image.

15. 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 instructions to implement the method according to claim 13.

16. A computer-readable storage medium, characterized in that, When the instructions in the computer-readable storage medium are executed by the processor of the electronic device, the electronic device is enabled to execute the method according to claim 13.

Citation Information

Patent Citations

  • Method and device for realizing white balance correction

    CN101079954A

  • Image gray-world white balance adjustment method and device based on color temperature curve

    CN106709887A