Image color cast detection method and device, readable storage medium and terminal equipment
By using image patch segmentation and feature distribution parameters, the image color cast detection process is simplified, solving the problem of low efficiency in existing technologies and achieving more efficient detection.
Patent Information
- Application Number
- CN202310508215.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-06
- Publication Date
- 2025-12-30
- Estimated Expiration
- 2043-05-06
AI Technical Summary
Existing image color cast detection methods require complex models, resulting in low efficiency.
By acquiring the target image, performing image block segmentation, calculating the color cast feature distribution parameters, and using the preset feature distribution parameters of non-color cast and color cast images, the color cast detection result is determined, avoiding the use of complex models.
It simplifies the calculation process and improves the efficiency of image color cast detection.
Smart Images

Figure CN116468807B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of image processing technology, and in particular relates to an image color distortion detection method, apparatus, computer-readable storage medium and terminal device. Background Technology
[0002] Color cast detection is a fundamental problem in the field of image processing technology. During the image capture process, due to lighting or angle, the captured image may easily have color cast issues. Therefore, it is usually necessary to perform color cast detection on the image to determine whether color cast correction is required.
[0003] However, existing image color cast detection methods typically require the use of various complex models and involve relatively complicated calculation processes, resulting in low efficiency. Summary of the Invention
[0004] In view of this, embodiments of this application provide an image color cast detection method, apparatus, computer-readable storage medium, and terminal device to solve the problem that existing image color cast detection methods require the use of various complex models and involve complicated calculation processes, resulting in low accuracy of image color cast detection methods.
[0005] A first aspect of this application provides an image color cast detection method, which may include:
[0006] Acquire the target image to be detected;
[0007] The target image is segmented into image blocks to obtain individual segmented image blocks of the target image;
[0008] The color cast feature distribution parameters of the target image are calculated based on each segmented image block;
[0009] The color cast detection result of the target image is determined based on the color cast feature distribution parameters of the target image, the preset color cast feature distribution parameters of the uncolored image, and the preset color cast feature distribution parameters of the colored image.
[0010] In one specific implementation of the first aspect, determining the color cast detection result of the target image based on the color cast feature distribution parameters of the target image, the color cast feature distribution parameters of a preset non-color cast image, and the color cast feature distribution parameters of a preset color cast image may include:
[0011] The color cast comprehensive value of the target image is calculated based on the color cast feature distribution parameters of the target image, the color cast feature distribution parameters of the uncolored image, and the color cast feature distribution parameters of the colored image.
[0012] If the color cast value is less than or equal to a preset value threshold, then the target image is determined to be a color cast image.
[0013] If the overall color cast value of the target image is greater than the overall value threshold, then the target image is determined to be a color-neutral image.
[0014] In one specific implementation of the first aspect, calculating the comprehensive color cast value of the target image based on the color cast feature distribution parameters of the target image, the color cast feature distribution parameters of the uncolored image, and the color cast feature distribution parameters of the colored image may include:
[0015] The probability of misjudging the color cast of the target image is calculated based on the color cast feature distribution parameters of the target image and the color cast feature distribution parameters of the uncast image.
[0016] Based on the color cast feature distribution parameters of the target image and the color cast feature distribution parameters of the color cast image, calculate the probability of misjudging the target image as having no color cast.
[0017] The overall color cast value is calculated based on the color cast misjudgment probability and the no-color cast misjudgment probability.
[0018] In one specific implementation of the first aspect, after determining the color cast detection result of the target image based on the color cast feature distribution parameters of the target image, the color cast feature distribution parameters of a preset non-color cast image, and the color cast feature distribution parameters of a preset color cast image, the following may be included:
[0019] If the target image is a colorless image, then the color cast feature distribution parameters of the colorless image are updated according to the color cast feature distribution parameters of the target image.
[0020] If the target image is a color-skewed image, then the color-skewed feature distribution parameters of the color-skewed image are updated according to the color-skewed feature distribution parameters of the target image.
[0021] In one specific implementation of the first aspect, the calculation process of the color cast feature distribution parameters of the unbiased image may include:
[0022] Obtain each image without color cast;
[0023] The image block segmentation is performed on each unbiased image using a preset image segmentation algorithm to obtain each initial unbiased image block.
[0024] The image blocks are classified using a preset image classification algorithm to obtain the category of each initial unbiased image block;
[0025] Based on the number of initial unbiased image blocks in each category, the number of image blocks in the initial unbiased image blocks is balanced to obtain each unbiased image block.
[0026] Calculate the color cast feature distribution parameters of each unbiased image based on each unbiased image block.
[0027] In one specific implementation of the first aspect, the calculation process of the color cast feature distribution parameters of the color cast image may include:
[0028] Obtain each color-skewed image;
[0029] The preset image segmentation algorithm is used to segment each color-distorted image into image blocks to obtain each initial color-distorted image block;
[0030] The initial color-distorted image blocks are classified using a preset image classification algorithm to obtain the category of each initial color-distorted image block;
[0031] Based on the number of initial color-skewed image blocks in each category, the number of image blocks in the initial color-skewed image blocks is balanced to obtain each color-skewed image block.
[0032] Calculate the color cast feature distribution parameters for each color cast image based on each color cast image block.
[0033] In one specific implementation of the first aspect, segmenting the target image into image blocks to obtain segmented image blocks of the target image may include:
[0034] The target image is segmented into image blocks using a preset image segmentation algorithm to obtain the initial image blocks of the target image;
[0035] If the number of initial image blocks is less than a preset threshold, the initial image blocks are split into individual image blocks to obtain the target image.
[0036] If the number of initial image blocks is greater than or equal to the threshold number, then each initial image block is determined as a segmented image block of the target image.
[0037] A second aspect of this application provides an image color cast detection device, which may include:
[0038] The image acquisition module is used to acquire the target image to be detected;
[0039] The image block segmentation module is used to segment the target image into image blocks to obtain each segmented image block of the target image;
[0040] The parameter calculation module is used to calculate the color cast feature distribution parameters of the target image based on each segmented image block;
[0041] The result determination module is used to determine the color cast detection result of the target image based on the color cast feature distribution parameters of the target image, the color cast feature distribution parameters of a preset non-color cast image, and the color cast feature distribution parameters of a preset color cast image.
[0042] In one specific implementation of the second aspect, the result determination module may include:
[0043] The comprehensive value calculation unit is used to calculate the comprehensive color cast value of the target image based on the color cast feature distribution parameters of the target image, the color cast feature distribution parameters of the uncolored image, and the color cast feature distribution parameters of the colored image.
[0044] The first image determination unit is used to determine the target image as a color-skewed image if the color cast comprehensive value is less than or equal to a preset comprehensive value threshold.
[0045] The second image determination unit is used to determine that the target image is a non-color-biased image if the color cast value of the target image is greater than the comprehensive value threshold.
[0046] In one specific implementation of the second aspect, the comprehensive value calculation unit may include:
[0047] The first probability calculation subunit is used to calculate the probability of misjudging the color cast of the target image based on the color cast feature distribution parameters of the target image and the color cast feature distribution parameters of the uncast image.
[0048] The second probability calculation subunit is used to calculate the probability of misjudging the target image as having no color cast based on the color cast feature distribution parameters of the target image and the color cast feature distribution parameters of the color cast image.
[0049] The comprehensive value calculation subunit is used to calculate the comprehensive value of color deviation based on the color deviation misjudgment probability and the no-color deviation misjudgment probability.
[0050] In one specific implementation of the second aspect, the image color cast detection device may further include:
[0051] The first update module is used to update the color cast feature distribution parameters of the unbiased image according to the color cast feature distribution parameters of the target image if the target image is an unbiased image.
[0052] The second update module is used to update the color cast feature distribution parameters of the color cast image according to the color cast feature distribution parameters of the target image if the target image is a color cast image.
[0053] In one specific implementation of the second aspect, the image color cast detection device may further include:
[0054] The image acquisition module is used to acquire each unbiased image.
[0055] The image block segmentation module is used to segment each unbiased image into image blocks using a preset image segmentation algorithm to obtain each initial unbiased image block.
[0056] The image patch classification module is used to classify each initial unbiased image patch using a preset image classification algorithm to obtain the category of each initial unbiased image patch.
[0057] The number equalization module is used to equalize the number of initial unbiased image blocks based on the number of initial unbiased image blocks in each category, so as to obtain each unbiased image block.
[0058] The parameter calculation module is used to calculate the color cast feature distribution parameters of each unbiased image based on each unbiased image block.
[0059] In one specific implementation of the second aspect, the image color cast detection device may further include:
[0060] The image acquisition module is used to acquire each color-distorted image;
[0061] The image block segmentation module is used to segment each color-distorted image into image blocks using a preset image segmentation algorithm to obtain each initial color-distorted image block.
[0062] The image patch classification module is used to classify each initial color-distorted image patch using a preset image classification algorithm to obtain the category of each initial color-distorted image patch;
[0063] The number equalization module is used to equalize the number of initial color-skewed image blocks based on the number of initial color-skewed image blocks of each category, so as to obtain each color-skewed image block.
[0064] The parameter calculation module is used to calculate the color cast feature distribution parameters of each color cast image based on each color cast image block.
[0065] In one specific implementation of the second aspect, the image patch segmentation module may include:
[0066] The image block segmentation unit is used to segment the target image into image blocks using a preset image segmentation algorithm to obtain each initial image block of the target image;
[0067] The image block splitting unit is used to split the initial image block into individual image blocks of the target image if the number of initial image blocks is less than a preset number threshold.
[0068] The image block determination unit is used to determine each initial image block as a segmented image block of the target image if the number of initial image blocks is greater than or equal to the number threshold.
[0069] A third aspect of this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of any of the above-described image color cast detection methods.
[0070] A fourth aspect of this application provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of any of the above-described image color cast detection methods.
[0071] The fifth aspect of this application provides a computer program product that, when run on a terminal device, causes the terminal device to execute the steps of any of the above-described image color distortion detection methods.
[0072] The beneficial effects of this application embodiment compared with the prior art are as follows: This application embodiment acquires a target image to be detected; performs image block segmentation on the target image to obtain each segmented image block of the target image; calculates the color cast feature distribution parameters of the target image based on each segmented image block; and determines the color cast detection result of the target image based on the color cast feature distribution parameters of the target image, the preset color cast feature distribution parameters of a non-color cast image, and the preset color cast feature distribution parameters of a color cast image. Through this application embodiment, the color cast detection result of the target image can be determined based on the color cast feature distribution parameters of the target image and two preset color cast feature distribution parameters. Since the two preset color cast feature distribution parameters are known quantities, the use of complex models in the image color cast detection process can be avoided, greatly simplifying the calculation process and improving the efficiency of the image color cast detection method. Attached Figure Description
[0073] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0074] Figure 1 A schematic flowchart illustrating the calculation process of the color cast feature distribution parameters of a color-neutral image;
[0075] Figure 2 A schematic flowchart illustrating the calculation process of the color cast feature distribution parameters of a color cast image;
[0076] Figure 3 This is a flowchart of one embodiment of an image color cast detection method in this application.
[0077] Figure 4 This is a flowchart illustrating the process of calculating the color cast comprehensive value.
[0078] Figure 5 This is a schematic diagram illustrating the normal distribution that an unbiased color image follows.
[0079] Figure 6 This is a schematic diagram illustrating the normal distribution that a color-skewed image follows.
[0080] Figure 7 A schematic flowchart illustrating the process of updating the color cast feature distribution parameters of a non-color cast image and the color cast feature distribution parameters of a color cast image.
[0081] Figure 8 This is a structural diagram of one embodiment of an image color cast detection device according to the present application.
[0082] Figure 9 This is a schematic block diagram of a terminal device in an embodiment of this application. Detailed Implementation
[0083] To make the inventive objectives, features, and advantages of this application more apparent and understandable, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the embodiments described below are only some embodiments of this application, and not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0084] It should be understood that, when used in this specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.
[0085] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the scope of the application. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.
[0086] It should also be further understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0087] As used in this specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrases "if determined" or "if [described condition or event] is detected" may be interpreted, depending on the context, as "once determined," "in response to determination," "once [described condition or event] is detected," or "in response to detection of [described condition or event]."
[0088] Furthermore, in the description of this application, the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0089] Color cast detection is a fundamental problem in the field of image processing technology. During the image capture process, due to lighting or angle, the captured image may easily have color cast issues. Therefore, it is usually necessary to perform color cast detection on the image to determine whether color cast correction is required.
[0090] However, existing image color cast detection methods typically require the use of various complex models and involve relatively complicated calculation processes, resulting in low efficiency.
[0091] In view of this, embodiments of this application provide an image color cast detection method, apparatus, computer-readable storage medium, and terminal device. Through these embodiments, the color cast detection result of a target image can be determined based on the color cast feature distribution parameters of the target image and two preset color cast feature distribution parameters. Since the two preset color cast feature distribution parameters are known quantities, the use of complex models in the image color cast detection process can be avoided, greatly simplifying the calculation process and improving the efficiency of the image color cast detection method.
[0092] It should be noted that the subject of execution of the method in this application is a terminal device, which can be a common computing device such as a desktop computer, a laptop, or a handheld computer, or other computing devices.
[0093] In this embodiment, the color cast detection result of the target image can be determined based on the color cast feature distribution parameters of the target image, the preset color cast feature distribution parameters of the uncolored image, and the preset color cast feature distribution parameters of the colored image. The color cast feature distribution parameters of the uncolored image or the colored image can be updated based on the color cast detection result of the target image, so that the image color cast detection method provided in this embodiment can be continuously optimized and thus better adapted to various application scenarios.
[0094] In the embodiments of this application, the color cast feature distribution parameters of a non-color cast image can be calculated based on multiple known non-color cast images, and the color cast feature distribution parameters of a color cast image can be calculated based on multiple known color cast images.
[0095] Please see Figure 1 In this application embodiment, the calculation of the color cast feature distribution parameters of the unbiased image may specifically include the following process:
[0096] Step S101: Obtain each unbiased image.
[0097] In this embodiment, each unbiased image can be acquired. Specifically, publicly available unbiased images can be acquired through networks or other means. The number of unbiased images acquired can be set according to actual conditions, and this application does not impose a specific limit on this. Here, it is preferable to acquire more than 10,000 unbiased images to ensure that the calculated color cast feature distribution parameters of the unbiased images are relatively accurate.
[0098] In one possible embodiment, to broaden the applicability of the image color cast detection method of this application, each uncolored image in different scenarios can be acquired separately. For example, uncolored images in several application scenarios such as architecture, people, and natural landscapes can be acquired separately.
[0099] In another possible embodiment, the image color cast detection method provided in this application can be applied to a specific application scenario. In this case, it can acquire each color-neutral image in that specific application scenario. For example, the image color cast detection method provided in this application can be applied to a security monitoring scenario. In this case, it can acquire each color-neutral image in the security monitoring scenario, including but not limited to indoor monitoring images, outdoor monitoring images, road monitoring images, and other color-neutral images in security monitoring scenarios.
[0100] Step S102: Use a preset image segmentation algorithm to segment each unbiased image into image blocks to obtain each initial unbiased image block.
[0101] Understandably, in order to obtain the color cast feature distribution parameters in each unbiased image more comprehensively, each unbiased image can be segmented into image blocks, and then the color cast feature distribution parameters in the unbiased image can be calculated based on the color cast features of each image block.
[0102] In the embodiments of this application, Simple Linear Iterative Cluster (SLIC) can be used to segment each unbiased image into image blocks to obtain initial unbiased image blocks with similar colors.
[0103] It is understandable that, in addition to using SLIC for image patch segmentation, any existing image segmentation algorithm can also be used for image patch segmentation, including but not limited to common existing image segmentation algorithms such as SEEDS, LSC, and SRMFS.
[0104] Step S103: Use a preset image classification algorithm to classify each initial unbiased image block to obtain the category of each initial unbiased image block.
[0105] It is understandable that, since each initial unbiased image patch is derived from multiple unbiased images, and each unbiased image may originate from different application scenarios, the color cast characteristics exhibited by each initial unbiased image patch may differ slightly. Therefore, in this embodiment, before calculating the color cast characteristic distribution parameters of the unbiased image, a preset image classification algorithm can be used to classify each initial unbiased image patch to obtain its category. Then, the number of each category of initial unbiased image patches is balanced to make the color cast characteristic distribution parameters of the unbiased image more accurate.
[0106] Specifically, common image classification algorithms in the prior art can be used to classify each initial unbiased image patch, including but not limited to common image classification algorithms such as YOLO, ResNet, DenseNet, and Vision Transformer. In the embodiments of this application, YOLO can be preferably used.
[0107] Step S104: Based on the number of initial unbiased image blocks in each category, perform image block number balancing on the initial unbiased image blocks to obtain each unbiased image block.
[0108] In the embodiments of this application, after obtaining the category of each initial unbiased image block, the number of initial unbiased image blocks can be balanced according to the number of initial unbiased image blocks in each category, so as to ensure that each type of unbiased image block makes the same contribution to the calculated color cast feature distribution parameters, making the color cast feature distribution parameter results of the unbiased image more accurate.
[0109] It is understandable that after obtaining the categories of the initial unbiased image patches, the number of image patches in each category can be determined.
[0110] In this embodiment of the application, the mode of the number of initial unbiased image blocks of each type can be determined by recording the number of such blocks. Then, using this mode as a standard, the number of initial unbiased image blocks of each type can be reduced or supplemented to reach the mode, thus obtaining each unbiased image block.
[0111] In a possible embodiment, the mode of the numbers of various types of initial non-color-biased image blocks is m, and the number of a certain type of initial non-color-biased image blocks is n1, where n1 > m. Then, n1 - m image blocks can be removed from this type of initial non-color-biased image blocks so that the number of this type of initial non-color-biased image blocks reaches the mode m. Specifically, n1 - m image blocks can be randomly selected from this type of initial non-color-biased image blocks and removed to obtain m non-color-biased image blocks of this type.
[0112] In another possible embodiment, the mode of the numbers of various types of initial non-color-biased image blocks is m, and the number of a certain type of initial non-color-biased image blocks is n2, where n2 < m. Then, m - n2 image blocks can be added to this type of initial non-color-biased image blocks so that the number of this type of initial non-color-biased image blocks reaches the mode m. Specifically, referring to the foregoing steps, one or more non-color-biased images can be obtained again, and the non-color-biased images are subjected to image block segmentation and image block classification, and the latest initial non-color-biased image blocks belonging to this type obtained are used for supplementation until the number of this type of initial non-color-biased image blocks reaches the mode, and m non-color-biased image blocks of this type are obtained.
[0113] Step S105: Calculate the color bias characteristic distribution parameters of each non-color-biased image according to each non-color-biased image block.
[0114] In the embodiment of the present application, the color bias characteristics of each non-color-biased image block can be extracted first, and then the color bias characteristic distribution parameters of each non-color-biased image are calculated according to the color bias characteristics of each non-color-biased image block.
[0115] Among them, the color bias characteristic of a non-color-biased image block can be a color bias factor. That is, in the CIELab color space, the ratio of the chromaticity center distance of the image block to the average chromaticity is used as the color bias factor K, and the color bias factor can be used to measure the color bias degree of the image block.
[0116] It can be understood that the color bias characteristic of a non-color-biased image block can also be a traditional image characteristic such as Lab value or color distribution histogram.
[0117] It should be understood that when the statistical data sample is large enough, the relevant characteristics of the data will follow a normal distribution. That is, the color bias factors of each non-color-biased image block will follow a normal distribution. Therefore, in the embodiment of the present application, the normal distribution situation of the color bias characteristics of each non-color-biased image can be characterized by the distribution situation of the color bias characteristics of each non-color-biased image block. Specifically, the mean μ0 and variance σ0 of the color bias characteristics of each non-color-biased image block can be calculated to obtain two color bias characteristic distribution parameters of the non-color-biased image.
[0118] In one possible embodiment, when the actual number of unbiased image blocks is small, the color bias characteristics of each unbiased image block may follow other variations of normal distribution such as t-distribution or chi-square distribution. In this case, the two color bias characteristic distribution parameters of the unbiased image can still be obtained by calculating the mean and variance of the color bias characteristics of each unbiased image block.
[0119] Please see Figure 2 Furthermore, embodiments of this application can also calculate the color cast feature distribution parameters of the color cast image. The specific calculation process may include the following steps:
[0120] Step S201: Obtain each color-biased image.
[0121] Step S202: Use a preset image segmentation algorithm to segment each color-distorted image into image blocks to obtain each initial color-distorted image block.
[0122] Step S203: Use a preset image classification algorithm to classify each initial color-distorted image block to obtain the category of each initial color-distorted image block.
[0123] Step S204: Based on the number of initial color-skewed image blocks in each category, perform image block number balancing on the initial color-skewed image blocks to obtain each color-skewed image block.
[0124] Step S205: Calculate the color cast feature distribution parameters of each color cast image based on each color cast image block.
[0125] In this embodiment, each color-skewed image can be obtained from publicly available sources, and each color-skewed image can be segmented into image blocks using SLIC to obtain each initial color-skewed image block. Then, each initial color-skewed image block can be classified using a common image classification algorithm in the prior art to obtain the category of each initial color-skewed image block. Based on the number of initial color-skewed image blocks in each category, the number of image blocks is balanced by removing or supplementing each category of initial color-skewed image blocks to obtain each color-skewed image block. Then, the mean μ1 and variance σ1 of the color-skew factor of each color-skewed image block can be calculated to obtain the color-skew feature distribution parameters of each color-skewed image.
[0126] It is understood that the specific calculation process of the color cast feature distribution parameters of the color cast image in the embodiments of this application can refer to the specific calculation process of the color cast feature distribution parameters of the non-color cast image in steps S101 to S105, and will not be repeated here.
[0127] After calculating the color cast feature distribution parameters of the unbiased image and the color cast feature distribution parameters of the biased image, the color cast detection result of the target image can be determined based on the color cast feature distribution parameters of the target image and the two known color cast feature distribution parameters.
[0128] Please see Figure 3 One embodiment of an image color cast detection method in this application may include:
[0129] Step S301: Obtain the target image to be detected.
[0130] In this embodiment of the application, the target image to be detected can be obtained from a preset memory module or server, or the image can be acquired in real time using a preset camera acquisition device, and the acquired image can be used as the target image to be detected.
[0131] In one possible embodiment, if a preset camera acquisition device is used to acquire images in real time, continuous shooting may be performed in a short period of time. The acquired multiple images to be detected may be highly similar. In this case, the acquired multiple images to be detected can be merged into one image and used as the target image to be detected.
[0132] Step S302: Perform image block segmentation on the target image to obtain each segmented image block of the target image.
[0133] In this embodiment, a preset image segmentation algorithm, preferably SLIC, can be used to segment the target image into image blocks, obtaining initial image blocks of the target image. After obtaining the initial image blocks, it can be determined whether to further segment the initial image blocks based on their number. If the number of initial image blocks is less than a preset threshold, then the initial image blocks can be segmented to obtain segmented image blocks of the target image. Here, a large initial image block is an initial image block whose pixel count is greater than a preset pixel count threshold. If the number of initial image blocks is greater than or equal to the preset threshold, then each initial image block can be directly determined as a segmented image block of the target image.
[0134] It is understandable that if the number of segmented image patches obtained is too large, it may reduce the efficiency of image color cast detection; if the number of segmented image patches obtained is too small, it may reduce the accuracy of image color cast detection. Therefore, in this embodiment, the number of segmented image patches of the target image can be controlled to remain at a preset threshold number N. The specific value of N can be set according to the actual situation, and this application does not make a specific limitation on it. In this embodiment, N can preferably be set to a value greater than or equal to 100.
[0135] In this embodiment, when the number of initial image blocks is less than N, the initial large image blocks can be uniformly divided into image blocks to obtain the segmented image blocks of the target image block. Here, the number of initial image blocks can be denoted as M, and the number of initial large image blocks in the initial image block can be denoted as L. Then, the initial large image blocks need to be uniformly divided into K parts, and the specific formula for calculating K can be...
[0136] In one possible embodiment, during the actual calculation and image block splitting process, the number of segmented image blocks obtained after image block splitting can be greater than N.
[0137] Step S303: Calculate the color cast feature distribution parameters of the target image based on each segmented image block.
[0138] In the embodiments of this application, the color cast features of each segmented image block can be extracted, and the color cast feature distribution parameters of the target image can be calculated based on the color cast features of each segmented image block.
[0139] It is understood that the color cast features of each segmented image block, the color cast features of the un-color-cast image, and the color cast features of the color-cast image must be the same type of feature in order to perform image color cast detection. In the embodiments of this application, the color cast features of each segmented image block, the color cast features of the un-color-cast image, and the color cast features of the color-cast image are all color cast factors.
[0140] In one possible embodiment, the color cast features of each segmented image block, the color cast features of the non-color cast image, and the color cast features of the color cast image can all be traditional image features such as Lab values or color histograms.
[0141] In this embodiment, the color cast feature distribution parameter of the target image may include the mean μ of the color cast feature of the target image. N and variance σ 2 N .
[0142] Step S304: Determine the color cast detection result of the target image based on the color cast feature distribution parameters of the target image, the preset color cast feature distribution parameters of the non-color cast image, and the preset color cast feature distribution parameters of the color cast image.
[0143] In this embodiment, the probability of a target image being misjudged due to color cast can be calculated based on the color cast feature distribution parameters of the target image and the color cast feature distribution parameters of the uncast image; the probability of a target image being misjudged due to color cast can also be calculated based on the color cast feature distribution parameters of the target image and the color cast image; then, a comprehensive color cast value can be calculated based on the probability of misjudgment due to color cast and the probability of misjudgment due to color cast. If the comprehensive color cast value is less than or equal to a preset comprehensive color cast value threshold, the target image can be determined to be a color cast image; if the comprehensive color cast value is greater than the preset comprehensive color cast value threshold, the target image can be determined to be an uncast image.
[0144] Please see Figure 4 The calculation of the color cast value can specifically include the following process:
[0145] Step S401: Calculate the probability of misjudging the color cast of the target image based on the color cast feature distribution parameters of the target image and the color cast feature distribution parameters of the uncast image.
[0146] Please see Figure 5 In Figure (a), the color cast factor of each unbiased image patch follows a normal distribution with mean μ0 and variance σ0. When the mean μ0 of the color cast factor of each segmented image patch of the target image is... N The smaller the value of μ0, the higher the probability that the target image is a color-neutral image; conversely, the larger the value of μ0, the lower the probability that the target image is a color-neutral image, meaning the higher the probability that the target image is a color-neutral image, and the lower the probability of it being misclassified as a color-neutral image. Specifically, the probability of a color-neutral misclassification of the target image can be calculated. like Figure 5 As shown in Figure (b), which represents the area of region A, where, This is a variable representing the color cast factor of a colorless image patch. If the target image has a color cast misjudgment probability... The smaller the value, the higher the μ value. N The further to the right the target image moves away from the mean value μ0 of the color cast factor of each unbiased image block, the greater the probability that the target image is a color-biased image, and the smaller the probability that the target image is misjudged as a color-biased image.
[0147] Step S402: Calculate the probability of misjudging the target image as having no color cast based on the color cast feature distribution parameters of the target image and the color cast feature distribution parameters of the color cast image.
[0148] Please see Figure 6 In Figure (a), the color cast factor of each color cast image patch follows a normal distribution with mean μ1 and variance σ1. When the mean μ of the color cast factor of each segmented image patch of the target image is... NThe larger the value is than μ1, the higher the probability that the target image is a color-biased image; conversely, the lower the value is, the lower the probability that the target image is a color-biased image, that is, the higher the probability that the target image is a colorless image, and the lower the probability of being misclassified as a colorless image. Specifically, the probability of a colorless image being misclassified can be calculated. like Figure 6 As shown in Figure (b), which represents the area of region B, This is a variable representing the color cast factor of the color-cast image patch. If the probability of misjudging the target image as having no color cast is... The smaller the value, the higher the μ value. N The further to the left the target image is from the mean μ1 of the color cast factor of each color cast image block, the greater the probability that the target image is a color cast image, and the smaller the probability that the target image is misjudged as a color cast image.
[0149] Step S403: Calculate the overall color cast value based on the probability of misjudging color cast and the probability of misjudging no color cast.
[0150] In the embodiments of this application, the overall color cast value of the target image can be calculated based on the probability of misjudging color cast and the probability of misjudging no color cast.
[0151] Specifically, the overall color cast value can be calculated using the following formula:
[0152]
[0153] Where C is the overall color cast value of the target image, and α is a preset smoothing parameter for the overall value. The specific value can be in [0,1]. The larger the value of α, the higher the confidence level in the calculation of the probability of misjudgment of color cast.
[0154] After obtaining the color cast value, the color cast detection result of the target image can be determined based on the color cast value. Specifically, if the color cast value is less than or equal to the preset color cast value threshold, the target image can be determined to be a color cast image; if the color cast value is greater than the preset color cast value threshold, the target image can be determined to be a non-color cast image.
[0155] It is understandable that the color cast comprehensive value threshold can be set according to actual needs. This application does not make specific limitations on this, but it can be preferably set to 0.05 here.
[0156] In one possible embodiment, besides calculating the overall color cast value, the probability of color cast misjudgment and the probability of no color cast misjudgment can also be expressed comprehensively through other calculation methods. For example, the harmonic mean of the probability of color cast misjudgment and the probability of no color cast misjudgment can be calculated, and whether the target image is a color-cast image can be determined based on the harmonic mean. Another example is that the F-score of the probability of color cast misjudgment and the probability of no color cast misjudgment can be calculated, and whether the target image is a color-cast image can be determined based on the F-score value. Yet another example is that the sum of squares of the probability of color cast misjudgment and the probability of no color cast misjudgment can be calculated, and whether the target image is a color-cast image can be determined based on the sum of squares.
[0157] In another possible embodiment, the color cast detection result of the target image can be determined solely based on the color cast misclassification probability of the target image. Specifically, only the color cast misclassification probability of the target image can be calculated. like If the value is less than the preset color cast misjudgment threshold P0, then the probability of the target image being misjudged as a color cast image is considered small, and the target image can be identified as a color cast image; if If the color cast misjudgment threshold P0 is greater than or equal to the preset threshold, the target image is considered to have a high probability of being misjudged as a color-cast image, and in this case, the target image can be determined as a color-uncasted image. The value of P0 can be set according to actual needs, and it can usually be set to a value less than or equal to 0.005. When a more rigorous color cast detection result is required, P0 can be set to a smaller value; otherwise, P0 can be set to a larger value.
[0158] In another possible embodiment, the color cast detection result of the target image can be determined based on the probability of a false positive for color cast. Specifically, only the probability of a false positive for color cast can be calculated. like If the value is less than the preset non-color cast misjudgment threshold P1, then the probability of the target image being misjudged as a non-color cast image is considered small, and the target image can be determined as a non-color cast image; if If the value is greater than or equal to the preset non-color cast misjudgment threshold P1, the probability of the target image being misjudged as a non-color cast image is relatively high. In this case, the target image can be identified as a color cast image. The value of P1 can be set according to actual needs. It can usually be set to a value less than or equal to 0.001. When a more rigorous color cast detection result is required, P1 can be set to a smaller value; otherwise, P1 can be set to a larger value.
[0159] It is understandable that after determining the color cast detection result of the target image, the color cast feature distribution parameters of the non-color cast image or the color cast image can be updated based on the target image, thereby making the color cast feature distribution parameters of the non-color cast image or the color cast image more accurate and improving the accuracy of subsequent image color cast detection.
[0160] For details, please refer to Figure 7 After determining the color cast of the target image, the following process can also be included:
[0161] Step S701: Determine whether the target image is a color-neutral image.
[0162] In this embodiment of the application, if the target image is determined to be a non-color-biased image, step S702 can be executed to update the color bias feature distribution parameters of the non-color-biased image; if the target image is determined to be a color-biased image, step S703 can be executed to update the color bias feature distribution parameters of the color-biased image.
[0163] Step S702: Update the color cast feature distribution parameters of the non-color cast image based on the color cast feature distribution parameters of the target image.
[0164] In this embodiment, if the target image is a color-neutral image, the color-neutral feature distribution parameters of the color-neutral image can be updated based on the color-neutral feature distribution parameters of the target image. Specifically, this can be done based on the mean value of the color-neutral features of the target image (denoted here as μ). t,0 ) and variance (denoted as σ here) 2 t,0 To recalculate the mean and variance of the color cast characteristics of the unbiased image, refer to the following formula:
[0165] μ0'=μ0 / (1+β0)+μ t,0 *β0 / (1+β0)
[0166]
[0167] Among them, μ0', , respectively, are the mean and variance of the color cast features of the recalculated unbiased image, and β0 is the preset first update smoothing parameter.
[0168] It is understood that the value of β0 can be set according to actual needs, and this application does not impose specific limitations on it. In the embodiments of this application, it can be set as β0 = N / T0, where N is the number of segmented image blocks and T0 is the number of non-color-biased image blocks. The calculated β0 is usually a value less than or equal to 0.001.
[0169] In one possible embodiment, if the target image is determined to be a non-color-skewed image solely based on its color cast misclassification probability, then the mean and variance of the color cast features of the non-color-skewed image can be updated based on this probability. It is understood that, to make the updated color cast feature distribution parameters of the non-color-skewed image more accurate, the target image can be further filtered after it is determined to be a non-color-skewed image to determine whether it can be used to update the color cast feature distribution parameters of the non-color-skewed image. Specifically, if the target image's color cast misclassification probability... If the target image is less than the preset first update threshold P'0, where P'0 is less than the color cast misjudgment threshold P0, then the target image can be determined as a non-color cast image that can be updated, and the color cast feature distribution parameters of the non-color cast image can be updated according to the above method.
[0170] In another possible implementation, besides using the above formula to update the mean and variance of the color cast features of the unbiased image, other update functions can also be used to update the mean and variance of the color cast features of the unbiased image. For example, a logarithmic function can be used to recalculate the mean and variance of the color cast features of the unbiased image. As another example, an exponential function can also be used to recalculate the mean and variance of the color cast features of the unbiased image.
[0171] Step S703: Update the color cast feature distribution parameters of the color cast image according to the color cast feature distribution parameters of the target image.
[0172] In this embodiment, if the target image is a color-skewed image, the color-skewed feature distribution parameters of the color-skewed image can be updated using the color-skewed feature distribution parameters of the target image. Specifically, this can be done based on the mean of the target image (denoted here as μ). t,1 ) and variance (denoted as σ here) 2 t,1 To recalculate the mean and variance of the color cast characteristics of the color cast image, refer to the following formula:
[0173] μ1'=μ1 / (1+β1)+μ t,1 *β1 / (1+β1)
[0174]
[0175] Among them, μ1', β1 represents the mean and variance of the color cast features of the recalculated color cast image, respectively, and β2 is the preset second update smoothing parameter.
[0176] It is understood that the value of β1 can be set according to actual needs, and this application does not impose specific limitations on it. Here, it can be set as β1 = N / T1, where N is the number of segmented image blocks of the target image, and T1 is the number of color-biased image blocks. The calculated β1 is usually a value less than or equal to 0.001.
[0177] In one possible embodiment, if the target image is determined to be a color-skewed image solely based on its probability of being unskewed, then the mean and variance of the color-skewed image's features can be updated based on this probability. It is understood that, to make the updated color-skewed image's feature distribution parameters more accurate, the target image can be further filtered when it is determined to be a color-skewed image to determine whether it can be used to update the color-skewed image's feature distribution parameters. Specifically, if the probability of the target image being unskewed... If the target image is less than the preset second update threshold P'1, where P'1 is less than the non-color cast misjudgment threshold P1, then the target image can be determined as a color cast image that can be updated, and the color cast feature distribution parameters of the color cast image can be updated according to the above method.
[0178] In another possible embodiment, besides using the above formula to update the mean and variance of the color cast features of the color cast image, other update functions can also be used to update the mean and variance of the color cast features of the color cast image. For example, a logarithmic function can be used to recalculate the mean and variance of the color cast features of the color cast image. As another example, an exponential function can also be used to recalculate the mean and variance of the color cast features of the color cast image.
[0179] In summary, the embodiments of this application acquire a target image to be detected; segment the target image into image blocks to obtain each segmented image block; calculate the color cast feature distribution parameters of the target image based on each segmented image block; and determine the color cast detection result of the target image based on the color cast feature distribution parameters of the target image, the preset color cast feature distribution parameters of a non-color cast image, and the preset color cast feature distribution parameters of a color cast image. Through the above method, the color cast detection result of the target image can be determined based on the color cast feature distribution parameters of the target image and two preset color cast feature distribution parameters. Since the two preset color cast feature distribution parameters are known quantities, the use of complex models in the image color cast detection process can be avoided, greatly simplifying the calculation process and improving the efficiency of the image color cast detection method.
[0180] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0181] Corresponding to the image color cast detection method described in the above embodiments, Figure 8 This diagram illustrates a structural diagram of an embodiment of an image color cast detection device provided in this application.
[0182] In this embodiment of the application, an image color cast detection device may include:
[0183] Image acquisition module 801 is used to acquire the target image to be detected;
[0184] The image block segmentation module 802 is used to segment the target image into image blocks to obtain each segmented image block of the target image;
[0185] The parameter calculation module 803 is used to calculate the color cast feature distribution parameters of the target image based on each segmented image block;
[0186] The result determination module 804 is used to determine the color cast detection result of the target image based on the color cast feature distribution parameters of the target image, the color cast feature distribution parameters of the preset non-color cast image, and the color cast feature distribution parameters of the preset color cast image.
[0187] In one specific implementation of this application embodiment, the result determination module may include:
[0188] The comprehensive value calculation unit is used to calculate the comprehensive color cast value of the target image based on the color cast feature distribution parameters of the target image, the color cast feature distribution parameters of the uncolored image, and the color cast feature distribution parameters of the colored image.
[0189] The first image determination unit is used to determine the target image as a color-skewed image if the color cast comprehensive value is less than or equal to a preset comprehensive value threshold.
[0190] The second image determination unit is used to determine that the target image is a non-color-biased image if the color cast value of the target image is greater than the comprehensive value threshold.
[0191] In one specific implementation of this application embodiment, the comprehensive value calculation unit may include:
[0192] The first probability calculation subunit is used to calculate the probability of misjudging the color cast of the target image based on the color cast feature distribution parameters of the target image and the color cast feature distribution parameters of the uncast image.
[0193] The second probability calculation subunit is used to calculate the probability of misjudging the target image as having no color cast based on the color cast feature distribution parameters of the target image and the color cast feature distribution parameters of the color cast image.
[0194] The comprehensive value calculation subunit is used to calculate the comprehensive value of color deviation based on the color deviation misjudgment probability and the no-color deviation misjudgment probability.
[0195] In one specific implementation of this application embodiment, the image color cast detection device may further include:
[0196] The first update module is used to update the color cast feature distribution parameters of the unbiased image according to the color cast feature distribution parameters of the target image if the target image is an unbiased image.
[0197] The second update module is used to update the color cast feature distribution parameters of the color cast image according to the color cast feature distribution parameters of the target image if the target image is a color cast image.
[0198] In one specific implementation of this application embodiment, the image color cast detection device may further include:
[0199] The image acquisition module is used to acquire each unbiased image.
[0200] The image block segmentation module is used to segment each unbiased image into image blocks using a preset image segmentation algorithm to obtain each initial unbiased image block.
[0201] The image patch classification module is used to classify each initial unbiased image patch using a preset image classification algorithm to obtain the category of each initial unbiased image patch.
[0202] The number equalization module is used to equalize the number of initial unbiased image blocks based on the number of initial unbiased image blocks in each category, so as to obtain each unbiased image block.
[0203] The parameter calculation module is used to calculate the color cast feature distribution parameters of each unbiased image based on each unbiased image block.
[0204] In one specific implementation of this application embodiment, the image color cast detection device may further include:
[0205] The image acquisition module is used to acquire each color-distorted image;
[0206] The image block segmentation module is used to segment each color-distorted image into image blocks using a preset image segmentation algorithm to obtain each initial color-distorted image block.
[0207] The image patch classification module is used to classify each initial color-distorted image patch using a preset image classification algorithm to obtain the category of each initial color-distorted image patch;
[0208] The number equalization module is used to equalize the number of initial color-skewed image blocks based on the number of initial color-skewed image blocks of each category, so as to obtain each color-skewed image block.
[0209] The parameter calculation module is used to calculate the color cast feature distribution parameters of each color cast image based on each color cast image block.
[0210] In one specific implementation of this application embodiment, the image patch segmentation module may include:
[0211] The image block segmentation unit is used to segment the target image into image blocks using a preset image segmentation algorithm to obtain each initial image block of the target image;
[0212] The image block splitting unit is used to split the initial image block into individual image blocks of the target image if the number of initial image blocks is less than a preset number threshold.
[0213] The image block determination unit is used to determine each initial image block as a segmented image block of the target image if the number of initial image blocks is greater than or equal to the number threshold.
[0214] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the devices, modules, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0215] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0216] Figure 9 A schematic block diagram of a terminal device provided in an embodiment of this application is shown. For ease of explanation, only the parts related to the embodiment of this application are shown.
[0217] like Figure 9 As shown, the terminal device 9 in this embodiment includes: a processor 90, a memory 91, and a computer program 92 stored in the memory 91 and executable on the processor 90. When the processor 90 executes the computer program 92, it implements the steps in the various image color cast detection method embodiments described above, for example... Figure 3 Steps S301 to S304 are shown. Alternatively, when the processor 90 executes the computer program 92, it implements the functions of each module / unit in the above-described device embodiments, for example... Figure 8 The functions of modules 801 to 804 are shown.
[0218] For example, the computer program 92 may be divided into one or more modules / units, which are stored in the memory 91 and executed by the processor 90 to complete this application. The one or more modules / units may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program 92 in the terminal device 9.
[0219] Those skilled in the art will understand that Figure 9 This is merely an example of terminal device 9 and does not constitute a limitation on terminal device 9. It may include more or fewer components than shown, or combine certain components, or different components. For example, terminal device 9 may also include input / output devices, network access devices, buses, etc.
[0220] The processor 90 can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor.
[0221] The memory 91 can be an internal storage unit of the terminal device 9, such as a hard disk or memory of the terminal device 9. The memory 91 can also be an external storage device of the terminal device 9, such as a plug-in hard disk, Smart Media Card (SMC), Secure Digital (SD) card, or Flash Card equipped on the terminal device 9. Furthermore, the memory 91 can include both internal and external storage units of the terminal device 9. The memory 91 is used to store the computer program and other programs and data required by the terminal device 9. The memory 91 can also be used to temporarily store data that has been output or will be output.
[0222] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments 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. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0223] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0224] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0225] In the embodiments provided in this application, it should be understood that the disclosed devices / terminal equipment and methods can be implemented in other ways. For example, the device / terminal equipment embodiments described above are merely illustrative. For instance, the division of modules or 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 displayed or discussed mutual coupling or direct coupling or communication connection may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0226] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0227] 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.
[0228] If the integrated module / unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable storage medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium, etc. It should be noted that the content included in the computer-readable storage medium can be appropriately added or removed according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable storage medium does not include electrical carrier signals and telecommunication signals.
[0229] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A method of image color cast detection, the method comprising: The method comprises the following steps: obtaining a target image to be detected; performing image block segmentation on the target image to obtain each segmented image block of the target image; calculating a color cast feature distribution parameter of the target image according to each segmented image block; determining a color cast detection result of the target image according to the color cast feature distribution parameter of the target image, a preset color cast feature distribution parameter of a non-color cast image, and a preset color cast feature distribution parameter of a color cast image; wherein the color cast feature distribution parameter of the non-color cast image is calculated by the following steps: obtaining each non-color cast image; performing image block segmentation on each non-color cast image by using a preset image segmentation algorithm to obtain each initial non-color cast image block; performing image block classification on each initial non-color cast image block by using a preset image classification algorithm to obtain the category of each initial non-color cast image block; performing image block number balancing on the initial non-color cast image blocks according to the number of initial non-color cast image blocks of each category to obtain each non-color cast image block; and calculating the color cast feature distribution parameter of each non-color cast image according to each non-color cast image block.
2. The image color cast detection method of claim 1, wherein, The method for determining the color cast detection result of the target image according to the color cast feature distribution parameter of the target image, the preset color cast feature distribution parameter of the non-color cast image, and the preset color cast feature distribution parameter of the color cast image comprises the following steps: calculating a color cast comprehensive value of the target image according to the color cast feature distribution parameter of the target image, the color cast feature distribution parameter of the non-color cast image, and the color cast feature distribution parameter of the color cast image; if the color cast comprehensive value is less than or equal to a preset comprehensive value threshold, determining that the target image is a non-color cast image; if the color cast comprehensive value of the target image is greater than the comprehensive value threshold, determining that the target image is a color cast image.
3. The image color cast detection method of claim 2, wherein, The method for calculating the color cast comprehensive value of the target image according to the color cast feature distribution parameter of the target image, the color cast feature distribution parameter of the non-color cast image, and the color cast feature distribution parameter of the color cast image comprises the following steps: calculating a color cast misjudgment probability of the target image according to the color cast feature distribution parameter of the target image and the color cast feature distribution parameter of the non-color cast image; calculating a non-color cast misjudgment probability of the target image according to the color cast feature distribution parameter of the target image and the color cast feature distribution parameter of the color cast image; calculating the color cast comprehensive value according to the color cast misjudgment probability and the non-color cast misjudgment probability.
4. The image color cast detection method of claim 2, wherein, After determining the color cast detection result of the target image according to the color cast feature distribution parameter of the target image, the preset color cast feature distribution parameter of the non-color cast image, and the preset color cast feature distribution parameter of the color cast image, the method further comprises the following steps: if the target image is a non-color cast image, updating the color cast feature distribution parameter of the non-color cast image according to the color cast feature distribution parameter of the target image; if the target image is a color cast image, updating the color cast feature distribution parameter of the color cast image according to the color cast feature distribution parameter of the target image.
5. The image color cast detection method of claim 1, wherein, The method for calculating the color cast feature distribution parameter of the color cast image comprises the following steps: obtaining each color cast image; performing image block segmentation on each color cast image by using a preset image segmentation algorithm to obtain each initial color cast image block; The preset image classification algorithm is used to classify each initial color cast image block, to obtain the category of each initial color cast image block; The number of initial color cast image blocks is balanced according to the number of initial color cast image blocks of each category, to obtain each color cast image block; The color cast feature distribution parameters of each color cast image are calculated according to each color cast image block.
6. The image color cast detection method of any one of claims 1 to 5, wherein, The target image is subjected to image block segmentation, to obtain each segmented image block of the target image, including: The preset image segmentation algorithm is used to segment the target image, to obtain each initial image block of the target image; If the number of initial image blocks is less than the preset number threshold, the initial image blocks are subjected to image block splitting, to obtain each segmented image block of the target image; If the number of initial image blocks is greater than or equal to the number threshold, each initial image block is determined as each segmented image block of the target image.
7. An image color cast detection apparatus, characterized by, Including: An image acquisition module is configured to acquire a target image to be detected; An image block segmentation module is configured to segment the target image, to obtain each segmented image block of the target image; A parameter calculation module is configured to calculate the color cast feature distribution parameters of the target image according to each segmented image block; A result determination module is configured to determine the color cast detection result of the target image according to the color cast feature distribution parameters of the target image, the color cast feature distribution parameters of a non-color cast image preset, and the color cast feature distribution parameters of a color cast image preset; the calculation process of the color cast feature distribution parameters of the non-color cast image includes: acquiring each non-color cast image; using the preset image segmentation algorithm to segment each non-color cast image, to obtain each initial non-color cast image block; using the preset image classification algorithm to classify each initial non-color cast image block, to obtain the category of each initial non-color cast image block; balancing the number of initial non-color cast image blocks according to the number of initial non-color cast image blocks of each category, to obtain each non-color cast image block; and calculating the color cast feature distribution parameters of each non-color cast image according to each non-color cast image block.
8. A computer-readable storage medium storing a computer program, the computer-readable storage medium comprising instructions that, when executed by a computer, cause the computer to perform the method of any one of claims 1 to 7. The computer program is executed by the processor to implement the steps of the image color cast detection method according to any one of claims 1 to 6.
9. A terminal device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, The processor executes the computer program to implement the steps of the image color cast detection method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Method for detecting color cast of video image based on Lab chrominance space
CN103402117A
Video image off-color detection method based on Lab space and correlation function
CN104168478A