Image color correction method, device, computer device and storage medium
By identifying different color areas in the image and calculating the color correction matrix for each area, the problem of low color correction accuracy in the prior art is solved, and higher image color correction accuracy and authenticity are achieved, and the shooting effect is improved.
Patent Information
- Application Number
- CN202110859113.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-28
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2041-07-28
AI Technical Summary
In the prior art, the color correction matrix obtained based on the 24-color standard color card generally balances the camera RGB response value and the human eye response value, but there may be a problem of low color correction accuracy in local areas.
By identifying different color areas in the image to be processed, the RGB response value and the real perception value of the color block corresponding to each area are obtained, the color correction matrix for each color area is calculated, and local color correction is performed.
Improve the accuracy of image color correction, enhance the authenticity of image color, and thus improve the shooting effect.
Smart Images

Figure CN113628135B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to an image color correction method, device, computer device and storage medium. Background Art
[0002] The current mainstream camera image sensors use the Bayer array design, in which each pixel contains three photosensitive sub-pixels: red, green, and blue (RGB). Two of the sub-pixels are sensitive to green (G), and the other two are sensitive to red (R) and blue (B). 50% of the sub-pixels in this design correspond to the G channel, which is significant in that the G channel is similar to the brightness perception of the human eye, and the human eye has a higher resolution of brightness images than the color channels R and B. The spectral response of the RGB channel approximately simulates the sensitivity of the three types of cones on the human eye's retina to long, medium, and short wavelengths, that is, to red, green, and blue light, respectively, but this spectral response is still somewhat different from that of the human eye.
[0003] In the related art, by shooting a 24-color standard color card in a light box and finding a 3×3 color correction matrix (Color Correction Matrix, CCM), the RGB response value of the camera can be multiplied by the color correction matrix to be as close to the red, green and blue response of the human eye as possible. However, the color correction matrix is obtained based on the 24-color standard color card, which covers multiple colors such as red, green, blue, white and gray. Therefore, the obtained color correction matrix can only be balanced in general, so that the corrected color is generally close to the human eye, but there may be a problem of low color correction accuracy in local areas. Summary of the invention
[0004] The present invention aims to solve one of the technical problems in the related art at least to a certain extent. To this end, the first object of the present invention is to provide an image color correction method, which can effectively improve the accuracy of image color correction, enhance the authenticity of image color, and thus improve the shooting effect.
[0005] A second objective of the present invention is to provide an image color correction device.
[0006] A third objective of the present invention is to provide a computer device.
[0007] A fourth object of the present invention is to provide a computer-readable storage medium.
[0008] To achieve the above-mentioned purpose, the first aspect of the present invention proposes an image color correction method, comprising the following steps: identifying one or more first color blocks corresponding to a first color area in an image to be processed, the first color area being an area in the image to be processed that is in the same color gamut, and the first color block being a color block in a color card that is in the color gamut corresponding to the first color area; obtaining a color correction matrix for the first color area based on first RGB response values corresponding to the one or more first color blocks and real perception values of the human eye; and performing color correction on the first color area using the color correction matrix.
[0009] According to the image color correction method of the embodiment of the present invention, by identifying one or more first color blocks corresponding to the first color area in the image to be processed, the first color area is an area in the image to be processed that is in the same color gamut range, and the first color block is a color block in the color card that is in the color gamut range corresponding to the first color area, and by obtaining the color correction matrix of the first color area according to the first RGB response values corresponding to the one or more first color blocks and the real perception values of the human eye, and by using the color correction matrix to perform color correction on the first color area, the accuracy of image color correction can be effectively improved, the authenticity of image color can be enhanced, and the shooting effect can be improved.
[0010] According to one embodiment of the present invention, identifying one or more first color blocks corresponding to a first color area in an image to be processed includes: obtaining a second RGB response value corresponding to the first color area; respectively obtaining the difference between the second RGB response value and the first RGB response value corresponding to each color block in the color card; obtaining a color block whose difference is less than a first threshold, and obtaining one or more first color blocks corresponding to the first color area.
[0011] According to an embodiment of the present invention, respectively obtaining the difference between the second RGB response value and the first RGB response value corresponding to each color block in the color card includes: for the first RGB response value corresponding to each color block, correspondingly obtaining the absolute values of the difference between the R value, G value, and B value in the second RGB response value and the R value, G value, and B value in the first RGB response value; and summing the absolute values of the difference to obtain the difference between the second RGB response value and the first RGB response value.
[0012] According to one embodiment of the present invention, a color correction matrix of a first color area is obtained according to first RGB response values corresponding to one or more first color blocks and real perception values of the human eye, including: according to first RGB response values corresponding to one or more first color blocks and real perception values of the human eye, a least squares method is used to calculate the color correction matrix of the first color area.
[0013] According to one embodiment of the present invention, the database stores the first RGB response value and the real human eye perception value corresponding to each color block in the color card, wherein the first RGB response value is obtained in advance by photographing the color card, and the real human eye perception value is obtained in advance by measuring with a colorimeter.
[0014] According to one embodiment of the present invention, before using the color correction matrix to perform color correction on the first color area, it also includes: obtaining a first color temperature value of the image to be processed and a second color temperature value of the color card; and correcting the color correction matrix of the first color area according to the difference between the first color temperature value and the second color temperature value.
[0015] According to an embodiment of the present invention, obtaining a first color temperature value of an image to be processed includes: obtaining pixel values of the image to be processed; and performing color temperature calculation according to the pixel values to obtain the first color temperature value of the image to be processed.
[0016] To achieve the above-mentioned purpose, the second aspect of the present invention proposes an image color correction device, including: an identification module, used to identify one or more first color blocks corresponding to a first color area in an image to be processed, the first color area is an area in the image to be processed that is in the same color gamut range, and the first color block is a color block in a color card that is in the color gamut range corresponding to the first color area; a color correction module, used to obtain a color correction matrix of the first color area according to first RGB response values corresponding to the one or more first color blocks and real perception values of the human eye, and use the color correction matrix to perform color correction on the first color area.
[0017] According to the image color correction device of the embodiment of the present invention, one or more first color blocks corresponding to the first color area in the image to be processed are identified by the recognition module, the first color area is an area in the image to be processed that is in the same color gamut range, and the first color block is a color block in the color card that is in the color gamut range corresponding to the first color area. The color correction module obtains the color correction matrix of the first color area according to the first RGB response values corresponding to the one or more first color blocks and the real perception value of the human eye, and uses the color correction matrix to perform color correction on the first color area, thereby effectively improving the accuracy of image color correction, enhancing the authenticity of image color, and thus improving the shooting effect.
[0018] To achieve the above objectives, a third aspect of the present invention provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above image color correction method when executing the computer program.
[0019] According to the computer device of the embodiment of the present invention, a computer program is stored in the memory, and the steps of the above-mentioned image color correction method are implemented when the processor executes the computer program, which can effectively improve the accuracy of image color correction, enhance the authenticity of image color, and thus improve the shooting effect.
[0020] To achieve the above-mentioned purpose, a fourth aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, which implements the steps of the above-mentioned image color correction method when executed by a processor.
[0021] The computer-readable storage medium according to the embodiment of the present invention stores a computer program, and when the computer program is executed by the processor, the steps of the above-mentioned image color correction method are implemented, which can effectively improve the accuracy of image color correction, enhance the authenticity of image color, and thus improve the shooting effect.
[0022] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1a is a spectral response curve diagram of the R channel of the image sensor and the CIE1931 tristimulus value X in the related art;
[0024] Figure 1b is a spectral response curve diagram of the G channel of the image sensor and the CIE1931 tristimulus value Y in the related art;
[0025] Figure 1c is a spectral response curve diagram of the B channel of the image sensor and the CIE1931 tristimulus value Z in the related art;
[0026] Figure 2 is a flow chart of an image color correction method according to an embodiment of the present invention;
[0027] Figure 3 is a structural block diagram of an image color correction device according to an embodiment of the present invention;
[0028] Figure 4 FIG. 4 is a structural block diagram of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0029] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present invention, and should not be construed as limiting the present invention.
[0030] It should be noted that there are three types of cones on the human retina, which are sensitive to long, medium and short wavelengths, that is, red, green and blue light respectively. Correspondingly, the image sensor using the Bayer array design in the camera includes three channels of red, green and blue, namely RGB channels. The spectral response of the RGB channels of the image sensor is close to that of the human eye, but there are still significant differences compared to the real perception of the human eye.
[0031] For example, the CIE1931 colorimetric system established by CIE (International Commission on Illumination) is generally used in the technical field as a standard measurement system for defining color space. In the CIE1931 colorimetric system, when the color match is achieved with the light to be measured, the amount of stimulation of the three primary colors of red, green and blue to the human eye is the CIE1931 tristimulus value, which is represented by X (the amount of stimulation of the red primary color), Y (the amount of stimulation of the green primary color) and Z (the amount of stimulation of the blue primary color). The following uses the CIE1931 tristimulus value XYZ to illustrate the spectral response of the human eye at a 2-degree observation angle. Figure 1a-Figure 1c The spectral response of a typical image sensor RGB channel and the human eye in the long, medium and short wavelength bands is compared, where Figure 1a It is the spectral response curve of the image sensor R channel (dashed line) and the CIE1931 tristimulus value X (solid line). Figure 1b It is the spectral response curve of the image sensor G channel (dashed line) and the CIE1931 tristimulus value Y (solid line). Figure 1c : is the spectral response curve of the image sensor B channel (dashed line) and the CIE1931 tristimulus value Z (solid line).
[0032] from Figure 1a-Figure 1c It can be seen that there is a deviation between the spectral response of the image sensor RGB channels and the human eye in the long, medium and short wave bands.
[0033] In the related art, the above deviation is corrected by a color correction matrix. The specific correction process is: first, a 24-color standard color card is photographed at a certain color temperature to obtain the 24-color RGB information of the camera, and a colorimeter is used to measure and obtain 24 groups of CIE1931 XYZ tristimulus values of the 24-color standard color card, and then the color correction matrix is calculated by the following formula:
[0034]
[0035] Among them, X1, X2, ..., X 24 The CIE1931 tristimulus values X corresponding to 24 colors; Y1, Y2, ..., Y 24 is the CIE1931 tristimulus value Y corresponding to 24 colors; Z1, Z2, ..., Z 24is the CIE1931 tristimulus value Z corresponding to 24 colors; a 11 、a 12 ,……,a 33 Construct a color correction matrix; R1, R2, ..., R 24 is the camera R response value corresponding to 24 colors; G1, G2, ..., G 24 is the camera G response value corresponding to 24 colors; B1, B2, ..., B 24 is the camera B response value corresponding to 24 colors.
[0036] In subsequent image processing, the color correction matrix is used to perform color correction on the image to be processed, that is, color correction is performed according to the following formula:
[0037]
[0038] Among them, X, Y, and Z are the CIE1931 tristimulus values corresponding to red, green, and blue of a color in the image to be processed, and R, G, and B are the camera RGB response values corresponding to the corresponding colors. It can be seen from the calculation formula of the above color correction matrix that the acquisition of the color correction matrix is closely related to the selection of the color card. In the related art, since the color correction matrix is obtained based on the 24-color standard color card, the color correction matrix is the optimal solution obtained by comprehensively considering the 24 colors, so that various colors are closer to the perception of the human eye, but this is not the optimal solution for each color, so it will lead to low accuracy of local image color correction. For example, the color correction matrix can make the response of the R channel of the camera closer to the true value, but the response of the B channel will deviate from the true value, and the authenticity of the image color is poor, so that the shooting effect cannot meet the increasingly high shooting requirements of customers. Based on this, the present application provides an image color correction method, which can effectively improve the accuracy of image color correction, enhance the authenticity of image color, and thus improve the shooting effect.
[0039] Figure 2 is a flowchart of an image color correction method according to an embodiment of the present invention, referring to Figure 2 As shown, the image color correction method may include the following steps:
[0040] Step S101: Identify one or more first color blocks corresponding to a first color region in an image to be processed, where the first color region is a region in the same color gamut in the image to be processed, and the first color block is a color block in a color card that is in the color gamut corresponding to the first color region.
[0041] Specifically, for different color areas, if a unified, fuzzy color correction matrix is used, there is an inevitable deviation between the correction result and the real perception value of the human eye in each color area. Therefore, in order to improve the accuracy of image color correction, this application will perform targeted color correction on different color areas in the image. Specifically, after shooting the image, the image is segmented according to the color of the image to obtain multiple color areas, and the color blocks within the color gamut corresponding to the different color areas are identified to perform different corrections on different color areas. Among them, the color gamut range refers to the range area composed of colors that can be expressed by a certain color representation mode (such as a camera). In a specific example, the same color gamut range can be expressed as (R0±ΔR, G0±ΔG, B0±ΔB), where R0, G0, B0 are RGB response values of a specific color (which can be a common color or a color on a color card), and ±ΔR, ±ΔG, ±ΔB are the range of changes in the corresponding RGB response values in the color gamut range.
[0042] For one color region, namely the first color region, the color block within the color gamut corresponding to it is the first color block. It is understandable that the first color region may correspond to only one first color block or may correspond to multiple first color blocks.
[0043] It should be noted that the first color block may be a color block in a color card. Before identifying one or more first color blocks corresponding to the first color region, a color card may be established first. Specifically, all colors in the color database may be projected into a uniform color space, such as a CIE-Lab (Commission International Eclairage-Lab) color space, and then uniform color sampling may be performed and made into a color card. The specific colors may be as shown in Table 1.
[0044]
[0045]
[0046] Table 1
[0047] It should be pointed out that in order to obtain a color card with more comprehensive color coverage, the above color sampling can be a large number of samples, for example, the sampling amount can be 140 kinds, that is, the color card made is a 140-color color card including 140 color blocks. Since the color card has a sufficient number of colors, it is closer to the actual color of the photo, which is conducive to improving the color correction effect of the color correction matrix. After the color card is established, one or more first color blocks corresponding to the first color area in the color card are identified as the color source object for establishing the color correction matrix of the first color area, so as to achieve the optimal solution for each color domain by finely refining the color correction matrix of the image to be processed, thereby effectively improving the accuracy of image color correction.
[0048] Step S102: acquiring a color correction matrix of a first color area according to first RGB response values respectively corresponding to one or more first color blocks and actual perception values of human eyes.
[0049] It should be noted that the first RGB response value and the real human eye perception value corresponding to each color block in the color card can be stored in a database, wherein the first RGB response value can be obtained in advance by taking a photo of the color card, and the real human eye perception value can be obtained in advance by measuring with a colorimeter.
[0050] Among them, for the first RGB response value of each color block, since different cameras usually have different RGB responses to colors, when performing image color correction, it is necessary to first obtain the first RGB response value of each color block in a given color card of the camera used. In a specific example, the color card can be photographed by a camera at a certain color temperature to obtain a color card image of the camera, and then the color card image is analyzed to obtain the first RGB response value of each color block in the color card.
[0051] For the real perception value of human eyes, when correcting the image color, it is necessary to obtain the real perception value of human eyes for each color block in the color card, and use it as the basis for image color correction. Specifically, the three-color stimulus value of each color block in the color card can be measured by a colorimeter, and the three-color stimulus value is the real perception value of human eyes for each color block in the color card.
[0052] In one embodiment, according to the first RGB response values corresponding to one or more first color blocks and the real perception values of the human eye, a color correction matrix of the first color area is obtained, including: according to the first RGB response values corresponding to one or more first color blocks and the real perception values of the human eye, a least squares method is used to calculate the color correction matrix of the first color area.
[0053] Specifically, for the first color region, after determining the first color block within its color gamut, a set of equations for a color correction matrix for the first color region can be established based on the first RGB response value of the first color block and the actual human eye perception value, and the color correction matrix for the first color region can be obtained by solving the set of equations. It can be understood that the method for obtaining the color correction matrix for the first color region based on the first RGB response value and the actual human eye perception value can use the least squares method or the three-dimensional lookup table (3D-LUT, 3Dimensional Lookup Table) method.
[0054] As a specific example, for the first color area, n first color blocks are obtained according to the above method. The first RGB response values of the n first color blocks are respectively (R1, G1, B1), (R2, G2, B2), ..., (R n ,Gn ,B n ), the corresponding real perception values of the human eye are (X1, Y1, Z1), (X2, Y2, Z2), ..., (X n ,Y n ,Z n ), establish the equation system for the color correction matrix of the first color region:
[0055]
[0056] Then, the least square method is preferably used to solve the equation system b ij , the color correction matrix b of the first color region can be obtained ij .
[0057] Step S103: performing color correction on the first color region using a color correction matrix.
[0058] Specifically, for the first color region, after obtaining its color correction matrix through the above steps, color correction can be performed according to the following formula:
[0059]
[0060] Among them, X', Y', and Z' are the CIE1931 tristimulus values corresponding to the first color block in the first color area and red, green, and blue, respectively, and R', G', and B' are the corresponding first RGB response values, respectively. 11 , b 12 ,……,b 33 The color correction matrix is formed. This formula is obtained by multiplying the color correction matrix of the first color area with the first RGB response value (R', G', B') of the first color block in the first color area (which can be obtained by the image sensor) to obtain the corresponding real human eye perception value (X', Y', Z'), thereby achieving accurate color correction for the first color area.
[0061] It can be seen that, through the above method, accurate color correction of one or more color regions can be achieved, thereby effectively improving the accuracy of image color correction, enhancing the authenticity of image colors, and further improving the shooting effect.
[0062] In one embodiment, identifying one or more first color blocks corresponding to a first color area in an image to be processed includes: obtaining a second RGB response value corresponding to the first color area; respectively obtaining the difference between the second RGB response value and the first RGB response value corresponding to each color block in the color card; obtaining a color block whose difference is less than a first threshold, and obtaining one or more first color blocks corresponding to the first color area.
[0063] Specifically, as the color source object for establishing the color correction matrix, the closer each color block obtained from the color card is to the color of the first color area, the better the color correction effect of the first color area is, and the RGB response value is a quantitative expression of the image color, so the closer the first color block is to the color of the first color area, the closer the RGB response values of the two are. In other words, the closer the first RGB response value of each color block obtained from the color card is to the second RGB response value of the first color area, the more ideal the color correction matrix is, that is, when the difference between the first RGB response value and the second RGB response value is small enough (less than the first threshold), the color block can be considered to be the first color block corresponding to the first color area.
[0064] Optionally, respectively obtaining the difference between the second RGB response value and the first RGB response value corresponding to each color block in the color card includes: for the first RGB response value corresponding to each color block, correspondingly obtaining the absolute values of the difference between the R value, G value, and B value in the second RGB response value and the R value, G value, and B value in the first RGB response value; and summing the absolute values of the differences to obtain the difference between the second RGB response value and the first RGB response value.
[0065] Specifically, when obtaining the difference P between the second RGB response value of the first color area and the first RGB response value corresponding to each color block, it is preferably expressed as: the R response value R0, the G response value G0 and the B response value B0 of the first color area and the R response value R0 of each color block i , G response value G i and B response value B i The sum of the absolute values of the corresponding differences between i -R0|+|G i -G0|+|B i -B0|, since the R response value, G response value and B response value are three dimensions of the RGB response value, the numerical value of the above difference P can be used to describe the proximity between the first RGB response value of each color block and the second RGB response value of the first color area, that is, the smaller the numerical value of the difference P, the closer the color block is to the second RGB response value of the first color area. When the difference P is less than the first threshold, the color block can be identified as the first color block corresponding to the first color area.
[0066] In one embodiment, before using the color correction matrix to perform color correction on the first color area, it also includes: obtaining a first color temperature value of the image to be processed and a second color temperature value of the color card; and correcting the color correction matrix of the first color area according to the difference between the first color temperature value and the second color temperature value.
[0067] Optionally, obtaining a first color temperature value of the image to be processed includes: obtaining pixel values of the image to be processed; and performing color temperature calculation according to the pixel values to obtain the first color temperature value of the image to be processed.
[0068] Specifically, the first color temperature value of the image to be processed and the second color temperature value of the color card are often difficult to be completely consistent, and the difference between the two will directly affect the accuracy of the color correction matrix, thereby affecting the effect of image color correction. Therefore, it is preferred to correct the color correction matrix of the first color area according to the color temperature difference between the two. As a specific example, the pixel value of the image to be processed can be obtained first, and the color temperature can be estimated according to the pixel value to obtain the first color temperature value of the image, and then the color correction matrix of the first color area can be corrected according to the color temperature difference between the first color temperature value of the image and the second color temperature value of the color card (known at the time of shooting), so as to effectively avoid the influence of the color temperature difference between the image to be processed and the color card on the image color correction.
[0069] In a specific embodiment, a 140-color color chart is photographed at a certain color temperature, and the first RGB response values of the 140 colors are obtained, and then a colorimeter is used to measure 140 groups of CIE1931 XYZ tristimulus values of the 140-color color chart. Thereafter, the image to be processed is divided into a plurality of first color regions according to different color gamut ranges. For each first color region, a plurality of corresponding first color blocks in the color chart are identified respectively, and a set of equations is established for the plurality of first color blocks according to formula (3), and the least squares method is used to solve b ij , to obtain the corresponding color correction matrix; then for each first color area, correction is performed using formula (4) according to the corresponding color correction matrix.
[0070] In another specific embodiment, the image to be processed includes a skin color area of a portrait face, a black area of hair, and a blue area of the sky. These three color areas can be considered as three first color areas. When performing image color correction, for the skin color area, multiple skin color blocks corresponding to the skin color area in the color card are identified, and a set of equations is established for the multiple skin color blocks according to formula (3), and bij is solved by the least square method to obtain the corresponding skin color correction matrix, and then the skin color area is corrected according to the above skin color correction matrix using formula (4). For the black area and the blue area in the image, the color correction method for the two is the same as that for the skin color area, which will not be repeated here.
[0071] In summary, according to the image color correction method of an embodiment of the present invention, by identifying one or more first color blocks corresponding to the first color area in the image to be processed, the first color area is an area in the image to be processed that is in the same color gamut range, and the first color block is a color block in the color card that is in the color gamut range corresponding to the first color area, and by obtaining the color correction matrix of the first color area according to the first RGB response values corresponding to the one or more first color blocks and the real perception values of the human eye, and by using the color correction matrix to perform color correction on the first color area, the accuracy of image color correction can be effectively improved, the authenticity of image color can be enhanced, and the shooting effect can be improved.
[0072] Figure 3 FIG. 1 is a structural block diagram of an image color correction device according to an embodiment of the present invention. Figure 3 As shown, the image color correction device 200 includes: a recognition module 201 and a color correction module 202 .
[0073] Among them, the identification module 201 is used to identify one or more first color blocks corresponding to the first color area in the image to be processed, the first color area is an area in the image to be processed that is in the same color gamut range, and the first color block is a color block in the color card that is in the color gamut range corresponding to the first color area; the color correction module 202 is used to obtain the color correction matrix of the first color area according to the first RGB response values corresponding to the one or more first color blocks and the real perception value of the human eye, and use the color correction matrix to perform color correction on the first color area.
[0074] In one embodiment, the identification module 201 is used to: obtain a second RGB response value corresponding to the first color area; respectively obtain the difference between the second RGB response value and the first RGB response value corresponding to each color block in the color card; obtain the color block whose difference is less than the first threshold value, and obtain one or more first color blocks corresponding to the first color area.
[0075] Further, the identification module 201 is specifically used to: respectively obtain the difference between the second RGB response value and the first RGB response value corresponding to each color block in the color card, including: for the first RGB response value corresponding to each color block, correspondingly obtaining the absolute values of the differences between the R value, G value, and B value in the second RGB response value and the R value, G value, and B value in the first RGB response value; summing the absolute values of the differences to obtain the difference between the second RGB response value and the first RGB response value.
[0076] In one embodiment, the color correction module 202 is specifically used to: obtain a color correction matrix of the first color area by using the least square method according to the first RGB response values corresponding to one or more first color blocks and the real perception values of human eyes.
[0077] In one embodiment, the database stores the first RGB response value and the real human eye perception value corresponding to each color block in the color card, wherein the first RGB response value is obtained in advance by photographing the color card, and the real human eye perception value is obtained in advance by measuring with a colorimeter.
[0078] In one embodiment, before using the color correction matrix to perform color correction on the first color area, the color correction module 202 is also used to: obtain a first color temperature value of the image to be processed and a second color temperature value of the color card; and modify the color correction matrix of the first color area according to the difference between the first color temperature value and the second color temperature value.
[0079] Furthermore, the color correction module 202 is specifically used to: obtain pixel values of the image to be processed; and perform color temperature calculation according to the pixel values to obtain a first color temperature value of the image to be processed.
[0080] It should be noted that, for the description of the image color correction device in the present application, please refer to the description of the image color correction method in the present application, and the details will not be repeated here.
[0081] According to the image color correction device of the embodiment of the present invention, one or more first color blocks corresponding to the first color area in the image to be processed are identified by the recognition module, the first color area is an area in the image to be processed that is in the same color gamut range, and the first color block is a color block in the color card that is in the color gamut range corresponding to the first color area. The color correction module obtains the color correction matrix of the first color area according to the first RGB response values corresponding to the one or more first color blocks and the real perception value of the human eye, and uses the color correction matrix to perform color correction on the first color area, thereby effectively improving the accuracy of image color correction, enhancing the authenticity of image color, and thus improving the shooting effect.
[0082] Figure 4 FIG. 1 is a block diagram of a computer device according to an embodiment of the present invention. Figure 4 As shown, the computer device 300 includes a memory 301 and a processor 302, wherein the memory 301 stores a computer program, and the processor 302 implements the steps of the above-mentioned image color correction method when executing the computer program.
[0083] According to the computer device of the embodiment of the present invention, a computer program is stored in the memory, and the steps of the above-mentioned image color correction method are implemented when the processor executes the computer program, which can effectively improve the accuracy of color correction of the image to be processed, enhance the authenticity of the image color, and thus improve the shooting effect.
[0084] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned image color correction method are implemented.
[0085] The computer-readable storage medium according to the embodiment of the present invention stores a computer program, and when the computer program is executed by the processor, the steps of the above-mentioned image color correction method are implemented, which can effectively improve the accuracy of image color correction, enhance the authenticity of image color, and thus improve the shooting effect.
[0086] It should be noted that the logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be specifically implemented in any computer-readable storage medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purposes of this specification, a "computer-readable storage medium" can be any device that stores programs for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples (non-exhaustive list) of computer-readable storage media include the following: portable computer disk cartridges (magnetic devices), random access memory (RAM), read-only memory (ROM), erasable and programmable read-only memory (EPROM or flash memory), and portable compact disk read-only memory (CDROM). In addition, the computer-readable storage medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing in other suitable ways if necessary, and then stored in a computer memory.
[0087] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, a plurality of steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0088] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0089] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of the present invention, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0090] In the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", "fixed" and the like should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, it can be the internal connection of two elements or the interaction relationship between two elements, unless otherwise clearly defined. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0091] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may change, modify, replace and vary the above embodiments within the scope of the present invention.
Claims
1. A method for image color correction, characterized in that: The following steps are involved: Segmenting the image to be processed according to the color of the image to be processed to obtain multiple color regions; Identify one or more first color blocks corresponding to a first color region in the image to be processed, wherein the first color region is a region in the image to be processed that is in the same color gamut, and the first color block is a color block in a color card that is in the color gamut corresponding to the first color region; Acquire a color correction matrix of the first color area according to first RGB response values and real human eye perception values respectively corresponding to the one or more first color blocks; Performing color correction on the first color area using the color correction matrix; Identifying one or more first color blocks corresponding to a first color area in an image to be processed includes: Obtaining a second RGB response value corresponding to the first color area; Respectively obtaining the difference between the second RGB response value and the first RGB response value corresponding to each color block in the color card; The color blocks whose difference is less than the first threshold are obtained to obtain one or more first color blocks corresponding to the first color area.
2. The image color correction method according to claim 1, characterized in that: The respectively obtaining the difference between the second RGB response value and the first RGB response value corresponding to each color block in the color card includes: For each color block corresponding to the first RGB response value, obtain the absolute value of the difference between the R value, G value, and B value in the second RGB response value and the R value, G value, and B value in the first RGB response value; The absolute values of the differences are summed to obtain the difference between the second RGB response value and the first RGB response value.
3. The image color correction method according to any one of claims 1 to 2, characterized in that: The step of acquiring the color correction matrix of the first color area according to the first RGB response values respectively corresponding to the one or more first color blocks and the real perception values of the human eye includes: According to the first RGB response values respectively corresponding to the one or more first color blocks and the real perception values of the human eye, a color correction matrix of the first color area is obtained by calculating using the least square method.
4. The image color correction method according to claim 3, characterized in that: The database stores the first RGB response value and the real human eye perception value corresponding to each color block in the color card, wherein the first RGB response value is obtained in advance by photographing the color card, and the real human eye perception value is obtained in advance by measuring with a colorimeter.
5. The image color correction method according to claim 1, characterized in that: Before performing color correction on the first color area using the color correction matrix, the method further includes: Acquire a first color temperature value of the image to be processed and a second color temperature value of the color card; The color correction matrix of the first color area is corrected according to the difference between the first color temperature value and the second color temperature value.
6. The image color correction method according to claim 5, characterized in that: The obtaining of the first color temperature value of the image to be processed includes: Obtaining pixel values of the image to be processed; Color temperature calculation is performed according to the pixel value to obtain a first color temperature value of the image to be processed.
7. An image color correction device, characterized in that: include: An identification module, used to identify one or more first color blocks corresponding to a first color region in an image to be processed, wherein the first color region is a region in the image to be processed that is in the same color gamut, and the first color block is a color block in a color card that is in the color gamut corresponding to the first color region; A color correction module, configured to obtain a color correction matrix of the first color area according to first RGB response values respectively corresponding to the one or more first color blocks and real perception values of human eyes, and perform color correction on the first color area using the color correction matrix; The device is further used to: segment the image to be processed according to the color of the image to be processed to obtain multiple color regions; The recognition module is used to: obtain a second RGB response value corresponding to the first color area; and respectively obtain the difference between the second RGB response value and the first RGB response value corresponding to each color block in the color card; The color blocks whose difference is less than the first threshold are obtained to obtain one or more first color blocks corresponding to the first color area.
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, the steps of the image color correction method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the image color correction method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Image color correction method, apparatus and system
CN108712639A