Image color adjustment method and device

By identifying and analyzing the target objects in the compressed image, calculating their chromaticity values, and adjusting colors according to preset standards, the color casting problem caused by image compression is solved, and user experience and product sales are improved.

CN119449970APending Publication Date: 2025-02-14SHENZHEN SKYWORTH DISPLAY TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411921812.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-23
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

Image compression causes color casts, affecting users' viewing experience and reducing product sales.

Method used

By identifying the target object in the compressed image, obtaining multiple valid image blocks in the image area where it is located, calculating the chromaticity value of each image block, and using the preset chromaticity threshold and color reference value to the image area of ​​the target object Make color adjustments.

Benefits of technology

It effectively optimizes the color performance of compressed images, alleviates the color casting problem caused by image compression, improves the user's viewing experience, and improves product sales.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119449970A_ABST
    Figure CN119449970A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides an image color adjustment method and device, and the method comprises the steps: obtaining a plurality of effective image blocks of an image region where a target object is located under the condition that the target object in a compressed image is recognized; determining a partial chromatic value of the target object based on the color value of each pixel point in each effective image block; judging whether the partial chrominance value exceeds a preset partial chrominance threshold value or not; and when it is determined that the partial chrominance value exceeds the preset partial chrominance threshold value, performing color adjustment on the image area where the target object is located according to a preset color reference value. According to the technical scheme, color adjustment can be performed on the image area where the target object of the compressed image is located under the condition that it is judged that the image area where the target object of the compressed image is located has high-degree color cast, so that the color performance of the compressed image can be effectively optimized; therefore, the technical problem of color cast of the image caused by image compression in the prior art is effectively relieved, and the product sales volume is increased while the watching feeling of a user is greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of image processing technology, and in particular to a method and device for image color adjustment. Background Art

[0002] In the current display industry, as digital cameras, camcorders, monitors, and televisions have grown significantly in the global market and the products are becoming more mature, related products are also turning to pursue quality improvement. Color technology has a decisive influence on the quality and efficacy of imaging system products, and users' purchasing behavior is greatly affected by color image quality and the color image processing functions provided.

[0003] However, in order to save bandwidth and improve transmission efficiency in today's image transmission, including improving efficiency and saving bandwidth in the image quality processing process and performing brightness-related processing on YUV (Luminance-Chrominance-Concentration) signals, images are compressed to varying degrees when displayed on the screen, resulting in color cast problems in the compressed images, which can easily bring a bad viewing experience to users, thereby affecting product sales. Summary of the invention

[0004] In view of this, in order to effectively alleviate the technical problem that image color cast occurs due to image compression, which affects the user's viewing experience and thus affects product sales, an embodiment of the present invention provides a method and device for image color adjustment.

[0005] In a first aspect, an embodiment of the present invention provides a method for adjusting image color, the method comprising:

[0006] When a target object is identified in the compressed image, a plurality of valid image blocks of the image region where the target object is located are obtained;

[0007] Determine the color deviation value of the target object based on the color value of each pixel in each valid image block;

[0008] Determine whether the color cast value exceeds a preset color cast threshold;

[0009] When it is determined that the color deviation value exceeds the preset color deviation threshold, the color of the image area where the target object is located is adjusted according to the preset color reference value.

[0010] In a possible implementation, obtaining a plurality of valid image blocks in an image region where a target object is located includes:

[0011] Dividing the compressed image into a plurality of image blocks;

[0012] A plurality of valid image blocks including only the target object are obtained from the plurality of image blocks.

[0013] In a possible implementation, determining the color cast value of the target object based on the color value of each pixel in each valid image block includes:

[0014] Determine a color difference value of each valid image block based on the color value of each pixel in each valid image block;

[0015] The color deviation value of the target object is determined according to the color difference values ​​of each valid image block.

[0016] In a possible implementation manner, determining the color difference value of each valid image block based on the color value of each pixel in each valid image block includes:

[0017] Determine the color mean of all valid image blocks based on the color value of each pixel in each valid image block;

[0018] Determine a block color mean value of each valid image block based on the color value of each pixel in each valid image block;

[0019] For each valid image block, a color difference value of the valid image block is determined according to the block color mean and the color mean.

[0020] In a possible implementation, determining the color cast value of the target object according to the color difference values ​​of each valid image block includes:

[0021] The valid image block corresponding to the minimum color difference value is taken as the target image block;

[0022] Obtain the center distance between each valid image block and the target image block;

[0023] Determine the color difference coefficient of each effective image block according to the center distance of each effective image block;

[0024] The color cast value of the target object is determined based on the color difference coefficients and color difference values ​​corresponding to each valid image block.

[0025] In a possible implementation manner, determining the color difference coefficient of each effective image block according to the center distance of each effective image block includes:

[0026] For each valid image block, the color difference coefficient corresponding to the center distance is searched from the color difference coefficient query table; wherein the color difference coefficient query table stores the corresponding relationship between the center distance and the color difference coefficient;

[0027] The color difference coefficient is determined as the color difference coefficient of the valid image block.

[0028] In a possible implementation, the preset color reference value includes a hue reference value and a saturation reference value;

[0029] Perform color adjustment on the image area where the target object is located according to the preset color reference value, including:

[0030] Obtain the hue value and saturation value of each pixel in the image area where the target object is located;

[0031] Determine a hue mean based on the hue value of each pixel point in the image region where the target object is located, and determine a saturation mean based on the saturation value of each pixel point in the image region where the target object is located;

[0032] Determine whether the saturation mean value is equal to the saturation reference value, and whether the hue mean value is equal to the hue reference value;

[0033] When it is determined that the saturation mean is not equal to the saturation reference value, the saturation of the image area where the target object is located is adjusted based on the saturation reference value, and / or, when it is determined that the hue mean is not equal to the hue reference value, the hue of the image area where the target object is located is adjusted based on the hue reference value.

[0034] In a possible implementation, adjusting the saturation of the image region where the target object is located based on the saturation reference value includes:

[0035] Determine whether the saturation mean value is less than the saturation reference value;

[0036] When it is determined that the saturation mean value is greater than the saturation reference value, obtaining a first pixel point in the image region where the target object is located, whose saturation value is greater than the saturation reference value;

[0037] Determine a saturation down-adjustment value based on the first saturation value of the first pixel and the saturation reference value, so as to down-adjust the saturation of the first saturation value of the first pixel according to the saturation down-adjustment value;

[0038] When it is determined that the saturation mean value is less than the saturation reference value, obtaining a second pixel point in the image region where the target object is located, the second pixel point having a saturation value less than the saturation reference value;

[0039] A saturation up-adjustment value is determined based on the second saturation value of the second pixel and the saturation reference value, so as to increase the saturation of the second saturation value of the second pixel according to the saturation up-adjustment value.

[0040] In a possible implementation, adjusting the hue of the image region where the target object is located based on the hue reference value includes:

[0041] Acquire the third pixel point in the image region where the target object is located, whose hue value is less than the hue reference value;

[0042] Determine a hue right-adjustment value based on the first hue value of the third pixel and the hue reference value, so as to right-adjust the first hue value of the third pixel according to the hue right-adjustment value;

[0043] Acquire a fourth pixel point in the image region where the target object is located, the fourth pixel point having a hue value greater than a hue reference value;

[0044] A hue left-adjusting value is determined based on the second hue value of the fourth pixel and the hue reference value, so as to left-adjust the second hue value of the fourth pixel according to the hue left-adjusting value.

[0045] In a second aspect, an embodiment of the present invention provides a device for adjusting image color, the device comprising:

[0046] An acquisition module, used for acquiring a plurality of valid image blocks of an image region where the target object is located when a target object in the compressed image is identified;

[0047] A determination module, used to determine the color deviation value of the target object based on the color value of each pixel in each valid image block;

[0048] A determination module, used to determine whether the color deviation value exceeds a preset color deviation threshold;

[0049] The color adjustment module is used to adjust the color of the image area where the target object is located according to a preset color reference value when it is determined that the color deviation value exceeds a preset color deviation threshold.

[0050] In a third aspect, an embodiment of the present invention provides an electronic device, which includes: a processor and a memory, the processor is used to execute an image color adjustment program stored in the memory to implement the above-mentioned image color adjustment method.

[0051] In a fourth aspect, an embodiment of the present invention provides a storage medium, wherein the storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the above-mentioned method of image color adjustment.

[0052] The method and device for image color adjustment provided by the embodiments of the present invention include: when a target object in a compressed image is identified, obtaining multiple valid image blocks of the image area where the target object is located; determining the color deviation value of the target object based on the color value of each pixel in each valid image block; determining whether the color deviation value exceeds a preset color deviation threshold; when it is determined that the color deviation value exceeds the preset color deviation threshold, performing color adjustment on the image area where the target object is located according to a preset color reference value. In the above technical solution, when it is determined that the image area where the target object of the compressed image is located has a high degree of color deviation, the image area where the target object is located can be color adjusted, which can effectively optimize the color performance of the compressed image, thereby effectively alleviating the existing technical problem of color deviation of the image caused by image compression, greatly improving the user's viewing experience while increasing product sales. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] Figure 1 A flowchart of an embodiment of a method for adjusting image color provided by an embodiment of the present invention;

[0054] Figure 2 An example diagram of a compressed image provided by an embodiment of the present invention;

[0055] Figure 3 A flowchart of another method for adjusting image color provided by an embodiment of the present invention;

[0056] Figure 4 A flowchart of another method for adjusting image color provided by an embodiment of the present invention;

[0057] Figure 5 A block diagram of an embodiment of a device for adjusting image color provided by an embodiment of the present invention;

[0058] Figure 6 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0059] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0060] To facilitate understanding of the embodiments of the present invention, specific embodiments will be further explained below in conjunction with the accompanying drawings. The embodiments do not constitute a limitation on the embodiments of the present invention.

[0061] The embodiment of the present invention provides a method for adjusting image color, which is applicable to terminal devices capable of displaying images, such as digital cameras, camcorders, monitors, televisions, etc., which are not limited here. Figure 1 , Figure 1 The present invention provides a flowchart of a method for adjusting image color according to an embodiment of the present invention. Figure 1 The process shown may include the following steps:

[0062] Step 101, when a target object is identified in a compressed image, a plurality of valid image blocks of an image region where the target object is located are obtained;

[0063] The compressed image is an image that has been processed for image quality and / or the YUV signal has been processed for brightness-related processing. The target object is an object that needs to be adjusted for color cast and is pre-set according to actual needs. For example, objects such as faces, skies, and trees are not limited here. In this embodiment, the human face is used as the target object for color, i.e., skin color cast adjustment, for subsequent analysis and explanation.

[0064] In practical applications, the compressed image can be input into a face recognition module, and then the face recognition module is used to identify whether there is a face in the compressed image. The face recognition module can be trained for face recognition using but not limited to a CNN (Convolutional Neural Network) model based on deep learning. When the face recognition module identifies that there is a face in the compressed image, multiple valid image blocks of the image area where the target object is located are obtained to perform a subsequent rapid analysis of whether the face color is cast.

[0065] The valid image block is an image block that only includes the target object in the image area where the target object is located. The acquisition process of the above-mentioned valid image block is: dividing the compressed image into multiple image blocks; and obtaining multiple valid image blocks that only include the target object from the multiple image blocks. The number of image blocks is divided according to the hardware capability of the terminal device, and the number of image blocks is not limited here. For ease of understanding, as Figure 2 As shown, the compressed image including only people can be divided into 14*13 dotted image blocks. If the target object is set as a human face, in order to accurately analyze whether the color of the human face is cast, it is necessary to remove the image blocks including the facial features, hair and eyebrows, clothing and background, and only take the image blocks including the human face skin as the valid image blocks, that is, obtain the image blocks including only the human face skin as the valid image blocks among multiple image blocks. Figure 2 As shown, the image blocks numbered 1-18 are valid image blocks.

[0066] Step 102, determining the color cast value of the target object based on the color value of each pixel in each valid image block;

[0067] The color cast value can be understood as a quantitative indicator that characterizes the degree of color cast of the target object. In this embodiment, the larger the color cast value is, the higher the degree of color cast of the target object is. Conversely, the smaller the color cast value is, the lower the degree of color cast of the target object is.

[0068] The above color value is the color information of each pixel in the compressed image, and is a value represented by the values ​​of the three color channels of red (R), green (G), and blue (B).

[0069] Step 103, determining whether the color deviation value exceeds a preset color deviation threshold;

[0070] The preset color cast threshold is a pre-set critical value that indicates that the color cast of the target object requires color adjustment. In actual application, the preset color cast threshold may have different values ​​according to different settings of the target object, and is not limited here.

[0071] Step 104 : When it is determined that the color deviation value exceeds the preset color deviation threshold, color adjustment is performed on the image region where the target object is located according to a preset color reference value.

[0072] It can be understood that if the color deviation value exceeds the preset color deviation threshold, it means that the color deviation of the target object is high, and it is necessary to perform color adjustment on the image area where the target object is located according to the preset color reference value; if the color deviation value does not exceed the preset color deviation threshold, it means that the color deviation of the target object is low, and it is not necessary to perform color adjustment on the image area where the target object is located.

[0073] In specific implementation, if multiple target objects are identified in the compressed image, the image color adjustment provided in this embodiment needs to be performed for each target object, that is, the above-mentioned color adjustment needs to be performed on the image area where each target object with a high degree of color cast in the compressed image is located.

[0074] Through the method in this embodiment, when it is determined that the image area where the target object of the compressed image is located has a high degree of color cast, the color of the image area where the target object is located can be adjusted, which can effectively optimize the color performance of the compressed image, thereby effectively alleviating the existing technical problem of color cast in the image caused by image compression, greatly improving the user's viewing experience while increasing product sales.

[0075] like Figure 3 As shown, as an optional implementation, as in the above method, step 102 of determining the color cast value of the target object based on the color value of each pixel in each valid image block includes the following steps:

[0076] Step 301, determining a color difference value of each valid image block based on the color value of each pixel in each valid image block;

[0077] The color difference value determination process may be implemented through steps A1 to A3:

[0078] Step A1, determining the color mean of all valid image blocks based on the color value of each pixel in each valid image block;

[0079] The color mean is a value obtained by adding the color values ​​of each pixel in each valid image block and then calculating the mean. The color mean can be recorded as (RAVG, GAVG, BAVG).

[0080] Step A2, determining a block color mean value of each valid image block based on the color value of each pixel in each valid image block;

[0081] The block color mean of each of the above-mentioned valid image blocks is a value obtained by adding the color values ​​of each pixel in the valid image block and then calculating the mean. The block color mean of each valid image block can be recorded as (RAVG1, GAVG1, BAVG1), (RAVG2, GAVG2, BAVG2)…(RAVGf, GAVGf, BAVGf).

[0082] Step A3: for each valid image block, determine the color difference value of the valid image block according to the block color mean and the color mean.

[0083] The color difference value of each valid image block is the difference between the block color mean and the color mean of each valid image block. The color difference value of each valid image block can be recorded as (△RAVG1, △GAVG1, △BAVG1), (△RAVG2, △GAVG2, △BAVG2)...(△RAVGf, △GAVGf, △BAVGf).

[0084] Among them, the color difference value quantifies the visual difference between the average color of each valid image block and the average color of all valid image blocks. The smaller the color difference value, the closer the two colors are; the larger the color difference value, the greater the difference between the two colors. This can be used to determine the color cast value of the subsequent target object.

[0085] Step 302: determining the color cast value of the target object according to the color difference value of each valid image block.

[0086] The color cast value of a specific target object can be achieved through steps B1 to B4:

[0087] Step B1, taking the valid image block corresponding to the minimum color difference value as the target image block;

[0088] That is, the valid image block closest to the color mean is taken as the target image block. When there are multiple valid image blocks corresponding to the smallest color difference value, you can select any one of them as the target image block, or you can select the image block closest to the center point of the target object as the target image block, which is not limited here.

[0089] Step B2, obtaining the center distance between each valid image block and the target image block;

[0090] The center distance is used to be the direct distance between the center point of the valid image block and the center point of the target image block. It can be understood that when the valid image block is the target image block, the center distance of the valid image block is 0, and the center distances of other valid image blocks and the target image block can be determined based on the coordinate information of the center point of the valid image block and the coordinate information of the center point of the target image block.

[0091] Step B3, determining the color difference coefficient of each effective image block according to the center distance of each effective image block;

[0092] The color difference coefficient of each effective image block can be determined by looking up a table, specifically: for each effective image block, the color difference coefficient corresponding to the center distance is searched from the color difference coefficient lookup table; and the color difference coefficient is determined as the color difference coefficient of the effective image block.

[0093] The color difference coefficient query table stores the corresponding relationship between the center distance and the color difference coefficient. For ease of understanding, the color difference coefficient query table is shown in Table 1:

[0094] Table 1

[0095] Center distance / mm Color Difference Coefficient 0 0.9 1-4 0.8 5-8 0.7 9-12 0.6 13-16 0.5 17 and above 0.4

[0096] It should be noted that Table 1 only shows an example of the corresponding relationship between the center distance and the color difference coefficient. The specific corresponding relationship between the center distance and the color difference coefficient can be set according to actual needs and is not limited here.

[0097] The color difference coefficient is a value that reflects the color difference. As shown in Table 1, the smaller the center distance, the larger the color difference coefficient. It can be understood that the closer the effective image block is to the target image block, the higher the color reference degree is and the better it can reflect the color difference. Therefore, the smaller the center distance is, the larger the color difference coefficient of the effective image block is.

[0098] Step B4: determining the color cast value of the target object based on the color difference coefficients and color difference values ​​corresponding to each valid image block.

[0099] Specifically, the color difference coefficient and color difference value corresponding to each valid image block are weighted and calculated to obtain the color deviation value. For ease of understanding, the calculation formula of the color deviation value is as follows:

[0100] M=(△RAVG1, △GAVG1, △BAVG1)*S1+(△RAVG2, △GAVG2, △BAVG2)*S2+...+(△RAVGf, △GAVGf, △BAVGf)*Sf;

[0101] Among them, S1, S2, ...Sf represent the color difference coefficients corresponding to each valid image block.

[0102] Through the method in this embodiment, the color deviation value of the target object can be accurately obtained based on the weighted calculation of the color difference value and the color difference coefficient of each valid image block. At the same time, the speed of calculating the color deviation value is improved by dividing the image area where the target object is located into image blocks.

[0103] In this embodiment, the color adjustment is performed on the image area where the target object is located, including adjusting the saturation and / or hue of the image area where the target object is located. Therefore, the preset color reference value includes a hue reference value and a saturation reference value, wherein the hue reference value and the saturation reference value are the saturation reference value and the hue reference value corresponding to the target object preset according to the subjective public preference style. The hue reference value and the saturation reference value of different target object color settings are all different, which are not limited here. Based on the above description, if Figure 4 As shown, as an optional implementation, as in the above method, step 104 of adjusting the color of the image area where the target object is located according to the preset color reference value includes the following steps:

[0104] Step 401, obtaining the hue value and saturation value of each pixel in the image area where the target object is located;

[0105] Since color adjustment is implemented at the pixel level, it is necessary to obtain the hue value and saturation value of each pixel in the image area where the target object is located as a data reference for subsequent color adjustment.

[0106] Step 402, determining a hue mean value based on the hue value of each pixel point in the image region where the target object is located, and determining a saturation mean value based on the saturation value of each pixel point in the image region where the target object is located;

[0107] The above-mentioned hue mean is obtained by adding the hue values ​​of each pixel in the image area where the target object is located and then calculating the average value. Similarly, the saturation mean is also obtained by adding the saturation values ​​of each pixel in the image area where the target object is located and then calculating the average value.

[0108] Step 403, determining whether the saturation mean is equal to the saturation reference value, and whether the hue mean is equal to the hue reference value;

[0109] The purpose of making the judgment is to determine whether the color adjustment needs to be made to the saturation or the hue, or whether both need to be adjusted. In practical applications, if the saturation mean value is equal to the saturation reference value, it means that the saturation of the target object meets the requirements and does not need to be adjusted. If the saturation mean value is not equal to the saturation reference value, it means that the saturation of the target object does not meet the requirements and needs to be adjusted. If the hue mean value is equal to the hue reference value, it means that the hue of the target object meets the requirements and does not need to be adjusted. If the hue mean value is not equal to the hue reference value, it means that the hue of the target object does not meet the requirements and needs to be adjusted. Therefore, step 404 needs to be executed.

[0110] Step 404: adjusting the saturation of the image region where the target object is located based on the saturation reference value, and / or adjusting the hue of the image region where the target object is located based on the hue reference value.

[0111] Specifically, when it is determined that the saturation mean value is not equal to the saturation reference value, the process of adjusting the saturation of the image area where the target object is located can be implemented through steps C1 to C6:

[0112] Step C1, determining whether the saturation mean value is less than the saturation reference value;

[0113] When it is determined that the saturation mean value is greater than the saturation reference value, step C2 is executed; when it is determined that the saturation mean value is less than the saturation reference value, step C4 is executed.

[0114] Step C2, obtaining a first pixel point in the image region where the target object is located whose saturation value is greater than a saturation reference value;

[0115] When the saturation mean value is greater than the saturation reference value, it indicates that the overall image region where the target object is located has a high saturation, which is likely to cause visual discomfort. In this embodiment, the saturation of all pixels in the image region where the target object is located whose saturation value is greater than the saturation reference value can be reduced to make the saturation mean value of the image region where the target object is located approach the saturation reference value, so as to provide a comfortable visual experience for the user. Therefore, when it is determined that the saturation mean value is greater than the saturation reference value, it is necessary to obtain all the first pixels in the image region where the target object is located whose saturation value is greater than the saturation reference value.

[0116] Step C3, determining a saturation down-adjustment value based on the first saturation value of the first pixel and the saturation reference value, so as to down-adjust the first saturation value of the first pixel according to the saturation down-adjustment value;

[0117] Among them, the calculation formula for the saturation reduction value is: (first saturation value-saturation reference value) / saturation reference value. Therefore, it is necessary to adjust the saturation reduction value of the first pixel point downward based on the first saturation value, that is, the saturation value of the first pixel point after the saturation reduction is: first saturation value-saturation reduction value.

[0118] For example, the saturation reference value is 128. If the first saturation value of the first pixel point that is greater than the saturation reference value is 160, then the first saturation value 160 of the first pixel point needs to be reduced by (160-128) / 128=0.25. The saturation value after the saturation reduction is: 159.75.

[0119] If the first saturation value of the first pixel point that is greater than the saturation reference value is 138, then the first saturation value 138 of the first pixel point needs to be adjusted down by (138-128) / 128=0.08, and the saturation value after the saturation is reduced is: 137.92.

[0120] Step C4, obtaining a second pixel point in the image region where the target object is located whose saturation value is less than the saturation reference value;

[0121] When the mean saturation value is less than the saturation reference value, it indicates that the overall image area where the target object is located has low saturation, which is likely to cause visual discomfort. In this embodiment, the saturation of all pixels in the image area where the target object is located whose saturation value is less than the saturation reference value can be increased to make the mean saturation value of the image area where the target object is located approach the saturation reference value, so as to provide a comfortable visual experience for the user. Therefore, when it is determined that the mean saturation value is less than the saturation reference value, it is necessary to obtain all second pixels in the image area where the target object is located whose saturation value is less than the saturation reference value.

[0122] Step C5, determining a saturation-up value based on the second saturation value of the second pixel and the saturation reference value, so as to increase the saturation of the second saturation value of the second pixel according to the saturation-up value.

[0123] Among them, the calculation formula for the saturation increase value is: |second saturation value-saturation reference value| / saturation reference value. Therefore, the saturation increase value of the second pixel point needs to be adjusted upward based on the second saturation value. That is, the saturation value of the second pixel point after the saturation increase is: second saturation value + saturation increase value.

[0124] For example, the saturation reference value is still 128. If the second saturation value of the second pixel point which is less than the saturation reference value is 105, then the second saturation value 105 of the second pixel point needs to be increased by |105-128| / 128=0.18. The saturation value after the saturation increase is: 128.18.

[0125] If the second saturation value of the second pixel point that is less than the saturation reference value is 118, then the second saturation value 118 of the second pixel point needs to be increased by |118-128| / 128=0.08, and the saturation value after the saturation is increased is: 118.08.

[0126] When it is determined that the hue mean value is not equal to the hue reference value, the hue of the image region where the target object is located is adjusted so that the overall hue of the target object is close to the hue reference value. Specifically, the process of adjusting the hue of the image region where the target object is located can be implemented through steps D1 to D4:

[0127] Step D1, obtaining a third pixel point whose hue value is less than the hue reference value in the image area where the target object is located;

[0128] In this embodiment, all pixels in the image region where the target object is located whose hue values ​​are less than the hue reference value are regarded as third pixels, and all third pixels whose hue values ​​are less than the hue reference value need to be hue-right adjusted.

[0129] Step D2, determining a hue right-adjusting value based on the first hue value of the third pixel and the hue reference value, so as to perform hue right-adjustment on the first hue value of the third pixel according to the hue right-adjusting value;

[0130] Among them, the calculation formula of the right-tuning value of the hue is: |first hue value-hue reference value| / hue reference value. Therefore, it is necessary to adjust the right-tuning value of the third pixel point to the right based on the first hue value, that is, the hue value of the third pixel point after right-tuning is: first hue value+right-tuning value of the hue.

[0131] For example, the hue reference value is still 128. If the first hue value of the third pixel point that is smaller than the hue reference value is 105, then the first hue value 105 of the third pixel point needs to be adjusted right by |105-128| / 128=0.18. The hue value after right adjustment is: 128.18.

[0132] If the first hue value of the third pixel point which is smaller than the hue reference value is 118, then the first hue value 118 of the third pixel point needs to be adjusted right by |118-128| / 128=0.08, and the hue value after the hue is adjusted right is: 118.08.

[0133] Step D3, obtaining a fourth pixel point in the image region where the target object is located whose hue value is greater than the hue reference value;

[0134] In specific implementation, all pixels in the image area where the target object is located whose hue value is less than the hue reference value are regarded as fourth pixels, and all fourth pixels whose hue value is greater than the hue reference value need to be hue-lefted.

[0135] Step D4, determining a hue left-adjusting value based on the second hue value of the fourth pixel and the hue reference value, so as to left-adjust the second hue value of the fourth pixel according to the hue left-adjusting value.

[0136] Among them, the calculation formula for the left-toned hue value is: (second hue value-hue reference value) / hue reference value. Therefore, the hue value of the fourth pixel point needs to be adjusted leftward based on the second hue value, that is, the hue value of the fourth pixel point after left-toned hue is: second hue value-hue left-toned value.

[0137] For example, if the hue base value is 128, and the second hue value of the fourth pixel point that is greater than the hue base value is 160, then the second hue value 160 of the fourth pixel point needs to be adjusted down by (160-128) / 128=0.25, and the hue value after hue left adjustment is: 159.75.

[0138] If the second hue value of the fourth pixel point that is greater than the hue reference value is 138, then the second hue value 138 of the fourth pixel point needs to be adjusted down by (138-128) / 128=0.08, and the hue value after the hue is adjusted leftward is: 137.92.

[0139] Through the method in this embodiment, when it is determined that the hue mean of the image area where the target object is located does not meet the hue reference value and / or the saturation mean does not meet the saturation reference value, in the case of color cast, the hue and / or saturation of each pixel point in the image area where the target object is located is adjusted, which can effectively optimize the color performance of the compressed image, thereby effectively alleviating the existing technical problem of color cast in the image caused by image compression, greatly improving the user's viewing experience while increasing product sales.

[0140] See also Figure 5 , is a block diagram of an embodiment of an apparatus for adjusting image color provided by an embodiment of the present invention. Figure 5 As shown, the device comprises:

[0141] An acquisition module 501 is used to acquire a plurality of valid image blocks of an image region where the target object is located when a target object is identified in the compressed image;

[0142] A determination module 502, configured to determine a color cast value of a target object based on a color value of each pixel in each valid image block;

[0143] A determination module 503 is used to determine whether the color deviation value exceeds a preset color deviation threshold;

[0144] The color adjustment module 504 is configured to adjust the color of the image region where the target object is located according to a preset color reference value when it is determined that the color deviation value exceeds a preset color deviation threshold.

[0145] The device for adjusting image color provided by the embodiment of the present invention includes: when a target object in a compressed image is identified, obtaining multiple valid image blocks of the image area where the target object is located; determining the color deviation value of the target object based on the color value of each pixel in each valid image block; determining whether the color deviation value exceeds a preset color deviation threshold; when it is determined that the color deviation value exceeds the preset color deviation threshold, performing color adjustment on the image area where the target object is located according to a preset color reference value. In the above technical scheme, when it is determined that the image area where the target object of the compressed image is located has a high degree of color deviation, the image area where the target object is located can be color adjusted, which can effectively optimize the color performance of the compressed image, thereby effectively alleviating the existing technical problem of color deviation of the image caused by image compression, greatly improving the user's viewing experience while increasing product sales.

[0146] Figure 6 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention, Figure 6 The electronic device 600 shown includes: at least one processor 601, a memory 602, at least one network interface 604 and other user interfaces 603. The various components in the electronic device 600 are coupled together via a bus system 605. It is understood that the bus system 605 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 605 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 605 is not shown in FIG. Figure 6 Various buses are labeled as bus system 605 .

[0147] The user interface 603 may include a display, a keyboard, or a pointing device (eg, a mouse, a trackball, a touch pad, or a touch screen).

[0148] It can be understood that the memory 602 in the embodiment of the present invention can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct RAM bus random access memory (DRRAM). The memory 602 described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0149] In some implementations, the memory 602 stores the following elements, executable units or data structures, or a subset thereof, or an extended set thereof: an operating system 6021 and an application 6022 .

[0150] The operating system 6021 includes various system programs, such as a framework layer, a core library layer, a driver layer, etc., which are used to implement various basic services and process hardware-based tasks. The application 6022 includes various application programs, such as a media player (Media Player), a browser (Browser), etc., which are used to implement various application services. The program for implementing the method of the embodiment of the present invention can be included in the application 6022.

[0151] In the embodiment of the present invention, by calling the program or instruction stored in the memory 602, specifically, the program or instruction stored in the application 6022, the processor 601 is used to execute the method steps provided by each method embodiment.

[0152] The method disclosed in the above embodiment of the present invention can be applied to the processor 601, or implemented by the processor 601. The processor 601 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit in the processor 601 or the instruction in the form of software. The above processor 601 can be a general processor, a digital signal processor (Digital Signal Processor, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present invention can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiment of the present invention can be directly embodied as a hardware decoding processor to execute, or the hardware and software units in the decoding processor can be executed. The software unit can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 602, and the processor 601 reads the information in the memory 602 and completes the steps of the above method in combination with its hardware.

[0153] It is understood that the embodiments described herein may be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit may be implemented in one or more application specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPDevice, DSPD), programmable logic devices (PLD), field programmable gate arrays (FPGA), general purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described in the present application, or a combination thereof.

[0154] For software implementation, the technology described herein can be implemented by a unit that performs the functions described herein. The software code can be stored in a memory and executed by a processor. The memory can be implemented in the processor or outside the processor.

[0155] The electronic device provided in this embodiment may be Figure 6 The electronic device shown in FIG. 1 may perform the following steps: Figure 1 , 3 -4 all the steps of the method for image color adjustment, thereby achieving Figure 1 , 3 -4 shows the technical effect of the image color adjustment method, please refer to Figure 1 , 3 -4 Related descriptions are omitted here for the sake of brevity.

[0156] The embodiment of the present invention also provides a storage medium (computer-readable storage medium). The storage medium here stores one or more programs. The storage medium may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a read-only memory, a flash memory, a hard disk or a solid-state drive; the memory may also include a combination of the above-mentioned types of memory.

[0157] When one or more programs in the storage medium can be executed by one or more processors, the above-mentioned method of image color adjustment can be implemented.

[0158] The processor is used to execute the image color adjustment program stored in the memory to implement the steps of the image color adjustment method.

[0159] The professionals should further realize that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to the function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0160] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0161] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A method for adjusting image color, characterized in that: The method comprises: When a target object is identified in the compressed image, a plurality of valid image blocks of the image region where the target object is located are obtained; Determine the color cast value of the target object based on the color value of each pixel in each of the valid image blocks; Determining whether the color deviation value exceeds a preset color deviation threshold; When it is determined that the color deviation value exceeds a preset color deviation threshold, color adjustment is performed on the image area where the target object is located according to a preset color reference value.

2. The method according to claim 1, characterized in that The step of acquiring a plurality of valid image blocks in the image region where the target object is located comprises: Dividing the compressed image into a plurality of image blocks; A plurality of valid image blocks including only the target object are obtained from the plurality of image blocks.

3. The method according to claim 1, characterized in that The determining the color cast value of the target object based on the color value of each pixel in each of the valid image blocks includes: Determine a color difference value of each of the valid image blocks based on the color value of each pixel in each of the valid image blocks; The color cast value of the target object is determined according to the color difference values ​​of each of the valid image blocks.

4. The method according to claim 3, characterized in that The determining the color difference value of each of the valid image blocks based on the color value of each pixel in each of the valid image blocks comprises: Determine the color mean of all the valid image blocks based on the color value of each pixel in each of the valid image blocks; Determine a block color mean value of each of the valid image blocks based on the color value of each pixel in each of the valid image blocks; For each of the valid image blocks, a color difference value of the valid image block is determined according to the block color mean value and the color mean value.

5. The method according to claim 3, characterized in that: The step of determining the color cast value of the target object according to the color difference values ​​of each of the valid image blocks comprises: Taking the valid image block corresponding to the minimum color difference value as the target image block; Obtaining the center distance between each of the valid image blocks and the target image block; Determine the color difference coefficient of each of the effective image blocks according to the center distance of each of the effective image blocks; The color cast value of the target object is determined based on the color difference coefficients and the color difference values ​​corresponding to each of the valid image blocks.

6. The method according to claim 5, characterized in that The step of determining the color difference coefficient of each of the valid image blocks according to the center distance of each of the valid image blocks comprises: For each of the valid image blocks, querying a color difference coefficient corresponding to the center distance from a color difference coefficient query table; wherein the color difference coefficient query table stores a corresponding relationship between the center distance and the color difference coefficient; The color difference coefficient is determined as the color difference coefficient of the valid image block.

7. The method according to claim 1, characterized in that The preset color reference value includes a hue reference value and a saturation reference value; The step of adjusting the color of the image area where the target object is located according to the preset color reference value includes: Acquire the hue value and saturation value of each pixel in the image area where the target object is located; Determine a hue mean based on the hue value of each pixel point in the image region where the target object is located, and determine a saturation mean based on the saturation value of each pixel point in the image region where the target object is located; Determining whether the saturation mean value is equal to the saturation reference value, and whether the hue mean value is equal to the hue reference value; When it is determined that the saturation mean is not equal to the saturation reference value, the saturation of the image area where the target object is located is adjusted based on the saturation reference value, and / or, when it is determined that the hue mean is not equal to the hue reference value, the hue of the image area where the target object is located is adjusted based on the hue reference value.

8. The method according to claim 7, characterized in that The step of adjusting the saturation of the image region where the target object is located based on the saturation reference value includes: Determine whether the saturation mean value is less than the saturation reference value; In the case where it is determined that the saturation mean value is greater than the saturation reference value, obtaining a first pixel point in the image region where the target object is located, the first pixel point having a saturation value greater than the saturation reference value; Determine a saturation down-adjustment value based on the first saturation value of the first pixel and the saturation reference value, so as to down-adjust the saturation of the first saturation value of the first pixel according to the saturation down-adjustment value; When it is determined that the saturation mean value is less than the saturation reference value, obtaining a second pixel point in the image region where the target object is located, the second pixel point having a saturation value less than the saturation reference value; A saturation-up value is determined based on the second saturation value of the second pixel and the saturation reference value, so as to increase the saturation of the second saturation value of the second pixel according to the saturation-up value.

9. The method according to claim 7, characterized in that: The step of adjusting the hue of the image region where the target object is located based on the hue reference value includes: Acquire a third pixel point in the image region where the target object is located, the third pixel point having a hue value less than the hue reference value; Determine a hue right-adjustment value based on the first hue value of the third pixel and the hue reference value, so as to perform hue right-adjustment on the first hue value of the third pixel according to the hue right-adjustment value; Acquire a fourth pixel point in the image region where the target object is located, the fourth pixel point having a hue value greater than the hue reference value; A hue left-adjustment value is determined based on the second hue value of the fourth pixel and the hue reference value, so as to left-adjust the second hue value of the fourth pixel according to the hue left-adjustment value.

10. A device for adjusting image color, characterized in that: The device comprises: An acquisition module, configured to acquire, when a target object in a compressed image is identified, a plurality of valid image blocks of an image region where the target object is located; A determination module, configured to determine a color cast value of the target object based on a color value of each pixel in each of the valid image blocks; A determination module, used to determine whether the color deviation value exceeds a preset color deviation threshold; The color adjustment module is used to adjust the color of the image area where the target object is located according to a preset color reference value when it is determined that the color deviation value exceeds a preset color deviation threshold.