Color correction method and device, computer device and storage medium

By mapping image pixels to pre-divided color swatch regions and performing color correction based on target optimization parameters of the color swatch regions, the problem of inaccurate color correction in traditional methods is solved, achieving higher accuracy and efficiency.

CN114549351BActive Publication Date: 2025-11-18GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210152649.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-18
Publication Date
2025-11-18
Estimated Expiration
2042-02-18

AI Technical Summary

Technical Problem

Traditional color correction methods suffer from inaccurate color correction.

Method used

The pixels of the image are mapped to predefined color swatch regions. Based on the pixels mapped to these color swatch regions, the target optimization parameters for each color swatch region are determined, and the color correction parameters are determined based on these parameters, thereby correcting the image.

Benefits of technology

It improves the accuracy and efficiency of color correction, resulting in images with more accurate colors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114549351B_ABST
    Figure CN114549351B_ABST
Patent Text Reader

Abstract

The application relates to a color correction method and device, computer equipment, a storage medium and a computer program product. The method comprises the following steps: mapping each pixel of a first image to a pre-divided color ticket field; determining a target optimization parameter of each color ticket field based on the pixels mapped to the color ticket field; determining a color correction parameter of the first image based on the target optimization parameter of each color ticket field; and correcting the first image based on the color correction parameter to obtain a second image. The method can more accurately correct the color of an image.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer, in particular to a color correction method and device, computer equipment, storage medium and computer program product. BACKGROUND

[0002] With the development of computer technology, image shooting has become an indispensable function in people's daily life. However, during image shooting, the color of the captured image may be distorted due to various reasons such as inaccurate device parameters, shaking, etc. Therefore, it is necessary to correct the color of the image.

[0003] However, the traditional color correction method has the problem of inaccurate color correction. SUMMARY

[0004] Therefore, it is necessary to provide a color correction method, device, computer equipment, computer readable storage medium and computer program product which can more accurately correct the color.

[0005] In a first aspect, the present application provides a color correction method. The method comprises:

[0006] mapping each pixel of a first image to a pre-divided color ticket field;

[0007] determining a target optimization parameter of each color ticket field based on the pixels mapped to the color ticket field;

[0008] determining a color correction parameter of the first image based on the target optimization parameter of each color ticket field;

[0009] correcting the first image based on the color correction parameter to obtain a second image.

[0010] In a second aspect, the present application further provides a color correction device. The device comprises:

[0011] a mapping module configured to map each pixel of a first image to a pre-divided color ticket field;

[0012] a determination module configured to determine a target optimization parameter of each color ticket field based on the pixels mapped to the color ticket field;

[0013] the determination module is further configured to determine a color correction parameter of the first image based on the target optimization parameter of each color ticket field;

[0014] a correction module configured to correct the first image based on the color correction parameter to obtain a second image.

[0015] In a third aspect, the present application provides a computer device. The computer device comprises a memory and a processor. The memory stores a computer program. The processor implements the following steps when executing the computer program:

[0016] mapping each pixel of the first image into a color swatch field which is divided in advance;

[0017] determining a target optimization parameter of each color swatch field based on the pixels mapped into the color swatch field;

[0018] determining a color correction parameter of the first image based on the target optimization parameter of each color swatch field;

[0019] correcting the first image based on the color correction parameter to obtain a second image.

[0020] In a fourth aspect, the present application provides a computer readable storage medium. The computer readable storage medium stores a computer program. The computer program is executed by a processor to implement the following steps:

[0021] mapping each pixel of the first image into a color swatch field which is divided in advance;

[0022] determining a target optimization parameter of each color swatch field based on the pixels mapped into the color swatch field;

[0023] determining a color correction parameter of the first image based on the target optimization parameter of each color swatch field;

[0024] correcting the first image based on the color correction parameter to obtain a second image.

[0025] In a fifth aspect, the present application provides a computer program product. The computer program product comprises a computer program. The computer program is executed by a processor to implement the following steps:

[0026] mapping each pixel of the first image into a color swatch field which is divided in advance;

[0027] determining a target optimization parameter of each color swatch field based on the pixels mapped into the color swatch field;

[0028] determining a color correction parameter of the first image based on the target optimization parameter of each color swatch field;

[0029] correcting the first image based on the color correction parameter to obtain a second image.

[0030] The color correction method, device, computer device, storage medium and computer program product can map each pixel of the first image to each color swatch field, and then determine the target optimization parameter of each color swatch field based on the pixels mapped in each color swatch field. That is, the target optimization parameter of each color swatch field is obtained based on each pixel of the first image, and has a strong correlation with the first image. Then, the color correction parameter having a strong correlation with the first image can be determined based on the target optimization parameter of each color swatch field, and the first image can be color corrected based on the color correction parameter, so that the second image with more faithful color can be generated, and the accuracy of color correction is improved. BRIEF DESCRIPTION OF DRAWINGS

[0031] Figure 1 A flowchart of a color correction method in an embodiment;

[0032] Figure 2 A flowchart of a color correction method in another embodiment;

[0033] Figure 3 A schematic diagram of determining the target optimization parameter of a color swatch field in an embodiment;

[0034] Figure 4 A schematic diagram of color space conversion of an image in an embodiment;

[0035] Figure 5 A flowchart of a color correction method in another embodiment;

[0036] Figure 6 A schematic diagram of color correction of an image in an embodiment;

[0037] Figure 7 A block diagram of a color correction device in an embodiment;

[0038] Figure 8 An internal structure diagram of a computer device in an embodiment. DETAILED DESCRIPTION

[0039] In order to make the purpose, technical scheme and advantages of the present application clearer, the present application will be further described in detail below with reference to the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application, and are not used to limit the present application.

[0040] The color correction method provided by the embodiments of the present application can be applied to a computer device. The computer device can be a terminal or a server. The terminal can be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, Internet of Things devices, and portable wearable devices. The Internet of Things device can be a smart speaker, a smart television, a smart air conditioner, a smart vehicle device, etc. The portable wearable device can be a smart watch, a smart bracelet, a head-mounted device, etc. The server can be implemented by an independent server or a server cluster composed of multiple servers.

[0041] In one embodiment, as shown in Figure 1 A color correction method is provided, comprising the following steps:

[0042] Step 102, mapping each pixel of the first image to a pre-divided color swatch field.

[0043] The color swatch refers to a specific color, and the color swatch field refers to a color range. For example, the color swatch field A can be a color range including red, that is, the color swatch field A includes not only red but also other colors adjacent to red. It should be noted that the number of pre-divided color swatch fields can be set as needed, and the shape of each color swatch field can also be set as needed, which are not limited herein.

[0044] Specifically, the computer device obtains a first image, detects each pixel in the first image, obtains pixel information of each pixel, matches the pixel information of each pixel with pre-divided color swatch fields, and maps the pixel to a matched color swatch field. The pre-divided color swatch fields can be divided based on hue and saturation, or based on brightness, or based on color values, but are not limited thereto. The pixel information can include one or more of pixel color values, pixel brightness, hue, and saturation.

[0045] Step 104, determining a target optimization parameter of each color swatch field based on the pixels mapped to the color swatch field.

[0046] The target optimization parameter is a parameter for optimizing the color correction parameter, so as to generate more accurate color correction parameters. The target optimization parameter can be a weight value of the color swatch field, or an optimization vector of the color swatch field, but is not limited thereto.

[0047] The target optimization parameter of the same color swatch field is positively correlated with the correction degree in the color correction process. That is, the greater the target optimization parameter of the same color swatch field, the greater the correction degree of the color swatch field, and the greater the weight of the correction of the color swatch field.

[0048] In an embodiment, the target optimization parameter of each color swatch field is determined based on the number of pixels mapped to the color swatch field, and the target optimization parameter of the same color swatch field is positively correlated with the number of pixels mapped to the color swatch field. That is, the greater the number of pixels mapped to the color swatch field, the greater the target optimization parameter, and the greater the degree of correction of the color swatch field.

[0049] In another embodiment, the target optimization parameter of each color swatch field is determined based on the distribution of pixels mapped to the color swatch field. Specifically, the color swatch field with a concentrated distribution of pixels is determined based on the distribution of pixels mapped to each color swatch field, the first target optimization parameter of the color swatch field with the concentrated distribution of pixels is determined, and the second target optimization parameter of the color swatch field other than the color swatch field with the concentrated distribution of pixels is determined, wherein the first target optimization parameter is greater than the second target optimization parameter.

[0050] It can be understood that the more concentrated the distribution of pixels mapped to each color swatch field in the first image, the greater the number of pixels mapped to the color swatch field, and the greater the target optimization parameter of the color swatch field.

[0051] It should be noted that the manner of determining the target optimization parameter of each color swatch field based on the pixels mapped to the color swatch field can be set as needed, and is not limited herein.

[0052] Step 106, determining the color correction parameter of the first image based on the target optimization parameter of each color swatch field.

[0053] The color correction parameter is a parameter for color correction of the first image. The color correction parameter can be a color correction matrix, a color correction vector, or a color correction value, and is not limited thereto.

[0054] Specifically, the computer device inputs the target optimization parameter of each color swatch field into an evaluation function, and outputs the color correction parameter of the first image through the evaluation function. The evaluation function is a mathematical function model for evaluating the overall and local performance of the research object.

[0055] Step 108, correcting the first image based on the color correction parameter to obtain a second image.

[0056] Specifically, the computer device multiplies each pixel in the first image with the color correction parameter to obtain each corrected pixel, and generates the second image based on the corrected pixels.

[0057] In another embodiment, the computer device can further select specified pixels from the first image, multiply each specified pixel with the color correction parameter respectively to obtain respective corrected pixels, and generate the second image based on the respective corrected pixels and other pixels except the specified pixels.

[0058] In other embodiments, the computer device can further generate the second image in other manners, which are not limited herein.

[0059] The color correction method described above maps each pixel of the first image to a respective color swatch field, and determines the target optimization parameter of each color swatch field based on the pixels mapped to the color swatch field. That is, the target optimization parameter of each color swatch field is determined based on the pixels of the first image, and has a strong correlation with the first image. Then, the color correction parameter having a strong correlation with the first image can be determined based on the target optimization parameter of each color swatch field, and the first image can be color corrected based on the color correction parameter to generate the second image with more accurate color, thereby improving the accuracy of color correction.

[0060] It can be understood that the target pixel value is set in each color swatch field. If the corrected pixel of the color swatch field is closer to the target pixel value of the color swatch field, it means that the color difference between the corrected pixel and the target pixel value is smaller, and the correction of the pixel is more accurate. The sum of the color differences of the pixels in the second image represents the accuracy of color correction of the second image. The smaller the sum of the color differences, the more accurate the color correction of the second image. The sum of the color differences is the sum of the color differences of all colors multiplied by the target optimization parameter of the color swatch field. If the sum of the color differences is the smallest, the color of the first image can be corrected to the greatest extent, thereby generating a more accurate second image.

[0061] In addition, the color correction method described above can automatically generate the color correction parameter of the first image, avoid time-consuming repeated debugging, and improve the efficiency of color correction.

[0062] In one embodiment, the division of each color swatch field includes: obtaining the hue and saturation of each color swatch; determining the division boundary value of each color swatch field based on the hue and saturation of each adjacent two color swatches; and generating each color swatch field based on the division boundary value of each color swatch field.

[0063] The hue is one of the three elements of color, namely the appearance of color. The saturation refers to the degree of brightness of color.

[0064] The computer device sorts the color chips according to a preset sorting manner. The preset sorting manner can be sorting according to color value, sorting according to brightness, sorting according to saturation, or the like, and is not limited thereto.

[0065] The division boundary value refers to a numerical value of a color chip field boundary. The division boundary value of the color chip field can include a hue boundary value and a saturation boundary value.

[0066] Specifically, the computer device calculates the hue of each adjacent two color chips to obtain the hue boundary value of each color chip field, and calculates the saturation of each adjacent two color chips to obtain the saturation boundary value of each color chip field. Based on the calculation of the hue boundary value and the saturation boundary value of each adjacent two color chips, each color chip field can be divided.

[0067] In an embodiment, the hue of each adjacent two color chips can be averaged to obtain the hue boundary value of each color chip field, and the saturation of each adjacent two color chips can be averaged to obtain the saturation boundary value of each color chip field.

[0068] In another embodiment, the hue of each adjacent two color chips can be added to obtain the hue boundary value, and the saturation of each adjacent two color chips can be added to obtain the saturation boundary value.

[0069] In other embodiments, the hue boundary value and the saturation boundary value can also be calculated in other manners, which are not limited herein.

[0070] In the present embodiment, the hue and the saturation of each color chip are obtained, and the division boundary value of each color chip field is accurately determined based on the hue and the saturation of each adjacent two color chips, so that each color chip field is more accurately generated.

[0071] In one embodiment, as shown in FIG. 1, another color correction method is provided, including the following steps: Figure 2

[0072] Step 202, mapping each pixel of the first image into each color chip field which is pre-divided.

[0073] Step 204, counting the number of pixels mapped in each color chip field, and determining a target color chip field with a pixel number greater than a preset number threshold from each color chip field.

[0074] The preset number threshold can be set as needed. For example, the preset number threshold can be 0, 50, or 100, or the like. The target color chip field is a color chip field with a pixel number greater than the preset number threshold.

[0075] ​In step 206, the computer device determines the target optimization parameter of each target color swatch field based on the number of pixels in each target color swatch field. The target optimization parameter of the same target color swatch field is positively correlated with the number of mapped pixels, and the target optimization parameter of the same target color swatch field is positively correlated with the correction degree.

[0076] The correction degree refers to the degree of color correction of the target color swatch field. The greater the correction degree of the target color swatch field, the greater the correction degree of the pixels mapped in the target color swatch field, and the more accurate the color correction of the pixels.

[0077] It can be understood that the greater the number of pixels mapped in the target color swatch field, the more pixels of the first image are mapped to the target color swatch field, the target color swatch field can better reflect the color of the first image, the greater the target optimization parameter of the target color swatch field, the greater the correction degree of the target color swatch field in color correction, and the target color swatch field is a color swatch field to be corrected first, so that most of the pixels in the first image can be corrected to a greater extent, and the first image can be more accurately color corrected.

[0078] In an embodiment, the computer device can take the number of pixels in each target color swatch field as the target optimization parameter of each target color swatch field. For example, the number of pixels in the target color swatch field A is 100, and the target optimization parameter of the target color swatch field A is 100.

[0079] In another embodiment, the computer device can take the proportion of the number of pixels in each target color swatch field in the total number as the target optimization parameter of each target color swatch field. The total number is the number of pixels in the first image. For example, the proportion of the number of pixels in the target color swatch field B in the total number is 30%, and the target optimization parameter of the target color swatch field B is 30%.

[0080] In an embodiment, as shown in FIG. 2, the computer device can determine the target optimization parameter of each target color swatch field based on the number of pixels in each target color swatch field. Figure 3As shown, the preset divided color ticket fields include 11, numbered 1 to 11, and each pixel of the first image is mapped to the preset divided color ticket fields, the number of pixels mapped to the color ticket field 1 is 3, the number of pixels mapped to the color ticket field 2 is 5, and the number of pixels mapped to the color ticket field 3 is 3. It can be seen that the proportion of the number of pixels of the color ticket field 1 in the total number is 27%, the proportion of the number of pixels of the color ticket field 2 in the total number is 46%, and the proportion of the number of pixels of the color ticket field 3 in the total number is 27%. Therefore, the proportion of the number of pixels of each target color ticket field in the total number can be used as the respective target optimization parameter, that is, the target optimization parameter of the color ticket field 1 is 0.27, the target optimization parameter of the color ticket field 2 is 0.46, and the target optimization parameter of the color ticket field 3 is 0.27. In each color ticket field, there is also a target value of the color ticket, which is used for comparison with the pixel value of the corrected pixel.

[0081] In other embodiments, the computer device can also determine the respective target optimization parameter of each target color ticket field in other ways, which are not limited herein.

[0082] In step 208, the color correction parameter of the first image is determined based on the respective target optimization parameter of each target color ticket field.

[0083] In step 210, the first image is corrected based on the color correction parameter to obtain a second image.

[0084] In this embodiment, the number of pixels mapped from each color ticket field is counted, and the target color ticket field with a pixel number greater than a preset number threshold is determined from each color ticket field. The target color ticket field with a larger number of mapped pixels can be screened out, and the color ticket field with no pixel number or a smaller number of mapped pixels can be avoided from being processed, which can improve the efficiency of color correction. Moreover, the respective target optimization parameter of each target color ticket field is determined based on the number of pixels of each target color ticket field. The target optimization parameter of the same target color ticket field is positively correlated with the number of mapped pixels, and the target optimization parameter of the same target color ticket field is positively correlated with the correction degree. Most of the pixels in the first image can be color corrected to a greater extent, so that the first image can be more accurately color corrected.

[0085] In one embodiment, the respective target optimization parameter of each color ticket field is determined based on the number of pixels mapped from each color ticket field, including: obtaining an initial optimization parameter of each color ticket field; adjusting the initial optimization parameter of each color ticket field based on the number of pixels mapped from each color ticket field to obtain the respective target optimization parameter of each color ticket field; the number of pixels mapped from the same color ticket field is positively correlated with the proportion of the target optimization parameter in all target optimization parameters, and the target optimization parameter of the same target color ticket field is positively correlated with the correction degree.

[0086] The initial optimization parameter is an initial optimization parameter in the color swatch field. For example, the initial optimization parameter is an initial weight factor, and the initial weight factor of each color swatch field is 1.

[0087] The number of pixels mapped by the same color swatch field is positively correlated with the proportion of the target optimization parameter in all target optimization parameters. If the number of pixels mapped by the color swatch field is large, the target optimization parameter of the color swatch field accounts for a large proportion in all target optimization parameters, and the initial optimization parameter of the color swatch field is increased to obtain the target optimization parameter. If the number of pixels mapped by the color swatch field is small, the target optimization parameter of the color swatch field accounts for a small proportion in all target optimization parameters, and the initial optimization parameter of the color swatch field is decreased to obtain the target optimization parameter.

[0088] Specifically, the computer device counts the number of pixels mapped by each color swatch field, inputs the number of pixels of each color swatch field and the original initial parameter into a preset algorithm, adjusts the initial optimization parameter of each color swatch field, and can output the target optimization parameter of each color swatch field. In the preset algorithm, the initial optimization parameter of the color swatch field is increased to obtain the target optimization parameter if the number of pixels of the color swatch field is large, and the initial optimization parameter of the color swatch field is decreased to obtain the target optimization parameter if the number of pixels of the color swatch field is small.

[0089] In this embodiment, the initial optimization parameter of each color swatch field is obtained, the initial optimization parameter of each color swatch field is adjusted based on the number of pixels mapped by each color swatch field, the number of pixels mapped by the same color swatch field is positively correlated with the proportion of the target optimization parameter in all parameters, the target optimization parameter of the color swatch field is larger, and the correction degree is larger in the color correction process. The color swatch field with a larger number of pixels is more accurate in color correction.

[0090] In one embodiment, the first image is corrected based on the color correction parameter to obtain a second image, including: correcting the original pixel value of each pixel of the first image based on the color correction parameter to obtain the corrected pixel value of each pixel; and generating the second image based on the corrected pixel value of each pixel.

[0091] The original pixel value is the pixel value before the pixel color correction. The corrected pixel value is the pixel value after the pixel color correction.

[0092] Specifically, the computer device multiplies the original pixel value of each pixel of the first image by the color correction parameter to obtain the corrected pixel value of each pixel, and generates the second image based on the corrected pixel value of each pixel.

[0093] In this embodiment, the original pixel values ​​of each pixel in the first image are corrected based on the color correction parameters to obtain the corrected pixel values ​​of each pixel. Then, based on the corrected pixel values ​​of each pixel, a color-corrected second image can be generated, thereby improving the accuracy of color correction.

[0094] In one embodiment, the method further includes: converting the first image to a color space to obtain a third image; wherein the color space of the third image includes hue and saturation; mapping each pixel of the first image to a pre-divided color swatch region, including: mapping each pixel of the third image to a pre-divided color swatch region; the color swatch regions are divided according to hue and saturation dimensions.

[0095] The color space of the first image can be RGB (Red, Green, Blue). The color space of the third image can be HSV (Hue, Saturation, Value) or LCH. In LCH, L represents value, C represents saturation, and H represents hue.

[0096] In one embodiment, such as Figure 4 As shown, the color space of the first image is RGB, and the color space of the third image is HSV. The computer device can convert the color space of the first image from RGB to HSV to obtain the third image.

[0097] In this embodiment, the first image is converted to a color space to obtain a third image whose color space includes hue and saturation. Then, each pixel of the third image can be more accurately mapped to each color swatch area divided by hue and saturation dimensions.

[0098] In one embodiment, the method further includes: obtaining a standard optimized color correction matrix; processing the first image based on the standard optimized color correction matrix to obtain a linear image; and mapping each pixel of the first image to a pre-divided color swatch region, including: mapping each pixel of the linear image to a pre-divided color swatch region.

[0099] The Standard Optimized Color Correction Matrix (CCM_std) is a standard matrix for color correction. CCM stands for Color Correction matrix.

[0100] The computer device obtains a standard optimization matrix, multiplies each pixel in the first image by the standard optimization color correction matrix to obtain a linear image, and then maps each pixel of the linear image to a pre-divided color swatch area.

[0101] In the embodiment, the computer device processes the first image based on the standard optimization color correction matrix, and a linear image can be obtained, in which each pixel has a linear relationship, and each pixel can be uniformly processed to improve the processing efficiency.

[0102] In one embodiment, the method further includes: obtaining a standard optimization color correction matrix; processing the first image based on the standard optimization color correction matrix to obtain a linear image; and performing color space conversion on the linear image to obtain a third image; wherein the color space of the third image includes hue and saturation; and the mapping of each pixel of the first image into each color card field includes mapping each pixel of the third image into each color card field; and the color card field is divided in the hue dimension and the saturation dimension.

[0103] In one embodiment, as shown in Figure 5 the computer device obtains a first image, the color space of the first image is RGB, and each pixel is RGB; the first image is input into a standard optimization color correction module, the first image is processed by the standard optimization color correction module based on a standard optimization color correction matrix to obtain a linear image, the color space of the linear image is also RGB, and each pixel is RGB; the linear image is input into a color space conversion module, the color space of the linear image is converted from RGB to HSV by the color space conversion module, where H represents hue and S represents saturation; the third image is input into a color card field weight generator, each pixel in the third image is mapped into each color card field by the color card field weight generator, and the weight of each color card field is determined based on the pixels mapped by each color card field, the weight belongs to a target optimization parameter; wherein the color card field is divided in the hue dimension and the saturation dimension; the weight of each color card field is input into a color correction matrix optimizer, the target color correction matrix of the first image is determined by the color correction matrix optimizer based on the target optimization parameter of each color card field, and the target color correction matrix belongs to a color correction parameter; the first image is corrected based on the target color correction matrix to obtain a second image.

[0104] The target color correction matrix is a 3*3 matrix:

[0105] a11 a12 a13

[0106] a21 a22 a23

[0107] a31 a32 a33

[0108] The target color correction matrix can also be a 4*4 matrix, a 5*5 matrix, etc., and is not limited thereto.

[0109] In one embodiment, as shown inFigure 6 As shown, the computer device maps each pixel of the first image into each color swatch field, and based on the pixels mapped into each color swatch field, determines the target optimization parameter of each color swatch field, and thus determines the optimized color correction parameter of the first image, and corrects the pixels of the first image that need to be corrected based on the color correction parameter, to generate a more accurate second image, and minimize the color difference from the accurate color value.

[0110] It should be understood that, although each step in the flowchart involved in each embodiment as described above is shown in sequence according to the arrow, these steps are not necessarily executed in sequence according to the arrow. Unless otherwise specified herein, the execution of these steps is not strictly limited in sequence, and these steps can be executed in other sequences. Moreover, at least part of the steps in the flowchart involved in each embodiment as described above can include multiple steps or multiple stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution sequence of these steps or stages is not necessarily sequential, but can be executed alternately or alternately with at least part of other steps or steps or stages in other steps.

[0111] Based on the same inventive concept, the embodiments of the present application also provide a color correction device for implementing the color correction method described above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme described in the above method, so the specific limitations in one or more color correction device embodiments provided below can refer to the limitations of the color correction method described above, and will not be repeated here.

[0112] In one embodiment, as Figure 7 shown, a color correction device is provided, comprising: a mapping module 702, a determination module 704 and a correction module 706, wherein:

[0113] The mapping module 702 is configured to map each pixel of the first image into each color swatch field.

[0114] The determination module 704 is configured to determine the target optimization parameter of each color swatch field based on the pixels mapped into each color swatch field.

[0115] The determination module 704 is further configured to determine the color correction parameter of the first image based on the target optimization parameter of each color swatch field.

[0116] The correction module 706 is configured to correct the first image based on the color correction parameter to obtain a second image.

[0117] The color correction device maps each pixel of the first image to each color swatch field, and determines the target optimization parameter of each color swatch field based on the pixel mapped to each color swatch field. The target optimization parameter of each color swatch field is determined based on the pixel of the first image, and has a strong correlation with the first image. The color correction parameter having a strong correlation with the first image is determined based on the target optimization parameter of each color swatch field, and the first image is corrected based on the color correction parameter, so that the second image having a more faithful color is generated, and the accuracy of the color correction is improved.

[0118] In one embodiment, the device further includes a division module configured to obtain the hue and saturation of each color swatch, determine the division boundary value of each color swatch field based on the hue and saturation of each adjacent two color swatches, and generate each color swatch field based on the division boundary value of each color swatch field.

[0119] In one embodiment, the determination module 704 is further configured to count the number of pixels mapped to each color swatch field, determine a target color swatch field in which the number of pixels is greater than a preset number threshold from each color swatch field, determine the target optimization parameter of each target color swatch field based on the number of pixels of each target color swatch field, and determine the color correction parameter of the first image based on the target optimization parameter of each target color swatch field. The target optimization parameter of the same target color swatch field is positively correlated with the number of pixels mapped to the same target color swatch field, and the target optimization parameter of the same target color swatch field is positively correlated with the correction degree.

[0120] In one embodiment, the determination module 704 is further configured to obtain the initial optimization parameter of each color swatch field, adjust the initial optimization parameter of each color swatch field based on the number of pixels mapped to each color swatch field to obtain the target optimization parameter of each color swatch field, and determine the color correction parameter of the first image based on the target optimization parameter of each color swatch field. The number of pixels mapped to the same color swatch field is positively correlated with the proportion of the target optimization parameter in all target optimization parameters, and the target optimization parameter of the same target color swatch field is positively correlated with the correction degree.

[0121] In one embodiment, the correction module 706 is further configured to correct the original pixel value of each pixel of the first image based on the color correction parameter to obtain the corrected pixel value of each pixel, and generate the second image based on the corrected pixel value of each pixel.

[0122] In one embodiment, the device further includes a conversion module configured to perform color space conversion on the first image to obtain a third image. The color space of the third image includes the hue and the saturation. The mapping module 702 is further configured to map each pixel of the third image to each color swatch field. The color swatch field is divided in the hue dimension and the saturation dimension.

[0123] In one embodiment, the above apparatus further includes a linear processing module for obtaining a standard optimized color correction matrix; processing the first image based on the standard optimized color correction matrix to obtain a linear image; and the mapping module 702 is further used to map each pixel of the linear image to a pre-divided color swatch area.

[0124] Each module in the aforementioned color correction device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.

[0125] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 8 As shown, the computer device includes a processor, memory, input / output interfaces, a communication interface, a display unit, and an input device. The processor, memory, and input / output interfaces are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interfaces. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interfaces are used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When executed by the processor, the computer program implements a color correction method. The display unit of the computer device is used to form a visually visible image. It can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.

[0126] Those skilled in the art will understand that Figure 8 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0127] In one embodiment, a computer device is provided, comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program: mapping each pixel of a first image into a pre-divided color swatch field; determining a target optimization parameter of each color swatch field based on the pixels mapped into the color swatch field; determining a color correction parameter of the first image based on the target optimization parameter of each color swatch field; and correcting the first image based on the color correction parameter to obtain a second image.

[0128] In one embodiment, the processor further implements the following steps when executing the computer program: obtaining hue and saturation of each color swatch; determining a division boundary value of each color swatch field based on the hue and saturation of each adjacent two color swatches; and generating each color swatch field based on the division boundary value of each color swatch field.

[0129] In one embodiment, the processor further implements the following steps when executing the computer program: counting the number of pixels mapped into each color swatch field, and determining a target color swatch field from each color swatch field, wherein the number of pixels in the target color swatch field is greater than a preset number threshold; determining a target optimization parameter of each target color swatch field based on the number of pixels in each target color swatch field; the target optimization parameter of the same target color swatch field is positively correlated with the number of pixels mapped into the target color swatch field, and the target optimization parameter of the same target color swatch field is positively correlated with a correction degree; and determining a color correction parameter of the first image based on the target optimization parameter of each target color swatch field.

[0130] In one embodiment, the processor further implements the following steps when executing the computer program: obtaining an initial optimization parameter of each color swatch field; adjusting the initial optimization parameter of each color swatch field based on the number of pixels mapped into each color swatch field to obtain a target optimization parameter of each color swatch field; the number of pixels mapped into the same color swatch field is positively correlated with the proportion of the target optimization parameter in all target optimization parameters, and the target optimization parameter of the same target color swatch field is positively correlated with a correction degree.

[0131] In one embodiment, the processor further implements the following steps when executing the computer program: correcting an original pixel value of each pixel of the first image based on the color correction parameter to obtain a corrected pixel value of each pixel; and generating a second image based on the corrected pixel value of each pixel.

[0132] In one embodiment, the processor further implements the following steps when executing the computer program: performing color space conversion on the first image to obtain a third image; wherein the color space of the third image comprises hue and saturation; mapping each pixel of the third image into a pre-divided color swatch field; and the color swatch field is divided in the hue dimension and the saturation dimension.

[0133] In one embodiment, the processor, when executing the computer program, also implements the following steps: obtaining a standard optimization color correction matrix; processing the first image based on the standard optimization color correction matrix to obtain a linear image; and mapping each pixel of the linear image to a pre-divided color swatch field.

[0134] In one embodiment, a computer readable storage medium is provided, and the computer readable storage medium stores a computer program. When the computer program is executed by a processor, the following steps are implemented: mapping each pixel of the first image to a pre-divided color swatch field; determining a target optimization parameter of each color swatch field based on the pixels mapped to each color swatch field; determining a color correction parameter of the first image based on the target optimization parameter of each color swatch field; and correcting the first image based on the color correction parameter to obtain a second image.

[0135] In one embodiment, the computer program, when executed by the processor, also implements the following steps: obtaining hue and saturation of each color swatch; determining a division boundary value of each color swatch field based on the hue and saturation of each adjacent two color swatches; and generating each color swatch field based on the division boundary value of each color swatch field.

[0136] In one embodiment, the computer program, when executed by the processor, also implements the following steps: counting the number of pixels mapped to each color swatch field, and determining a target color swatch field in which the number of pixels is greater than a preset number threshold; determining a target optimization parameter of each target color swatch field based on the number of pixels of each target color swatch field; the target optimization parameter of the same target color swatch field is positively correlated with the number of pixels mapped to the same target color swatch field, and the target optimization parameter of the same target color swatch field is positively correlated with the correction degree; and determining a color correction parameter of the first image based on the target optimization parameter of each target color swatch field.

[0137] In one embodiment, the computer program, when executed by the processor, also implements the following steps: obtaining an initial optimization parameter of each color swatch field; adjusting the initial optimization parameter of each color swatch field based on the number of pixels mapped to each color swatch field to obtain a target optimization parameter of each color swatch field; the number of pixels mapped to the same color swatch field is positively correlated with the proportion of the target optimization parameter in all target optimization parameters, and the target optimization parameter of the same target color swatch field is positively correlated with the correction degree.

[0138] In one embodiment, the computer program, when executed by the processor, also implements the following steps: correcting the original pixel value of each pixel of the first image based on the color correction parameter to obtain a corrected pixel value of each pixel; and generating the second image based on the corrected pixel value of each pixel.

[0139] In one embodiment, the computer program, when executed by the processor, further implements the following steps: performing color space conversion on the first image to obtain a third image; wherein the color space of the third image comprises hue and saturation; mapping each pixel of the third image to a pre-divided color swatch field; and the color swatch field is divided in the hue dimension and the saturation dimension.

[0140] In one embodiment, the computer program, when executed by the processor, further implements the following steps: obtaining a standard optimization color correction matrix; processing the first image based on the standard optimization color correction matrix to obtain a linear image; and mapping each pixel of the linear image to a pre-divided color swatch field.

[0141] In one embodiment, a computer program product is provided, comprising a computer program which, when executed by the processor, implements the following steps: mapping each pixel of the first image to a pre-divided color swatch field; determining a target optimization parameter for each color swatch field based on the pixels mapped to each color swatch field; determining a color correction parameter for the first image based on the target optimization parameter for each color swatch field; and correcting the first image based on the color correction parameter to obtain a second image.

[0142] In one embodiment, the computer program, when executed by the processor, further implements the following steps: obtaining the hue and saturation of each color swatch; determining a division boundary value for each color swatch field based on the hue and saturation of each adjacent two color swatches; and generating each color swatch field based on the division boundary value of each color swatch field.

[0143] In one embodiment, the computer program, when executed by the processor, further implements the following steps: counting the number of pixels mapped to each color swatch field, and determining a target color swatch field from each color swatch field, wherein the number of pixels mapped to the target color swatch field is greater than a preset number threshold; determining a target optimization parameter for each target color swatch field based on the number of pixels mapped to each target color swatch field; the target optimization parameter of the same target color swatch field is positively correlated with the number of pixels mapped to the same target color swatch field, and the target optimization parameter of the same target color swatch field is positively correlated with the correction degree; and determining a color correction parameter for the first image based on the target optimization parameter for each target color swatch field.

[0144] In one embodiment, the computer program, when executed by the processor, further implements the following steps: obtaining an initial optimization parameter for each color swatch field; adjusting the initial optimization parameter for each color swatch field based on the number of pixels mapped to each color swatch field to obtain a target optimization parameter for each color swatch field; the number of pixels mapped to the same color swatch field is positively correlated with the proportion of the target optimization parameter in all target optimization parameters, and the target optimization parameter of the same target color swatch field is positively correlated with the correction degree.

[0145] In one embodiment, the computer program, when executed by the processor, further implements the following steps: correcting original pixel values of the pixels of the first image based on the color correction parameter to obtain corrected pixel values of the pixels; and generating the second image based on the corrected pixel values of the pixels.

[0146] In one embodiment, the computer program, when executed by the processor, further implements the following steps: performing color space conversion on the first image to obtain a third image; wherein the color space of the third image comprises hue and saturation; and mapping the pixels of the third image to the color swatch fields.

[0147] In one embodiment, the computer program, when executed by the processor, further implements the following steps: obtaining a standard optimized color correction matrix; processing the first image based on the standard optimized color correction matrix to obtain a linear image; and mapping the pixels of the linear image to the color swatch fields.

[0148] It should be noted that the user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or authorized by all parties, and the collection, use and processing of the relevant data need to comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0149] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer readable storage medium, and when the computer program is executed, the processes of the above-mentioned embodiments of the methods can be included. Any reference to memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (Read-Only Memory, ROM), magnetic tape, floppy disk, flash memory, optical storage, high-density embedded non-volatile memory, resistive memory (ReRAM), magnetoresistive random access memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric memory (Ferroelectric Random Access Memory, FRAM), phase change memory (Phase Change Memory, PCM), graphene memory, etc. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, etc. As an illustration but not limitation, RAM can be in various forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), etc. The database involved in the embodiments provided in the present application can include at least one of a relational database and a non-relational database. The non-relational database can include a distributed database based on a block chain, etc., without being limited thereto. The processor involved in the embodiments provided in the present application can be a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., without being limited thereto.

[0150] Any combination of the technical features of the above embodiments can be made. In order to make the description simple, all possible combinations of the technical features in the above embodiments are not described, however, as long as the combination of the technical features does not exist contradictory, it should be considered as the scope of the present application.

[0151] The above embodiments only express several implementation manners of the present application, and the description is more specific and detailed, but it should not be understood as a limitation on the scope of the patent of the present application. It should be noted that for ordinary skilled in the art, without departing from the concept of the present application, a number of modifications and improvements can be made, which are within the scope of protection of the present application. Therefore, the scope of protection of the present application should be subject to the appended claims.

Claims

1. A color correction method, characterized in that, The method includes: Each pixel of the first image is mapped to a pre-divided color swatch region; the color swatch region refers to a color range. Based on the pixels mapped to each color swatch area, the target optimization parameters for each color swatch area are determined. Based on the target optimization parameters of each color swatch area, the color correction parameters of the first image are determined; The first image is corrected based on the color correction parameters to obtain the second image; The classification methods for various color ticket categories include: Obtain the hue and saturation of each color swatch; Based on the hue and saturation of each pair of adjacent color swatches, the boundary values ​​for dividing each color swatch area are determined respectively; Each color swatch domain is generated based on the boundary values ​​of each color swatch domain. The determination of target optimization parameters for each color swatch region based on the pixels mapped to each color swatch region includes: Count the number of pixels mapped to each color swatch area, and determine the target color swatch area whose number of pixels is greater than a preset threshold from each color swatch area; Based on the number of pixels in each target color swatch domain, the target optimization parameters for each target color swatch domain are determined. The target optimization parameters for the same target color swatch domain are positively correlated with the number of pixels mapped, and the target optimization parameters for the same target color swatch domain are positively correlated with the degree of correction. The step of determining the color correction parameters of the first image based on the target optimization parameters of each color swatch domain includes: The color correction parameters of the first image are determined based on the target optimization parameters of each target color swatch domain.

2. The method according to claim 1, characterized in that, The determination of target optimization parameters for each color swatch region based on the pixels mapped to each color swatch region includes: Obtain the initial optimization parameters for each color swatch area; Based on the number of pixels mapped to each color swatch area, the initial optimization parameters of each color swatch area are adjusted to obtain the target optimization parameters for each color swatch area. The number of pixels mapped to the same color swatch area is positively correlated with the proportion of the target optimization parameters in all target optimization parameters, and the target optimization parameters of the same target color swatch area are positively correlated with the degree of correction.

3. The method according to claim 1, characterized in that, The step of correcting the first image based on the color correction parameters to obtain the second image includes: The original pixel values ​​of each pixel in the first image are corrected based on the color correction parameters to obtain the corrected pixel values ​​of each pixel; A second image is generated based on the corrected pixel values ​​of each pixel.

4. The method according to any one of claims 1 to 3, characterized in that, The method further includes: The first image is converted to a different color space to obtain a third image; wherein the color space of the third image includes hue and saturation. The step of mapping each pixel of the first image to each pre-divided color swatch region includes: Each pixel of the third image is mapped to a pre-divided color swatch region; the color swatch regions are divided by hue and saturation dimensions.

5. The method according to any one of claims 1 to 3, characterized in that, The method further includes: Obtain the standard optimized color correction matrix; The first image is processed based on the standard optimized color correction matrix to obtain a linear image; The step of mapping each pixel of the first image to each pre-divided color swatch region includes: Each pixel of the linear image is mapped to a pre-divided color swatch area.

6. A color correction device, characterized in that, The device includes: The segmentation module is used to obtain the hue and saturation of each color swatch; based on the hue and saturation of each pair of adjacent color swatches, it determines the segmentation boundary value of each color swatch region; and generates each color swatch region based on the segmentation boundary value of each color swatch region. The mapping module is used to map each pixel of the first image to a pre-divided color swatch area; the color swatch area refers to a color range. The determination module is used to determine the target optimization parameters for each color swatch region based on the pixels mapped to each color swatch region; it is also used to count the number of pixels mapped to each color swatch region and determine the target color swatch regions with a number of pixels greater than a preset threshold from each color swatch region; based on the number of pixels in each target color swatch region, it determines the target optimization parameters for each target color swatch region; the target optimization parameters for the same target color swatch region are positively correlated with the number of pixels mapped, and the target optimization parameters for the same target color swatch region are positively correlated with the degree of correction; The determining module is further configured to determine the color correction parameters of the first image based on the target optimization parameters of each target color swatch domain; The correction module is used to correct the first image based on the color correction parameters to obtain the second image.

7. The apparatus according to claim 6, characterized in that, The determining module is also used to obtain the initial optimization parameters of each color swatch area; based on the number of pixels mapped by each color swatch area, the initial optimization parameters of each color swatch area are adjusted to obtain the target optimization parameters of each color swatch area. The number of pixels mapped in the same color swatch area is positively correlated with the proportion of the target optimization parameter in all target optimization parameters, and the target optimization parameter in the same target color swatch area is positively correlated with the degree of correction.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 5.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 5.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Image processing device and method

    CN101360179A

  • Image processing method and device

    CN113096046A