Data processing method and device

By directly calculating the tone spread value of the image in the HSV or HSL color space, the problem of low detection efficiency in the prior art is solved, and efficient image color shift detection in real-time active scenes is achieved.

CN120264155APending Publication Date: 2025-07-04LENOVO (BEIJING) LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510695421.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-27
Publication Date
2025-07-04

AI Technical Summary

Technical Problem

The prior art has a large amount of calculation when detecting image color offset, resulting in low detection efficiency and cannot meet the needs of real-time active scenarios.

Method used

By directly determining the tone dispersion value of the image in the HSV or HSL color space, the intermediate step of converting the image from the RGB color space to the XYZ and Lab color space is avoided, and the tone dispersion value is calculated directly in the HSV or HSL color space to detect whether the image has a color shift.

Benefits of technology

The efficiency of image color shift detection is improved, and it can quickly and accurately detect whether the image has color shift in real-time active scenes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120264155A_ABST
    Figure CN120264155A_ABST
Patent Text Reader

Abstract

The invention discloses a data processing method and device, and the method comprises the steps: obtaining first image data of a first image in a first color space; determining a hue dispersion value of the first image at least based on the hue value of each pixel in the first image data; a color cast detection result of the first image is determined at least based on the hue distribution value, and the color cast detection result indicates whether color cast exists in the first image or not.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of data processing, and particularly relates to a data processing method and apparatus. Background Art

[0002] Color cast is a phenomenon in the fields of image processing and photography. Color cast is manifested as a specific hue dominating in an image, resulting in the image deviating from its true color. This phenomenon is caused by various factors, such as uneven lighting conditions, improper white balance settings during image capture, or degradation of photographic materials over time, environmental factors, etc. Taking photographic and videographic scenarios, such as real-time event live broadcasts, video surveillance, etc., as an example, due to the continuous changes in weather conditions and the surrounding environment, the parameters of the acquisition device are often difficult to adapt to the complex scenarios of the entire real-time event, thereby causing color cast in the captured images.

[0003] To obtain higher-quality images, it is necessary to detect whether an image has color cast in order to further correct the color cast of the image. Summary of the Invention

[0004] For this reason, the present application discloses the following technical solutions:

[0005] A first aspect of the present application provides a data processing method, including:

[0006] Obtaining first image data of a first image in a first color space;

[0007] Determining a hue dispersion value of the first image based on at least hue values of pixels in the first image data;

[0008] Determining a color cast detection result of the first image based on at least the hue dispersion value, where the color cast detection result indicates whether the first image has color cast.

[0009] Optionally, the determining the hue dispersion value of the first image based on at least hue values of pixels in the first image data includes:

[0010] Adjusting the hue values of pixels in the first image data to obtain adjusted hue values of the pixels;

[0011] Determining the hue dispersion value of the first image based on at least the adjusted hue values of pixels in the first image data;

[0012] Wherein, the adjusted hue value of a target pixel in the first image data is within a continuous target interval, and the target pixels include pixels with hue values greater than a first threshold and pixels with hue values less than a second threshold.

[0013] Optionally, obtaining the first image data of the first image in the first color space includes:

[0014] Obtaining the first image raw data corresponding to the first image output by the acquisition device;

[0015] Converting the first image raw data belonging to the second color space to the first color space to obtain the first image data in the first color space;

[0016] Wherein, the first image raw data in the second color space does not include hue values, and the first image data in the first color space includes at least hue values.

[0017] Optionally, determining the hue dispersion value of the first image based at least on the hue values of the pixels in the first image data includes:

[0018] Based on the hue values of the pixels in the first image data and the hue average value of the first image data, determining the pixel hue dispersion value of each pixel in the first image data, where the hue average value is obtained according to the hue values of the pixels in the first image data;

[0019] Obtaining the hue dispersion value of the first image based at least on the pixel hue dispersion values of the pixels in the first image data.

[0020] Optionally, obtaining the hue dispersion value of the first image based at least on the pixel hue dispersion values of the pixels in the first image data includes:

[0021] Adjusting the pixel hue dispersion value of the pixel according to the brightness value of the pixel to obtain a corresponding adjusted hue dispersion value;

[0022] Determining the hue dispersion value of the first image according to the adjusted hue dispersion values of the pixels in the first image data.

[0023] Optionally, adjusting the pixel hue dispersion value of the pixel according to the brightness value of the pixel to obtain a corresponding adjusted hue dispersion value includes:

[0024] Obtaining a first brightness threshold and a second brightness threshold, where the first brightness threshold is greater than the second brightness threshold;

[0025] Determining a correction coefficient of the pixel according to the first brightness threshold, the second brightness threshold, and the brightness value of the pixel;

[0026] Adjusting the pixel hue dispersion value of the pixel according to the correction coefficient of the pixel to obtain a corresponding adjusted hue dispersion value.

[0027] Optionally, obtaining the first brightness threshold and the second brightness threshold includes:

[0028] Obtaining the first brightness threshold and the second brightness threshold according to the scene information of the first image, where the scene information of the first image characterizes the scene displayed in the first image.

[0029] Optionally, at least based on the hue dispersion value, determining the color cast detection result of the first image includes:

[0030] Determining the color cast detection result of the first image based on the hue dispersion value and the brightness mean value of the first image, where the brightness mean value of the first image is determined according to the brightness values of each pixel in the first image data.

[0031] Optionally, at least based on the hue dispersion value, determining the color cast detection result of the first image includes:

[0032] When the hue dispersion value is greater than or equal to the dispersion threshold, determining that the color cast detection result of the first image is that there is no color cast;

[0033] When the hue dispersion value is less than the dispersion threshold, determining that the color cast detection result of the first image is that there is a color cast.

[0034] A second aspect of the present application provides a data processing device, including:

[0035] An obtaining unit, configured to obtain first image data of a first image in a first color space;

[0036] A determining unit, configured to determine the hue dispersion value of the first image at least based on the hue values of each pixel in the first image data;

[0037] A detecting unit, configured to determine the color cast detection result of the first image at least based on the hue dispersion value, where the color cast detection result indicates whether there is a color cast in the first image. Description of the Drawings

[0038] To more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only the embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained according to the provided drawings without creative efforts.

[0039] Figure 1 It is a flowchart of a data processing method provided by an embodiment of the present application;

[0040] Figure 2It is a schematic diagram of the value range of a hue value and the corresponding color provided by an embodiment of the present application;

[0041] Figure 3 It is a schematic diagram of the hue distribution of the first type of image provided by an embodiment of the present application;

[0042] Figure 4 It is a schematic diagram of the hue distribution of the second type of image provided by an embodiment of the present application;

[0043] Figure 5 It is a schematic diagram of the hue distribution of the third type of image provided by an embodiment of the present application;

[0044] Figure 6 It is a schematic diagram of adjusting the hue value provided by an embodiment of the present application;

[0045] Figure 7 It is a schematic diagram of adjusting the value range of the hue value and the corresponding color provided by an embodiment of the present application;

[0046] Figure 8 It is a flowchart of a method for determining a hue dispersion value provided by an embodiment of the present application;

[0047] Figure 9 It is a schematic diagram of the hue distribution of the fourth type of image provided by an embodiment of the present application;

[0048] Figure 10 It is a schematic diagram of the hue distribution of the fifth type of image provided by an embodiment of the present application;

[0049] Figure 11 It is a schematic diagram of the structure of a data processing device provided by an embodiment of the present application. Detailed implementation manners

[0050] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts shall fall within the protection scope of the present application.

[0051] In the related technical field, a scheme for detecting whether an image has color cast is a detection scheme based on an equivalent circle. This scheme converts the image from the RGB color space to the CIELAB color space (also known as the Lab color space), which is composed of a lightness channel L and two chromaticity channels a and b. After conversion, this scheme can determine the statistical center of each pixel in the a channel and the statistical center in the b channel of the image, and determine whether the image has color cast according to whether the position of a specific circle where these two statistical centers are located deviates.

[0052] The problem with this solution is that the RGB color space cannot be directly converted to the CIELAB color space. Instead, it needs to be converted through the XYZ color space. That is to say, the image needs to be first converted from the RGB color space to the XYZ color space and then from the XYZ color space to the Lab color space. This obviously increases the computational complexity of the above detection solution, resulting in a low detection efficiency in actual applications and unable to meet the requirements for detection efficiency in some scenarios (such as live broadcast scenarios).

[0053] In view of the above problems, this embodiment provides a data processing method. Please refer to Figure 1 and the method may include the following steps.

[0054] S101, obtain first image data of a first image in a first color space.

[0055] The first image can be generated in various ways. In some embodiments, the first image can be an image captured by a capture device with a shooting function, including but not limited to mobile phones, tablets, cameras, monitoring devices, etc. In some embodiments, the first image can also be an image obtained after being processed by any electronic device with data processing capabilities. For example, the electronic device receives encoded image coding data or video coding data, and the first image can be an image obtained by decoding these data. Another example is that the first image can be an image generated based on an artificial intelligence (AI) model with image generation capabilities.

[0056] The method of this embodiment can be executed in real time during the process of obtaining the image. For example, during the process of shooting a video, each time the capture device captures a frame of the image, this frame of the image can be used as the first image, and the method of this embodiment can be applied to detect whether there is color deviation; when the electronic device downloads and plays a video stream from the network, each time a video frame is decoded, this video frame is used as the first image, and the method of this embodiment is applied to detect whether there is color deviation.

[0057] In an electronic device, a frame of the image can be composed of a set of image data. This set of image data contains several pixels, and each pixel contains a set of values in a specific color space. When it is necessary to display a frame of the image, the electronic device controls the display screen of the electronic device to emit light based on the values of the pixels in the corresponding image data, and then the frame of the image can be displayed on the display screen.

[0058] The first color space can be any color space that includes hue values. Each pixel contained in the first image data includes at least the hue value in the first color space, and the hue values of different pixels can be the same or different.

[0059] As some examples, the first color space can be the Hue - Saturation - Value color space, i.e., the HSV color space. Any pixel in the first image data can include a hue value, a saturation value, and a value value. Alternatively, the first color space can be the Hue - Saturation - Lightness color space, i.e., the HSL color space. Any pixel in the first image data can include a hue value, a saturation value, and a lightness value.

[0060] In the first color space, the hue value is used to distinguish the types of colors, such as red, green, blue, etc. Different hues correspond to different colors. In the visible light range, the value range of the hue value can be from 0 to 180, and the colors corresponding to different hue values can be represented by Figure 2 representation.

[0061] The first image data can be the original image data corresponding to the first image, that is, the original image data output by the device that generates the first image is the first image data containing the hue value. In this case, the first image data can be directly obtained from the device that generates the first image.

[0062] The original image data corresponding to the first image may not contain the hue value. At this time, the original image data corresponding to the first image can be processed to obtain the first image data.

[0063] S102. Determine the hue dispersion value of the first image based at least on the hue values of the pixels in the first image data.

[0064] In this embodiment, the hue dispersion value of the first image can be a numerical value that can characterize the Measure of the Spread of Hue (MOS) of the first image. MOS mainly measures the gap between the overall hue of the image and the hue of each pixel. If the difference between the hue of each pixel and the overall hue is small, the corresponding hue dispersion degree is small. At this time, each pixel is in a similar hue, and the corresponding image may have color cast. If the difference between the hue of each pixel and the overall hue is large, the corresponding hue dispersion degree is large. At this time, the pixels contained in the image data are scattered in different hues, and the corresponding image generally has no color cast.

[0065] As an example, please refer to Figure 3 and Figure 4 , Figure 3 The (1) in is a frame of image without color cast, Figure 3Figure (2) is a schematic diagram of the hue distribution curve of this frame of image. The abscissa of this curve is the hue value from 0 to 180, and the ordinate is the number of pixels with the corresponding hue value in the image data of this frame of image. It can be seen that there are a large number of pixels between 0 and 20, and between 120 and 140, and the hue distribution is relatively uniform, with a large degree of hue dispersion.

[0066] Figure 4 Figure (1) is a frame of image with color cast. This frame of image is overall biased towards blue. Figure 4 Figure (2) is a schematic diagram of the hue distribution curve of this frame of image. The meanings of the abscissa and ordinate are the same as those in Figure 3 Figure (2). It can be seen that almost all pixels in this frame of image are located between the hue values of 120 and 140, the hue distribution is highly concentrated, and the degree of hue dispersion is small.

[0067] Thus, it can be seen that the degree of hue dispersion of the image has a certain relationship with whether the image has color cast. If the degree of hue dispersion is small, it indicates that the image may have color cast. If the degree of hue dispersion is large, it indicates that the image may not have color cast. Therefore, the method of this embodiment can determine the hue dispersion value of the image according to the hue values of each pixel, so as to determine whether the first image has color cast based on the hue dispersion value.

[0068] Since MOS mainly measures the gap between the overall hue of the image and the hue of each pixel, in S102, the hues of each pixel in the first image data can be fused to obtain a parameter representing the overall hue of the image, and then combined with the parameter representing the overall hue of the image and the hues of each pixel in the first image data to determine the hue dispersion value of the first image.

[0069] S103, determine the color cast detection result of the first image based on at least the hue dispersion value, and the color cast detection result indicates whether the first image has color cast.

[0070] In S103, the color cast detection result of the first image can be determined only according to the hue dispersion value of the first image, or can be jointly determined by combining the hue dispersion value and other relevant parameters of the first image.

[0071] As an example, if the first color space is the HSV color space, the color cast detection result can be determined by combining the hue dispersion value and the overall brightness of the first image.

[0072] In this embodiment, the hue dispersion value of the first image can be positively correlated with the degree of hue dispersion. That is, the larger the hue dispersion value, the greater the degree of hue dispersion; the smaller the hue dispersion value, the smaller the degree of hue dispersion. Combining the previous description of the degree of hue dispersion, in S103, if the hue dispersion value of the first image is large, it can be determined that the first image has no color cast; if the hue dispersion value of the first image is small, it can be determined that the first image has a color cast.

[0073] Among them, if the color cast detection result indicates that the first image has no color cast, the first image can be directly saved in the corresponding file, or the first image can be displayed and output, or the first image can be transmitted to any electronic device; if the color cast detection result indicates that the first image has a color cast, any method capable of correcting the color cast of the image in the relevant technical field can be applied to process the first image, and then the first image after correcting the color cast can be saved in the corresponding file, or displayed and output, or transmitted to any electronic device.

[0074] The beneficial effects of this embodiment are as follows:

[0075] On the one hand, the method of this embodiment can obtain the first image data in the first color space, determine the hue dispersion value of the corresponding first image based on the first image data, and then detect whether the first image has a color cast according to the hue dispersion value;

[0076] On the other hand, in the case where the original image data corresponding to the first image does not contain hue values, the hue values of the pixels can be directly obtained based on the original image data corresponding to the first image through linear transformation without passing through other color spaces. Therefore, this embodiment can improve the efficiency of detecting the color cast of images.

[0077] Optionally, if the original image data of the first image does not contain hue values, the method for obtaining the first image data of the first image in the first color space can be:

[0078] Obtain the first original image data corresponding to the first image output by the acquisition device;

[0079] Convert the first original image data belonging to the second color space to the first color space to obtain the first image data in the first color space;

[0080] Among them, the first original image data in the second color space does not contain hue values, and the first image data in the first color space contains at least hue values.

[0081] The first original image data refers to the image data directly output by the acquisition device for acquiring the first image and constituting the first image. The second color space refers to the color space to which the first original image data belongs.

[0082] As some examples, the second color space may be a Red Green Blue (RGB) color space. Correspondingly, in the first image raw data, each pixel may include a red value (R value), a green value (G value), and a blue value (B value).

[0083] After obtaining the first image raw data, any method for converting the color space of an image can be used to calculate a set of values of a pixel in the second color space in the first image raw data to obtain the value of the pixel in the first color space. After calculating each pixel of the first image raw data, these pixels represented by the values in the first color space are equivalent to the first image data in S101.

[0084] Exemplarily, when the second color space is the RGB color space and the first color space is the HSV color space, the method for converting from the RGB color space to the HSV color space in the field of image processing can be used to process each pixel in the first image raw data to obtain the first image data. The method for converting from the RGB color space to the HSV color space can be referred to the related art and will not be elaborated here.

[0085] As an example, a function for converting the color space provided by an image processing library based on the Python language can be used, such as the function for converting from RGB to HSV in the OpenCV image processing library, to convert the first image raw data into the first image data.

[0086] Please refer to Figure 5 , Figure 5 in which (1) is a schematic diagram of an image with a red color cast, Figure 5 and (2) is a schematic diagram of the hue distribution curve of the image. The meanings of the abscissa and ordinate are the same as those in Figure 3 (2). It can be seen that although the overall image is biased towards red, its pixels are distributed between the hue values of 0 to 20 and 160 to 180, resulting in a relatively large degree of hue dispersion in the image. That is to say, when the image has a red color cast, the magnitude of the hue dispersion degree cannot correctly reflect the color cast of the image.

[0087] Refer to Figure 2 . The reason for this phenomenon is that both ends of the value range of the hue value represent the red hue. Therefore, when the image has a red color cast, the hue values of the pixels may be scattered at both ends of the value range from 0 to 180, resulting in a relatively large degree of hue dispersion in the image.

[0088] To address the above problem, when determining the hue dispersion value in the method of this embodiment, the hue value of the pixel can be adjusted according to the following method, and then the hue dispersion value can be determined based on the obtained adjusted hue value:

[0089] Adjust the hue values of each pixel in the first image data to obtain the adjusted hue values of each pixel;

[0090] Determine the hue dispersion value of the first image based at least on the adjusted hue values of each pixel in the first image data;

[0091] Among them, the adjusted hue values of the target pixels in the first image data are within a continuous target interval, and the target pixels include pixels with hue values greater than the first threshold and pixels with hue values less than the second threshold.

[0092] A method for adjusting the hue value of a pixel can be to increase all hue values less than the first threshold by a certain amplitude, and at the same time map the hue values greater than the first threshold to near the lower limit of the hue value range, that is, map them to a position close to 0. After such adjustment, the original hue values greater than the first threshold and the original hue values less than the second threshold are both adjusted to the target interval near the lower limit within the value range, so that the adjusted hue values of the target pixels are within a continuous target interval.

[0093] A method for adjusting the hue value of a pixel can also be to decrease all hue values greater than the second threshold by a certain amplitude, and at the same time map the hue values less than the second threshold to near the upper limit of the hue value range, that is, map them to a position close to 180. After such adjustment, the original hue values greater than the first threshold and the original hue values less than the second threshold are both adjusted to the target interval near the upper limit within the value range, so that the adjusted hue values of the target pixels are within a continuous target interval.

[0094] Combined Figure 2 It can be seen that the colors presented by the pixels with hue values greater than the first threshold and the target pixels with hue values less than the second threshold are similar, that is, both are close to red.

[0095] The first threshold and the second threshold can be set according to the actual situation without limitation. As some examples, for Figure 2 the shown hue values, since the colors presented when the hue values are above 160 and below 20 are both close to red, the first threshold can be set to 160 and the second threshold can be set to 20.

[0096] As an example of the first method for adjusting the hue value, the hue value of each pixel can be calculated according to formula (1) to obtain the adjusted hue value corresponding to each pixel.

[0097]

[0098] In formula (1), Hue represents the hue value of any pixel in the first image data, and MapHue represents the adjusted hue value obtained after adjusting the hue value of this pixel. When Hue is less than or equal to T1, the adjusted hue value is obtained according to the first line of formula (1). When Hue is greater than T1 and less than T2, the adjusted hue value is obtained according to the second line of formula (1). When Hue is greater than or equal to T2, the adjusted hue value is obtained according to the third line of formula (1). T2 can be the median between the first threshold and the upper limit of the value range of the hue value. For example, if T1 is equal to 160, then T2 can be equal to 170.

[0099] After adjustment according to formula (1), for the target pixels with hue values less than 20 and greater than 160, their hue values are adjusted to be within a continuous target range, that is, the adjusted hue values between 0 and 25.

[0100] See Figure 6 , after adjustment based on formula (1), the hue values that were originally less than the first threshold, that is, between 0 and 160, are mapped to the adjusted hue values between 5 and 165. The hue values that were originally greater than the first threshold and far from the upper limit of the value range are mapped to the adjusted hue values between 0 and 5. The hue values that were originally greater than the first threshold and closest to the upper limit of the value range are mapped to the adjusted hue values between 5 and 15.

[0101] After adjustment based on formula (1), the colors represented by different adjusted hue values can be seen in Figure 7 .

[0102] After adjustment based on formula (1), the hue values that were originally between 0 and 10, and those between 170 and 180, are both mapped to the adjusted hue values between 5 and 15. Mapping these two parts of hue values to the same adjusted hue value has the effect that, as Figure 2 shown, the hue values close to the upper and lower limits of the value range, that is, the hue values between 0 and 10 and those between 170 and 180, basically present positive red in terms of visual effect. Based on this, the method of this embodiment maps these two parts of hue values to the same adjusted hue value, which can make the distribution of the adjusted hue values of pixels in the image with red color deviation more concentrated, thereby further reducing the hue dispersion value of such images, which is beneficial to more accurately detecting whether the image has red color deviation.

[0103] By adjusting the hue value of pixels according to the method of the above embodiments, the adjusted hue values of target pixels close to red can be mapped to a continuous target interval, for example, mapped to the interval from 0 to 25. Thus, when the first image has a red color cast, the adjusted hue values of the pixels in the first image data will be concentrated in this target interval, making the first image exhibit a smaller degree of hue dispersion, thereby solving the problem that the degree of hue dispersion cannot correctly reflect the red color cast of the image.

[0104] Combined with the foregoing example, for Figure 5 the image shown in (1) of, if adjusted in the foregoing manner without combining brightness, the hue dispersion value of the obtained image may be 0.21, which is relatively large and cannot indicate that the image has a color cast. After adjusting the pixel hue dispersion values of each pixel in the foregoing manner, the hue dispersion value of the obtained image can be 0.02, which is relatively small and can indicate that the image has a color cast.

[0105] In some alternative embodiments, please refer to Figure 8 , the method for determining the hue dispersion value of the first image based at least on the hue values of the pixels in the first image data may include the following steps.

[0106] S801, obtain the hue average value of the first image data according to the hue values of the pixels in the first image data.

[0107] In S801, the average value of the hue values of all the pixels included in the first image data may be calculated, and the obtained result is used as the hue average value of the first image data.

[0108] S802, determine the pixel hue dispersion value of each pixel in the first image data based on the hue values of the pixels in the first image data and the hue average value of the first image data.

[0109] For any pixel in the first image data, the pixel hue dispersion value of this pixel may be determined according to the difference between the hue average value and the hue value of this pixel. For example, in S802, for any pixel in the first image data, the pixel hue dispersion value of this pixel may be calculated based on the following formula (2).

[0110]

[0111] Wherein, MOSx represents the pixel hue dispersion value of a pixel, mean_Hue represents the hue average value of the first image data, Hue represents the hue value of this pixel, and Min() represents taking the minimum value of the two.

[0112] S803, obtain the hue dispersion value of the first image based at least on the pixel hue dispersion values of the pixels in the first image data.

[0113] After obtaining the pixel tone dispersion value of each pixel in the first image data, one method of obtaining the tone dispersion value can be to directly calculate the average value of the pixel tone dispersion values of all pixels, and use the calculation result as the tone dispersion value of the first image.

[0114] That is to say, the tone dispersion value of the first image can be calculated according to the following formula (3).

[0115]

[0116] Among them, MOS represents the tone dispersion value of the first image, the first image data is a pixel matrix, M and N represent that the first image data contains M rows and N columns of pixels, the total number of pixels is M*N, and MOSx(x, y) represents the pixel tone dispersion value of a pixel in the x-th row and y-th column.

[0117] One method of obtaining the tone dispersion value can be to adjust the pixel tone dispersion value according to other parameters to obtain the adjusted tone dispersion value corresponding to each pixel, and then take the average of the adjusted tone dispersion values of all pixels in the first image data, and use the obtained result as the tone dispersion value of the first image.

[0118] To obtain the tone dispersion value of the first image by the above method, only need to replace MOSx(x, y) representing the pixel tone dispersion value in formula (3) with the parameter representing the adjusted tone dispersion value of the pixel, which will not be elaborated.

[0119] Optionally, if the tone value of the pixel is adjusted according to the method of the foregoing embodiment, then when determining the tone dispersion value according to the method Figure 8 shown, the tone value used can be replaced with the adjusted tone value mentioned above.

[0120] In the foregoing embodiment, the method of adjusting the pixel tone dispersion value and then determining the tone dispersion value of the first image may include:

[0121] Adjust the pixel tone dispersion value of the pixel according to the brightness value of the pixel to obtain the corresponding adjusted tone dispersion value;

[0122] Determine the tone dispersion value of the first image according to the adjusted tone dispersion values of the pixels in the first image data.

[0123] When adjusting according to the brightness value, all pixels included in the first image data can be divided into overexposed pixels, underexposed pixels, and normal pixels according to the size of the brightness value; lower the pixel tone dispersion values of the overexposed pixels and underexposed pixels among them to obtain the corresponding adjusted tone dispersion values, and the lowering amplitude depends on the brightness value of the pixel; determine the pixel tone dispersion value of the normal pixels as the adjusted tone dispersion value, that is, the pixel tone dispersion value of the normal pixels is not adjusted.

[0124] Overexposed pixels can be defined as pixels whose corresponding luminance values are greater than a first luminance threshold, underexposed pixels can be defined as pixels whose corresponding luminance values are less than a second luminance threshold, the first luminance threshold and the second luminance threshold can be preset fixed thresholds, or can be thresholds dynamically set according to different first images, and the first luminance threshold is greater than the second luminance threshold.

[0125] After obtaining the adjusted tone dispersion value of the pixels, the adjusted tone dispersion values of all pixels can be averaged, and the obtained result is used as the tone dispersion value of the image.

[0126] Among them, according to the luminance value of the pixel, the method of adjusting the pixel tone dispersion value of the pixel to obtain the corresponding adjusted tone dispersion value can be:

[0127] Obtain a first luminance threshold and a second luminance threshold, where the first luminance threshold is greater than the second luminance threshold;

[0128] Determine the correction coefficient of the pixel according to the first luminance threshold, the second luminance threshold and the luminance value of the pixel;

[0129] Adjust the pixel tone dispersion value of the pixel according to the correction coefficient of the pixel to obtain the corresponding adjusted tone dispersion value.

[0130] For any pixel in the first image data, the correction coefficient P of the pixel can be calculated according to the following formula (4).

[0131]

[0132] Among them, Sig is a preset real number greater than 0 and less than 1, and its value can be set according to experience, for example, set to 0.1 or 0.001. The function of setting this parameter is to avoid problems caused by a denominator of 0 in the calculation process.

[0133] Among them, T bright represents the first luminance threshold, T dark represents the second luminance threshold, mean V represents the average value of the luminance values of all pixels in the first image data, V represents the luminance value of a pixel in the first image data, P represents the correction coefficient of the pixel, Min() represents taking the minimum value, and Max() represents taking the maximum value.

[0134] For any pixel, after obtaining the correction coefficient, the adjusted tone dispersion value of the pixel can be obtained by multiplying the correction coefficient by the pixel tone dispersion value of the pixel. That is to say, the adjusted tone dispersion value MOSy of a pixel can be represented by the following formula (5), MOSy = P * MOSx, (5). MOSx is the pixel tone dispersion value of the pixel.

[0135] As can be seen from formula (4), the denominators of all pixels in the first image are the same. For overexposed pixels, the higher their brightness value, the closer it is to the upper limit of the brightness value, and thus the smaller their correction coefficient. When adjusting the pixel tone dispersion value, the greater the downward adjustment amplitude. For underexposed pixels, the lower their brightness value, the closer it is to the lower limit of the brightness value, and thus the smaller their correction coefficient. When adjusting the pixel tone dispersion value, the greater the downward adjustment amplitude.

[0136] That is to say, when adjusting the pixel tone dispersion values of overexposed pixels and underexposed pixels, the downward adjustment amplitude can be positively correlated with the deviation degree of the pixel brightness value from the relative brightness threshold. The greater the deviation degree of the brightness value of overexposed pixels from the first brightness threshold and the closer it is to the upper limit of the brightness value, the greater the downward adjustment amplitude. The greater the deviation degree of the brightness value of underexposed pixels from the second brightness threshold and the closer it is to the lower limit of the brightness value, the greater the downward adjustment amplitude.

[0137] Please refer to Figure 9 , which is a schematic diagram of the tone distribution of an image provided in this embodiment. Figure 9 In (1) of , it is an image with an overall overexposure problem. The brightness of most pixels in the image is too high. It can be seen that this frame of image visually presents a defect of overall white bias. However, Figure 9 in the tone distribution curve of the image shown in (2) of , its pixels are evenly distributed between the tone values of 20 and 100. That is to say, although this image has a white color cast, its tone dispersion degree is relatively large.

[0138] Please refer to Figure 10 , which is a schematic diagram of the tone distribution of an image provided in this embodiment. Figure 10 In (1) of , it is an image with an overall underexposure problem. The brightness values of most pixels in the image are too low. It can be seen that this frame of image visually presents a defect of overall black bias. However, Figure 10 in the tone distribution curve of the image shown in (2) of , its pixels are evenly distributed between the tone values of 80 and 120, and between 40 and 60. That is to say, although this image has a black color cast, its tone dispersion degree is relatively large.

[0139] Combining Figure 9 and Figure 10 examples, it can be seen that for images with white color cast caused by overexposure and black color cast caused by underexposure, their tone dispersion degrees cannot correctly reflect the color cast phenomenon of the images.

[0140] After adjusting the pixel tone dispersion value of each pixel according to the brightness value by the method of the foregoing embodiment, overexposed pixels and underexposed pixels can have a relatively small adjusted tone dispersion value. When there is a white color cast in the image, the adjusted tone dispersion values of most overexposed pixels in the image are small, so the overall tone dispersion value of the image is also small. When there is a black color cast in the image, the adjusted tone dispersion values of most underexposed pixels in the image are small, so the overall tone dispersion value of the image is also small. In this way, images with black and white color casts can both have a relatively small tone dispersion value, and images without black and white color casts have a relatively large tone dispersion value, thereby improving the accuracy of detecting black and white color casts according to the tone dispersion value.

[0141] Combined with the foregoing example, for Figure 9 the image shown in (1) of, if the adjustment is not performed in the foregoing manner in combination with the brightness, the tone dispersion value of the obtained image may be 0.12, and this tone dispersion value is relatively large and cannot indicate that the image has a color cast. After adjusting the pixel tone dispersion values of each pixel in the foregoing manner, the tone dispersion value of the obtained image can be 0.02, and this tone dispersion value is relatively small and can indicate that the image has a color cast.

[0142] For Figure 10 the image shown in (1) of, if the adjustment is not performed in the foregoing manner in combination with the brightness, the tone dispersion value of the obtained image may be 0.08, and this tone dispersion value is relatively large and cannot indicate that the image has a color cast. After adjusting the pixel tone dispersion values of each pixel in the foregoing manner, the tone dispersion value of the obtained image can be 0.01, and this tone dispersion value is relatively small and can indicate that the image has a color cast.

[0143] As described above, the first brightness threshold and the second brightness threshold can be fixed values. For example, the upper and lower limits of the brightness value are 255 and 0 respectively, the first brightness threshold can be 240, and the second brightness threshold can be 55; the first brightness threshold and the second brightness threshold can also be thresholds dynamically determined according to the difference of the first image. For the latter case, a method for determining the first brightness threshold and the second brightness threshold can be:

[0144] Obtain the first brightness threshold and the second brightness threshold according to the scene information of the first image, and the scene information of the first image characterizes the scene displayed by the first image.

[0145] In the foregoing embodiment, the brightness of several images captured under different scenes can be analyzed to obtain the environmental brightness range under different scenes. The scenes can be divided according to various factors such as the location, time, and weather conditions. For example, they can be divided according to whether the location is outdoors or indoors, the time is day or night, and the weather is sunny or rainy.

[0146] As some examples, the scene and the corresponding ambient brightness range may include: the ambient brightness range for the outdoor scene during the day is 80 to 245, the ambient brightness range for the indoor scene is 50 to 220, the ambient brightness range for the outdoor scene at night is 40 to 180, the ambient brightness range for the clear-day outdoor scene is 100 to 250, the ambient brightness range for the rainy-day outdoor scene is 60 to 230, etc.

[0147] Based on this, the ambient brightness range corresponding to the scene information of the first image can be determined, and the upper limit of this ambient brightness range is used as the first brightness threshold, and the lower limit of this ambient brightness range is used as the second brightness threshold.

[0148] Combined with the foregoing examples, if the scene information of the first image indicates that the first image is taken indoors, the first brightness threshold can be determined to be 220, and the second brightness threshold can be determined to be 50.

[0149] Obtaining the first brightness threshold and the second brightness threshold according to the above method can make the setting of the brightness threshold more in line with the brightness of the environment when the first image is collected, more accurately identify overexposed pixels and underexposed pixels, and thus can more accurately detect whether there is color cast in the first image.

[0150] In some alternative embodiments, the method for determining the color cast detection result of the first image based at least on the hue dispersion value may be:

[0151] In the case where the hue dispersion value is greater than or equal to the dispersion threshold, it is determined that there is no color cast in the color cast detection result of the first image;

[0152] In the case where the hue dispersion value is less than the dispersion threshold, it is determined that there is color cast in the color cast detection result of the first image.

[0153] That is to say, the hue dispersion value of the first image can be compared with a pre-determined dispersion threshold. If the hue dispersion value is greater than or equal to the dispersion threshold, it means that the hue dispersion degree of the first image is relatively high, and the pixels are evenly distributed on multiple colors, and there is no color cast in the first image; if the hue dispersion value is less than the dispersion threshold, it means that the hue dispersion degree of the first image is relatively low, and the pixels are concentrated on a certain specific color, and there is color cast in the first image.

[0154] The dispersion threshold can be a fixed threshold. Exemplarily, the dispersion threshold can be equal to 0.05.

[0155] Alternatively, the dispersion threshold can also be dynamically adjusted. For example, after determining the color cast detection result of the first image based on the dispersion threshold, the first image can be displayed and output to the user, and the user is prompted to judge whether there is color cast in the first image. The current dispersion threshold is adjusted in combination with the color cast detection result and the user's judgment result.

[0156] For example, when the color cast detection result is consistent with the user's judgment result, the current scatter threshold remains unchanged;

[0157] When the color cast detection result indicates no color cast and the user's judgment result indicates the existence of a color cast, the scatter threshold can be increased by a certain amount on the current basis to improve the sensitivity of color cast detection;

[0158] When the color cast detection result indicates the existence of a color cast and the user's judgment result indicates no color cast, the scatter threshold can be decreased by a certain amount on the current basis to reduce the false positive rate of color cast detection.

[0159] In some alternative embodiments, the method for determining the color cast detection result of the first image based at least on the hue scatter value may also be:

[0160] Based on the hue scatter value and the brightness mean value of the first image, determine the color cast detection result of the first image, where the brightness mean value of the first image is determined according to the brightness values of each pixel in the first image data.

[0161] In the above embodiments, the hue scatter value of the first image can be calculated according to the following formula (6) or formula (7) to obtain the corrected hue scatter value of the first image.

[0162]

[0163]

[0164] MOS_V represents the corrected hue scatter value of the first image, MOS represents the hue scatter value of the first image, A is a preset adjustment coefficient less than 1 and greater than 0, and its value can be set as needed, for example, set to 0.5, 0.7 or other values; T max represents the upper limit of the brightness value, which can generally be 255, T min represents the lower limit of the brightness value, which can generally be 0, mean V represents the brightness mean value of the first image.

[0165] Among them, after obtaining the hue scatter value of the first image, the brightness mean value of the first image can be compared with the first brightness threshold and the second brightness threshold respectively. If the brightness mean value is greater than the first brightness threshold, the corrected hue scatter value can be calculated according to formula (6); if the brightness mean value is less than the second brightness threshold, the corrected hue scatter value can be calculated according to formula (7); if the brightness mean value is less than or equal to the first brightness threshold and greater than or equal to the second brightness threshold, the hue scatter value of the first image can be directly compared with the scatter threshold to determine the color cast detection result, and there is no need to calculate the corrected hue scatter value according to the methods of formula (6) and (7).

[0166] The hue dispersion value used in this embodiment can be calculated according to the method corresponding to formula (3) based on the pixel hue dispersion values of the pixels in the first image data or based on the adjusted hue dispersion values of the pixels.

[0167] After obtaining the corrected hue dispersion value, it is possible to compare the corrected hue dispersion value with the dispersion threshold according to the method of the foregoing embodiment. If the corrected hue dispersion value is greater than or equal to the dispersion threshold, it can be determined that the first image has no color cast. If the corrected hue dispersion value is less than the dispersion threshold, it can be determined that the first image has a color cast.

[0168] Similar to adjusting the pixel hue dispersion value of each pixel according to the brightness value in the foregoing embodiment, determining the color cast detection result in the above manner is beneficial to reducing the hue dispersion value of the first image in the case of overexposure or underexposure of the first image, so as to obtain a corrected hue dispersion value that can more accurately reflect the color cast phenomenon, thereby improving the accuracy of detecting black color cast and white color cast according to the hue dispersion value.

[0169] The embodiment of the present application also provides a data processing device. Please refer to Figure 11 This device may include the following units.

[0170] An obtaining unit 1101, configured to obtain first image data of a first image in a first color space;

[0171] A determining unit 1102, configured to determine the hue dispersion value of the first image based at least on the hue values of the pixels in the first image data;

[0172] A detecting unit 1103, configured to determine a color cast detection result of the first image based at least on the hue dispersion value, where the color cast detection result indicates whether the first image has a color cast.

[0173] The determining unit 1102 determines the hue dispersion value of the first image based at least on the hue values of the pixels in the first image data, including:

[0174] Adjusting the hue values of the pixels in the first image data to obtain adjusted hue values of the pixels;

[0175] Determining the hue dispersion value of the first image based at least on the adjusted hue values of the pixels in the first image data;

[0176] Among them, the adjusted hue value of the target pixel in the first image data is within a continuous target interval, and the target pixel includes pixels with a hue value greater than the first threshold and pixels with a hue value less than the second threshold.

[0177] Optionally, the obtaining unit 1101 obtains the first image data of the first image in the first color space, including:

[0178] Obtain the first image raw data corresponding to the first image output by the acquisition device;

[0179] Convert the first image raw data belonging to the second color space to the first color space to obtain the first image data in the first color space;

[0180] Among them, the first image raw data in the second color space does not include hue values, and the first image data in the first color space includes at least hue values.

[0181] Optionally, the determination unit 1102 determines the hue dispersion value of the first image based at least on the hue values of the pixels in the first image data, including:

[0182] Based on the hue values of the pixels in the first image data and the hue average value of the first image data, determine the pixel hue dispersion value of each pixel in the first image data, and the hue average value is obtained according to the hue values of the pixels in the first image data;

[0183] Obtain the hue dispersion value of the first image based at least on the pixel hue dispersion values of the pixels in the first image data.

[0184] Optionally, the determination unit 1102 obtains the hue dispersion value of the first image based at least on the pixel hue dispersion values of the pixels in the first image data, including:

[0185] Adjust the pixel hue dispersion value of the pixel according to the brightness value of the pixel to obtain the corresponding adjusted hue dispersion value;

[0186] Determine the hue dispersion value of the first image according to the adjusted hue dispersion values of the pixels in the first image data.

[0187] Optionally, the determination unit 1102 adjusts the pixel hue dispersion value of the pixel according to the brightness value of the pixel to obtain the corresponding adjusted hue dispersion value, including:

[0188] Obtain a first brightness threshold and a second brightness threshold, where the first brightness threshold is greater than the second brightness threshold;

[0189] Determine the correction coefficient of the pixel according to the first brightness threshold, the second brightness threshold and the brightness value of the pixel;

[0190] Adjust the pixel hue dispersion value of the pixel according to the correction coefficient of the pixel to obtain the corresponding adjusted hue dispersion value.

[0191] Optionally, the determination unit 1102 obtains the first brightness threshold and the second brightness threshold, including:

[0192] Obtain the first brightness threshold and the second brightness threshold according to the scene information of the first image, and the scene information of the first image characterizes the scene displayed by the first image.

[0193] Optionally, the detection unit 1103 determines the color cast detection result of the first image based on at least the hue dispersion value, including:

[0194] Based on the hue dispersion value and the brightness mean value of the first image, the color cast detection result of the first image is determined, and the brightness mean value of the first image is determined according to the brightness values of the pixels in the first image data.

[0195] Optionally, the detection unit 1103 determines the color cast detection result of the first image based on at least the hue dispersion value, including:

[0196] When the hue dispersion value is greater than or equal to the dispersion threshold, it is determined that there is no color cast in the color cast detection result of the first image;

[0197] When the hue dispersion value is less than the dispersion threshold, it is determined that there is a color cast in the color cast detection result of the first image.

[0198] For the data processing device in the above embodiments, the working principle can refer to the relevant steps in the data processing method in the foregoing embodiments, which will not be elaborated.

[0199] It should be noted that the embodiments in this specification are all described in a progressive manner. Each embodiment focuses on the differences from other embodiments. The same or similar parts among the embodiments can be referred to each other.

[0200] For the convenience of description, when describing the above system or device, various modules or units are described according to functions. Of course, when implementing the present application, the functions of each unit can be implemented in the same or multiple software and / or hardware.

[0201] From the description of the above embodiments, those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product can be stored in a storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in various embodiments or some parts of the embodiments of the present application.

[0202] Finally, it should also be noted that in this text, relational terms such as first, second, third, and fourth are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprising", "including" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements not only includes those elements, but also includes other elements not expressly listed, or also includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or device comprising the element.

[0203] The above are only the preferred embodiments of the present application. It should be pointed out that for those of ordinary skill in the art, without departing from the principle of the present application, several improvements and refinements can be made, and these improvements and refinements should also be regarded as the protection scope of the present application.

Claims

1. A data processing method, comprising: Obtaining first image data of a first image in a first color space; Determining a hue dispersion value of the first image based at least on hue values of pixels in the first image data; Determining a color cast detection result of the first image based at least on the hue dispersion value, the color cast detection result indicating whether there is a color cast in the first image.

2. The method according to claim 1, wherein the determining the hue dispersion value of the first image based at least on the hue values of pixels in the first image data comprises: Adjusting the hue values of pixels in the first image data to obtain adjusted hue values of the pixels; Determining the hue dispersion value of the first image based at least on the adjusted hue values of pixels in the first image data; wherein the adjusted hue value of a target pixel in the first image data is within a continuous target range, and the target pixels include pixels with hue values greater than a first threshold and pixels with hue values less than a second threshold.

3. The method according to claim 1, wherein the obtaining the first image data of the first image in the first color space comprises: Obtaining first raw image data corresponding to the first image output by an acquisition device; Converting the first raw image data belonging to a second color space to the first color space to obtain the first image data in the first color space; wherein the first raw image data in the second color space does not include hue values, and the first image data in the first color space includes at least hue values.

4. The method according to claim 1, wherein the determining the hue dispersion value of the first image based at least on the hue values of pixels in the first image data comprises: Determining a pixel hue dispersion value of each pixel in the first image data based on the hue value of each pixel in the first image data and the hue average value of the first image data, the hue average value being obtained according to the hue values of pixels in the first image data; Obtaining the hue dispersion value of the first image based at least on the pixel hue dispersion values of pixels in the first image data.

5. The method according to claim 4, wherein the obtaining the hue dispersion value of the first image based at least on the pixel hue dispersion values of pixels in the first image data comprises: Adjusting the pixel hue dispersion value of the pixel according to the brightness value of the pixel to obtain a corresponding adjusted hue dispersion value; Determining the hue dispersion value of the first image based on the adjusted hue dispersion values of pixels in the first image data.

6. The method according to claim 5, wherein the adjusting the pixel hue dispersion value of the pixel according to the brightness value of the pixel to obtain a corresponding adjusted hue dispersion value comprises: Obtaining a first brightness threshold and a second brightness threshold, the first brightness threshold being greater than the second brightness threshold; Determining a correction coefficient of the pixel according to the first brightness threshold, the second brightness threshold and the brightness value of the pixel; Adjusting the pixel hue dispersion value of the pixel according to the correction coefficient of the pixel to obtain a corresponding adjusted hue dispersion value.

7. The method according to claim 6, wherein the obtaining of the first brightness threshold and the second brightness threshold comprises: obtaining the first brightness threshold and the second brightness threshold according to the scene information of the first image, wherein the scene information of the first image characterizes the scene shown in the first image.

8. The method according to claim 1, wherein the determining of the color cast detection result of the first image based at least on the hue dispersion value comprises: determining the color cast detection result of the first image based on the hue dispersion value and the brightness mean value of the first image, wherein the brightness mean value of the first image is determined according to the brightness values of the pixels in the first image data.

9. The method according to claim 1, wherein the determining of the color cast detection result of the first image based at least on the hue dispersion value comprises: when the hue dispersion value is greater than or equal to the dispersion threshold, determining that the color cast detection result of the first image is that there is no color cast; when the hue dispersion value is less than the dispersion threshold, determining that the color cast detection result of the first image is that there is a color cast.

10. A data processing device, comprising: an obtaining unit, configured to obtain first image data of a first image in a first color space; a determining unit, configured to determine the hue dispersion value of the first image based at least on the hue values of the pixels in the first image data; a detecting unit, configured to determine the color cast detection result of the first image based at least on the hue dispersion value, wherein the color cast detection result indicates whether there is a color cast in the first image.