Image color adjustment method and device, computer readable storage medium, and terminal
By determining the color index difference value and the preset difference threshold in image processing and adjusting the parameters to be adjusted for the image, the accuracy and stability problems of image color casting debugging in the prior art are solved, and more efficient and accurate color correction is achieved.
Patent Information
- Application Number
- CN202210130443.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-11
- Publication Date
- 2025-04-22
- Estimated Expiration
- 2042-02-11
AI Technical Summary
When dealing with image color casting problems, the prior art has low accuracy and stability, especially for color casting problems caused by different reasons and similar visual perception, the misjudgment rate is high.
By determining the comparison between the color index difference value of the image and the preset difference threshold, determine the parameters to be adjusted corresponding to the color index parameters, and perform one or more rounds of adjustments, and adjust the adjustment step size according to the size of the color index difference.
Improve the accuracy and efficiency of image color adjustment, reduce the misjudgment rate, and achieve more accurate and efficient color correction.
Smart Images

Figure CN114463219B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing, and in particular to an image color adjustment method and device, a computer-readable storage medium, and a terminal. Background Art
[0002] In the field of image effect debugging, debugging color cast has always been a key and difficult point. Specifically, due to the influence of the light and other environmental factors when taking pictures, the captured images may have color cast problems, such as the blue sky in the image being gray or yellow, which cannot accurately reflect the true color of the captured object or scene.
[0003] In the prior art, such images with color deviation are mainly corrected by manual operation. Specifically, the debugging engineer can observe the color cast of the image with the naked eye, and then try to adjust the parameters based on experience. However, the accuracy and stability of naked eye observation are low, especially for color cast problems caused by different reasons and with similar appearance, the misjudgment rate is high.
[0004] There is an urgent need for an image color adjustment method that can improve the efficiency and accuracy of color cast debugging. Summary of the invention
[0005] The technical problem solved by the present invention is to provide an image color adjustment method and device, a computer-readable storage medium, and a terminal, which can improve the accuracy of adjustment while also improving the adjustment efficiency.
[0006] To solve the above technical problems, an embodiment of the present invention provides an image color adjustment method, comprising: determining the values of one or more color index parameters of an image to be debugged, obtaining the values of the same color index parameters of a target image, and calculating a color index difference; if there is at least one color index difference greater than or equal to a preset difference threshold, determining a parameter to be adjusted corresponding to the color index parameter, wherein each color index parameter has a preset corresponding relationship with one or more parameters to be adjusted; performing one or more rounds of adjustment on the corresponding parameters to be adjusted of the image to be debugged, wherein after each round of adjustment, the color index difference is determined again, and if the color index difference is still greater than or equal to the preset difference threshold, continuing to adjust the corresponding parameters to be adjusted until the adjusted color index difference is less than the preset difference threshold; wherein, in each round of adjustment, the larger the color index difference in the current round, the larger the step size for adjustment, and the smaller the color index difference in the current round, the smaller the step size for adjustment.
[0007] Optionally, performing one or more rounds of adjustments on the corresponding parameters to be adjusted of the image to be debugged includes: determining an initial adjustment step of the parameters to be adjusted; dividing adjustment levels based on the initial adjustment step, each adjustment level corresponding to a different color index difference range and having its own adjustment step, and the larger the color index difference, the larger the adjustment step in the corresponding adjustment level; using the initial adjustment step to perform the first round of adjustment, and in each subsequent round of adjustment, using the adjustment step in the adjustment level to which the color index difference in the current round belongs to adjust the corresponding parameters to be adjusted of the image to be debugged.
[0008] Optionally, determining the initial adjustment step of the parameter to be adjusted includes: extracting auxiliary information; determining an estimated selected value range of the parameter to be adjusted based on the auxiliary information; determining the initial adjustment step based on the upper and lower limit difference of the estimated selected value range; wherein, the larger the upper and lower limit difference of the estimated selected value range, the larger the initial adjustment step.
[0009] Optionally, extracting the auxiliary information includes: acquiring an Exchangeable Image File Format (EXIF) file of the image to be debugged; and extracting the auxiliary information from the EXIF file.
[0010] Optionally, the auxiliary information includes scene mode information and shooting auxiliary information; determining the estimated selected value range of the parameter to be adjusted according to the auxiliary information includes: determining the initial parameter value range of the parameter to be adjusted according to the scene mode information, each parameter of each scene mode has a preset value range; according to the shooting auxiliary information, selecting at least a part within the initial parameter value range as the estimated selected value range.
[0011] Optionally, the shooting auxiliary information is selected from one or more of the following: shooting brightness and color temperature of the image to be debugged.
[0012] Optionally, determining the value of one or more color index parameters of the image to be debugged includes: extracting red, green, and blue (RGB) color gamut pixel data of the image to be debugged; and calculating the value of the color index parameter according to the RGB color gamut pixel data.
[0013] Optionally, the color index parameter is selected from one or more of the following: chroma, hue and saturation.
[0014] Optionally, the target image and the image to be debugged are shot under the same scene mode; and / or, the difference in shooting brightness between the target image and the image to be debugged is within a preset brightness range, and / or, the difference in color temperature between the target image and the image to be debugged is within a preset color temperature range.
[0015] Optionally, the method further includes: recording the mapping relationship between the adjusted parameters to be adjusted and the values of the various color index parameters of the image to be debugged; when the difference between the values of the various color index parameters of a new image to be debugged and the values of the various color index parameters of the image to be debugged is less than a preset difference, using the adjusted values of the parameters to be adjusted as the initial value.
[0016] To solve the above technical problems, an embodiment of the present invention provides an image color adjustment device, comprising: a difference determination module, used to determine the values of one or more color index parameters of an image to be debugged, obtain the values of the same color index parameters of a target image, and calculate the color index difference; a parameter determination module, used to determine the to-be-adjusted parameter corresponding to the color index parameter when there is at least one color index difference greater than or equal to a preset difference threshold, wherein each color index parameter has a preset corresponding relationship with one or more to-be-adjusted parameters; an adjustment module, used to perform one or more rounds of adjustment on the corresponding to-be-adjusted parameter of the image to be debugged, wherein the color index difference is determined again after each round of adjustment, and if the color index difference is still greater than or equal to the preset difference threshold, the corresponding to-be-adjusted parameter continues to be adjusted until the adjusted color index difference is less than the preset difference threshold; wherein, in each round of adjustment, the larger the color index difference in the current round, the larger the step length for adjustment, and the smaller the color index difference in the current round, the smaller the step length for adjustment.
[0017] In order to solve the above technical problem, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above image color adjustment method are executed.
[0018] To solve the above technical problem, an embodiment of the present invention provides a terminal, including a memory and a processor, wherein the memory stores computer instructions that can be executed on the processor, and the processor executes the steps of the above image color adjustment method when executing the computer instructions.
[0019] Compared with the prior art, the technical solution of the embodiment of the present invention has the following beneficial effects:
[0020] In an embodiment of the present invention, by determining the color index difference and comparing it with a preset difference threshold, the parameter to be adjusted corresponding to the color index parameter is determined and adjusted in one or more rounds. In each round of adjustment, the larger the color index difference, the larger the step size of the adjustment. Compared with the prior art, the parameter to be adjusted is directly selected according to the value of the color index parameter, and the effect feedback and verification are obtained through experiments after each adjustment. By adopting the scheme of the embodiment of the present invention, it is possible to determine whether the parameter needs to be adjusted according to the color index difference and the preset difference threshold, thereby improving the accuracy of the judgment on whether to adjust the parameter; it is also possible to select appropriate parameters to be adjusted according to the preset corresponding relationship, thereby improving the accuracy of the judgment on which parameters to adjust; it is also possible to select the step size for adjustment in the current round according to the color index difference. The farther away from the correct value, the larger the step size is, and the closer to the correct value, the smaller the step size is. This can improve the accuracy of the adjustment while taking into account the improvement of the adjustment efficiency.
[0021] Furthermore, by first determining the initial adjustment step and then dividing the adjustment levels based on the initial adjustment step, the setting of the adjustment levels can be targeted, such as avoiding the situation where the initial adjustment step is too large but the subsequent adjustment step is too small, thereby further improving the efficiency and accuracy of the adjustment; and each adjustment level corresponds to a different color index difference range and has its own adjustment step, so that subsequent rounds of adjustments can be consistent, avoiding the situation where the level is high but the adjustment step is small.
[0022] Further, the estimated value range of the parameter to be adjusted is determined based on the auxiliary information, and then the initial adjustment step is determined based on the difference between the upper and lower limits of the estimated value range. Since the adjustment step of each subsequent round of adjustment is less than or equal to the initial adjustment step, and a larger initial adjustment step can improve the adjustment efficiency, and a smaller initial adjustment step can improve the adjustment accuracy, the solution of the embodiment of the present invention can strike a balance between the adjustment efficiency and the adjustment accuracy.
[0023] Furthermore, an initial parameter value range of the parameter to be adjusted is determined based on the scene mode information, each parameter of each scene mode has a preset value range, and based on the shooting auxiliary information, at least a part of the initial parameter value range is selected as the estimated selected value range, which can reduce the upper and lower limit difference of the estimated selected value range, thereby reducing the initial adjustment step size, and further improving the adjustment efficiency while maintaining the adjustment accuracy.
[0024] Furthermore, the target image and the image to be debugged are shot under the same scene mode, and the difference in shooting brightness between the target image and the image to be debugged is within a preset brightness range, and / or the difference in color temperature between the target image and the image to be debugged is within a preset color temperature range, so that the target image can be used as a benchmark, so that the debugged image to be debugged can be closer to the target image, thereby improving the effectiveness of the adjustment. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 is a flow chart of an image color adjustment method in an embodiment of the present invention;
[0026] Figure 2 yes Figure 1 A flowchart of a specific implementation of step S13;
[0027] Figure 3 yes Figure 2 A flowchart of a specific implementation of step S21;
[0028] Figure 4 yes Figure 3 A flowchart of a specific implementation of step S32;
[0029] Figure 5 is a flow chart of a model training method in an embodiment of the present invention;
[0030] Figure 6 It is a structural schematic diagram of an image color adjustment device in an embodiment of the present invention. DETAILED DESCRIPTION
[0031] As mentioned above, due to the influence of the environment such as light when taking pictures, the captured images may have color cast problems and cannot accurately reflect the true color of the captured objects or scenes. In the prior art, such images with color cast are mainly corrected by manual operation, resulting in low accuracy and stability of correction, especially for color cast problems with similar appearance caused by different reasons, the misjudgment rate is high.
[0032] The inventor of the present invention has found through research that in the prior art, when an image has a color cast problem, it is often corrected and debugged manually.
[0033] Specifically, the area where the color cast occurs and the details of the color cast in the image may be observed and located first. For example, when the blue sky in the image is grayish or yellowish, only the blue sky area may be adjusted.
[0034] Then, the shooting information of the image, such as color temperature, brightness, etc., can be determined, and then based on the color cast and shooting information, the possible causes of color cast and parameter debugging solutions can be judged combined with experience, modules and parameters can be selected for debugging, and effect feedback and verification can be obtained through experiments.
[0035] However, the accuracy and stability of manual observation are often not high, and the degree of disagreement is also large. In addition, the color cast problem has a certain degree of complexity and confusion. Often two similar color cast situations correspond to completely different causes and parameter debugging solutions. Inexperienced debugging engineers may need multiple attempts to find the cause of the color cast, and the misjudgment rate is high.
[0036] In an embodiment of the present invention, by determining the color index difference and comparing it with a preset difference threshold, the parameter to be adjusted corresponding to the color index parameter is determined and adjusted in one or more rounds. In each round of adjustment, the larger the color index difference, the larger the step size of the adjustment. Compared with the prior art, the parameter to be adjusted is directly selected according to the value of the color index parameter, and the effect feedback and verification are obtained through experiments after each adjustment. By adopting the scheme of the embodiment of the present invention, it is possible to determine whether the parameter needs to be adjusted according to the color index difference and the preset difference threshold, thereby improving the accuracy of the judgment on whether to adjust the parameter; it is also possible to select appropriate parameters to be adjusted according to the preset corresponding relationship, thereby improving the accuracy of the judgment on which parameters to adjust; it is also possible to select the step size for adjustment in the current round according to the color index difference. The farther away from the correct value, the larger the step size is, and the closer to the correct value, the smaller the step size is. This can improve the accuracy of the adjustment while taking into account the improvement of the adjustment efficiency.
[0037] In order to make the above-mentioned objects, features and beneficial effects of the present invention more obvious and easy to understand, specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0038] Reference Figure 1 , Figure 1 1 is a flow chart of an image color adjustment method in an embodiment of the present invention. The image color adjustment method may include steps S11 to S13:
[0039] Step S11: determining the value of one or more color index parameters of the image to be debugged, obtaining the value of the same color index parameter of the target image, and calculating the color index difference;
[0040] Step S12: if there is at least one color index difference greater than or equal to a preset difference threshold, determining a parameter to be adjusted corresponding to the color index parameter, wherein each color index parameter has a preset corresponding relationship with one or more parameters to be adjusted;
[0041] Step S13: perform one or more rounds of adjustment on the corresponding parameters to be adjusted of the image to be debugged, wherein the color index difference is determined again after each round of adjustment, and if the color index difference is still greater than or equal to the preset difference threshold, continue to adjust the corresponding parameters to be adjusted until the adjusted color index difference is less than the preset difference threshold, wherein in each round of adjustment, the larger the color index difference in the current round, the larger the step size for adjustment, and the smaller the color index difference in the current round, the smaller the step size for adjustment.
[0042] It is understandable that, in a specific implementation, the method can be implemented in the form of a software program, which runs in a processor integrated inside a chip or a chip module; or, the method can be implemented in the form of hardware or a combination of hardware and software.
[0043] In the specific implementation of step S11, one or more color index parameters are selected, and the values of the selected color index parameters are determined for the image to be debugged and the target image, respectively.
[0044] The color index parameter may be used to indicate whether the image color of the image to be debugged has a color cast problem, so that the image color cast problem can be improved after image signal processing (ISP) tuning.
[0045] Furthermore, the color index parameter may be selected from one or more of the following: chroma, hue and saturation.
[0046] Specifically, chroma can be the depth of color, indicating the degree of color intensity of the entire picture.
[0047] Hue can be the relative lightness or darkness of an image, and in color images it is represented by color.
[0048] Saturation can be the intensity or purity of a color, and as a non-limiting example, can represent the proportion of gray components in the hue, expressed as 0%-100% (pure color).
[0049] Furthermore, the target image and the image to be debugged may be shot under the same scene mode; and the difference in shooting brightness between the target image and the image to be debugged is within a preset brightness range, and / or the difference in color temperature between the target image and the image to be debugged is within a preset color temperature range.
[0050] Among them, scene mode can be used in digital photography to pre-adjust parameter values such as aperture, shutter, focal length, metering method and flash for different scenes, so that users can take images with higher quality assurance. For example, it can include landscape mode, portrait mode, food mode, night mode, etc.
[0051] Brightness can be the brightness of a picture, or a dimension of a color space related to the brightness of a color. In a color space, brightness can be used to reflect a human's subjective sense of brightness.
[0052] Color temperature can be a probability formulated by combining color and temperature, quantified in Kelvin temperature (K value).
[0053] It should be pointed out that the closer the shooting scene and shooting parameters of the target image and the image to be debugged are, the closer the image to be debugged after the adjustment is made will be to the target image.
[0054] In a non-limiting specific implementation, a camera device for shooting a target image and a camera device for shooting an image to be debugged may be placed side by side for shooting, and ISP debugging may be performed to achieve that the image to be debugged is close to the target image.
[0055] In an embodiment of the present invention, the target image and the image to be debugged are shot under the same scene mode, and the difference in shooting brightness between the target image and the image to be debugged is within a preset brightness range, and / or the difference in color temperature between the target image and the image to be debugged is within a preset color temperature range, so that the target image can be used as a benchmark, so that the debugged image to be debugged can be closer to the target image, thereby improving the effectiveness of image color adjustment.
[0056] Furthermore, the step of determining the value of one or more color index parameters of the image to be debugged may include: extracting red-green-blue (RGB) color gamut pixel data of the image to be debugged; and calculating the value of the color index parameter based on the RGB color gamut pixel data.
[0057] Among them, the RGB color mode can be a color standard, which obtains various colors by changing the three color channels of red (R), green (G), and blue (B) and superimposing them on each other.
[0058] In a specific implementation, conventional techniques may be used to calculate the value of the color index parameter, and the embodiment of the present invention does not limit the specific calculation steps.
[0059] After determining the values of one or more color index parameters of the image to be debugged and obtaining the values of the same color index parameters of the target image, the color index difference can also be calculated, for example, the chromaticity difference is calculated using the chromaticity of the image to be debugged and the target image, the hue difference is calculated using the hue of the image to be debugged and the target image, the saturation difference is calculated using the saturation of the image to be debugged and the target image, etc.
[0060] In the specific implementation of step S12, if there is at least one color index difference greater than or equal to a preset difference threshold, it can be determined that the image color of the image to be debugged and the target image is significantly different and needs to be adjusted.
[0061] Specifically, each color index parameter has a preset corresponding relationship with one or more parameters to be adjusted, and the preset corresponding relationship may be collected and sorted based on empirical data.
[0062] In the specific implementation of step S13, the corresponding parameters to be adjusted of the image to be debugged can be adjusted, and after each round of adjustment, the color index difference is determined again, and if the color index difference is still greater than or equal to the preset difference threshold, adjustment is performed again, and if the color index difference is less than the preset difference threshold, adjustment is stopped.
[0063] It should be noted that when there are multiple color index differences that are all greater than or equal to the preset difference threshold, the color index differences can be adjusted one by one. For example, when the chromaticity difference exceeds the preset chromaticity difference threshold, and the saturation difference exceeds the preset saturation difference threshold, the parameter to be adjusted corresponding to one of them (such as chromaticity) can be selected first to be adjusted until the chromaticity difference is less than the preset chromaticity difference threshold, and then the parameter to be adjusted corresponding to the other color index parameter (such as saturation) can be adjusted until the saturation difference is less than the preset saturation difference threshold.
[0064] Reference Figure 2 , Figure 2 yes Figure 1 The step of performing one or more rounds of adjustment on the corresponding parameters to be adjusted of the image to be debugged may include steps S21 to S23, and each step is described below.
[0065] In step S21, an initial adjustment step length of the parameter to be adjusted is determined.
[0066] In a specific implementation of the embodiment of the present invention, a preset initial adjustment step A0 may be used. For example, no matter how large the color index difference is, A0 is used for the first round of adjustment, and then a step smaller than A1 is used for the second round of adjustment, and A1<A0.
[0067] It is understandable that the use of the preset initial adjustment step A0 can improve the adjustment efficiency and reduce the amount of calculation. However, since the preset initial adjustment step A0 is a pre-set fixed value and does not take into account the specific situation of the current color index difference, there may be a problem of too many adjustment rounds when the color index difference is large but too small an initial adjustment step A0 is used, or there may be a problem of insufficient adjustment accuracy when the color index difference is small but too large an initial adjustment step A0 is used.
[0068] In another specific implementation of the embodiment of the present invention, the initial adjustment step length A0 may be determined according to specific circumstances, and the subsequent adjustment step length A1 may be determined according to A0, A2 may be determined according to A0 or A1, and so on.
[0069] Reference Figure 3 , Figure 3 yes Figure 2 The step of determining the initial adjustment step of the parameter to be adjusted may include steps S31 to S33, and each step is described below.
[0070] In step S31, auxiliary information is extracted.
[0071] The auxiliary information may include scene mode information and shooting auxiliary information. The scene mode information may be used to indicate different scene modes and parameter value ranges under each scene mode. The shooting auxiliary information may be used to indicate shooting parameters of the image to be debugged, which belongs to the instantaneous situation during shooting.
[0072] Furthermore, the shooting auxiliary information may be selected from one or more of the following: shooting brightness and color temperature of the image to be adjusted.
[0073] The shooting brightness can be the brightness of the picture, or the dimension of the color space related to the brightness of the color. In the color space, brightness can be used to reflect the subjective brightness feeling of human beings. The color temperature can be a probability formulated by combining color and temperature, and is quantified in Kelvin temperature (K value).
[0074] For more information about scene modes, please refer to the previous description, which will not be repeated here.
[0075] In the embodiment of the present invention, the auxiliary information may be obtained from an auxiliary file of the image to be debugged, or may be confirmed after being calculated in a conventional manner.
[0076] Furthermore, the step of extracting the auxiliary information may include: obtaining an Exchangeable image file format (EXIF) file of the image to be debugged; and extracting the auxiliary information from the EXIF file.
[0077] Specifically, EXIF is an image file format, and its data storage is exactly the same as the Joint Photographic Experts Group (JPEG) format. EXIF format can be inserted into the JPEG format header with the information of digital photos, including the aperture, shutter, white balance, International Organization for Standardization (ISO), focal length, date and time, and shooting conditions, as well as camera brand, model, color coding, sound recorded during shooting, global positioning system data, thumbnails, etc.
[0078] It should be noted that the above EXIF file is only used to indicate a conventional file containing the above parameters, but the implementation of the embodiment of the present invention is not limited to this.
[0079] In step S32, the estimated selected value range of the parameter to be adjusted is determined according to the auxiliary information.
[0080] Reference Figure 4 , Figure 4 yes Figure 3 The step of determining the initial adjustment step of the parameter to be adjusted may include steps S41 to S42, and each step is described below.
[0081] Step S41: determining an initial parameter value range of the parameter to be adjusted according to the scene mode information, wherein each parameter of each scene mode has a preset value range.
[0082] Specifically, taking the night scene mode as an example, in order to improve the brightness, the values of the relevant parameters related to the brightness may be larger and have a different value range from that of the day scene mode.
[0083] Step S42: selecting at least a portion of the initial parameter value range as the estimated selected value range according to the shooting auxiliary information.
[0084] Specifically, the value may be selected according to a preset value selection strategy, such as selecting the entire value range, or selecting only a part of it.
[0085] Continuing with the example of the aforementioned night scene mode, if the brightness indicated by the shooting auxiliary information is a higher value in the brightness value range, the higher part of the brightness value range (such as 60% to 100%) can be selected as the estimated selected value range. Conversely, if the brightness indicated by the shooting auxiliary information is a lower value in the brightness value range, the lower part of the brightness value range (such as 0% to 60%) can be selected as the estimated selected value range.
[0086] In an embodiment of the present invention, an initial parameter value range of the parameter to be adjusted is determined according to the scene mode information, each parameter of each scene mode has a preset value range, and according to the shooting auxiliary information, at least a part of the initial parameter value range is selected as the estimated selected value range, which can reduce the upper and lower limit difference of the estimated selected value range, thereby reducing the initial adjustment step size, and further improving the adjustment efficiency while maintaining the adjustment accuracy.
[0087] Continue to refer to Figure 3 In step S33, the initial adjustment step is determined according to the difference between the upper and lower limits of the estimated selected value range; wherein, the larger the difference between the upper and lower limits of the estimated selected value range is, the larger the initial adjustment step is.
[0088] Continuing with the example of the aforementioned night scene mode, if 60% to 100% is selected as the estimated selection range, the difference between the upper and lower limits is 40%, compared to selecting 0% to 60% as the estimated selection range, the difference between the upper and lower limits is 60%. The initial adjustment step of the former can be smaller than that of the latter.
[0089] In an embodiment of the present invention, the estimated value range of the parameter to be adjusted is determined based on the auxiliary information, and then the initial adjustment step is determined based on the difference between the upper and lower limits of the estimated value range. Since the adjustment step of each subsequent round of adjustment is less than or equal to the initial adjustment step, and a larger initial adjustment step can improve the adjustment efficiency, and a smaller initial adjustment step can improve the adjustment accuracy, the solution of the embodiment of the present invention can strike a balance between the adjustment efficiency and the adjustment accuracy.
[0090] Continue to refer to Figure 2 In step S22, adjustment levels are divided based on the initial adjustment step, each adjustment level corresponds to a different color index difference range and has its own adjustment step, and the larger the color index difference, the larger the adjustment step in the corresponding adjustment level.
[0091] Specifically, the initial adjustment step is first determined, and then the adjustment levels are divided based on the initial adjustment step, so that the setting of the adjustment level can be targeted, such as avoiding the situation where the initial adjustment step is too large but the subsequent adjustment step is too small.
[0092] Each adjustment level corresponds to a different color index difference range and has its own adjustment step, so that subsequent rounds of adjustments can be consistent, avoiding the situation where the adjustment step is small for a high level or large for a low level, or the situation where the adjustment step is large for a low level or small for a high level.
[0093] In step S23, the initial adjustment step is used to perform the first round of adjustment, and in each subsequent round of adjustment, the adjustment step in the adjustment level to which the color index difference in the current round belongs is used to adjust the corresponding parameters to be adjusted of the image to be adjusted.
[0094] In a non-limiting specific embodiment, taking the color index parameter as hue (Hue) and the corresponding parameters to be adjusted as P1 and P2 as an example, information such as brightness and color temperature is extracted from the auxiliary information, and then the P1 parameter range is set to [L1, H1] according to the brightness information, and the P2 parameter range is set to [L2, H2] according to the color temperature information.
[0095] When the Hue difference is in the range of [40,100], P1 is reduced by 15 / step and P2 is increased by 20 / step. Then the adjusted parameters are written to the chip and the corresponding image is obtained. The current Hue difference is calculated again.
[0096] When the Hue difference is in the range of [25,40], P1 is reduced by 5 / step and P2 is increased by 10 / step. Then the adjusted parameters are written to the chip and the corresponding image is obtained. The current Hue difference is calculated again.
[0097] When the Hue difference is in the range of [20,25], P1 is reduced by a step size of 1 / step, and P2 is increased by a step size of 2 / step. Then the adjusted parameters are written to the chip and the corresponding image is obtained. The current Hue difference is calculated again and obtained. When the Hue difference is reduced to within the preset difference threshold (for example, 2), the adjustment is considered to be completed.
[0098] In the above example, [40, 100], [25, 40], [20, 25], etc. are respectively used to indicate various adjustment levels, and each adjustment level has its own adjustment step.
[0099] In an embodiment of the present invention, the initial adjustment step is first determined, and then the adjustment levels are divided based on the initial adjustment step, so that the setting of the adjustment level can be targeted, such as avoiding the situation where the initial adjustment step is too large but the subsequent adjustment step is too small, thereby further improving the efficiency and accuracy of the adjustment; and each adjustment level corresponds to a different color index difference range and has its own adjustment step, so that subsequent rounds of adjustments can be consistent, avoiding the situation where the level is high but the adjustment step is small.
[0100] Continue to refer to Figure 1 After step S13, the image color adjustment method may further include: recording the mapping relationship between the adjusted parameters to be adjusted and the values of the various color index parameters of the image to be debugged; when the difference between the values of the various color index parameters of the new image to be debugged and the values of the various color index parameters of the image to be debugged is less than a preset difference, using the adjusted values of the parameters to be adjusted as the initial values.
[0101] In the embodiment of the present invention, by recording the mapping relationship between the adjusted parameters to be adjusted and the values of each color index parameter of the image to be debugged, a specific parameter debugging strategy can be stored for the problematic module and parameter set and applied to subsequent applicable situations.
[0102] Furthermore, if the difference between the value of each color index parameter of the new image to be debugged and the value of each color index parameter of the image to be debugged is less than the preset difference, the difference between the multiple color index parameters between the new image to be debugged and the image to be debugged can be calculated respectively, and then compared with the preset difference after weighted operation.
[0103] In an embodiment of the present invention, by determining that the difference between the value of each color index parameter of the new image to be debugged and the value of each color index parameter of the image to be debugged is less than a preset difference, the adjusted value of the parameter to be adjusted is used as the initial value, so as to effectively screen out scenes suitable for adopting the parameter debugging strategy.
[0104] In an embodiment of the present invention, by determining the color index difference and comparing it with a preset difference threshold, the parameter to be adjusted corresponding to the color index parameter is determined and adjusted in one or more rounds. In each round of adjustment, the larger the color index difference, the larger the step size of the adjustment. Compared with the prior art, the parameter to be adjusted is directly selected according to the value of the color index parameter, and the effect feedback and verification are obtained through experiments after each adjustment. By adopting the scheme of the embodiment of the present invention, it is possible to determine whether the parameter needs to be adjusted according to the color index difference and the preset difference threshold, thereby improving the accuracy of the judgment on whether to adjust the parameter; it is also possible to select appropriate parameters to be adjusted according to the preset corresponding relationship, thereby improving the accuracy of the judgment on which parameters to adjust; it is also possible to select the step size for adjustment in the current round according to the color index difference. The farther away from the correct value, the larger the step size is, and the closer to the correct value, the smaller the step size is. This can improve the accuracy of the adjustment while taking into account the improvement of the adjustment efficiency.
[0105] It should be pointed out that in the embodiment of the present invention, the model can be pre-trained to improve the efficiency, accuracy and feasibility of some steps.
[0106] Specifically, the scene recognition model and the image segmentation model may be trained separately to judge the scene mode of the image to be debugged, and to perform segmentation processing on the image to be debugged to reserve the block to be debugged.
[0107] Reference Figure 5 , Figure 5 1 is a flow chart of a model training method in an embodiment of the present invention. The model training method may include steps S51 to S59, and each step is described below.
[0108] In step S51, a neural network is constructed.
[0109] Specifically, a suitable deep neural network can be built according to the characteristics of the scene recognition task, taking into account both computational complexity and performance.
[0110] It should be pointed out that if the task is image segmentation, a suitable deep neural network can also be built according to the characteristics of the image segmentation task. Since the two processes are very similar, the training process of the scene recognition model is used as an example to illustrate the following.
[0111] In step S52, a data set is constructed.
[0112] Specifically, for scenes where color cast problems often occur, a large number of pictures can be taken and labeled to build a scene recognition data set.
[0113] In step S53, the image is pre-processed.
[0114] Specifically, before the image is input into the neural network, it may be necessary to preprocess the image according to the network characteristics, such as scaling.
[0115] In step S54, the model is trained.
[0116] Specifically, the image data in the training set is sent to the preprocessing module in the previous step for processing. After obtaining suitable pictures, they are sent to the neural network for training, and the output of the model loss function is monitored.
[0117] In step S55, the model is verified.
[0118] Specifically, in parallel with model training, the accuracy of the model in training is continuously calculated based on the validation dataset.
[0119] In step S56, does the model accuracy meet the requirements?
[0120] Specifically, if the model accuracy reaches expectations (eg, a preset accuracy threshold), step S57 may be executed, otherwise the process returns to step S54 to continue model training.
[0121] In step S57, the model is tested.
[0122] Specifically, after the model training and verification is completed, a set of recognition models will be output, and on this basis, the actual effect will be tested using the test data set.
[0123] In step S58, does the test result meet the requirements?
[0124] Specifically, if the test data set is used to test the actual effect of the recognition model and the test result meets expectations, step S58 can be executed, otherwise return to step S52 to continue building the data set, such as re-collecting images and restarting the training process.
[0125] In step S59, the model is output.
[0126] Specifically, the final scene recognition model can be output.
[0127] In the embodiment of the present invention, existing models can also be used for implementation. For example, scene recognition can be implemented using ResNet50 as the basic network, and image segmentation can be implemented using DeeplabV4 as the basic network. By receiving an image with a color cast problem as input, the shooting scene information of the image can be determined, such as day scene / night scene, outdoor / indoor, and this information is the basis for subsequent judgment. It is also possible to identify and segment iconic targets in the image that are conducive to color analysis, such as the sky, color cards, faces, etc. By adopting the model, the implementation efficiency and accuracy can be improved.
[0128] Reference Figure 6 , Figure 6 : is a schematic diagram of the structure of an image color adjustment device in an embodiment of the present invention. The image color adjustment device may include:
[0129] The difference determination module 61 is used to determine the value of one or more color index parameters of the image to be debugged, obtain the value of the same color index parameter of the target image, and calculate the color index difference;
[0130] A parameter determination module 62, configured to determine a parameter to be adjusted corresponding to the color index parameter when at least one color index difference is greater than or equal to a preset difference threshold, wherein each color index parameter has a preset corresponding relationship with one or more parameters to be adjusted;
[0131] The adjustment module 63 is used to perform one or more rounds of adjustment on the corresponding parameters to be adjusted of the image to be debugged, wherein the color index difference is determined again after each round of adjustment, and if the color index difference is still greater than or equal to the preset difference threshold, the corresponding parameters to be adjusted continue to be adjusted until the adjusted color index difference is less than the preset difference threshold; wherein, in each round of adjustment, the larger the color index difference in the current round, the larger the step size of the adjustment, and the smaller the color index difference in the current round, the smaller the step size of the adjustment.
[0132] In a specific implementation, the above-mentioned image color adjustment device may correspond to a chip with a color adjustment function; or correspond to a chip module with a color adjustment function in a terminal, or correspond to a terminal.
[0133] about Figure 6 For more information on the working principle, working method and beneficial effects of the image color adjustment device shown in FIG. Figures 1 to 5 The relevant description will not be repeated here.
[0134] The embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned image color adjustment method are executed. The storage medium may include ROM, RAM, a magnetic disk or an optical disk, etc. The storage medium may also include a non-volatile memory or a non-transitory memory, etc.
[0135] The embodiment of the present invention further provides a terminal, including a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and the processor executes the steps of the above-mentioned image color adjustment method when running the computer program. The terminal includes but is not limited to terminal devices such as mobile phones, computers, tablet computers, servers, and cloud platforms.
[0136] It should be understood that in the embodiments of the present application, the processor may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0137] It should also be understood that the memory in the embodiments of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may 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 may be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of random access memory (RAM) are available, such as static RAM (SRAM), dynamic random access memory (DRAM), synchronous DRAM (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link DRAM (SLDRAM) and direct rambus RAM (DR RAM).
[0138] The above embodiments may be implemented in whole or in part by software, hardware, firmware or any other combination thereof. When implemented using software, the above embodiments may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, the processes or functions described in the embodiments of the present application are generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer program may be stored in a computer-readable storage medium, or may be transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer program may be transmitted from one website, computer, server or data center to another website, computer, server or data center by wired or wireless means.
[0139] In the several embodiments provided in the present application, it should be understood that the disclosed methods, devices and systems can be implemented in other ways. For example, the device embodiments described above are merely schematic; for example, the division of the units is only a logical function division, and there may be other division methods in actual implementation; for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the scheme of this embodiment.
[0140] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may be physically included separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units. For example, for each device or product applied to or integrated in a chip, each module / unit contained therein may be implemented in the form of hardware such as circuits, or at least part of the modules / units may be implemented in the form of software programs, which run on a processor integrated inside the chip, and the remaining (if any) modules / units may be implemented in the form of hardware such as circuits; for each device or product applied to or integrated in a chip module, each module / unit contained therein may be implemented in the form of hardware such as circuits, and different modules / units may be located in the same component (such as a chip, circuit module, etc.) or different components of the chip module, or at least part of the modules / units may be implemented in the form of software programs. The element can be implemented in the form of a software program, which runs on a processor integrated inside the chip module, and the remaining (if any) modules / units can be implemented in the form of hardware such as circuits; for various devices and products applied to or integrated in the terminal, the various modules / units contained therein can be implemented in the form of hardware such as circuits, and different modules / units can be located in the same component (for example, chip, circuit module, etc.) or in different components in the terminal, or, at least some modules / units can be implemented in the form of a software program, which runs on a processor integrated inside the terminal, and the remaining (if any) modules / units can be implemented in the form of hardware such as circuits.
[0141] It should be understood that the term "and / or" in this article is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article indicates that the associated objects before and after are in an "or" relationship.
[0142] The "plurality" appearing in the embodiments of the present application refers to two or more.
[0143] The first, second, etc. descriptions appearing in the embodiments of the present application are only used for illustration and distinction of the description objects. There is no order, nor do they indicate any special limitation on the number of devices in the embodiments of the present application, and cannot constitute any limitation on the embodiments of the present application.
[0144] Although the present invention is disclosed as above, the present invention is not limited thereto. Any person skilled in the art can make various changes and modifications without departing from the spirit and scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the scope defined by the claims.
Claims
1. A method for adjusting image color, characterized in that: include: Determine the value of one or more color index parameters of the image to be debugged, obtain the value of the same color index parameter of the target image, and calculate the color index difference; If there is at least one color index difference greater than or equal to a preset difference threshold, determining a parameter to be adjusted corresponding to the color index parameter, wherein each color index parameter has a preset corresponding relationship with one or more parameters to be adjusted; Perform one or more rounds of adjustment on the corresponding parameters to be adjusted of the image to be debugged, wherein the color index difference is determined again after each round of adjustment, and if the color index difference is still greater than or equal to the preset difference threshold, continue to adjust the corresponding parameters to be adjusted until the adjusted color index difference is less than the preset difference threshold; In each round of adjustment, the greater the color index difference in the current round, the greater the step length of the adjustment, and the smaller the color index difference in the current round, the smaller the step length of the adjustment.
2. The method according to claim 1, characterized in that Performing one or more rounds of adjustment on the corresponding parameters to be adjusted of the image to be debugged includes: Determining an initial adjustment step size of the parameter to be adjusted; Dividing adjustment levels based on the initial adjustment step, each adjustment level corresponds to a different color index difference range and has a respective adjustment step, and the larger the color index difference, the larger the adjustment step in the corresponding adjustment level; The initial adjustment step is used to perform the first round of adjustment, and in each subsequent round of adjustment, the adjustment step in the adjustment level to which the color index difference in the current round belongs is used to adjust the corresponding parameters to be adjusted of the image to be adjusted.
3. The method according to claim 2, characterized in that Determining the initial adjustment step of the parameter to be adjusted includes: Extract auxiliary information; Determining an estimated selected value range of the parameter to be adjusted according to the auxiliary information; Determining the initial adjustment step size according to the difference between the upper and lower limits of the estimated selected value range; The larger the difference between the upper and lower limits of the estimated selected value range is, the larger the initial adjustment step is.
4. The method according to claim 3, characterized in that The extraction of auxiliary information includes: Obtain an Exchangeable Image File Format (EXIF) file of the image to be debugged; The auxiliary information is extracted from the EXIF file.
5. The method according to claim 3, characterized in that: The auxiliary information includes scene mode information and shooting auxiliary information; Determining the estimated selected value range of the parameter to be adjusted according to the auxiliary information includes: Determining an initial parameter value range of the parameter to be adjusted according to the scene mode information, wherein each parameter of each scene mode has a preset value range; According to the shooting auxiliary information, at least a part of the initial parameter value range is selected as the estimated selected value range.
6. The method according to claim 5, characterized in that The shooting assistance information is selected from one or more of the following: The shooting brightness and color temperature of the image to be adjusted.
7. The method according to claim 1, characterized in that Determining the value of one or more color index parameters of the image to be debugged includes: Extracting red, green, and blue (RGB) color gamut pixel data of the image to be debugged; The value of the color index parameter is calculated based on the RGB color gamut pixel data.
8. The method according to claim 1 or 7, characterized in that: The color index parameter is selected from one or more of the following: Hue, hue, and saturation.
9. The method according to claim 1, characterized in that: The target image and the image to be debugged are shot in the same scene mode; and / or, The difference between the shooting brightness of the target image and the image to be debugged is within a preset brightness range, and / or the difference between the color temperature of the target image and the image to be debugged is within a preset color temperature range.
10. The method according to claim 1, characterized in that Also includes: Recording the mapping relationship between the adjusted parameters to be adjusted and the values of each color index parameter of the image to be debugged; When the difference between the value of each color index parameter of the new image to be adjusted and the value of each color index parameter of the image to be adjusted is less than the preset difference, the adjusted value of the parameter to be adjusted is used as the initial value.
11. An image color adjustment device, characterized in that: include: A difference determination module, used to determine the value of one or more color index parameters of the image to be debugged, obtain the value of the same color index parameter of the target image, and calculate the color index difference; A parameter determination module, used for determining the parameter to be adjusted corresponding to the color index parameter when there is at least one color index difference greater than or equal to a preset difference threshold, wherein each color index parameter has a preset corresponding relationship with one or more parameters to be adjusted; An adjustment module, used for performing one or more rounds of adjustment on the corresponding parameters to be adjusted of the image to be debugged, wherein the color index difference is determined again after each round of adjustment, and if the color index difference is still greater than or equal to the preset difference threshold, the corresponding parameters to be adjusted are continuously adjusted until the adjusted color index difference is less than the preset difference threshold; In each round of adjustment, the greater the color index difference in the current round, the greater the step length of the adjustment, and the smaller the color index difference in the current round, the smaller the step length of the adjustment.
12. 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 10 are executed.
13. A terminal comprising a memory and a processor, wherein the memory stores computer instructions that can be executed on the processor, characterized in that: When the processor runs the computer instructions, the steps of the image color adjustment method according to any one of claims 1 to 10 are performed.
Citation Information
Patent Citations
White balance parameter determination method, white balance adjustment method and device, storage medium and terminal
CN108234971A
Image brightness adjustment method and device, equipment and storage medium
CN113610934A