An image color cast detection method, device and computer readable storage medium

By acquiring component data of color channels in the target color space and classifying the moment features using a feature classifier, the problems of image color cast detection efficiency and resource consumption in video surveillance systems are solved, achieving efficient image color cast detection.

CN115205579BActive Publication Date: 2026-06-19ZHEJIANG DAHUA TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ZHEJIANG DAHUA TECH CO LTD
Filing Date
2022-05-31
Publication Date
2026-06-19

AI Technical Summary

Technical Problem

In existing video surveillance systems, there is a contradiction between real-time intelligent analysis and inefficient and lagging manual diagnosis. How to design an image color distortion detection algorithm with strong generalization ability and low resource consumption has become an urgent problem to be solved.

Method used

By acquiring component data of at least one color channel in the target color space, and using a feature classifier to classify the moment features, it is possible to determine whether the image has a color cast. This includes training the classification function and constructing the target function, and directly processing YUV format images to improve efficiency.

🎯Benefits of technology

It achieves efficient image color cast detection, improves the algorithm's generalization ability and computing speed, reduces resource consumption, and improves the detection efficiency of surveillance video quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115205579B_ABST
    Figure CN115205579B_ABST
Patent Text Reader

Abstract

This invention discloses an image color cast detection method, device, and computer-readable storage medium. The image color cast detection method includes: acquiring component data of at least one color channel of the detection image in a target color space; determining color features of the detection image based on the component data of at least one color channel, wherein the color features include moment features determined based on the component data of at least one color channel; and classifying the color features using a feature classifier to determine whether the detection image has a color cast. Through the above method, this invention can directly utilize a classifier to perform color cast detection on the image color channels, improving algorithm efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology, and in particular to an image color cast detection method, device, and computer-readable storage medium. Background Technology

[0002] With the nationwide promotion of smart city construction, the number of surveillance cameras and image sensors in cities exceeds tens of thousands, spanning over a decade, resulting in inconsistent video quality. Meanwhile, video data, as a crucial resource for efficient and intelligent analysis, presents a pressing issue: how to assess the quality of this collected video data. Currently, most video surveillance systems face a contradiction between real-time intelligent analysis and inefficient, lagging manual diagnostics. Video color cast detection algorithms can provide an effective solution to this problem. In the field of video surveillance, algorithm speed is also a significant challenge, as most front-end cameras often have very limited computing power and memory. Therefore, designing a detection algorithm with strong generalization capabilities and low resource consumption is particularly important. Summary of the Invention

[0003] The main technical problem solved by this invention is to provide an image color cast detection method, device and computer-readable storage medium, which can directly use a classifier to detect color cast on the color channels of an image and improve algorithm efficiency.

[0004] To solve the above-mentioned technical problems, one technical solution adopted by the present invention is: to provide an image color cast detection method, the image color cast detection method comprising: acquiring component data of at least one color channel of the detection image in a target color space; determining color features of the detection image based on the component data of at least one color channel, wherein the color features include moment features determined based on the component data of at least one color channel; classifying the color features using a feature classifier to determine whether the detection image has a color cast.

[0005] The target color space includes the YUV color space, and the component data of at least one color channel includes the U component data of the U channel and the V component data of the V channel.

[0006] The process of classifying color features using a feature classifier to determine whether a detected image is color-biased includes: classifying the moment features using a feature classifier to obtain color feature scores; and classifying detected images with color feature scores greater than a preset score as color-biased images.

[0007] The process of classifying moment features using a feature classifier to determine whether the detected image has a color cast includes: training a classification function, and using the trained classification function as the feature classifier. The trained classification function is as follows: Where x is the moment characteristic, θ i These are preset parameters.

[0008] The training of the classification function includes: obtaining color-distorted samples and normal samples; inputting the color-distorted samples and normal samples into the classifier function to obtain the classification result; constructing the objective function; and training the classification function using the classification result and the objective function. The objective function is as follows: Where, N a N represents the number of color-biased samples. n N represents the number of normal samples. total The sum of the number of skewed samples and normal samples is given, and the value of α ranges from 0 to 1.

[0009] The process of classifying moment features using a feature classifier to obtain color feature scores includes: inputting moment features into a classification function to obtain color feature scores, where the range of color feature scores is 0 to 1.

[0010] Specifically, determining the color features of the detected image based on the component data of at least one color channel includes: dividing the component data of at least one color channel into blocks to obtain multiple component sub-data of the component data; and calculating the Hu moment features of the multiple component sub-data.

[0011] The calculation of the Hu moment features of multiple component sub-data includes: calculating the original moments corresponding to the multiple component sub-data respectively; obtaining multiple center distances of the component sub-data using the original moments; and constructing an invariant set of moments using the multiple center distances as the Hu moment features corresponding to the component sub-data.

[0012] The process of acquiring detection images includes: acquiring video images; selecting multiple images from the video images by skipping frames as a group of detection images; and using the group of detection images to determine whether the video images have color cast.

[0013] To solve the above-mentioned technical problems, another technical solution adopted by the present invention is to provide an image color cast detection device, which includes a processor for executing the above-mentioned image color cast detection method.

[0014] To solve the above-mentioned technical problems, another technical solution adopted by the present invention is to provide a computer-readable storage medium for storing instruction / program data, which can be executed to implement the above-mentioned image color distortion detection method.

[0015] The beneficial effects of the present invention are as follows: Unlike the prior art, the present invention provides an image color cast detection method, which processes the component data of at least one color channel in the target color space, obtains color features of the detected image based on statistical analysis of the component data of the color channels, and uses a constructed feature classifier to analyze the degree of color cast of the color features to determine whether the image is color cast. Attached Figure Description

[0016] Figure 1 This is a flowchart illustrating one embodiment of the image color cast detection method of this application;

[0017] Figure 2 This is a flowchart illustrating another embodiment of the image color cast detection method of this application;

[0018] Figure 3 This is a flowchart illustrating another implementation of the image color cast detection method of this application;

[0019] Figure 4 This is a schematic diagram of the image color cast detection device in the embodiments of this application;

[0020] Figure 5 This is a schematic diagram of the image color cast detection device in the embodiments of this application;

[0021] Figure 6 This is a schematic diagram of the structure of a computer-readable storage medium in an embodiment of this application. Detailed Implementation

[0022] To make the objectives, technical solutions, and effects of the present invention clearer and more explicit, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments.

[0023] In some large-scale projects, color distortion in the surveillance footage can occur to varying degrees due to power supply methods and incorrect installation of the monitoring lines, significantly impacting the quality of the images. Therefore, using a video color distortion detection system to inspect surveillance videos can promptly identify anomalies in the monitoring equipment, facilitating timely repairs by troubleshooting personnel.

[0024] In video surveillance, the main characteristic of color cast is that the overall color of the image is abnormal and clearly biased towards a certain color. The main difficulty in designing an automatic detection algorithm is that, in actual use, the types of colors that the image is biased towards are diverse and almost without any pattern, which poses a great challenge to the algorithm's generalization ability.

[0025] Please see Figure 1 , Figure 1This is a schematic flowchart of one embodiment of the image color cast detection method of this application. It should be noted that if substantially the same result is obtained, this embodiment does not necessarily reflect that outcome. Figure 1 The illustrated process sequence is limited. For example... Figure 1 As shown, this embodiment includes:

[0026] S110: Acquire component data of at least one color channel of the detected image in the target color space.

[0027] The detection image is acquired using monitoring equipment, and component data of at least one color channel in the color space of the data format of the detection image are selected according to the data format of the data image. The detection image can be in RGB, HSV, LAB, or YUV format.

[0028] S130: Determine the color features of the detected image based on the component data of at least one color channel.

[0029] The component data of the color channels of each pixel in the detected image are processed to obtain feature data describing the color features of the detected image. These color features include moment features determined based on the component data of at least one color channel.

[0030] S150: Use a feature classifier to classify color features and determine whether the detected image has a color cast.

[0031] This application constructs a feature classifier to classify the moment features obtained above. The feature data of the entire detected image are then used to determine whether the detected image has a color cast.

[0032] In this embodiment, the present application provides an image color cast detection method, which processes the component data of at least one color channel in the target color space, obtains color features of the detected image based on statistical analysis of the component data of the color channels, and uses a constructed feature classifier to analyze the degree of color cast of the color features to determine whether the image has a color cast.

[0033] Please see Figure 2 , Figure 2 This is a flowchart illustrating another embodiment of the image color cast detection method of this application. It should be noted that if substantially the same result is obtained, this embodiment does not necessarily reflect that outcome. Figure 2 The illustrated process sequence is limited. For example... Figure 2 As shown, this embodiment includes:

[0034] S210: Acquire component data of at least one color channel of the detected image in the target color space.

[0035] S230: Determine the moment features of the detected image based on the component data of at least one color channel.

[0036] By analyzing the component data of the color channels of each pixel in the detected image, feature data describing the color characteristics of the detected image is obtained. In embodiments of this application, the obtained color features can be moment features of the detected image. These moment features include Hu moments, etc.

[0037] Before calculating the Hu moments, the center distance of the detection image is calculated using the component data of the color channels of the detection image. First, the component data of the color channels of each pixel in the detection image are obtained, and the k-th order center distance feature is calculated using the pixel values. The calculation method is: μ k =E[(X-EX)] k ], where k takes the value of an integer from 0 to 4. For moments of order three or lower, specific physical characteristic meanings can be assigned to them. Multiple center distance features are used as color features of the detected image.

[0038] The Hu distance of the detected image is calculated using the component data of the color channels. The Hu moment is a linear combination of normalized central moments. First, the component data of the color channels of each pixel in the detected image are obtained, and the moment features are calculated using the pixel values.

[0039] Specifically, firstly, multiple origin moments of the pixel values ​​are obtained. The obtained detection image is an m×n image, meaning the detection image has m×n pixels. The p+q order origin moments of each pixel in the detection image are obtained, and the specific calculation method is as follows:

[0040]

[0041] Where f(x, y) represents the pixel value of the pixel in the x-th row and y-th column, and p, q = 0, 1, 2, ... Similarly, for moments of order three or lower, specific physical characteristic meanings can be assigned to them; center distance features of different orders have different physical meanings. The 0th-order center distance represents the mass of the target region, the 1st-order center distance represents the centroid of the target region, the 2nd-order center distance represents the radius of rotation of the target region, and the 3rd-order center distance represents the orientation and slope of the target region. The acquired multiple origin moments are used as basic color features to construct Hu moment features.

[0042] Furthermore, multiple center distances of the pixel value data are obtained using the origin moments. As explained above, the first-order center distance represents the centroid of the target region. Therefore, the centroid coordinates can be calculated based on the zeroth-order and first-order origin moments obtained above, where the centroid coordinates are... The center distance is calculated using the centroid coordinates, where the center distance is: After normalizing the center distance, the normalized center distance is obtained as follows:

[0043] Multiple sets of invariant moments are constructed using multiple center distances as Hu moment features. In one specific implementation, four sets of invariant moments are constructed as Hu moment features, namely:

[0044] Φ1=η 20 +η 02 ;

[0045]

[0046] Φ3=(η 20 -3η 12 ) 2 +3(η 21 -η 03 ) 2 ;

[0047] Φ4=(η 30 +η 12 ) 2 +(η 21 +η 03 ) 2 .

[0048] S250: Use a feature classifier to classify the moment features and obtain color feature scores; use the detected images with color feature scores greater than the preset scores as color-biased images.

[0049] Construct a feature classifier to classify the moment features obtained above.

[0050] In one specific implementation, the classifier can be a logistic regression classifier, and the training data is used to classify the data, achieving the function of classification moment features. The classification function of the feature classifier is: Where x is the moment characteristic, θ i These are preset parameters.

[0051] The moment features are input into the classifier function to obtain color feature scores, where the color feature scores range from 0 to 1. Detected images with color feature scores greater than a preset score are considered color-skewed images. In one specific embodiment, detected images with color feature scores greater than 0.5 are considered color-skewed images.

[0052] Prior to this implementation, this application requires training a logistic regression classifier. First, skewed samples and normal samples are obtained; the skewed samples and normal samples are input into the classifier function to obtain the classification results; a target function is constructed; and the classifier function is trained using the classification results and the target function.

[0053] This application addresses the problems of logistic regression classifiers by optimizing and improving the classification function using maximum likelihood estimation. First, the objective function to be optimized is constructed as follows:

[0054] g(x) y (1-g(x)) 1-y ,

[0055] Introducing maximum likelihood estimation into the objective function yields the final objective function as follows:

[0056]

[0057] Because the available training samples are extremely limited in this task, in order to further limit the model's capabilities and prevent overfitting, and also to further compress the model, this application introduces the following regularization term:

[0058]

[0059] In practice, the number of skewed data samples is often far less than the number of normal samples. This application proposes an adaptive weight adjustment method to improve the objective function as follows: Where, N a N represents the number of color-biased samples. n N represents the number of normal samples. total The sum of the number of skewed samples and normal samples is given, and the value of α ranges from 0 to 1.

[0060] The component data of at least one color channel in the target color space are processed, and the color features of the detected image are obtained by statistical analysis based on the component data of the color channel. The constructed feature classifier is used to analyze the degree of color deviation of the color features to determine whether the image is color-biased.

[0061] In this embodiment, by processing the component data of at least one color channel in the target color space, and statistically analyzing the data information of the color channels, moment features of the detected image are obtained as color features. This application proposes two methods for constructing moment features and constructs hybrid features based on multiple moment features, which have strong robustness. Finally, a logistic regression classifier is used to process the moment features to improve the algorithm's computation speed. Based on the classification results, the degree of color cast is analyzed to determine whether the image has a color cast, resulting in high algorithm accuracy.

[0062] Since most surveillance video source data is in YUV format, converting it to RGB and LAB formats, which are easier to analyze for color cast, results in slow and inefficient color cast analysis. While direct color cast analysis of RGB and LAB formats, where color features are easier to capture, is more difficult, it offers significant speed improvements. Therefore, this application provides an image color cast detection method. This method processes a YUV format detection image to obtain U and V component data. Based on statistical analysis of the data from the UV channels, color features of the detection image are obtained. These color features are then used to analyze the degree of color cast to determine whether the image has a color cast. In one specific embodiment, the target color space includes the YUV color space, and the component data of at least one color channel includes the U component data of the U channel and the V component data of the V channel. Please refer to [link to relevant documentation]. Figure 3 , Figure 3 This is a flowchart illustrating another embodiment of the image color cast detection method of this application. It should be noted that if substantially the same result is obtained, this embodiment does not necessarily reflect that result. Figure 3 The illustrated process sequence is limited. For example... Figure 3 As shown, this embodiment includes:

[0063] S310: Obtain component data blocks of at least one color channel of the detected image.

[0064] This paper describes a method for detecting color cast in video images. Video images are acquired using monitoring equipment. Multiple images are selected from the video images at a preset frame rate, and these images are used to determine if the video images have color cast. Specifically, when the preset frame rate is N, one image is selected from N frames to minimize the impact of certain features on the algorithm and enhance its robustness. The entire video image is traversed, and multiple images are selected as the detection image group. The detection images are typically in YUV format, where Y represents luminance (grayscale value), and U and V (Cb and Cr) represent chrominance, describing the image's color and saturation. This application directly processes the YUV format detection images, specifically extracting U and V component data from the three components to detect color cast.

[0065] S330: Divide the component data of at least one color channel into blocks to obtain multiple component sub-data of the component data.

[0066] For the acquired detection image, there is a lot of U component data and V component data in the whole image. The calculation of the overall data is complicated and inefficient. Therefore, the U component data and V component data of the acquired detection image are divided into blocks to obtain multiple U component sub-data and V component sub-data.

[0067] S350: Calculate the Hu moment characteristics of multiple component data.

[0068] Color features are obtained by using multiple U-component quantum data and V-component quantum data.

[0069] The U-component and V-component sub-data in each small block of the detected image are processed separately to obtain feature data describing the color features of the detected image. In the embodiments of this application, the obtained color features can be moment features of the detected image. These moment features include Hu moments, etc. The origin moments corresponding to multiple U-component and V-component sub-data are calculated separately; multiple center distances of the U-component and V-component sub-data are obtained using the origin moments; and an invariant set of moments is constructed using these multiple center distances as the Hu moment features corresponding to the U-component and V-component sub-data.

[0070] Using the above method, four invariant moment sets are obtained for the U-component and V-component sub-data in each small block. Therefore, each small block contains four Hu moment features of the U-component and four Hu moment features of the V-component.

[0071] S370: Use a feature classifier to classify the moment features and obtain color feature scores; use the detected images with color feature scores greater than the preset scores as color-biased images.

[0072] Construct a classifier to classify the moment features obtained above. The classification function of the feature classifier is: Where x is the moment characteristic, θ i These are preset parameters. The moment features are input into the classifier function to obtain color feature scores, where the color feature scores range from 0 to 1. When the image is segmented as described above, and the U component data and V component data are divided into n small blocks, there are a total of 8n moment features, namely x1, x2, ..., xn. 8n .

[0073] Images with color feature scores greater than a preset score are classified as color-biased images.

[0074] In this embodiment, color cast detection is performed by directly processing the YUV format detection image, eliminating the extremely time-consuming color space conversion process and greatly improving algorithm efficiency. Before processing, the image is divided into blocks to reduce the image size and processing difficulty. The U and V component data of each sub-image are obtained. Statistical analysis of the data from the UV channels yields moment features as color features. This application proposes two methods for constructing moment features and constructs hybrid features based on multiple moment features, exhibiting strong robustness. Finally, a logistic regression classifier is used to process the moment features, improving the algorithm's computational speed. The classification results are used to analyze the degree of color cast to determine whether the image has a color cast, resulting in high algorithm accuracy.

[0075] Please see Figure 4 , Figure 4 This is a schematic diagram of the image color cast detection device according to an embodiment of this application. In this embodiment, the image color cast detection device includes a detection module 41, a color module 42, and a classification module 43.

[0076] The detection module 41 acquires component data of at least one color channel of the detection image in the target color space; the color module 42 determines the color features of the detection image based on the component data of at least one color channel, the color features including moment features determined based on the component data of at least one color channel; and the classification module 43 classifies the color features using a feature classifier to determine whether the detection image has a color cast. This image color cast detection device processes the component data of at least one color channel in the target color space, statistically analyzes the component data of the color channels to obtain color features of the detection image, and uses a constructed feature classifier to analyze the degree of color cast in the color features to determine whether the image has a color cast.

[0077] Please see Figure 5 , Figure 5 This is a schematic diagram of the structure of an image color cast detection device according to an embodiment of this application. In this embodiment, the image color cast detection device 51 includes a processor 52.

[0078] Processor 52 can also be referred to as a CPU (Central Processing Unit). Processor 52 may be an integrated circuit chip with signal processing capabilities. Processor 52 can also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. A general-purpose processor can be a microprocessor, or processor 52 can be any conventional processor.

[0079] The image color cast detection device 51 may further include a memory (not shown) for storing instructions and data required for the processor 52 to run.

[0080] The processor 52 is used to execute instructions to implement the method provided by any embodiment and any non-conflicting combination of the image color cast detection method of this application described above.

[0081] Please see Figure 6 , Figure 6This is a schematic diagram of the structure of a computer-readable storage medium in an embodiment of this application. The computer-readable storage medium 61 in this embodiment stores instruction / program data 62. When executed, this instruction / program data 62 implements the method provided by any embodiment of the image color cast detection method of this application and any non-conflicting combination thereof. The instruction / program data 62 can be formed into a program file and stored in the aforementioned storage medium 61 in the form of a software product, so that a computer device (which may be a personal computer, server, or network device, etc.) or processor can execute all or part of the steps of the methods of various embodiments of this application. The aforementioned storage medium 61 includes various media capable of storing program code, such as a USB flash drive, mobile hard drive, read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk, or terminal devices such as computers, servers, mobile phones, and tablets.

[0082] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, or indirect coupling or communication connection between apparatuses or units, and may be electrical, mechanical, or other forms.

[0083] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0084] The above description is merely an embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent structural or procedural transformations made based on the content of the present invention specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of the present invention.

Claims

1. A method of image color cast detection, the method comprising: The method includes: Acquire component data of at least one color channel of the detected image in the target color space; The color features of the detected image are determined based on the component data of the at least one color channel, and the color features include moment features determined based on the component data of the at least one color channel. The color features are classified using a feature classifier to determine whether the detected image has a color cast. Determining the color features of the detected image based on the component data of the at least one color channel includes: The component data of the at least one color channel is divided into blocks to obtain multiple component sub-data of the component data; Calculating the Hu moment features of the multiple component sub-data includes: calculating the original moments corresponding to the multiple component sub-data respectively; obtaining multiple center distances of the component sub-data using the original moments; and constructing an invariant set of moments using the multiple center distances as the Hu moment features corresponding to the component sub-data. The multiple center distances of the component quantum data include 0th-order center distance, 1st-order center distance, 2nd-order center distance, and 3rd-order center distance. The 0th-order center distance of the component quantum data represents the mass of the target region corresponding to the component quantum data in the detection image. The 1st-order center distance of the component quantum data represents the centroid of the target region. The 2nd-order center distance of the component quantum data represents the rotation radius of the target region. The 3rd-order center distance of the component quantum data represents the orientation and slope of the target region.

2. The image color cast detection method according to claim 1, characterized in that, The target color space includes the YUV color space, and the component data of the at least one color channel includes the U component data of the U channel and the V component data of the V channel.

3. The image color cast detection method according to claim 1, characterized in that, The step of classifying the color features using a feature classifier to determine whether the detected image has a color cast includes: The feature classifier is used to classify the moment features to obtain color feature scores; The detected images whose color feature scores are greater than a preset score are considered as color-biased images.

4. The image color cast detection method according to claim 3, characterized in that, Before classifying the moment features using the feature classifier to determine whether the detected image has a color cast, the following steps are included: A classification function is trained, and the trained classification function is used as a feature classifier. The trained classification function is: Where x is the moment feature, These are preset parameters.

5. The image color cast detection method according to claim 4, characterized in that, The training classification function includes: Obtain color-distorted samples and normal samples; The color-distorted sample and the normal sample are input into the classification function to obtain the classification result; Construct a target function, and train the classification function using the classification results and the target function.

6. The image color cast detection method according to claim 4, characterized in that, The step of classifying the moment features using the feature classifier to obtain color feature scores includes: The moment feature is input into the classification function to obtain the color feature score, wherein the color feature score ranges from 0 to 1.

7. The image color cast detection method according to claim 1, characterized in that, The acquisition of the detected image includes: Acquire video images; Multiple images are selected from the video image by skipping frames to form a detection image group, and the detection image group is used to determine whether the video image has a color cast.

8. An image color cast detection device, characterized in that, Includes a processor, the processor being configured to execute instructions to implement the image color cast detection method as described in any one of claims 1-7.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store instruction / program data that can be executed to implement the image color cast detection method as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Image color cast detection method, system and device and storage medium

    CN114283210A