Image color adjustment method, device, electronic device and storage medium
By segmenting the image into sub-images and comparing the HSV parameters, determining the reference HSV parameters to generate a color correction matrix, the problem of inconsistent color display of wide dynamic images is solved, and the consistent display of image colors is achieved.
Patent Information
- Application Number
- CN202210787728.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-06
- Publication Date
- 2025-08-08
- Estimated Expiration
- 2042-07-06
AI Technical Summary
In the prior art, the color display quality of wide dynamic images is low. When the existing CCM matrix is calibrated linearly and directly applied to wide dynamic images, it leads to differences in brightness or brightness, affecting the consistency of image color display.
The image to be processed is divided into multiple sub-images, the current HSV parameters of each sub-image are obtained, the reference HSV parameters are compared with the standard HSV parameters, the color correction matrix is determined based on the reference HSV parameters, and the color correction matrix is adjusted through the color correction matrix to ensure that the image color is displayed with the standard HSV parameters.
The quality of wide dynamic image color display is improved, ensuring the consistency of video image color display under real wide dynamics.
Smart Images

Figure CN115358935B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to an image color adjustment method, device, electronic device and storage medium. Background Art
[0002] With the development of security technology, video image quality is increasingly being improved. Color, as the most crucial component of image quality, often becomes the primary metric for users when evaluating videos, reflecting its stylistic characteristics. To ensure that video images more closely resemble the physical world as seen by the human eye, technicians in related fields typically use a color correction matrix (CCM) to adjust the color of images captured by the device.
[0003] In existing technology, a set of target CCM matrices is typically pre-calibrated within the device at high, medium, and low color temperatures. When used in real time, the device uses an algorithm to estimate the color temperature of the current monitoring image and then selects the corresponding CCM matrix based on the current color temperature, ensuring a consistent color style across the display. However, CCM matrices are often calibrated using a linear method. Directly applying this linearly calibrated CCM matrix to wide dynamic range (WDR) images can introduce color variations in brightness or luminance. This results in inconsistent color presentation for images with a true WDR, impacting the image's color quality.
[0004] With respect to the problem of low color display quality of wide dynamic image in related technologies, no effective solution has been proposed so far. Summary of the Invention
[0005] In this embodiment, an image color adjustment method, device, electronic device, and storage medium are provided to solve the problem of low color display quality of wide dynamic image in the related art.
[0006] In a first aspect, an image color adjustment method is provided in this embodiment, which is applied to wide dynamic range images. The method includes:
[0007] Divide the image to be processed into multiple sub-images;
[0008] Obtain the current HSV parameters of each of the sub-images;
[0009] Comparing each of the current HSV parameters with a standard HSV parameter to determine a reference HSV parameter, wherein the reference HSV parameter is a standard HSV parameter having a parameter ratio closest to that of the current HSV parameter;
[0010] A color correction matrix is determined based on the reference HSV parameters, and color adjustment is performed on the image to be processed based on the color correction matrix.
[0011] In some embodiments, before comparing each of the current HSV parameters with the standard HSV parameters, the method further includes:
[0012] Determining a color temperature corresponding to the image to be processed;
[0013] The standard HSV parameters are determined based on the color temperature.
[0014] In some embodiments, determining a color correction matrix based on the reference HSV parameters includes:
[0015] determining a compensation coefficient based on the reference HSV parameter;
[0016] The color correction matrix of the image to be processed is determined based on the compensation coefficients and an initial color correction matrix.
[0017] In some embodiments, determining the compensation coefficient based on the reference HSV parameter includes:
[0018] The compensation coefficient is determined based on a V component parameter of the reference HSV parameter and a V component parameter of the current HSV parameter.
[0019] In some embodiments, determining the color correction matrix of the image to be processed based on the compensation coefficient and an initial color correction matrix includes:
[0020] determining current RGB parameters of a plurality of said sub-images;
[0021] Determine a compensation matrix based on the compensation coefficient and the current RGB parameters;
[0022] The color correction matrix of the image to be processed is determined based on the compensation matrix and the initial color correction matrix.
[0023] In some embodiments, determining a compensation matrix based on the compensation coefficients and the current RGB parameters includes:
[0024] Compensating each channel value of the current RGB parameter based on the compensation coefficient to obtain a compensated RGB parameter;
[0025] The compensation matrix is determined based on the compensated RGB parameters and the current RGB parameters.
[0026] In some embodiments, the color adjustment of the image to be processed based on the color correction matrix includes:
[0027] performing normalization processing on the color correction matrix;
[0028] Performing color adjustment on the image to be processed based on the normalized color correction matrix.
[0029] In a second aspect, an image color adjustment device is provided in this embodiment for adjusting the color of a wide dynamic range image, comprising:
[0030] An image segmentation module, used for segmenting the image to be processed into multiple sub-images;
[0031] An acquisition module, configured to acquire the current HSV parameters of each sub-image;
[0032] a determination module, configured to compare each of the current HSV parameters with a standard HSV parameter to determine a reference HSV parameter, wherein the reference HSV parameter is a standard HSV parameter having a parameter ratio closest to that of the current HSV parameter;
[0033] The color adjustment module is configured to determine a color correction matrix based on the reference HSV parameters, and perform color adjustment on the image to be processed based on the color correction matrix.
[0034] In a third aspect, an electronic device is provided in this embodiment, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the image color adjustment method described in the first aspect when executing the computer program.
[0035] In a fourth aspect, a storage medium is provided in this embodiment, on which a computer program is stored. When the program is executed by a processor, the image color adjustment method described in the first aspect is implemented.
[0036] Compared with the related art, the image color adjustment method provided in this embodiment divides the image to be processed into multiple sub-images and obtains the current HSV parameters of each sub-image. Further, each current HSV parameter is compared with the standard HSV parameter to determine the reference HSV parameter. The reference HSV parameter is the standard HSV parameter whose parameter ratio is closest to the parameter ratio of the current HSV parameter. Then, a color correction matrix is determined based on the reference HSV parameter, and the color of the image to be processed is adjusted based on the color correction matrix, so that the color of the image to be processed is adjusted with the standard HSV parameter, so that the color of the image under wide dynamic range is displayed with the standard color, thereby improving the quality of image color display.
[0037] The details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0039] Figure 1 This is a hardware structure block diagram of a terminal for an image color adjustment method provided in an embodiment of the present application.
[0040] Figure 2 This is a flowchart of an image color adjustment method provided in an embodiment of the present application.
[0041] Figure 3 This is a schematic diagram of current HSV parameters of all sub-images provided in an embodiment of the present application.
[0042] Figure 4 It is a schematic diagram of a standard HSV parameter provided in an embodiment of the present application.
[0043] Figure 5 This is a schematic diagram of a reference HSV parameter provided in an embodiment of the present application.
[0044] Figure 6 This is a flow chart of an embodiment of an image color adjustment method provided in an embodiment of the present application.
[0045] Figure 7 This is a structural block diagram of an image color adjustment device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0046] In order to more clearly understand the purpose, technical solutions and advantages of the present application, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments.
[0047] Unless otherwise defined, the technical terms or scientific terms involved in this application should have the general meaning understood by people with ordinary skills in the technical field to which this application belongs. The words "one", "an", "a", "the", "these" and the like in this application do not indicate quantitative restrictions, and they can be singular or plural. The terms "include", "comprise", "have" and any variants thereof involved in this application are intended to cover non-exclusive inclusions; for example, a process, method and system, product or device comprising a series of steps or modules (units) is not limited to the listed steps or modules (units), but may include unlisted steps or modules (units), or may include other steps or modules (units) inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The "plurality" involved in this application refers to two or more. "And / or" describes the relationship between related objects, indicating that three possible relationships exist. For example, "A and / or B" can represent: A exists alone, A and B exist simultaneously, and B exists alone. Generally, the character " / " indicates that the related objects are in an "or" relationship. The terms "first," "second," "third," etc. used in this application are only used to distinguish similar objects and do not represent a specific ordering of the objects.
[0048] The method embodiment provided in this embodiment can be executed in a terminal, a computer or a similar computing device. For example, running on a terminal, Figure 1 This is a hardware structure diagram of a terminal of an image color adjustment method provided in an embodiment of the present application. Figure 1 As shown, the terminal may include one or more ( Figure 1 The terminal may further include a transmission device 106 and an input / output device 108 for communication functions. As will be appreciated by those skilled in the art, Figure 1 The structure shown is only for illustration and does not limit the structure of the above terminal. Figure 1 More or fewer components than shown, or with Figure 1 Different configurations shown.
[0049] Memory 104 can be used to store computer programs, such as software programs and modules of application software, such as the computer program corresponding to the image color adjustment method in this embodiment. Processor 102 executes the computer programs stored in memory 104 to execute various functional applications and data processing, thereby implementing the above-mentioned method. Memory 104 may include high-speed random access memory (RAM) and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some embodiments, memory 104 may further include memory remotely located relative to processor 102, and such remote memory may be connected to the terminal via a network. Examples of such networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0050] Transmission device 106 is used to receive or transmit data via a network. This network may include a wireless network provided by the terminal's communications provider. In one embodiment, transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In one embodiment, transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0051] With the development of security technology, video image quality is increasingly being improved. Color, as the most crucial component of image quality, often becomes the primary metric when users evaluate videos, reflecting its stylistic characteristics. To ensure that video images more closely resemble the physical world as seen by the human eye, technicians in this field typically use a CCM matrix to adjust the color of images captured by the device.
[0052] In existing technology, a set of target CCM matrices is typically pre-calibrated in the device at high, medium, and low color temperatures. When used in real time, the device uses an algorithm to estimate the color temperature of the current monitoring image. Then, the device selects the corresponding CCM matrix based on the current color temperature to ensure a consistent color style across the image displayed on the display device. However, CCM matrices are often calibrated under a linear condition. Directly applying a linearly calibrated CCM matrix to a wide dynamic range image can result in differences in color brightness or luminance. Because the dynamic range strength used under a linear condition differs from that used under a wide dynamic range, applying a linear CCM matrix directly to a wide dynamic range image can result in inconsistent color display across the wide dynamic range image, impacting the quality of the image's color display.
[0053] Therefore, how to improve the quality of image color display under wide dynamic range is a problem that needs to be solved.
[0054] The present invention provides a method for adjusting image color. Figure 2 This is a flow chart of an image color adjustment method provided by an embodiment of the present application. The method execution subject of the embodiment of the present application may be an electronic device. Specifically, the electronic device may be a terminal device, a server, or a driver, and there is no limitation here. Figure 2 As shown, the process includes the following steps:
[0055] Step S201: dividing the image to be processed into multiple sub-images.
[0056] Exemplarily, the image to be processed is a video image captured by an image capture device, and the electronic device divides the image to be processed into N sub-images, where N is greater than or equal to 2, and N=m*n.
[0057] It should be noted that m*n in the embodiment of the present application can be 16*16 or 32*32. In practical applications, m*n can be configured according to actual needs and is not limited here.
[0058] Step S202: Obtain the current HSV parameters of each sub-image.
[0059] Furthermore, the HSV parameters of all sub-images are obtained.
[0060] Specifically, obtain the parameters of all sub-images in the RGB space, recorded as RGB_S(3,N), where RGB_S(3,N) represents an array of 3 rows and N columns. The first row represents the R channel value, the second row represents the G channel value, the third row represents the B channel value, and the N columns represent the parameter values of the N sub-images in the R, G, and B channels respectively.
[0061] Furthermore, the parameters of all sub-images in the RGB space are converted to the HSV space to obtain the HSV parameters of all sub-images, which are recorded as HSV_S(3, N). HSV_S(3, N) also represents an array of 3 rows and N columns. The first row represents the H channel value, the second row represents the S channel value, the third row represents the V channel value, and the N columns represent the parameter values of the N sub-images in the H, S, and V channels respectively.
[0062] As an embodiment, the parameters of the image in the RGB space are converted to the HSV space, which can be achieved by the following method:
[0063] H:
[0064] if(R==max)H=(GB) / (max-min);
[0065] if(G==max)H=2+(BR) / (max-min);
[0066] if(B==max)H=4+(RG) / (max-min);
[0067] H=H / 6;
[0068] if (H<0) H=(H / 360+1)
[0069] S:
[0070] S = (max - min) / max;
[0071] V:
[0072] V = (max);
[0073] Among them, max and min represent the maximum and minimum values of the R, G, and B values in the current sub-image, respectively, and H, S, and V represent the values of the current sub-image in the H, S, and V channels, respectively.
[0074] It should be noted that RGB space refers to describing a specific color using the three color components red, green, and blue, which is usually the same as representing the color of the image itself. HSV space is a device-related color model that is mainly used for device display and data transmission. The H in HSV space represents the hue of the color, S represents the saturation of the color, and V represents the lightness of the color. This application only uses the above-mentioned method to convert an image from RGB space to HSV space as an example to illustrate. In actual applications, color space conversion can also be performed in other ways, which are not limited here.
[0075] Step S203 : Compare each current HSV parameter with the standard HSV parameter to determine the reference HSV parameter.
[0076] The reference HSV parameters are standard HSV parameters whose parameter ratio is closest to the parameter ratio of the current HSV parameters.
[0077] Furthermore, the parameter ratio of the current HSV parameters of each sub-image is compared with the parameter ratio of the standard HSV parameters, and the standard HSV parameters with the closest parameter ratio are used as reference HSV parameters.
[0078] For example, if the HSV parameter value of the sub-image is (100, 10, 10) and the standard HSV parameter value is (10, 1, 1), then they belong to the same parameter ratio.
[0079] Specifically, the standard HSV parameters can be determined based on the HSV parameter values of the standard 24 color cards, recorded as HSV_T(3,24). HSV_T(3,24) represents an array of 3 rows and 24 columns, 24 represents 24 color cards, and each color card has its own value in the three HSV channels and corresponding proportional characteristics.
[0080] As another embodiment, since color cards 1 to 18 in the standard 24 color cards represent different standard colors, and color cards 19 to 24 represent different degrees of gray and have no color, the standard HSV parameters in the embodiment of the present application can be determined based on the HSV parameter values of color cards 1 to 18 in the standard 24 color cards, recorded as HSV_T(3,18), HSV_T(3,18) represents an array of 3 rows and 18 columns, 18 represents 18 color cards, and each color card has its own value in the three HSV channels and corresponding proportional characteristics.
[0081] As an example, taking the proportional relationship of the first column HSV_S(3,1) in the array HSV_S(3,N) as an example, the three values of HSV_S(3,1) in the HSV channel are H1, S1 and V1, respectively. The HSV_T(3,18) array is represented by lowercase h, s and v. There are 18 h values, 18 s values, and 18 v values.
[0082] Let coef(i) = H1 / h(i), where h(i) represents the h value of the i-th column in HSV_T(3,18). Calculate the proportional relationship Q(i) between each column in HSV_T(3,18) and the first column HSV_S(3,1), where:
[0083] Q(i)=(sqrt(coef(i)*s(i)-S1)^2+(coef(i)*v(i)-V1)^2) (1)
[0084] Furthermore, the minimum Q(i) value in the 18 columns, that is, minQ(i) corresponding to h, s and v in HSV_T(3,18) is used as the reference HSV parameter value corresponding to HSV_S(3,1). Similarly, the reference HSV parameters corresponding to the array HSV_S(3,N) are determined and recorded as HSV_TC(3,N).
[0085] It should be noted that, in the embodiment of the present application, coef(i) represents the parameter ratio relationship between the current sub-image and the standard color card on the H channel. In the embodiment of the present application, only coef(i)=H1 / h(i) is used as an example for explanation. In actual applications, coef(i) can also be h(i) / H1, that is, coef(i)=h(i) / H1. In addition, the present application only uses the H channel as a reference to calculate the relationship between the other two channels and the H channel. In actual applications, the other two channels can also be calculated based on S as a reference. The relationship between the channel and the S channel is coef(i)=S / s(i), Q(i)=(sqrt(coef(i)*s(i)-H1)^2+(coef(i)*v(i)-V1)^2), or the relationship between the other two channels and the V channel is calculated based on V as a reference, that is, coef(i)=V / v(i), Q(i)=(sqrt(coef(i)*s(i)-H1)^2+(coef(i)*v(i)-S1)^2), which is not limited here.
[0086] Figure 3 is a schematic diagram of the current HSV parameters of all sub-images provided in an embodiment of the present application. Figure 3 The format of the array HSV_S(3, N) is shown in Figure 1, which includes the parameter values of N sub-images in the three HSV channels.
[0087] Figure 4 is a schematic diagram of a standard HSV parameter provided in an embodiment of the present application, Figure 4 The format of the array HSV_T(3,18) is shown in the figure, which includes the parameter values of 18 color cards in the three HSV channels.
[0088] Furthermore, if the proportional relationship of (H1, S1, V1) is close to (h4, s4, v4) according to the above formula (1), the value of the reference HSV parameter HSV_TC(3,1) is (h4, s4, v4); if the proportional relationship of (H2, S2, V2) is close to (h8, s8, v8), the value of HSV_TC(3,2) is (h8, s8, v8); if the proportional relationship of (H3, S3, V3) is close to (h18, s18, v18), the value of HSV_TC(3,3) is (h18, s18, v18); if the proportional relationship of (H4, S4, V4) is close to (h8, s8, v8), the value of HSV_TC(3,4) is (h8, s8, v8), and so on, to determine all the parameter values of HSV_TC(3,N). Figure 5 is a schematic diagram of a reference HSV parameter provided in an embodiment of the present application, Figure 5 The format of the array HSV_TC(3,N) is shown in Figure 1, which includes the parameter values of N reference sub-images in the three HSV channels.
[0089] Step S204 : determining a color correction matrix based on the reference HSV parameters, and performing color adjustment on the image to be processed based on the color correction matrix.
[0090] Furthermore, a color correction matrix is determined according to the determined reference HSV parameters, and color adjustment is performed on the image to be processed according to the determined color correction matrix.
[0091] In the above implementation process, the image to be processed is divided into multiple sub-images, so that it is convenient to determine the color correction matrix according to each sub-image, so as to improve the overall rationality of the color adjustment of the image to be processed. Furthermore, the current HSV parameters of each sub-image are compared with the standard HSV parameters to determine the reference HSV parameters, which further facilitates the determination of the color correction matrix according to the reference HSV parameters, so that the determined color correction matrix is generated according to the standard HSV parameters. Furthermore, the image to be processed is color corrected according to the color correction matrix, so that the color of the image to be processed is adjusted with the standard HSV parameters. Further, the adjusted image is displayed in color with the standard HSV parameters, ensuring the consistency of the color display of the video image under real wide dynamic conditions, thereby improving the color display quality of the wide dynamic image.
[0092] In some embodiments, before comparing each current HSV parameter with the standard HSV parameter, the following steps may be further included:
[0093] Step 1: Determine the color temperature corresponding to the image to be processed.
[0094] Step 2: Determine standard HSV parameters based on color temperature.
[0095] For example, the database stores standard HSV parameters corresponding to color cards No. 1-18 of 24 color cards under M color temperatures. If the database stores standard HSV parameters corresponding to five color temperatures of D75, D65, D50, TL84, and F, that is, each color temperature corresponds to a set of standard HSV parameters, a total of 5 groups of HSV_T(3,18) arrays are included.
[0096] Furthermore, the color temperature corresponding to the image to be processed is determined based on the image acquisition device. Specifically, the white balance gain expression of the image acquisition device under different color temperature environments is recorded in advance in a laboratory environment. In the actual environment, the actual white balance calculation result of the image acquisition device is matched with the pre-recorded white balance gain expression in the laboratory environment to determine the color temperature value in the current actual environment.
[0097] Furthermore, standard HSV parameters corresponding to the color temperature value in the current actual environment are matched from the database. Specifically, if the color temperature value in the current actual environment is D75, the standard HSV parameters corresponding to the color temperature D75 are obtained from the database.
[0098] It should be noted that, in the embodiment of the present application, only the standard HSV parameters corresponding to five color temperatures are stored in the database as an example for explanation. In actual applications, standard HSV parameters corresponding to 8 color temperatures can also be stored, or standard HSV parameters corresponding to 10 color temperatures can also be stored, without limitation here. In addition, in the embodiment of the present application, only the standard HSV parameters corresponding to five color temperatures in color cards No. 1 to 18 can be stored in the database, or standard HSV parameters corresponding to five color temperatures in color cards No. 1 to 24 can also be stored, without limitation here. In the embodiment of the present application, only the color temperature corresponding to the image to be processed is determined based on the white balance gain of the image acquisition device. In actual applications, the color temperature corresponding to the image to be processed can also be determined according to other methods, without limitation here.
[0099] In the above implementation process, the standard HSV parameters are determined according to the color temperature of the image to be processed, and the color correction matrix is further determined according to the standard HSV parameters. This enables the determined color correction matrix to adapt to the current color temperature of the image to be processed, thereby improving the applicability of the color correction matrix.
[0100] In some embodiments, determining a color correction matrix based on reference HSV parameters may include the following steps:
[0101] Step 1: Determine the compensation coefficient based on the reference HSV parameters.
[0102] Step 2: Based on the compensation coefficients and the initial color correction matrix, determine the color correction matrix of the image to be processed.
[0103] Exemplarily, the compensation coefficient is determined according to the reference HSV parameter and the current HSV parameter. Further, the color correction matrix of the image to be processed is determined according to the compensation coefficient and the initial color correction matrix.
[0104] As an embodiment, the initial color correction matrix can be a CCM matrix calibrated under linear conditions, or it can be a pre-set standard CCM matrix. In the embodiment of the present application, the initial color correction matrix is a CCM matrix calibrated under linear conditions as an example, and the initial color correction matrix corresponds to the color temperature of the image to be processed.
[0105] In the above implementation process, the initial color correction matrix is adjusted by the compensation coefficient to obtain the color correction matrix corresponding to the image to be processed, so that the color correction matrix corresponding to the image to be processed is suitable for the image to be processed under wide dynamic conditions, avoiding the problem of inconsistent image color display results caused by using the linear CCM matrix for wide dynamic images.
[0106] In some embodiments, determining the compensation coefficient based on the reference HSV parameter may include: determining the compensation coefficient based on a V component parameter of the reference HSV parameter and a V component parameter of the current HSV parameter.
[0107] Exemplarily, the compensation coefficient is determined based on the V component parameter of the reference HSV parameter and the V component parameter of the current HSV parameter. Specifically, the reference HSV parameter HSV_TC(3,N) includes parameter values for the H, S, and V channels, and the parameter value HSV_TC(V,i) of the reference HSV parameter in the V channel is obtained. The current HSV parameter HSV_S(3,N) includes parameter values for the H, S, and V channels, and the parameter value HSV_S(V,i) of the current HSV parameter in the V channel is obtained. The V component compensation coefficient Vcoef(i) of each sub-image is further determined based on HSV_TC(V,i) and HSV_S(V,i).
[0108] As an embodiment, the V component compensation coefficient Vcoef(i) of each sub-image is the ratio of the parameter value HSV_TC(V,i) of the reference HSV parameter in the V channel to the parameter value HSV_S(V,i) of the current HSV parameter in the V channel, that is:
[0109] Vcoef(i)=HSV_TC(V,i) / HSV_S(V,i) (2)
[0110] Here, i represents 1 to N sub-images.
[0111] In the above implementation process, the compensation coefficient is determined according to the parameter value of the V component. Furthermore, after the compensation coefficient is applied to the image to be processed, the brightness of the color of the image to be processed is dynamically adjusted. This not only makes the adjusted image similar to the natural saturation effect, but also does not affect the actual saturation of the image, further improving the rationality of the image color adjustment.
[0112] As another embodiment, after determining the compensation coefficient based on the V component parameter of the reference HSV parameter and the V component parameter of the current HSV parameter, the method may further include mapping the V component compensation coefficient greater than 1.0 to 1.0.
[0113] In the above implementation process, the V component compensation coefficient greater than 1.0 is mapped to 1.0, which can increase the V component parameter of the smaller current HSV parameter based on the V component parameter of the reference HSV parameter, so that the adjusted V component parameter becomes the V component parameter of the reference HSV parameter. Furthermore, in the subsequent adjustment of the image color, the V component of the image is always maintained at the standard parameter, thereby ensuring the consistency of the video image color display under real wide dynamic conditions.
[0114] In some embodiments, determining the color correction matrix of the image to be processed based on the compensation coefficient and the initial color correction matrix may include the following steps:
[0115] Step 1: Determine the current RGB parameters of multiple sub-images.
[0116] Step 2: Determine the compensation matrix based on the compensation coefficients and the current RGB parameters.
[0117] Step 3: Based on the compensation matrix and the initial color correction matrix, determine the color correction matrix of the image to be processed.
[0118] Exemplarily, the current RGB parameters RGB_S(3,N) of each sub-image are determined, and further, the compensation coefficients are used to compensate the current RGB parameters to obtain a compensation matrix RGB_S_V(3,N). Further, based on the compensation matrix and the initial color correction matrix, the color correction matrix of the image to be processed is determined.
[0119] In the above implementation process, since in actual application, the color correction matrix is used to adjust the color of the RGB parameters of the image to be processed, the compensation coefficient is used to compensate the current RGB parameters. After the compensation coefficient is applied to the current RGB parameters, a compensation matrix is obtained, which further facilitates determining the color correction matrix of the image to be processed based on the compensation matrix.
[0120] In some embodiments, determining the compensation matrix based on the compensation coefficients and the current RGB parameters may include the following steps:
[0121] Step 1: Compensate each channel value of the current RGB parameter based on the compensation coefficient to obtain the compensated RGB parameter.
[0122] Step 2: Determine a compensation matrix based on the compensated RGB parameters and the current RGB parameters.
[0123] Exemplarily, the compensation coefficient is used to compensate each channel value of the current RGB parameter to obtain the compensated RGB parameter.
[0124] Specifically, the compensation coefficient is Vcoef(i), and the current RGB parameters RGB_S(3,N) include the parameters RGB_S(R,i) of the R channel, the parameters RGB_S(G,i) of the G channel, and the parameters RGB_S(B,i) of the B channel. According to the compensation coefficient Vcoef(i) and the current RGB parameters RGB_S(3,N), the parameters RGB_S_V(R,i) of the R channel, the parameters RGB_S_V(G,i) of the G channel, and the parameters RGB_S_V(B,i) of the B channel of the compensation matrix are obtained. The compensation RGB parameters RGB_S_V(3,N) can be determined as follows:
[0125] RGB_S_V(R,i)=RGB_S(R,i)*Vcoef(i) (3)
[0126] RGB_S_V(G,i)=RGB_S(G,i)*Vcoef(i) (4)
[0127] RGB_S_V(B,i)=RGB_S(B,i)*Vcoef(i) (5)
[0128] Furthermore, the compensation matrix is determined based on the compensation RGB parameters RGB_S_V(3,N) and the current RGB parameters RGB_S(3,N). Specifically, the compensation matrix CorrectCoef can be determined as follows:
[0129] CorrectCoef=RGB_S_V(3,N) / RGB_S(3,N) (6)
[0130] Furthermore, the color correction matrix result_CCM of the image to be processed is determined according to the compensation matrix and the initial color correction matrix, which can be achieved by the following method:
[0131] result_CCM=CorrectCoef*CCM (7)
[0132] Where CCM is the initial color correction matrix, and result_CCM is the color correction matrix of the image to be processed.
[0133] In the above implementation process, the compensation coefficients are used to compensate the channel values of the current RGB parameters to obtain compensated RGB parameters, and the current RGB parameters are further corrected according to the compensated RGB parameters, thereby realizing the fitting of two 3-row and N-column arrays by least squares calculation, so that the obtained compensation matrix is 3*3, which facilitates further correction of the 3*3 initial color correction matrix according to the compensation matrix.
[0134] In some embodiments, performing color adjustment on the image to be processed based on the color correction matrix may include the following steps:
[0135] Step 1: Normalize the color correction matrix.
[0136] Step 2: Perform color adjustment on the image to be processed based on the normalized color correction matrix.
[0137] For example, if the color correction matrix result_CCM is: Then, c02=1-c00-c01; c12=1-c10-c11; c22=1-c20-c21 can be constrained to achieve normalization of the color correction matrix. Further, the color of the image to be processed is adjusted using the normalized color correction matrix to obtain a color-adjusted image.
[0138] It should be noted that this application only uses the above-mentioned method to perform matrix normalization as an example. In actual applications, other methods can also be used to perform matrix normalization, which is not limited here.
[0139] In the above implementation process, the color correction matrix is normalized to ensure the standardization of the matrix.
[0140] The present embodiment is described and illustrated below through preferred embodiments.
[0141] Figure 6 This is a flow chart of an embodiment of an image color adjustment method provided by an embodiment of the present application, such as Figure 6 As shown, the image color adjustment method includes the following steps:
[0142] Step 601, start.
[0143] Step 602: Store the standard HSV parameters of color cards No. 1 to No. 18 of the 24 color cards under M color temperatures in a database.
[0144] Specifically, the standard HSV parameters corresponding to the five color temperatures of D75, D65, D50, TL84, and F are stored in the database, that is, each color temperature corresponds to a set of standard HSV parameters, including a total of 5 groups of HSV_T(3,18) arrays.
[0145] Step 603: Divide the image to be processed into N sub-images, and obtain the RGB parameters of each sub-image, recorded as RGB_S(3,N), and the HSV parameters of each sub-image, recorded as HSV_S(3,N).
[0146] Step 604 : According to the color temperature value of the image to be processed, the standard HSV parameters corresponding to the image to be processed are matched from the database, and are recorded as HSV_T(3,18).
[0147] Furthermore, according to the color temperature value of the image to be processed, a set of standard HSV parameters corresponding to the image to be processed is determined from the above five sets of standard HSV parameters, and is recorded as HSV_T(3,18).
[0148] Step 605: Determine the standard HSV parameter with the closest HSV ratio relationship in HSV_T(3,18) based on HSV_S(3,N) to obtain the HSV parameter HSV_TC(3,N).
[0149] Step 606 : Determine the compensation coefficient Vcoef(i) of the V component according to the reference HSV parameter HSV_TC(3,N) and the HSV parameter HSV_T(3,N) of each sub-image.
[0150] Specifically, the compensation coefficient Vcoef(i) of the V component is determined by the above formula (2).
[0151] Step 607 : Map the compensation coefficient Vcoef(i) of the V component greater than 1.0 to 1.0.
[0152] Step 608 : Compensate the RGB parameters RGB_S(3,N) of each sub-image according to the compensation coefficient Vcoef(i) of the V component to obtain compensated RGB parameters.
[0153] Specifically, the compensation RGB parameter RGB_S_V(3,N) is determined by the above formulas (3), (4) and (5).
[0154] Step 609 : Correct the RGB parameters RGB_S(3,N) of each sub-image according to the compensation RGB parameters to obtain a compensation matrix.
[0155] Specifically, the compensation matrix CorrectCoef is determined according to the above formula (6).
[0156] Step 610: Obtain a color correction matrix for the image to be processed according to the compensation matrix and the initial color correction image.
[0157] Specifically, the color correction matrix result_CCM of the image to be processed is determined according to the above formula (7).
[0158] Step 611 , normalizing the color correction matrix of the image to be processed, and performing color correction on the image to be processed using the normalized color correction matrix.
[0159] Step 612, end.
[0160] It should be noted that the steps shown in the above process or the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0161] This embodiment also provides an image color adjustment device for implementing the aforementioned embodiments and preferred implementations. Details already described will not be repeated. Terms such as "module," "unit," and "subunit" used below may refer to a combination of software and / or hardware that implements a predetermined function. While the devices described in the following embodiments are preferably implemented using software, implementation using hardware, or a combination of software and hardware, is also possible and contemplated.
[0162] Figure 7 This is a structural block diagram of an image color adjustment device provided by an embodiment of the present application. Figure 7 As shown, the device includes:
[0163] An image segmentation module 701 is used to segment the image to be processed into multiple sub-images;
[0164] An acquisition module 702 is used to acquire the current HSV parameters of each sub-image;
[0165] A determination module 703 is configured to compare each current HSV parameter with a standard HSV parameter to determine a reference HSV parameter, where the reference HSV parameter is a standard HSV parameter having a parameter ratio closest to that of the current HSV parameter;
[0166] The color adjustment module 704 is configured to determine a color correction matrix based on the reference HSV parameters, and perform color adjustment on the image to be processed based on the color correction matrix.
[0167] In some embodiments, the determining module 703 is further configured to:
[0168] Determine the color temperature corresponding to the image to be processed;
[0169] Determine standard HSV parameters based on color temperature.
[0170] In some embodiments, the color adjustment module 704 is specifically configured to:
[0171] determining a compensation coefficient based on a reference HSV parameter;
[0172] A color correction matrix of the image to be processed is determined based on the compensation coefficients and the initial color correction matrix.
[0173] In some embodiments, the color adjustment module 704 is specifically configured to:
[0174] The compensation coefficient is determined based on the V component parameter of the reference HSV parameter and the V component parameter of the current HSV parameter.
[0175] In some embodiments, the color adjustment module 704 is specifically configured to:
[0176] Determine current RGB parameters of multiple sub-images;
[0177] Determine a compensation matrix based on the compensation coefficients and the current RGB parameters;
[0178] A color correction matrix of the image to be processed is determined based on the compensation matrix and the initial color correction matrix.
[0179] In some embodiments, the color adjustment module 704 is specifically configured to:
[0180] Compensate each channel value of the current RGB parameter based on the compensation coefficient to obtain the compensated RGB parameter;
[0181] A compensation matrix is determined based on the compensated RGB parameters and the current RGB parameters.
[0182] In some embodiments, the color adjustment module 704 is specifically configured to:
[0183] Normalize the color correction matrix;
[0184] Perform color adjustment on the image to be processed based on the normalized color correction matrix.
[0185] It should be noted that the above modules can be functional modules or program modules, and can be implemented through software or hardware. For modules implemented through hardware, the above modules can be located in the same processor; or the above modules can be located in different processors in any combination.
[0186] This embodiment further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0187] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0188] Optionally, in this embodiment, the processor may be configured to execute the following steps through a computer program:
[0189] S1, dividing the image to be processed into multiple sub-images.
[0190] S2, obtain the current HSV parameters of each sub-image.
[0191] S3, comparing each current HSV parameter with a standard HSV parameter to determine a reference HSV parameter, where the reference HSV parameter is a standard HSV parameter whose parameter ratio is closest to that of the current HSV parameter.
[0192] S4, determining a color correction matrix based on the reference HSV parameters, and performing color adjustment on the image to be processed based on the color correction matrix.
[0193] It should be noted that, for specific examples in this embodiment, reference may be made to the examples described in the above embodiments and optional implementation modes, and will not be repeated in this embodiment.
[0194] In addition, in conjunction with the image color adjustment method provided in the above embodiments, a storage medium may be provided in this embodiment to implement the method. The storage medium stores a computer program that, when executed by a processor, implements any of the image color adjustment methods in the above embodiments.
[0195] It should be understood that the specific embodiments described herein are only used to explain this application and are not used to limit it. Based on the embodiments provided in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0196] Obviously, the accompanying drawings are merely examples or embodiments of the present application. A person skilled in the art can also apply the present application to other similar situations based on these drawings without inventive effort. Furthermore, it is understandable that, although the work involved in this development process may be complex and lengthy, certain design, manufacturing, or production changes based on the technical content disclosed in this application are merely routine technical means for a person skilled in the art and should not be considered to constitute a deficiency in the disclosure of the present application.
[0197] The term "embodiment" as used in this application refers to specific features, structures, or characteristics described in conjunction with the embodiment that can be included in at least one embodiment of this application. The appearance of this phrase in various places in the specification does not necessarily mean that the embodiment is the same, nor does it mean that it is mutually exclusive with other embodiments and is independent or optional. It is understood, either explicitly or implicitly, by those skilled in the art that the embodiments described in this application can be combined with other embodiments when there is no conflict.
[0198] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of patent protection. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, and these modifications and improvements fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.
Claims
1. An image color adjustment method, applied to wide dynamic range images, characterized in that: The method comprises: Divide the image to be processed into multiple sub-images; Obtain the current HSV parameters of each of the sub-images; Comparing each of the current HSV parameters with a standard HSV parameter to determine a reference HSV parameter, wherein the reference HSV parameter is a standard HSV parameter having a parameter ratio closest to that of the current HSV parameter; A color correction matrix is determined based on the reference HSV parameters, and color adjustment is performed on the image to be processed based on the color correction matrix.
2. The method according to claim 1, characterized in that Before comparing each of the current HSV parameters with the standard HSV parameters, the method further includes: Determining a color temperature corresponding to the image to be processed; The standard HSV parameters are determined based on the color temperature.
3. The method according to claim 1, characterized in that The determining of a color correction matrix based on the reference HSV parameters includes: determining a compensation coefficient based on the reference HSV parameter; The color correction matrix of the image to be processed is determined based on the compensation coefficients and an initial color correction matrix.
4. The method according to claim 3, characterized in that The determining of the compensation coefficient based on the reference HSV parameter includes: The compensation coefficient is determined based on a V component parameter of the reference HSV parameter and a V component parameter of the current HSV parameter.
5. The method according to claim 3 or 4, characterized in that The step of determining the color correction matrix of the image to be processed based on the compensation coefficient and the initial color correction matrix includes: determining current RGB parameters of a plurality of said sub-images; Determine a compensation matrix based on the compensation coefficient and the current RGB parameters; The color correction matrix of the image to be processed is determined based on the compensation matrix and the initial color correction matrix.
6. The method according to claim 5, characterized in that The determining of a compensation matrix based on the compensation coefficient and the current RGB parameter includes: Compensating each channel value of the current RGB parameter based on the compensation coefficient to obtain a compensated RGB parameter; The compensation matrix is determined based on the compensated RGB parameters and the current RGB parameters.
7. The method according to claim 1, characterized in that The color adjustment of the image to be processed based on the color correction matrix includes: performing normalization processing on the color correction matrix; Performing color adjustment on the image to be processed based on the normalized color correction matrix.
8. An image color adjustment device for adjusting the color of a wide dynamic image, characterized in that: include: An image segmentation module, used for segmenting the image to be processed into multiple sub-images; An acquisition module, configured to acquire the current HSV parameters of each sub-image; a determination module, configured to compare each of the current HSV parameters with a standard HSV parameter to determine a reference HSV parameter, wherein the reference HSV parameter is a standard HSV parameter having a parameter ratio closest to that of the current HSV parameter; The color adjustment module is configured to determine a color correction matrix based on the reference HSV parameters, and perform color adjustment on the image to be processed based on the color correction matrix.
9. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the image color adjustment method according to any one of claims 1 to 7.
10. 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 adjustment method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Color correction method and mobile terminal
CN107958470A
Image color correction method and device, equipment and storage medium
CN113947533A