Image processing method and device

By generating incremental and/or balanced matrices and combining them with the initial color correction matrix, the problem of not being able to adjust certain chromaticities independently in existing technologies is solved, achieving diverse and personalized color correction effects.

CN113096046BActive Publication Date: 2024-11-05BEIJING YOUZHUJU NETWORK TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202110407882.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-04-15
Publication Date
2024-11-05
Estimated Expiration
2041-04-15

AI Technical Summary

Technical Problem

In existing technologies, color correction using a color correction matrix cannot individually adjust certain chromaticities, thus failing to meet diverse and personalized color reproduction needs.

Method used

By obtaining the initial color correction matrix and receiving incremental and/or balance parameters, an incremental matrix and/or balance matrix are generated. Combined with the initial color correction matrix, an optimized color correction matrix is ​​generated, enabling individual adjustment of certain chromaticities.

Benefits of technology

It enables individual adjustment of certain chromaticities, meeting diverse and personalized color reproduction needs and enriching users' optimization options.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113096046B_ABST
    Figure CN113096046B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides an image processing method and device, which relates to the field of image processing technology. The method includes: obtaining an initial color correction matrix, which is a matrix that calibrates each pixel value of an image to a corresponding value in a preset color space; receiving matrix optimization parameters, which include: incremental parameters and / or balance parameters, the incremental parameters include: at least one of a red incremental parameter, a green incremental parameter, and a blue incremental parameter, and the balance parameters include: at least one of a red balance parameter, a green balance parameter, and a blue balance parameter; generating an incremental matrix according to the incremental parameters and / or generating a balance matrix according to the balance parameters; generating an optimized color correction matrix according to at least one of the incremental matrix and the balance matrix and the initial color correction matrix; correcting the original image data according to the optimized color correction matrix to obtain a corrected image. The embodiment of the present invention is used for color correction of an image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to an image processing method and device. Background Art

[0002] Color correction refers to converting device-related color signals to device-independent color values ​​under standard light sources, thereby achieving digital image color restoration that conforms to human visual perception. Different image sensors will capture different colors in the same shooting scene, and the colors will also be different from the colors perceived by the human eye, so color correction is one of the important links in the camera image signal processing process.

[0003] Color correction through a color correction matrix has the advantages of small computational complexity and low modular cost. Therefore, color correction through a color correction matrix is ​​currently the most widely used color correction method. For the color correction matrix, only an overall saturation control method is proposed in the prior art. Therefore, when color correction is performed through a color correction matrix, only the saturation of the global chromaticity can be adjusted, and partial chromaticity cannot be adjusted individually. However, with the development of terminal technology, the requirements for color restoration have become diversified and personalized. There are both debugging requirements for increasing or decreasing the global saturation and requirements for optimizing the color tendency for a single or local hue. For example, the saturation of blue is enhanced when it is sunny outdoors, and the skin color is adjusted to be whiter when the color temperature is low indoors. Summary of the invention

[0004] In view of this, the present invention provides an image processing method and apparatus for solving the problem that partial chromaticity cannot be adjusted separately when color correction is performed using a color correction matrix.

[0005] In order to achieve the above purpose, the embodiment of the present invention provides the following technical solutions:

[0006] In a first aspect, an embodiment of the present invention provides an image processing method, comprising:

[0007] Acquire an initial color correction matrix, where the initial color correction matrix is ​​a matrix used to calibrate each pixel value of the image to a corresponding value in a preset color space;

[0008] receiving matrix optimization parameters, the matrix optimization parameters comprising: incremental parameters and / or balance parameters, the incremental parameters comprising: at least one of a red incremental parameter, a green incremental parameter, and a blue incremental parameter, the balance parameters comprising: at least one of a red balance parameter, a green balance parameter, and a blue balance parameter;

[0009] generating an incremental matrix according to the incremental parameters and / or generating a balance matrix according to the balance parameters;

[0010] generating an optimized color correction matrix according to at least one of the incremental matrix and the balanced matrix and the initial color correction matrix;

[0011] The original image data is corrected according to the optimized color correction matrix to obtain a corrected image.

[0012] As an optional implementation of the embodiment of the present invention, the obtaining of the initial color correction matrix includes:

[0013] Under the color temperature and illumination conditions corresponding to the initial color correction matrix, photographing a standard color card to obtain first image data;

[0014] preprocessing the first image data into second image data;

[0015] The color value of each color sample in the second image data and the corresponding standard color value are fitted by using the least square method to obtain the initial color correction matrix.

[0016] As an optional implementation of the embodiment of the present invention, the increment matrix is:

[0017]

[0018] Among them, when the incremental parameters include a red incremental parameter, R_E is the red incremental parameter, and when the incremental parameters do not include the red incremental parameter, R_E is 0; when the incremental parameters include a green incremental parameter, G_E is the green incremental parameter, and when the incremental parameters do not include the green incremental parameter, G_E is 0; when the incremental parameters include a blue incremental parameter, B_E is the blue incremental parameter, and when the incremental parameters do not include the blue incremental parameter, B_E is 0.

[0019] As an optional implementation of the embodiment of the present invention, the balance matrix is:

[0020]

[0021] Among them, when the balance parameters include a red balance parameter, R_E is the red balance parameter, and when the balance parameters do not include the red balance parameter, R_E is 0; when the balance parameters include a green balance parameter, G_E is the green balance parameter, and when the balance parameters do not include the green balance parameter, G_E is 0; when the balance parameters include a blue balance parameter, B_E is the blue balance parameter, and when the balance parameters do not include the blue balance parameter, B_E is 0.

[0022] As an optional implementation manner of the embodiment of the present invention, generating an optimized color correction matrix according to at least one of the incremental matrix and the balance matrix and the initial color correction matrix includes:

[0023] At least one of the incremental matrix and the balanced matrix is ​​added to the initial color correction matrix to obtain the optimized color correction matrix.

[0024] As an optional implementation of the embodiment of the present invention, the matrix optimization parameters further include: hue angle optimization parameters and / or saturation optimization parameters;

[0025] The method further comprises:

[0026] Generate a hue optimization matrix according to the hue angle optimization parameter and / or generate a saturation optimization matrix according to the saturation optimization parameter;

[0027] The step of generating an optimized color correction matrix according to at least one of the incremental matrix and the balanced matrix and the initial color correction matrix comprises:

[0028] An optimized color correction matrix is ​​generated according to at least one of the incremental matrix and the balanced matrix, at least one of the hue optimization matrix and the saturation optimization matrix, and the initial color correction matrix.

[0029] As an optional implementation of the embodiment of the present invention, the tone optimization matrix is:

[0030]

[0031] When the matrix optimization parameters include the hue angle optimization parameter, θ is the hue angle optimization parameter; when the matrix optimization parameters do not include the hue angle optimization parameter, θ is 0.

[0032] As an optional implementation of the embodiment of the present invention, the saturation optimization matrix is:

[0033]

[0034] When the matrix optimization parameters include the saturation optimization parameters, S is the saturation optimization parameter; when the matrix optimization parameters do not include the saturation optimization parameter, S is 1.

[0035] As an optional implementation manner of the embodiment of the present invention, generating an optimized color correction matrix according to at least one of the incremental matrix and the balance matrix, at least one of the hue optimization matrix and the saturation optimization matrix, and the initial color correction matrix includes:

[0036] Multiplying the first matrix, at least one of the hue optimization matrix and the saturation optimization matrix, and the second matrix in sequence to obtain a third matrix; wherein the first matrix is ​​a matrix for converting a YUV color space into an RGB color space, and the second matrix is ​​a matrix for converting an RGB color space into a YUV color space;

[0037] Adding at least one of the incremental matrix and the balanced matrix to the initial color correction matrix to obtain a fourth matrix;

[0038] The first matrix is ​​multiplied by the fourth matrix to obtain the optimized color correction matrix.

[0039] As an optional implementation of the embodiment of the present invention, after obtaining the optimized color correction matrix, the method further includes:

[0040] Correcting the color value of each color sample in the second image data using the optimized color correction matrix to obtain third image data;

[0041] Acquire the chromaticity value of each color sample in the third image data;

[0042] The difference between the chromaticity value of each color sample in the third image data and the chromaticity value of the corresponding standard color value is output.

[0043] As an optional implementation of the embodiment of the present invention, the outputting the difference between the chromaticity value of each color sample in the third image data and the chromaticity value of the corresponding standard color value includes:

[0044] Adding the correction chromaticity points corresponding to the chromaticity values ​​of each color sample in the third image data and the standard chromaticity points corresponding to the chromaticity values ​​of each standard color value in the chromaticity coordinate system;

[0045] Adding a connection line between each corrected chromaticity point and a corresponding standard chromaticity point in the chromaticity coordinate system to generate a difference comparison diagram;

[0046] Output the difference comparison graph.

[0047] In a second aspect, an embodiment of the present invention provides an image processing device, including:

[0048] An acquisition unit, used to acquire an initial color correction matrix, where the initial color correction matrix is ​​a matrix used to calibrate each pixel value of the image to a corresponding value in a preset color space;

[0049] a receiving unit, configured to receive a matrix optimization parameter, wherein the matrix optimization parameter includes: an incremental parameter and / or a balance parameter, wherein the incremental parameter includes: at least one of a red incremental parameter, a green incremental parameter, and a blue incremental parameter, and the balance parameter includes: at least one of a red balance parameter, a green balance parameter, and a blue balance parameter;

[0050] A generating unit, configured to generate an incremental matrix according to the incremental parameters and / or generate a balance matrix according to the balance parameters;

[0051] A processing unit, configured to generate an optimized color correction matrix according to at least one of the incremental matrix and the balanced matrix and the initial color correction matrix;

[0052] The correction unit is used to correct the original image data according to the optimized color correction matrix to obtain a corrected image.

[0053] As an optional implementation of an embodiment of the present invention, the acquisition unit is specifically used to photograph a standard color card under the color temperature and illumination conditions corresponding to the initial color correction matrix to obtain first image data; preprocess the first image data into second image data; and use the least squares method to fit the color values ​​of each color sample in the second image data and the corresponding standard color values ​​to obtain the initial color correction matrix.

[0054] As an optional implementation of the embodiment of the present invention, the increment matrix is:

[0055]

[0056] Among them, when the incremental parameters include a red incremental parameter, R_E is the red incremental parameter, and when the incremental parameters do not include the red incremental parameter, R_E is 0; when the incremental parameters include a green incremental parameter, G_E is the green incremental parameter, and when the incremental parameters do not include the green incremental parameter, G_E is 0; when the incremental parameters include a blue incremental parameter, B_E is the blue incremental parameter, and when the incremental parameters do not include the blue incremental parameter, B_E is 0.

[0057] As an optional implementation of the embodiment of the present invention, the balance matrix is:

[0058]

[0059] Among them, when the balance parameters include a red balance parameter, R_E is the red balance parameter, and when the balance parameters do not include the red balance parameter, R_E is 0; when the balance parameters include a green balance parameter, G_E is the green balance parameter, and when the balance parameters do not include the green balance parameter, G_E is 0; when the balance parameters include a blue balance parameter, B_E is the blue balance parameter, and when the balance parameters do not include the blue balance parameter, B_E is 0.

[0060] As an optional implementation of the embodiment of the present invention, the processing unit is specifically configured to add at least one of the incremental matrix and the balance matrix to the initial color correction matrix to obtain the optimized color correction matrix.

[0061] As an optional implementation of the embodiment of the present invention, the matrix optimization parameters further include: hue angle optimization parameters and / or saturation optimization parameters;

[0062] The generating unit is further configured to generate a hue optimization matrix according to the hue angle optimization parameter and / or generate a saturation optimization matrix according to the saturation optimization parameter;

[0063] The processing unit is specifically configured to generate an optimized color correction matrix according to at least one of the incremental matrix and the balance matrix, at least one of the hue optimization matrix and the saturation optimization matrix, and the initial color correction matrix.

[0064] As an optional implementation of the embodiment of the present invention, the tone optimization matrix is:

[0065]

[0066] When the matrix optimization parameters include the hue angle optimization parameter, θ is the hue angle optimization parameter; when the matrix optimization parameters do not include the hue angle optimization parameter, θ is 0.

[0067] As an optional implementation of the embodiment of the present invention, the saturation optimization matrix is:

[0068]

[0069] When the matrix optimization parameters include the saturation optimization parameters, S is the saturation optimization parameter; when the matrix optimization parameters do not include the saturation optimization parameter, S is 1.

[0070] As an optional implementation manner of an embodiment of the present invention, the processing unit is specifically used to multiply the first matrix, at least one of the hue optimization matrix and the saturation optimization matrix, and the second matrix in sequence to obtain a third matrix; wherein the first matrix is ​​a matrix for converting the YUV color space into the RGB color space, and the second matrix is ​​a matrix for converting the RGB color space into the YUV color space; adding at least one of the incremental matrix and the balance matrix to the initial color correction matrix to obtain a fourth matrix; and multiplying the first matrix by the fourth matrix to obtain the optimized color correction matrix.

[0071] As an optional implementation of the embodiment of the present invention, the device includes:

[0072] An output unit is used to correct the color value of each color sample in the second image data using the optimized color correction matrix to obtain third image data; obtain the chromaticity value of each color sample in the third image data; and output the difference between the chromaticity value of each color sample in the third image data and the chromaticity value of the corresponding standard color value.

[0073] As an optional implementation manner of an embodiment of the present invention, the output unit is specifically used to add correction chromaticity points corresponding to the chromaticity values ​​of each color sample in the third image data and standard chromaticity points corresponding to the chromaticity values ​​of each standard color value in the chromaticity coordinate system; add lines between each correction chromaticity point and the corresponding standard chromaticity point in the chromaticity coordinate system to generate a difference comparison diagram; and output the difference comparison diagram.

[0074] In a third aspect, an embodiment of the present invention provides an electronic device, comprising: a memory and a processor, the memory being used to store a computer program; the processor being used to execute the image processing method described in the first aspect or any optional implementation of the first aspect when calling the computer program.

[0075] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the image processing method described in the first aspect or any optional implementation of the first aspect is implemented.

[0076] In a fifth aspect, an embodiment of the present invention provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the image processing method described in the first aspect or any optional implementation manner of the first aspect.

[0077] The image processing method provided by the embodiment of the present invention first obtains an initial color correction matrix for calibrating each pixel value of the image to a corresponding numerical value in a preset color space, then receives matrix optimization parameters including incremental parameters and / or balance parameters, and then generates an incremental matrix according to the incremental parameters and / or generates a balance matrix according to the balance parameters, and generates an optimized color correction matrix according to at least one of the incremental matrix and the balance matrix and the initial color correction matrix, and finally corrects the original image data according to the optimized color correction matrix to obtain a corrected image. Since the image processing method provided by the embodiment of the present invention can generate an incremental matrix according to at least one of the red incremental parameter, the green incremental parameter and the blue incremental parameter and / or generate a balance matrix according to the balance parameter, and generate an optimized color correction matrix according to at least one of the incremental matrix and the balance matrix and the initial color correction matrix, the user can optimize the initial color correction matrix by inputting the red incremental parameter, the green incremental parameter or the blue incremental parameter, thereby adjusting the hue of part of the chromaticity individually, and can also optimize the initial color correction matrix by inputting the red balance parameter, the green balance parameter or the blue balance parameter, thereby adjusting the saturation of part of the chromaticity individually. Therefore, the image processing method provided by the embodiment of the present invention can adjust part of the chromaticity individually when color correction is performed through the color correction matrix, thereby solving the problem that part of the chromaticity cannot be adjusted individually when color correction is performed through the color correction matrix. BRIEF DESCRIPTION OF THE DRAWINGS

[0078] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0079] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0080] Figure 1 One of the flowcharts of the image processing method provided by the embodiment of the present invention;

[0081] Figure 2 A schematic diagram of an image corresponding to second image data provided by an embodiment of the present invention;

[0082] Figure 3 One of the schematic diagrams of the matrix optimization parameter input interface provided by the embodiment of the present invention;

[0083] Figure 4 The second flowchart of the image processing method provided by the embodiment of the present invention;

[0084] Figure 5 A second schematic diagram of a matrix optimization parameter input interface provided by an embodiment of the present invention;

[0085] Figure 6 Flowchart 3 of the image processing method provided by the embodiment of the present invention;

[0086] Figure 7 A difference comparison diagram provided for an embodiment of the present invention;

[0087] Figure 8 One of the schematic diagrams of the image processing device provided by the embodiment of the present invention;

[0088] Fig. 9 A second schematic diagram of an image processing device provided by an embodiment of the present invention;

[0089] Fig.10 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0090] In order to more clearly understand the above-mentioned objectives, features and advantages of the present invention, the scheme of the present invention will be further described below. It should be noted that the embodiments of the present invention and the features in the embodiments can be combined with each other without conflict.

[0091] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present invention, rather than all of the embodiments.

[0092] In the embodiments of the present invention, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present invention should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a concrete way. In addition, in the description of the embodiments of the present invention, unless otherwise specified, the meaning of "multiple" refers to two or more.

[0093] The term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there may be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the objects associated with each other are in an "or" relationship. The matrix optimization parameters include: incremental parameters and / or balance parameters, indicating that the matrix optimization parameters may include only incremental parameters, only balance parameters, or both incremental parameters and balance parameters.

[0094] The embodiment of the present invention provides an image processing method, referring to Figure 1 As shown, the image processing method provided by the embodiment of the present invention includes the following steps:

[0095] S101, obtaining an initial color correction matrix (Color Correction Matrix, CCM).

[0096] The initial color correction matrix is ​​a matrix used to calibrate each pixel value of the image to a corresponding value in a preset color space.

[0097] As an optional implementation of the embodiment of the present invention, the implementation of the above step S101 (obtaining the initial color correction matrix) may include the following steps a to b.

[0098] Step a: Under the color temperature and illumination conditions corresponding to the initial color correction matrix, photograph the standard color card to obtain first image data (RAW image).

[0099] Specifically, in order to accurately restore the color values ​​of images captured under different color temperature and illumination conditions to standard color values, the image signal processor (Image Signal Processor) of the device will divide the color temperature and illumination into several intervals, and store the color correction matrix applied to the color temperature and illumination conditions corresponding to the critical points of each adjacent interval. When performing color correction, first select the color correction matrix corresponding to the two critical points of the color temperature and illumination area according to the color temperature and illumination when the image was captured, then obtain the color correction matrix for color correction according to the color correction matrix corresponding to the two critical points, and finally restore the color of the captured image according to the obtained color correction matrix. Since the ISP stores color correction matrices corresponding to multiple color temperature intervals and illumination conditions, when obtaining the color correction matrix (initial color correction matrix) to be optimized, it is necessary to shoot the first image data under the color temperature and illumination conditions corresponding to the initial color correction matrix.

[0100] Step b: preprocessing the first image data into second image data.

[0101] Specifically, preprocessing the first image data into the second image data may include one or more of the following processes:

[0102] 1. Black Level Compensation (BLC)

[0103] Due to the influence of impurities, heat and other factors, even if there is no light irradiating the photoelectric sensor corresponding to the pixel unit, the photoelectric sensor corresponding to the pixel unit will generate charge, which will cause the first image data output by the photoelectric sensor to be not a true black balance (the pixel value of the pixel point with an illumination of 0 is not 0). BLC means: in order to eliminate or reduce the influence of dark current on the image signal, the photoelectric sensors corresponding to a preset number of pixel units are set as non-photosensitive areas in the photoelectric sensor, the average value of the image signals output from these areas is used as a correction value, and the image information output by the photoelectric sensors in other areas is subtracted from the correction value, thereby eliminating or reducing the influence of dark current on the image signal.

[0104] 2. Lens Shading Correction (LSC)

[0105] Lens light decay refers to the decrease in lens light transmission from the center to the corners, resulting in a decrease in brightness response from the center to the corners. LSC is implemented by calculating the brightness correction value corresponding to each pixel based on a certain algorithm to compensate for the brightness decay in the edge area.

[0106] 3. Bad Pixel Correction (BPC)

[0107] The photoelectric sensors corresponding to some pixels are defective, which will cause abnormal output signals, such as white dots or black dots. Bad dots refer to white dots in images output under a completely dark environment or black dots in images output under a bright environment. The BPC method can be to automatically detect bad dots and automatically repair them, or to establish a bad dot pixel list to repair bad pixels at fixed positions.

[0108] 4. De-noise (DNS)

[0109] When using a photoelectric sensor to acquire an image, the light intensity, sensor accuracy, and analog-to-digital converter (ADC) will all cause noise, which will cause the image to become blurred and details to be lost, so the image needs to be denoised. Noise removal can be done by: mean filtering, Gaussian filtering, bilateral filtering, etc.

[0110] 5. Color interpolation

[0111] The photoelectric sensor senses light and obtains the RAW data of the Bayer Pattern. However, each pixel only has one of the RGB data, so an interpolation algorithm is needed to supplement the color information of the other two channels to form full-color image data.

[0112] 6. Automatic White Balance (AWB)

[0113] Specifically, automatic white balance means: calculating the correction of the color cast image through the white blocks in the image, so as to make the machine vision closer to the human eye perception.

[0114] Exemplarily, the image corresponding to the second image data may be as follows: Figure 2 As shown, it includes: color blocks (A to X) corresponding to 24 color samples.

[0115] Step c: using the least square method to fit the color value of each color sample in the second image data and the corresponding standard color value to obtain the initial color correction matrix.

[0116] It should be noted that before step c (using the least square method to fit the color value of each color sample in the second image data and the corresponding standard color value), it is first necessary to determine whether the second image data and the standard color value belong to the same color space. If they do not belong to the same color space, the second image data and the standard color value need to be converted to the same color space. Exemplarily, the second image data and the standard color value can be converted to the sRGB space or the Display-P3 space.

[0117] Exemplarily, the initial color correction matrix obtained by fitting the color values ​​of each color sample in the second image data and the corresponding standard color values ​​using the least squares method can be shown as follows:

[0118]

[0119] The color value of the color sample in the second image data, the corresponding standard color value, and the initial color correction matrix have the following relationship:

[0120]

[0121] Among them, R1, G1, and B1 are color values ​​of the color samples in the second image data; and R, G, and B are corresponding standard color values.

[0122] It should be noted that, in theory, the color values ​​of each pixel in the color block corresponding to the same color sample in the second image data are the same. However, due to the influence of noise and other factors, the color values ​​of each pixel in the color block corresponding to the same color sample may also be different. Therefore, the average value of the color values ​​of each pixel in the color block corresponding to the same color sample can be selected as the color value of the color sample in the second image data, and the least squares method can be used to fit the average value to the corresponding standard color value.

[0123] S102. Receive matrix optimization parameters.

[0124] Wherein, the matrix optimization parameters include: incremental parameters and / or balance parameters, the incremental parameters include: at least one of a red incremental parameter, a green incremental parameter and a blue incremental parameter, and the balance parameters include: at least one of a red balance parameter, a green balance parameter and a blue balance parameter.

[0125] Exemplarily, the image processing apparatus may provide Figure 3 The matrix optimization parameter input interface shown in the figure. Figure 3 As shown, the matrix optimization parameter input interface includes: prompts "Please enter the incremental parameters", "Please enter the balance parameters" and sliding controls 31 to 36 respectively located below the prompts "Please enter the incremental parameters" and "Please enter the balance parameters". Among them, sliding control 31 is used to enter the red incremental parameters, sliding control 32 is used to enter the green incremental parameters, sliding control 33 is used to enter the blue incremental parameters, sliding control 34 is used to enter the red balance parameters, sliding control 35 is used to enter the green balance parameters, and sliding control 36 is used to enter the blue balance parameters. The user can enter the corresponding parameters through any sliding control. In addition, the matrix optimization parameter input interface will also display the corresponding parameter values ​​according to the user's sliding operation.

[0126] S103: Generate an incremental matrix according to the incremental parameters and / or generate a balance matrix according to the balance parameters.

[0127] Specifically, if the matrix optimization parameters only include incremental parameters, the incremental matrix is ​​generated only according to the incremental parameters; if the matrix optimization parameters only include balance parameters, the balance matrix is ​​generated only according to the balance parameters; if the matrix optimization parameters include both incremental parameters and balance parameters, the incremental matrix is ​​generated according to the incremental parameters and the balance matrix is ​​generated according to the balance parameters.

[0128] S104: Generate an optimized color correction matrix according to at least one of the incremental matrix and the balanced matrix and the initial color correction matrix.

[0129] That is, when only incremental parameters are received, an incremental matrix is ​​generated according to the incremental parameters, and an optimized color correction matrix is ​​generated according to the incremental matrix and the initial color correction matrix; when only balance parameters are received, a balance matrix is ​​generated according to the balance parameters, and an optimized color correction matrix is ​​generated according to the balance matrix and the initial color correction matrix; when both incremental parameters and balance parameters are received, an incremental matrix is ​​generated according to the incremental parameters and a balance matrix is ​​generated according to the balance parameters, and then an optimized color correction matrix is ​​generated according to the incremental matrix, the balance matrix and the initial color correction matrix.

[0130] S105 , correcting the original image data according to the optimized color correction matrix to obtain a corrected image.

[0131] The original image data in the embodiment of the present invention may be image data acquired by an image acquisition device and not yet processed by a color correction matrix.

[0132] The image processing method provided by the embodiment of the present invention first obtains an initial color correction matrix for calibrating each pixel value of the image to a corresponding numerical value in a preset color space, then receives matrix optimization parameters including incremental parameters and / or balance parameters, and then generates an incremental matrix according to the incremental parameters and / or generates a balance matrix according to the balance parameters, and generates an optimized color correction matrix according to at least one of the incremental matrix and the balance matrix and the initial color correction matrix, and finally corrects the original image data according to the optimized color correction matrix to obtain a corrected image. Since the image processing method provided by the embodiment of the present invention can generate an incremental matrix according to at least one of the red incremental parameter, the green incremental parameter and the blue incremental parameter and / or generate a balance matrix according to the balance parameter, and generate an optimized color correction matrix according to at least one of the incremental matrix and the balance matrix and the initial color correction matrix, the user can optimize the initial color correction matrix by inputting the red incremental parameter, the green incremental parameter or the blue incremental parameter, thereby adjusting the hue of part of the chromaticity individually, and can also optimize the initial color correction matrix by inputting the red balance parameter, the green balance parameter or the blue balance parameter, thereby adjusting the saturation of part of the chromaticity individually. Therefore, the image processing method provided by the embodiment of the present invention can adjust part of the chromaticity individually when color correction is performed through the color correction matrix, thereby solving the problem that part of the chromaticity cannot be adjusted individually when color correction is performed through the color correction matrix.

[0133] As an optional implementation of the embodiment of the present invention, the above step S104 (generating an optimized color correction matrix according to at least one of the incremental matrix and the balance matrix and the initial color correction matrix) includes:

[0134] At least one of the incremental matrix and the balanced matrix is ​​added to the initial color correction matrix to obtain the optimized color correction matrix.

[0135] That is, when the matrix optimization parameters only include the incremental parameters but not the balance parameters, the incremental matrix is ​​generated according to the incremental parameters, then the initial color correction matrix and the incremental matrix are summed, and the sum result is used as the optimized color correction matrix. When the matrix optimization parameters only include the balance parameters but not the incremental parameters, the balance matrix is ​​generated according to the balance parameters, then the initial color correction matrix and the balance matrix are summed, and the sum result is used as the optimized color correction matrix. When the matrix optimization parameters include both the incremental parameters and the balance parameters, the incremental matrix is ​​generated according to the incremental parameters and the balance matrix is ​​generated according to the balance parameters, then the initial color correction matrix, the incremental matrix and the balance matrix are summed, and the sum result is used as the optimized color correction matrix.

[0136] As an implementation and refinement of the image processing method provided in the above embodiment, the following matrix optimization parameters include both incremental parameters and balance parameters as an example to illustrate the above embodiment, referring to Figure 4 As shown, when the matrix optimization parameters include both incremental parameters and balance parameters, the image processing method provided by the embodiment of the present invention includes:

[0137] S401: Obtain an initial color correction matrix.

[0138] The initial color correction matrix is ​​a matrix used to calibrate each pixel value of the image to a corresponding value in a preset color space.

[0139] S402: Receive matrix optimization parameters.

[0140] The matrix optimization parameters include incremental parameters and balance parameters. The incremental parameters include at least one of a red incremental parameter, a green incremental parameter and a blue incremental parameter. The balance parameters include at least one of a red balance parameter, a green balance parameter and a blue balance parameter.

[0141] S403: Generate an incremental matrix according to the incremental parameters.

[0142] Optionally, the increment matrix is:

[0143]

[0144] Among them, when the incremental parameters include a red incremental parameter, R_E is the red incremental parameter, and when the incremental parameters do not include the red incremental parameter, R_E is 0; when the incremental parameters include a green incremental parameter, G_E is the green incremental parameter, and when the incremental parameters do not include the green incremental parameter, G_E is 0; when the incremental parameters include a blue incremental parameter, B_E is the blue incremental parameter, and when the incremental parameters do not include the blue incremental parameter, B_E is 0.

[0145] S404: Generate a balance matrix according to the balance parameters.

[0146] Optionally, the balance matrix is:

[0147]

[0148] Among them, when the balance parameters include a red balance parameter, R_E is the red balance parameter, and when the balance parameters do not include the red balance parameter, R_E is 0; when the balance parameters include a green balance parameter, G_E is the green balance parameter, and when the balance parameters do not include the green balance parameter, G_E is 0; when the balance parameters include a blue balance parameter, B_E is the blue balance parameter, and when the balance parameters do not include the blue balance parameter, B_E is 0.

[0149] S405: Add the incremental matrix, the balance matrix, and the initial color correction matrix to obtain the optimized color correction matrix.

[0150] Specifically, the optimized color correction matrix is:

[0151]

[0152] It should be noted that in some implementations, the hue of a single chromaticity is not adjusted, and the matrix optimization parameters do not include any parameters in the incremental parameters. The incremental matrix is ​​a matrix whose eigenvalues ​​are all 0, so the optimized color correction matrix can be simplified as:

[0153]

[0154] Similarly, in some implementations, the saturation of a single hue is not adjusted, and the matrix optimization parameters do not include any parameters in the balance parameters. Then the balance matrix is ​​a matrix whose eigenvalues ​​are all 0, so the optimized color correction matrix can be simplified as:

[0155]

[0156] Furthermore, in some cases, there is a need not only to adjust partial chromaticity individually, but also to improve the global hue and / or saturation. In order to meet various user needs, the matrix optimization parameters may also include: hue angle optimization parameters and / or saturation optimization parameters.

[0157] For example, refer to Figure 5 As shown, in Figure 3 Based on the matrix optimization parameter input interface shown, the matrix optimization parameter input interface includes: a prompt "Please enter the hue angle optimization parameter", a prompt "Saturation optimization parameter" and sliding controls 51 and 52. Among them, the sliding control 51 is used to enter the hue angle optimization parameter, and the sliding control 52 is used to enter the saturation optimization parameter.

[0158] When the matrix optimization parameters further include: a hue angle optimization parameter and / or a saturation optimization parameter, the image processing method provided by the embodiment of the present invention further includes:

[0159] A hue optimization matrix is ​​generated according to the hue angle optimization parameter and / or a saturation optimization matrix is ​​generated according to the saturation optimization parameter.

[0160] The above step S104 (generating an optimized color correction matrix according to at least one of the incremental matrix and the balanced matrix and the initial color correction matrix) includes:

[0161] An optimized color correction matrix is ​​generated according to at least one of the incremental matrix and the balanced matrix, at least one of the hue optimization matrix and the saturation optimization matrix, and the initial color correction matrix.

[0162] That is, when the matrix optimization parameters also include: hue angle optimization parameters and / or saturation optimization parameters, the implementation scheme of the above step S104 includes: arranging and combining various methods with or without incremental matrix, balance matrix, hue optimization matrix and saturation optimization matrix to form all schemes.

[0163] S406: Correct the original image data according to the optimized color correction matrix to obtain a corrected image.

[0164] As an implementation and refinement of the image processing method provided in the above embodiment, the following matrix optimization parameters including increment parameters, balance parameters, hue angle optimization parameters and saturation optimization parameters are used as examples to illustrate the above embodiment. Figure 6 As shown, when the matrix optimization parameters include an increment parameter, a balance parameter, a hue angle optimization parameter, and a saturation optimization parameter, the image processing method provided by the embodiment of the present invention includes:

[0165] S601: Obtain an initial color correction matrix.

[0166] The initial color correction matrix is ​​a matrix used to calibrate each pixel value of the image to a corresponding value in a preset color space.

[0167] S602: Receive matrix optimization parameters.

[0168] The matrix optimization parameters include: an increment parameter, a balance parameter, a hue angle optimization parameter, and a saturation optimization parameter. The increment parameter includes: at least one of a red increment parameter, a green increment parameter, and a blue increment parameter, and the balance parameter includes: at least one of a red balance parameter, a green balance parameter, and a blue balance parameter.

[0169] S603: Generate a hue optimization matrix according to the hue angle optimization parameters.

[0170] The tone optimization matrix is:

[0171]

[0172] When the matrix optimization parameters include the hue angle optimization parameter, θ is the hue angle optimization parameter; when the matrix optimization parameters do not include the hue angle optimization parameter, θ is 0.

[0173] S604: Generate a saturation optimization matrix according to the saturation optimization parameters.

[0174] Optionally, the saturation optimization matrix is:

[0175]

[0176] When the matrix optimization parameters include the saturation optimization parameters, S is the saturation optimization parameter; when the matrix optimization parameters do not include the saturation optimization parameter, S is 1.

[0177] S605 , multiplying the first matrix, the hue optimization matrix, the saturation optimization matrix, and the second matrix in sequence to obtain a third matrix.

[0178] The first matrix is ​​a matrix for preprocessing the YUV color space into the RGB color space, and the second matrix is ​​a matrix for preprocessing the RGB color space into the YUV color space.

[0179] Specifically, the third matrix is:

[0180]

[0181] in, To preprocess the YUV color space into a matrix of the RGB color space (the first matrix), A matrix (second matrix) for preprocessing the RGB color space into the YUV color space.

[0182] Exemplarily, the first matrix and the second matrix may be conversion matrices in the video standard BT.601, BT.709 or BT.2020.

[0183] It should be noted that in some implementations, the global hue is not adjusted, and the matrix optimization parameters do not include hue angle optimization parameters, then the hue optimization matrix is:

[0184]

[0185] At this time, whether the tone optimization matrix participates in the calculation does not affect the calculation result of the third matrix, so the calculation formula of the third matrix can be simplified as follows:

[0186]

[0187] Likewise, in some implementations, the global saturation is not adjusted, and the matrix optimization parameters do not include the saturation optimization parameters, then the saturation optimization matrix is:

[0188]

[0189] At this time, whether the saturation optimization matrix participates in the calculation does not affect the calculation result of the third matrix, so the calculation formula of the third matrix can be simplified as follows:

[0190]

[0191] S606: Generate an incremental matrix according to the incremental parameters.

[0192] Optionally, the increment matrix is:

[0193]

[0194] Among them, when the incremental parameters include a red incremental parameter, R_E is the red incremental parameter, and when the incremental parameters do not include the red incremental parameter, R_E is 0; when the incremental parameters include a green incremental parameter, G_E is the green incremental parameter, and when the incremental parameters do not include the green incremental parameter, G_E is 0; when the incremental parameters include a blue incremental parameter, B_E is the blue incremental parameter, and when the incremental parameters do not include the blue incremental parameter, B_E is 0.

[0195] S607: Generate a balance matrix according to the balance parameters.

[0196] Optionally, the balance matrix is:

[0197]

[0198] Among them, when the balance parameters include a red balance parameter, R_E is the red balance parameter, and when the balance parameters do not include the red balance parameter, R_E is 0; when the balance parameters include a green balance parameter, G_E is the green balance parameter, and when the balance parameters do not include the green balance parameter, G_E is 0; when the balance parameters include a blue balance parameter, B_E is the blue balance parameter, and when the balance parameters do not include the blue balance parameter, B_E is 0.

[0199] S608: Add the initial color correction matrix, the incremental matrix, and the balance matrix to obtain a fourth matrix.

[0200] As above, at least one of the incremental matrix and the balance matrix is ​​added to the initial color correction matrix to obtain a fourth matrix:

[0201]

[0202] S609: Multiply the first matrix by the fourth matrix to obtain the optimized color correction matrix.

[0203] That is, the optimized color correction matrix=first matrix*fourth matrix.

[0204] The embodiment of the present invention not only adjusts part of the chromaticity individually when performing color correction through the color correction matrix, but also adjusts the global hue and global saturation when performing color correction through the color correction matrix. Therefore, the embodiment of the present invention can further enrich the user's optimization options, thereby restoring colors in a more diversified and personalized manner.

[0205] S610: Correct the original image data according to the optimized color correction matrix to obtain a corrected image.

[0206] Furthermore, through Figure 4 or Figure 6 After the image processing method shown in the figure obtains the optimized color correction matrix, the image processing method provided by the embodiment of the present invention further includes the following steps I to III:

[0207] Step I: Use the optimized color correction matrix to correct the color value of each color sample in the second image data to obtain third image data.

[0208] The color values ​​in the second image data, the color values ​​in the third image data, and the optimized color correction matrix have the following relationship:

[0209]

[0210] Among them, R1, G1, and B1 are the color values ​​of the color samples in the second image data, and R2, G2, and B2 are the color values ​​of the corresponding color samples in the third image data. Correction matrix for optimized color.

[0211] Step II: Obtain the chromaticity value of each color sample in the third image data.

[0212] Exemplarily, the third image data and the standard color value may be converted into a Lab color space to obtain the chromaticity value of each color sample in the third image data and the chromaticity value of the standard color value of each color sample.

[0213] Step III: outputting the difference between the chromaticity value of each color sample in the third image data and the chromaticity value of the corresponding standard color value.

[0214] Exemplarily, the difference between the chromaticity value of each color sample in the third image data and the chromaticity value of the corresponding standard color value may include: the difference between the saturation of each color sample in the third image data and the saturation of the corresponding standard color value and / or the difference between the hue angle of each color sample in the third image data and the hue angle of the corresponding standard color value.

[0215] As an optional implementation of an embodiment of the present invention, a method for outputting the difference between the chromaticity value of each color sample in the third image data and the chromaticity value of the corresponding standard color value may be: outputting the difference between the saturation of each color sample in the third image data and the saturation of the corresponding standard color value and / or the difference between the hue angle of each color sample in the third image data and the hue angle of the corresponding standard color value in a tabular form.

[0216] As an optional implementation of the embodiment of the present invention, the implementation method of the above step III (outputting the difference between the chromaticity value of each color sample in the third image data and the chromaticity value of the corresponding standard color value) may include the following steps a to c:

[0217] Step a: adding, in a chromaticity coordinate system, correction chromaticity points corresponding to the chromaticity values ​​of each color sample in the third image data and standard chromaticity points corresponding to the chromaticity values ​​of each standard color value.

[0218] Step b: adding a line between each corrected chromaticity point and a corresponding standard chromaticity point in the chromaticity coordinate system to generate a difference comparison diagram.

[0219] Step c: outputting the difference comparison chart.

[0220] For example, refer to Figure 7 As shown, Figure 7The above embodiment is described by taking 12 color samples as an example, and the difference comparison diagram is generated including the correction chromaticity points ( Figure 7 The solid dots in the middle show the standard chromaticity points corresponding to the chromaticity values ​​of each standard color value ( Figure 7 The hollow dots are shown) and the lines between each corrected chromaticity point and the corresponding standard chromaticity point. After outputting the difference comparison diagram shown in 7, the user can determine the change in the saturation of the corresponding color sample by the length of the line between the corrected chromaticity point and the corresponding standard chromaticity point, and determine the change in the hue angle of the corresponding color sample by the angle between the line between the corrected chromaticity point and the origin of the chromaticity coordinate system and the line between the corresponding standard chromaticity point and the origin of the chromaticity coordinate system. For example: Figure 7 The correction chromaticity point 71 and the corresponding standard chromaticity point 72 in the figure can determine the saturation change of the corresponding color sample by the size of the a value, and determine the change of the hue angle of the corresponding color sample by δ.

[0221] After outputting the difference comparison map, the user can obtain the changes in saturation and hue angle of each color sample based on the difference comparison map, and then determine whether to continue optimizing the color correction matrix. If it is necessary to continue optimizing the color correction matrix, the matrix optimization parameters can be re-entered and the optimized color correction matrix can be regenerated.

[0222] Based on the same inventive concept, as an implementation of the above method, an embodiment of the present invention further provides an image processing device. The device embodiment corresponds to the above method embodiment. For ease of reading, the device embodiment will no longer repeat the details of the above method embodiment one by one, but it should be clear that the image processing device in this embodiment can correspond to all the contents of the above method embodiment.

[0223] Figure 8 A schematic diagram of the structure of an image processing device provided by an embodiment of the present invention is shown in FIG. Figure 8 As shown, the image processing device 800 provided in this embodiment includes:

[0224] An acquisition unit 81 is used to acquire an initial color correction matrix, where the initial color correction matrix is ​​a matrix used to calibrate each pixel value of an image to a corresponding value in a preset color space;

[0225] A receiving unit 82 is used to receive a matrix optimization parameter, wherein the matrix optimization parameter includes: an incremental parameter and / or a balance parameter, wherein the incremental parameter includes: at least one of a red incremental parameter, a green incremental parameter, and a blue incremental parameter, and the balance parameter includes: at least one of a red balance parameter, a green balance parameter, and a blue balance parameter;

[0226] A generating unit 83, configured to generate an incremental matrix according to the incremental parameters and / or generate a balance matrix according to the balance parameters;

[0227] A processing unit 84, configured to generate an optimized color correction matrix according to at least one of the incremental matrix and the balanced matrix and the initial color correction matrix;

[0228] The correction unit 85 is used to correct the original image data according to the optimized color correction matrix to obtain a corrected image.

[0229] As an optional implementation of an embodiment of the present invention, the acquisition unit 81 is specifically used to photograph a standard color card under the color temperature and illumination conditions corresponding to the initial color correction matrix to obtain first image data; preprocess the first image data into second image data; and use the least squares method to fit the color values ​​of each color sample in the second image data and the corresponding standard color values ​​to obtain the initial color correction matrix.

[0230] As an optional implementation of the embodiment of the present invention, the increment matrix is:

[0231]

[0232] Among them, when the incremental parameters include a red incremental parameter, R_E is the red incremental parameter, and when the incremental parameters do not include the red incremental parameter, R_E is 0; when the incremental parameters include a green incremental parameter, G_E is the green incremental parameter, and when the incremental parameters do not include the green incremental parameter, G_E is 0; when the incremental parameters include a blue incremental parameter, B_E is the blue incremental parameter, and when the incremental parameters do not include the blue incremental parameter, B_E is 0.

[0233] As an optional implementation of the embodiment of the present invention, the balance matrix is:

[0234]

[0235] Among them, when the balance parameters include a red balance parameter, R_E is the red balance parameter, and when the balance parameters do not include the red balance parameter, R_E is 0; when the balance parameters include a green balance parameter, G_E is the green balance parameter, and when the balance parameters do not include the green balance parameter, G_E is 0; when the balance parameters include a blue balance parameter, B_E is the blue balance parameter, and when the balance parameters do not include the blue balance parameter, B_E is 0.

[0236] As an optional implementation of the embodiment of the present invention, the processing unit 84 is specifically configured to add at least one of the incremental matrix and the balanced matrix to the initial color correction matrix to obtain the optimized color correction matrix.

[0237] As an optional implementation of the embodiment of the present invention, the matrix optimization parameters further include: hue angle optimization parameters and / or saturation optimization parameters;

[0238] The generating unit 83 is further configured to generate a hue optimization matrix according to the hue angle optimization parameter and / or generate a saturation optimization matrix according to the saturation optimization parameter;

[0239] The processing unit 84 is specifically configured to generate an optimized color correction matrix according to at least one of the incremental matrix and the balance matrix, at least one of the hue optimization matrix and the saturation optimization matrix, and the initial color correction matrix.

[0240] As an optional implementation of the embodiment of the present invention, the tone optimization matrix is:

[0241]

[0242] When the matrix optimization parameters include the hue angle optimization parameter, θ is the hue angle optimization parameter; when the matrix optimization parameters do not include the hue angle optimization parameter, θ is 0.

[0243] As an optional implementation of the embodiment of the present invention, the saturation optimization matrix is:

[0244]

[0245] When the matrix optimization parameters include the saturation optimization parameters, S is the saturation optimization parameter; when the matrix optimization parameters do not include the saturation optimization parameter, S is 1.

[0246] As an optional implementation of an embodiment of the present invention, the processing unit 84 is specifically used to multiply the first matrix, at least one of the hue optimization matrix and the saturation optimization matrix, and the second matrix in sequence to obtain a third matrix; wherein the first matrix is ​​a matrix for converting the YUV color space into the RGB color space, and the second matrix is ​​a matrix for converting the RGB color space into the YUV color space; adding at least one of the incremental matrix and the balance matrix to the initial color correction matrix to obtain a fourth matrix; multiplying the first matrix by the fourth matrix to obtain the optimized color correction matrix.

[0247] As an optional implementation of the embodiment of the present invention, refer to Fig. 9 As shown, the image processing device 800 includes:

[0248] The output unit 86 is used to use the optimized color correction matrix to correct the color value of each color sample in the second image data to obtain the third image data; obtain the chromaticity value of each color sample in the third image data; and output the difference between the chromaticity value of each color sample in the third image data and the chromaticity value of the corresponding standard color value.

[0249] As an optional implementation manner of an embodiment of the present invention, the output unit 86 is specifically used to add correction chromaticity points corresponding to the chromaticity values ​​of each color sample in the third image data and standard chromaticity points corresponding to the chromaticity values ​​of each standard color value in the chromaticity coordinate system; add lines between each correction chromaticity point and the corresponding standard chromaticity point in the chromaticity coordinate system to generate a difference comparison diagram; and output the difference comparison diagram.

[0250] Based on the same inventive concept, an embodiment of the present invention further provides an electronic device. Fig.10 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention, such as Fig.10 As shown, the electronic device provided in this embodiment includes: a memory 101 and a processor 102, wherein the memory 101 is used to store a computer program; the processor 102 is used to enable the electronic device to implement the steps of the image processing method provided in the above embodiment when calling the computer program.

[0251] An embodiment of the present invention further provides a computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a computing device, the computing device implements the image processing method provided by the above embodiment.

[0252] An embodiment of the present invention further provides a computer program product, characterized in that when the computer program product is run on a computer, the computer is enabled to implement the image processing method provided in the above embodiment.

[0253] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media containing computer-usable program code.

[0254] The processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0255] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0256] Computer readable media include permanent and non-permanent, removable and non-removable storage media. Storage media can be implemented by any method or technology to store information, and the information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media 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 memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0257] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention 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 with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. An image processing method, characterized in that: include: Acquire an initial color correction matrix, where the initial color correction matrix is ​​a matrix used to calibrate each pixel value of the image to a corresponding value in a preset color space; Receive matrix optimization parameters, the matrix optimization parameters including: increment parameters and / or balance parameters, the increment parameters including: at least one of a red increment parameter, a green increment parameter, and a blue increment parameter, the balance parameters including: at least one of a red balance parameter, a green balance parameter, and a blue balance parameter; the matrix optimization parameters further including: a hue angle optimization parameter and / or a saturation optimization parameter; generating an incremental matrix according to the incremental parameters and / or generating a balance matrix according to the balance parameters; Generate a hue optimization matrix according to the hue angle optimization parameter and / or generate a saturation optimization matrix according to the saturation optimization parameter; Multiplying the first matrix, at least one of the hue optimization matrix and the saturation optimization matrix, and the second matrix in sequence to obtain a third matrix; wherein the first matrix is ​​a matrix for converting a YUV color space into an RGB color space, and the second matrix is ​​a matrix for converting an RGB color space into a YUV color space; Adding at least one of the incremental matrix and the balanced matrix to the initial color correction matrix to obtain a fourth matrix; Multiplying the first matrix by the fourth matrix to obtain an optimized color correction matrix; The original image data is corrected according to the optimized color correction matrix to obtain a corrected image.

2. The method according to claim 1, characterized in that The obtaining of the initial color correction matrix comprises: Under the color temperature and illumination conditions corresponding to the initial color correction matrix, photographing a standard color card to obtain first image data; preprocessing the first image data into second image data; The color value of each color sample in the second image data and the corresponding standard color value are fitted by using the least square method to obtain the initial color correction matrix.

3. The method according to claim 1, characterized in that The increment matrix is: Among them, when the incremental parameters include a red incremental parameter, R_E is the red incremental parameter, and when the incremental parameters do not include the red incremental parameter, R_E is 0; when the incremental parameters include a green incremental parameter, G_E is the green incremental parameter, and when the incremental parameters do not include the green incremental parameter, G_E is 0; when the incremental parameters include a blue incremental parameter, B_E is the blue incremental parameter, and when the incremental parameters do not include the blue incremental parameter, B_E is 0.

4. The method according to claim 1, characterized in that: The balance matrix is: Among them, when the balance parameters include a red balance parameter, R_E is the red balance parameter, and when the balance parameters do not include the red balance parameter, R_E is 0; when the balance parameters include a green balance parameter, G_E is the green balance parameter, and when the balance parameters do not include the green balance parameter, G_E is 0; when the balance parameters include a blue balance parameter, B_E is the blue balance parameter, and when the balance parameters do not include the blue balance parameter, B_E is 0.

5. The method according to claim 1, characterized in that Generating an optimized color correction matrix according to at least one of the incremental matrix and the balanced matrix and the initial color correction matrix, comprising: At least one of the incremental matrix and the balanced matrix is ​​added to the initial color correction matrix to obtain the optimized color correction matrix.

6. The method according to claim 1, characterized in that The tone optimization matrix is: When the matrix optimization parameters include the hue angle optimization parameter, θ is the hue angle optimization parameter; when the matrix optimization parameters do not include the hue angle optimization parameter, θ is 0.

7. The method according to claim 1, characterized in that The saturation optimization matrix is: When the matrix optimization parameters include the saturation optimization parameters, S is the saturation optimization parameter; when the matrix optimization parameters do not include the saturation optimization parameter, S is 1.

8. The method according to claim 2, characterized in that: After obtaining the optimized color correction matrix, the method further includes: Correcting the color value of each color sample in the second image data using the optimized color correction matrix to obtain third image data; Acquire the chromaticity value of each color sample in the third image data; The difference between the chromaticity value of each color sample in the third image data and the chromaticity value of the corresponding standard color value is output.

9. The method according to claim 8, characterized in that Outputting the difference between the chromaticity value of each color sample in the third image data and the chromaticity value of the corresponding standard color value includes: Adding the correction chromaticity points corresponding to the chromaticity values ​​of each color sample in the third image data and the standard chromaticity points corresponding to the chromaticity values ​​of each standard color value in the chromaticity coordinate system; Adding a connection line between each corrected chromaticity point and a corresponding standard chromaticity point in the chromaticity coordinate system to generate a difference comparison diagram; Output the difference comparison graph.

10. An image processing device, characterized in that: include: An acquisition unit, used to acquire an initial color correction matrix, where the initial color correction matrix is ​​a matrix used to calibrate each pixel value of the image to a corresponding value in a preset color space; a receiving unit, configured to receive matrix optimization parameters, wherein the matrix optimization parameters include: an incremental parameter and / or a balance parameter, wherein the incremental parameter includes: at least one of a red incremental parameter, a green incremental parameter, and a blue incremental parameter, and the balance parameter includes: at least one of a red balance parameter, a green balance parameter, and a blue balance parameter; and the matrix optimization parameters further include: a hue angle optimization parameter and / or a saturation optimization parameter; a generating unit, configured to generate an incremental matrix according to the incremental parameters and / or a balanced matrix according to the balanced parameters, and to generate a hue optimization matrix according to the hue angle optimization parameters and / or a saturation optimization matrix according to the saturation optimization parameters; A processing unit, configured to sequentially multiply the first matrix, at least one of the hue optimization matrix and the saturation optimization matrix, and the second matrix to obtain a third matrix; wherein the first matrix is ​​a matrix for converting a YUV color space into an RGB color space, and the second matrix is ​​a matrix for converting an RGB color space into a YUV color space; add at least one of the incremental matrix and the balance matrix to the initial color correction matrix to obtain a fourth matrix; and multiply the first matrix by the fourth matrix to obtain an optimized color correction matrix; The correction unit is used to correct the original image data according to the optimized color correction matrix to obtain a corrected image.

11. An electronic device, characterized in that: include: A memory and a processor, wherein the memory is used to store a computer program; and the processor is used to enable the electronic device to implement the image processing method according to any one of claims 1 to 9 when calling the computer program.

12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a computing device, the computing device implements the image processing method according to any one of claims 1 to 9.

13. A computer program product, characterized in that When the computer program product is executed on a computer, the computer is enabled to implement the image processing method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Method for correcting signal and circuit thereof as well as method for correcting image signal and circuit thereof

    CN101330564A

  • Image processing method and device and electronic device

    CN103647958A

  • Imaging equipment color correction method and device, electronic equipment and storage medium

    CN110830778A

  • Industrial camera color adjustment method

    CN110933386A

  • Color correction matrix adjusting method and device and storage medium

    CN111861922A