Sample color correction method, device, electronic equipment and medium

By using evenly distributed 24-color standard color blocks and standard concentration color blocks on the light intelligent calibration color comparison plate, combined with the least squares method and LINEARsRGB color space iterative calculation, the problem of large color correction errors in the existing technology is solved. Achieving accurate color correction in a variety of lighting environments.

CN113674164BActive Publication Date: 2024-09-03HANGZHOU WEIMING XINKE TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110835812.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-23
Publication Date
2024-09-03
Estimated Expiration
2041-07-23

AI Technical Summary

Technical Problem

The existing technology is difficult to accurately perform sample color correction under most lighting environments, especially under non-uniform lighting, resulting in large color recognition errors.

Method used

A light intelligent calibration color guide using evenly distributed 24-color standard color blocks and standard concentration color blocks is used to iteratively calculate the color correction matrix in the sRGB color space through the least squares method, and then convert to the LINEARsRGB color space for correction to reduce color correction errors. .

Benefits of technology

In most lighting environments, including uneven lighting, low-cost and accurate color correction is achieved, reducing color recognition errors caused by uneven light sources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113674164B
    Figure CN113674164B
Patent Text Reader

Abstract

The present application provides a sample color correction method, device, electronic device and medium. The method includes: obtaining a target image to be color corrected, determining a color block to be corrected from a sample area on the target image; taking the pixel values ​​of multiple color correction color blocks in the sRGB color space as the original values ​​and the true values ​​as the target values, and using the least squares method to obtain an initial color correction matrix from the original values ​​to the target values; iteratively calculating the color correction matrix and the color correction value in the LINEAR sRGB color space according to the initial color correction matrix to obtain a final color correction matrix from the original value to the target value; obtaining the correction value of the color block to be corrected according to the final color correction matrix, and correcting the sample color according to the final color correction matrix. The present application avoids the color recognition error caused by uneven light source to a large extent by using uniformly distributed color correction color blocks, obtains the final color correction matrix by iterative calculation in the LINEAR sRGB color space, and reduces the color correction error.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and in particular to a sample color correction method and device, an electronic device, and a computer-readable storage medium. Background Art

[0002] In health monitoring projects, the method of judging physiological health status by test strips has advantages such as short-term convenience. There are usually two ways to obtain the reaction results of test strips: the first is to directly read the color by human eyes and compare it with the colorimetric card. This solution has a strong subjective factor, has a large error, and cannot obtain quantitative results. The second is for the operator to use a specific analyzer to directly read the test strip. The results of this method are not affected by subjective or external factors, and the results are more accurate, but it requires professional equipment and is costly.

[0003] At present, smart mobile devices are becoming more and more popular. Using mobile devices to take pictures and then using image processing technology to detect the results of various indicators is a more accurate way than the human eye and more convenient than professional equipment. However, in the process of shooting images, the image often produces an overall color cast due to characteristics such as the color temperature of the light source. Image color cast will cause huge errors in color value recognition and visual perception, making the color value of the pixel in the image inconsistent with the actual situation. Even if the subsequent camera will automatically adjust the white balance according to the actual image, the color correction result will still be abnormal. In addition, in the actual shooting process, the color of different parts of the image will change due to uneven light exposure or inappropriate shooting angles.

[0004] At present, some technical solutions have taken color correction into consideration. Among them, some color correction solutions only use the difference between the color value of the color correction block displayed in the image and the average grayscale of the real color value of the color correction block to perform color cast correction on the test strip image. However, this method can only perform color cast correction on images taken under white light. If the images are taken under other lighting environments with color cast, the effect of color cast correction will be poor. At the same time, it is not scientific to directly perform color correction in the sRGB color space using the difference between the color value of the color correction block in the image and the real color value, because the image obtained by the camera is nonlinear in the color space, and it is not possible to obtain the accurate color value of the color block to be corrected simply by linear addition and subtraction.

[0005] Therefore, there is currently a lack of a method that can perform low-cost and accurate color correction under most lighting conditions, even under uneven lighting. Summary of the invention

[0006] The purpose of this application is to provide a sample color correction method and device, an electronic device and a computer-readable storage medium.

[0007] The first aspect of the present application provides a sample color correction method, comprising:

[0008] Acquire a target image to be color corrected, wherein the target image includes a calibration colorimetric plate and a sample placed on the calibration colorimetric plate; a plurality of color correction blocks are evenly distributed on the calibration colorimetric plate, wherein the plurality of color correction blocks include 24-color standard blocks and a plurality of standard concentration value color blocks corresponding to the sample;

[0009] Determine a color block to be corrected from a sample area on the target image;

[0010] Taking the pixel values ​​of the plurality of color correction color blocks in the sRGB color space as the original values ​​and the true values ​​as the target values, and using the least square method to obtain an initial color correction matrix from the original values ​​to the target values;

[0011] Convert the pixel values ​​of the plurality of color correction color blocks in the sRGB color space into the LINEAR sRGB color space, and iteratively calculate the color correction matrix and the color correction value in the LINEAR sRGB color space according to the initial color correction matrix to obtain a final color correction matrix from the original value to the target value;

[0012] The correction value of the color block to be corrected is obtained according to the final color correction matrix, and the color of the sample is corrected according to the final color correction matrix.

[0013] A second aspect of the present application provides a sample color correction device, comprising:

[0014] An acquisition module is used to acquire a target image to be color corrected, wherein the target image includes a calibration colorimetric plate and a sample placed on the calibration colorimetric plate; a plurality of color correction blocks are evenly distributed on the calibration colorimetric plate, wherein the plurality of color correction blocks include 24-color standard blocks and a plurality of standard concentration value color blocks corresponding to the sample;

[0015] A determination module, used for determining a color block to be corrected from a sample area on a target image;

[0016] An initial module, used to use the pixel values ​​of the plurality of color correction color blocks in the sRGB color space as original values ​​and the true values ​​as target values, and obtain an initial color correction matrix from the original values ​​to the target values ​​by using the least square method;

[0017] An iteration module, configured to convert the pixel values ​​of the plurality of color correction color blocks in the sRGB color space into the LINEAR sRGB color space, and iteratively calculate the color correction matrix and the color correction value in the LINEAR sRGB color space according to the initial color correction matrix, so as to obtain a final color correction matrix from the original value to the target value;

[0018] The correction module is used to obtain the correction value of the color block to be corrected according to the final color correction matrix, and correct the sample color according to the final color correction matrix.

[0019] The third aspect of the present application provides an electronic device, comprising: 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 method described in the first aspect of the present application.

[0020] A fourth aspect of the present application provides a computer-readable medium having computer-readable instructions stored thereon, wherein the computer-readable instructions can be executed by a processor to implement the method described in the first aspect of the present application.

[0021] Compared with the prior art, the sample color correction method provided by the present application obtains the target image to be color corrected, determines the color block to be corrected from the sample area on the target image; takes the pixel values ​​of multiple color correction color blocks in the sRGB color space as the original values, and the true values ​​as the target values, and uses the least squares method to obtain the initial color correction matrix from the original values ​​to the target values; according to the initial color correction matrix, iteratively calculates the color correction matrix and the color correction value in the LINEAR sRGB color space to obtain the final color correction matrix from the original value to the target value; obtains the correction value of the color block to be corrected according to the final color correction matrix, and corrects the sample color according to the final color correction matrix. It can be seen that the present application avoids the color recognition error caused by the uneven light source to a large extent with the help of uniformly distributed color correction color blocks, obtains the final color correction matrix by iterative calculation in the LINEAR sRGB color space, and reduces the color correction error. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present application. Also, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:

[0023] Figure 1 A flow chart of a sample color correction method provided by the present application is shown;

[0024] Figure 2 A schematic diagram of an integrated light intelligent calibration colorimetric plate device provided by the present application is shown;

[0025] Figure 3 The color correction matrix iteration flow chart provided by the present application is shown;

[0026] Figure 4A schematic diagram of a sample color correction device provided by the present application is shown;

[0027] Figure 5 A schematic diagram of an electronic device provided by the present application is shown;

[0028] Figure 6 A schematic diagram of a computer-readable storage medium provided by the present application is shown. DETAILED DESCRIPTION

[0029] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

[0030] It should be noted that, unless otherwise specified, the technical terms or scientific terms used in this application should have the common meanings understood by technicians in the field to which this application belongs.

[0031] In addition, the terms "first" and "second" etc. are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units that are not listed, or may optionally include other steps or units that are inherent to these processes, methods, products or devices.

[0032] At present, most color correction methods are simple and direct. They calculate the difference between the true value and the pixel value of a single color correction block in the sRGB color space, and then directly obtain the value of the color block to be corrected based on the difference. This method ignores the fact that the image acquired by the camera is presented in a nonlinear color space, and the color correction error is large.

[0033] In view of this, the embodiments of the present application provide a sample color correction method and device, an electronic device, and a computer-readable storage medium, which are described below in conjunction with the accompanying drawings.

[0034] Please refer to Figure 1 , which shows a flow chart of a sample color correction method provided by some embodiments of the present application, the method may include the following steps S101 to S105:

[0035] Step S101: Acquire a target image to be color corrected, wherein the target image includes a calibration colorimetric plate and a sample placed on the calibration colorimetric plate; a plurality of color correction blocks are evenly distributed on the calibration colorimetric plate, wherein the plurality of color correction blocks include 24-color standard blocks and a plurality of standard concentration value color blocks corresponding to the sample;

[0036] In this step, the calibration colorimetric plate can be an integrated light intelligent calibration colorimetric plate device, on which 24 standard color cards and multiple standard concentration value color blocks related to the sample are evenly distributed, reducing the impact of uneven light and light source color cast on color recognition.

[0037] For example, the sample is a test strip that displays different colors when testing liquids of different concentrations. The standard concentration value color block is the color displayed when the test strip tests the standard concentration liquid.

[0038] Specifically, Figure 2 The figure shows an integrated light intelligent calibration colorimetric plate device, such as Figure 2 As shown:

[0039] A 24-color X-Rite standard color card that meets various industry standards is added to the device, and color correction blocks made of the 24 standard color values ​​are evenly distributed on the device, and this part of the color correction blocks serves as part one of the color correction blocks.

[0040] For each sample, a plurality of color blocks with standard concentration values ​​related to the sample are added into the device, and this part of color correction color blocks is used as the second part of color correction color blocks.

[0041] A sample area for placing samples is added to the device to facilitate correct positioning of the color block to be calibrated on the sample. Figure 2 As shown, the sample area is located in the middle of the light intelligent calibration colorimetric plate device, and the test strip can be placed in it.

[0042] The present application will automatically detect whether an image is overexposed or too dark, rather than directly correcting such an image. Therefore, before step S102, the method further includes:

[0043] Counting the pixel values ​​of all color correction blocks on the target image, and calculating the proportion of color correction blocks whose pixel values ​​exceed a preset range to the total number of color correction blocks;

[0044] If the ratio is greater than a preset threshold, a prompt message is sent to prompt the user to adjust the light and re-shoot the target image.

[0045] Specifically, first obtain the target image, and automatically locate and perspective transform the target image. Normalize the color of the target image, and scale the pixel value of the target image from [0,255] to [0,1]. Specifically, divide the pixel value of the target image by 255 to obtain a normalized image. Specifically, [0.02-0.98] can be selected as a preset range of appropriate pixel values, and pixel values ​​outside the preset range can be recorded as too bright or too dark.

[0046] The present application automatically detects whether the image was taken in an overexposed or dark light situation, instead of directly correcting the input image, thereby reducing the error in subsequent color recognition caused by color correction.

[0047] Step S102: determining a color block to be corrected from a sample area on the target image;

[0048] Specifically, the positions of all color correction blocks are known, and the color blocks to be corrected are determined from the sample area according to the positions of the color correction blocks. Specifically, the size of the range of the color blocks to be corrected can be selected as a square block with a side length of 6.

[0049] Calculate the R average, G average, and B average values ​​of the pixel values ​​in the square block. The formula is as follows:

[0050]

[0051]

[0052]

[0053] Among them, N pixels is the total number of pixels in the color block to be corrected. R(x,y) represents the value of the pixel at position (x,y) in the R color channel, G(x,y) represents the value of the pixel at position (x,y) in the G color channel, and B(x,y) represents the value of the pixel at position (x,y) in the B color channel.

[0054] Step S103: taking the pixel values ​​of the plurality of color correction blocks in the sRGB color space as the original values ​​and the true values ​​as the target values, and obtaining an initial color correction matrix from the original values ​​to the target values ​​by using the least square method;

[0055] Step S104: converting the pixel values ​​of the plurality of color correction color blocks in the sRGB color space into the LINEAR sRGB color space, and iteratively calculating the color correction matrix and the color correction value in the LINEAR sRGB color space according to the initial color correction matrix to obtain a final color correction matrix from the original value to the target value;

[0056] Specifically, in order to make the color cast correction process more scientific, this application does not directly calculate the color correction matrix (Color Correction Matrix, CCM) in the sRGB color space, but calculates the CCM using the LINEAR sRGB color space. CCM represents the mapping relationship between the true value of the color correction block and its pixel value in the sRGB color space. The color is converted from sRGB to LINEAR sRGB, and the CCM and correction value are iteratively calculated in the LINEAR sRGB color space, and the correction value generated after each iteration is converted from LINEAR sRGB back to sRGB, and then the value of the loss function obtained by the iteration is calculated. Among them, the loss function is defined as the sum of the squares of the difference between the true value and the pixel value of multiple color correction blocks in the sRGB linear color space. The value of the loss function is continuously reduced by iteration to obtain the mapping relationship from the pixel value to the true value in the sRGB color space.

[0057] The above step S104 specifically includes:

[0058] Multiply the pixel values ​​of all color correction blocks in the LINEARsRGB color space by the initial color correction matrix to obtain color correction values ​​of all color correction blocks;

[0059] All the obtained color correction values ​​are normalized to [0,1], and the pixel values ​​of the color correction blocks are converted from LINEARsRGB to sRGB color space. The subsequent loss function is calculated in sRGB color space.

[0060] In the sRGB color space, the pixel values ​​of all color-corrected color blocks are subtracted from their corresponding true values ​​in the three RGB color channels respectively, and all the differences are squared and summed up, which is recorded as the loss function. The formula is as follows:

[0061]

[0062] Among them, num is the number of all color correction blocks, Corrected_color (sRGB) Color correction value for color correction color block, Real_color (sRGB) The true value of the color patch for color correction;

[0063] With the goal of reducing the value of the loss function Loss, a new color correction matrix is ​​obtained;

[0064] Repeat the above steps until the value of the loss function Loss is less than the preset threshold, and the final color correction matrix from the original value to the target value is obtained.

[0065] Specifically, the pixel value of the color block is converted from the sRGB color space to the LINEAR sRGB color space. The conversion formula is as follows:

[0066] gamma = ((sRGB + 0.055) / 1.055) 2.4

[0067] scale=sRGB / 12.92

[0068]

[0069] Specifically, the pixel value of the color block is converted from the LINEAR sRGB color space to the sRGB color space. The conversion formula is as follows:

[0070] gamma = 1.055 × LINEAR sRGB (1 / 2.4) -0.055

[0071] sacle=LINEAR sRGB×12.92

[0072]

[0073] Specifically, the initial CCM is obtained using the least square method, and the fitting formula is: Ax=b.

[0074] Among them, A is the pixel value of all color correction patches, b is the true value of all color correction patches, and the Euclidean norm is minimized. The solution for x is the initial CCM.

[0075] After obtaining the initial CCM, it is necessary to iterate the CCM to obtain the final CCM. The iterative process is as follows: Figure 3 shown.

[0076] Step S105: obtaining a correction value of the color block to be corrected according to the final color correction matrix, and correcting the color of the sample according to the final color correction matrix.

[0077] Specifically, step S105 includes:

[0078] Convert the pixel value of the color block to be corrected from sRGB to LINEAR sRGB color space;

[0079] Multiplying the pixel value of the color block to be corrected in the LINEAR sRGB color space by the final color correction matrix to obtain a correction value of the color block to be corrected in the LINEAR sRGB color space;

[0080] The correction value of the color block to be corrected is normalized within [0,1], and then the pixel value of the LINEAR sRGB color space is converted to sRGB to obtain the pixel value of the corrected sample in the sRGB color space.

[0081] The present application can still perform accurate color correction even when the light is uneven and the light source produces color cast. With the help of the 24-color standard color blocks on the light intelligent calibration colorimetric plate device and multiple color correction color blocks corresponding to the color blocks to be corrected, the images acquired under most light sources can be accurately corrected and restored. In addition, for the case of local uneven lighting, the present device can also perform accurate color cast correction processing to reduce the error in color recognition caused by light.

[0082] In the above-mentioned embodiment, a sample color correction method is provided. Correspondingly, the present application also provides a sample color correction device. Figure 4 , which shows a schematic diagram of a sample color correction device provided by some embodiments of the present application. Since the device embodiment is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device embodiment described below is only illustrative.

[0083] like Figure 4 As shown, the sample color correction device 10 may include:

[0084] The acquisition module 101 is used to acquire a target image to be color corrected, wherein the target image includes a calibration colorimetric plate and a sample placed on the calibration colorimetric plate; a plurality of color correction blocks are evenly distributed on the calibration colorimetric plate, wherein the plurality of color correction blocks include 24-color standard blocks and a plurality of standard concentration value color blocks corresponding to the sample;

[0085] A determination module 102, configured to determine a color block to be corrected from a sample area on a target image;

[0086] An initial module 103 is used to use the pixel values ​​of the plurality of color correction blocks in the sRGB color space as original values ​​and the true values ​​as target values, and obtain an initial color correction matrix from the original values ​​to the target values ​​by using the least square method;

[0087] An iteration module 104 is used to convert the pixel values ​​of the plurality of color correction color blocks in the sRGB color space into the LINEAR sRGB color space, and iteratively calculate the color correction matrix and the color correction value in the LINEAR sRGB color space according to the initial color correction matrix to obtain a final color correction matrix from the original value to the target value;

[0088] The correction module 105 is used to obtain the correction value of the color block to be corrected according to the final color correction matrix, and correct the color of the sample according to the final color correction matrix.

[0089] According to some embodiments of the present application, the device further comprises:

[0090] The prompt module is used to count the pixel values ​​of all color correction color blocks on the target image before the determination module determines the color block to be corrected from the sample area on the target image, and calculate the proportion of color correction color blocks whose pixel values ​​exceed a preset range to the total color correction color blocks; if the proportion is greater than a preset threshold, a prompt message is sent to prompt the user to adjust the light and re-shoot the target image.

[0091] According to some implementations of the present application, the iteration module 104 is specifically configured to:

[0092] Multiply the pixel values ​​of all color correction blocks in the LINEARsRGB color space by the initial color correction matrix to obtain color correction values ​​of all color correction blocks;

[0093] Normalize all the obtained color correction values ​​to [0,1], and convert the pixel values ​​of the color correction blocks from LINEARsRGB to sRGB color space. The subsequent loss function needs to be calculated in sRGB color space.

[0094] In the sRGB color space, the pixel values ​​of all color-corrected color blocks are subtracted from their corresponding true values ​​in the three RGB color channels respectively, and all the differences are squared and summed up, which is recorded as the loss function. The formula is as follows:

[0095]

[0096] Among them, num is the number of all color correction blocks, Corrected_color (sRGB) Color correction value for color correction color block, Real_color (sRGB) The true value of the color patch for color correction;

[0097] With the goal of reducing the value of the loss function Loss, a new color correction matrix is ​​obtained;

[0098] Repeat the above steps until the value of the loss function Loss is less than the preset threshold, and the final color correction matrix from the original value to the target value is obtained.

[0099] According to some implementations of the present application, the correction module 105 is specifically used to:

[0100] Convert the pixel value of the color block to be corrected from sRGB to LINEAR sRGB color space;

[0101] Multiplying the pixel value of the color block to be corrected in the LINEAR sRGB color space by the final color correction matrix to obtain a correction value of the color block to be corrected in the LINEAR sRGB color space;

[0102] The correction value of the color block to be corrected is normalized within [0,1], and then the pixel value of the LINEAR sRGB color space is converted to sRGB to obtain the pixel value of the corrected sample in the sRGB color space.

[0103] The sample color correction device 10 provided in the embodiment of the present application is based on the same inventive concept as the sample color correction method provided in the aforementioned embodiment of the present application and has the same beneficial effects.

[0104] The embodiments of the present application also provide an electronic device corresponding to the sample color correction method provided in the aforementioned embodiments, such as a mobile phone, a laptop computer, a tablet computer, a desktop computer, etc., to execute the aforementioned sample color correction method.

[0105] Please refer to Figure 5 , which shows a schematic diagram of an electronic device provided by some embodiments of the present application. Figure 5 As shown, the electronic device 20 includes: a processor 200, a memory 201, a bus 202 and a communication interface 203, wherein the processor 200, the communication interface 203 and the memory 201 are connected via the bus 202; the memory 201 stores a computer program that can be run on the processor 200, and when the processor 200 runs the computer program, the sample color correction method provided in any of the aforementioned embodiments of the present application is executed.

[0106] The electronic device provided in the embodiment of the present application and the sample color correction method provided in the embodiment of the present application are based on the same inventive concept and have the same beneficial effects as the methods adopted, operated or implemented therein.

[0107] The present application also provides a computer-readable storage medium corresponding to the sample color correction method provided in the above embodiment. Figure 6 The computer-readable storage medium shown is a CD 30 on which a computer program (ie, a program product) is stored. When the computer program is run by a processor, the sample color correction method provided in any of the aforementioned embodiments will be executed.

[0108] It should be noted that examples of the computer-readable storage medium may also include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other optical or magnetic storage media, which are not listed here one by one.

[0109] The computer-readable storage medium provided in the above-mentioned embodiment of the present application and the sample color correction method provided in the embodiment of the present application are based on the same inventive concept and have the same beneficial effects as the method adopted, run or implemented by the application program stored therein.

[0110] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application, and they should all be included in the scope of the claims and specification of the present application.

Claims

1. A sample color correction method, characterized in that: include: Acquire a target image to be color corrected, wherein the target image includes a calibration colorimetric plate and a sample placed on the calibration colorimetric plate; a plurality of color correction blocks are evenly distributed on the calibration colorimetric plate, wherein the plurality of color correction blocks include 24-color standard blocks and a plurality of standard concentration value color blocks corresponding to the sample; Determine a color block to be corrected from a sample area on the target image; Taking the pixel values ​​of the plurality of color correction color blocks in the sRGB color space as the original values ​​and the true values ​​as the target values, and using the least square method to obtain an initial color correction matrix from the original values ​​to the target values; Converting pixel values ​​of the plurality of color correction color blocks in the sRGB color space into the LINEAR sRGB color space, iteratively calculating the color correction matrix and the color correction value in the LINEAR sRGB color space according to the initial color correction matrix, and obtaining a final color correction matrix from the original value to the target value; Obtaining a correction value of the color block to be corrected according to the final color correction matrix, and correcting the color of the sample according to the final color correction matrix; The method of iteratively calculating the color correction matrix and the color correction value in the LINEAR sRGB color space according to the initial color correction matrix to obtain a final color correction matrix from the original value to the target value includes: The color is converted from sRGB to LINEAR sRGB, and the CCM and correction value are iteratively calculated in the LINEAR sRGB color space. The correction value generated after each iteration is converted from LINEAR sRGB back to sRGB, and the value of the loss function obtained in this iteration is calculated; wherein, CCM represents the mapping relationship between the true value of the color correction block and its pixel value in the sRGB color space, and the loss function is defined as the sum of the squares of the difference between the true value and the pixel value of multiple color correction blocks in the sRGB linear color space. The value of the loss function is continuously reduced by iteration to obtain the mapping relationship from the pixel value to the true value in the sRGB color space.

2. The method according to claim 1, characterized in that Before determining the color block to be corrected from the sample area on the target image, the method further includes: Counting the pixel values ​​of all color correction blocks on the target image, and calculating the proportion of color correction blocks whose pixel values ​​exceed a preset range to the total number of color correction blocks; If the ratio is greater than a preset threshold, a prompt message is sent to prompt the user to adjust the light and re-shoot the target image.

3. The method according to claim 1 or 2, characterized in that: The color correction matrix and the color correction value are iteratively calculated in the LINEARsRGB color space according to the initial color correction matrix to obtain a final color correction matrix from the original value to the target value, including: Multiply the pixel values ​​of all color correction blocks in the LINEAR sRGB color space by the initial color correction matrix to obtain color correction values ​​of all color correction blocks; All the obtained color correction values ​​are normalized to [0,1], and the pixel values ​​of the color correction blocks are converted from LINEARsRGB to sRGB color space, and the loss function is calculated in the sRGB color space; In the sRGB color space, the pixel values ​​of all color-corrected color blocks are subtracted from their corresponding true values ​​in the three RGB color channels respectively, and all the differences are squared and summed up, which is recorded as the loss function. The formula is as follows: Among them, num is the number of all color correction blocks, Corrected_color (sRGB) Color correction value for color correction color block, Real_color (sRGB) The true value of the color patch for color correction; With the goal of reducing the value of the loss function Loss, a new color correction matrix is ​​obtained; Repeat the above steps until the value of the loss function Loss is less than the preset threshold, and the final color correction matrix from the original value to the target value is obtained.

4. The method according to claim 3, characterized in that Obtaining the correction value of the color block to be corrected according to the final color correction matrix, and correcting the color of the sample according to the final color correction matrix, comprises: Convert the pixel value of the color block to be corrected from sRGB to LINEAR sRGB color space; Multiplying the pixel value of the color block to be corrected in the LINEAR sRGB color space by the final color correction matrix to obtain a correction value of the color block to be corrected in the LINEAR sRGB color space; The correction value of the color block to be corrected is normalized within [0,1], and then the pixel value of the LINEAR sRGB color space is converted to sRGB to obtain the pixel value of the corrected sample in the sRGB color space.

5. A sample color correction device, characterized in that: include: An acquisition module is used to acquire a target image to be color corrected, wherein the target image includes a calibration colorimetric plate and a sample placed on the calibration colorimetric plate; a plurality of color correction blocks are evenly distributed on the calibration colorimetric plate, wherein the plurality of color correction blocks include 24-color standard blocks and a plurality of standard concentration value color blocks corresponding to the sample; A determination module, used for determining a color block to be corrected from a sample area on a target image; An initial module, used to use the pixel values ​​of the plurality of color correction color blocks in the sRGB color space as original values ​​and the true values ​​as target values, and obtain an initial color correction matrix from the original values ​​to the target values ​​by using the least square method; An iteration module, configured to convert the pixel values ​​of the plurality of color correction color blocks in the sRGB color space into the LINEAR sRGB color space, and iteratively calculate the color correction matrix and the color correction value in the LINEAR sRGB color space according to the initial color correction matrix, so as to obtain a final color correction matrix from the original value to the target value; A correction module, used to obtain a correction value of the color block to be corrected according to the final color correction matrix, and correct the color of the sample according to the final color correction matrix; The iteration module is specifically used for: The color is converted from sRGB to LINEAR sRGB, and the CCM and correction value are iteratively calculated in the LINEAR sRGB color space. The correction value generated after each iteration is converted from LINEAR sRGB back to sRGB, and the value of the loss function obtained in this iteration is calculated; wherein, CCM represents the mapping relationship between the true value of the color correction block and its pixel value in the sRGB color space, and the loss function is defined as the sum of the squares of the difference between the true value and the pixel value of multiple color correction blocks in the sRGB linear color space. The value of the loss function is continuously reduced by iteration to obtain the mapping relationship from the pixel value to the true value in the sRGB color space.

6. The device according to claim 5, characterized in that The device also includes: The prompt module is used to count the pixel values ​​of all color correction color blocks on the target image before the determination module determines the color block to be corrected from the sample area on the target image, and calculate the proportion of color correction color blocks whose pixel values ​​exceed a preset range to the total color correction color blocks; if the proportion is greater than a preset threshold, a prompt message is sent to prompt the user to adjust the light and re-shoot the target image.

7. The device according to claim 5 or 6, characterized in that The iteration module is specifically used for: Multiply the pixel values ​​of all color correction blocks in the LINEAR sRGB color space by the initial color correction matrix to obtain color correction values ​​of all color correction blocks; All the obtained color correction values ​​are normalized to [0,1], and the pixel values ​​of the color correction blocks are converted from LINEARsRGB to sRGB color space, and the loss function is calculated in the sRGB color space; In the sRGB color space, the pixel values ​​of all color-corrected color blocks are subtracted from their corresponding true values ​​in the three RGB color channels respectively, and all the differences are squared and summed up, which is recorded as the loss function. The formula is as follows: Among them, num is the number of all color correction blocks, Corrected_color (sRGB) Color correction value for color correction color block, Real_color (sRGB) The true value of the color patch for color correction; With the goal of reducing the value of the loss function Loss, a new color correction matrix is ​​obtained; Repeat the above steps until the value of the loss function Loss is less than the preset threshold, and the final color correction matrix from the original value to the target value is obtained.

8. The device according to claim 7, characterized in that The correction module is specifically used for: Convert the pixel value of the color block to be corrected from sRGB to LINEAR sRGB color space; Multiplying the pixel value of the color block to be corrected in the LINEAR sRGB color space by the final color correction matrix to obtain a correction value of the color block to be corrected in the LINEAR sRGB color space; The correction value of the color block to be corrected is normalized within [0,1], and then the pixel value of the LINEAR sRGB color space is converted to sRGB to obtain the pixel value of the corrected sample in the sRGB color space.

9. An electronic device, comprising: 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 method according to any one of claims 1 to 4.

10. A computer-readable storage medium, characterized in that: Computer readable instructions are stored thereon, and the computer readable instructions can be executed by a processor to implement the method according to any one of claims 1 to 4.