Image processing method and device, equipment and medium
By detecting the target area and transmittance, combining dark channel map and light intensity information, the image is removed from graying, and using bilateral filtering algorithm and color adjustment curve optimization effect, the problem of poor image graying effect in the existing technology is solved. Improves the visual and quality of the image.
Patent Information
- Application Number
- CN202411117435.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-14
- Publication Date
- 2024-12-06
AI Technical Summary
The existing image gray removal method is difficult to meet users' optimization processing needs for gray images, and the effect is not good.
By detecting the target area in the image, determining the target transmittance, and performing ash removal process based on the transmittance, combining the dark channel map and light intensity information, adjusting the transmittance, and optimizing the ash removal effect using a bilateral filtering algorithm and color adjustment curve.
It achieves better gray removal effect, improves the visual appearance of the image, and meets users' image quality needs after gray removal.
Smart Images

Figure CN119090765A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image processing technology, and in particular to an image processing method, device, equipment and medium. Background Art
[0002] With the development of image processing technology and the improvement of people's aesthetic level, more and more users hope to optimize the original images obtained by shooting. The inventor has found through research that due to problems with image shooting equipment (such as hardware limitations, parameter settings, etc.) or shooting environment (such as cloudy days, overcast weather), the overall image obtained by shooting will appear grayish, so it is necessary to de-gray such images to optimize the image color. However, the image effect obtained by the existing image de-graying method is not good and it is difficult to meet user needs. Summary of the invention
[0003] In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides an image processing method, apparatus, device and medium.
[0004] An embodiment of the present disclosure provides an image processing method, which includes: acquiring a first image to be processed; detecting a target area in the first image to obtain a detection result of the target area; wherein the target area is an area with specified features; based on the detection result of the target area, determining a target transmittance corresponding to the first image; determining a target degraving intensity based on the target transmittance, and degraving the first image according to the target degraving intensity to obtain a target image.
[0005] Optionally, determining the target transmittance corresponding to the first image based on the detection result of the target area includes: obtaining a dark channel map corresponding to the first image; when the detection result of the target area indicates that the target area exists in the first image, determining the target transmittance corresponding to the first image based on the dark channel map and a comparison result of the area of the target area with a preset area threshold; when the detection result of the target area indicates that the target area does not exist in the first image, determining the target transmittance corresponding to the first image based on the dark channel map and a preset light intensity.
[0006] Optionally, determining the target transmittance corresponding to the first image based on the dark channel map and the comparison result of the area of the target area with a preset area threshold includes: when the area of the target area is greater than the preset area threshold, determining the dark channel average value corresponding to the target area based on the dark channel map, and determining the target transmittance corresponding to the first image based on the dark channel average value corresponding to the target area; when the area of the target area is not greater than the preset area threshold, determining the target transmittance corresponding to the first image based on the dark channel map and a preset light intensity.
[0007] Optionally, determining the target transmittance corresponding to the first image based on the dark channel average value corresponding to the target area includes: obtaining a theoretical transmittance corresponding to the target area based on the dark channel average value corresponding to the target area; when the theoretical transmittance is greater than a preset upper limit of transmittance, setting the target transmittance corresponding to the first image equal to the upper limit of transmittance; when the theoretical transmittance is less than a preset lower limit of transmittance, setting the target transmittance corresponding to the first image equal to the lower limit of transmittance; when the theoretical transmittance is between the lower limit of transmittance and the upper limit of transmittance, setting the target transmittance corresponding to the first image equal to the theoretical transmittance.
[0008] Optionally, determining a target transmittance corresponding to the first image based on the dark channel map and a preset light intensity includes: determining a first transmittance corresponding to the first image based on the dark channel map and a preset light intensity; and adjusting the first transmittance using a guided filtering algorithm to obtain a target transmittance.
[0009] Optionally, determining a target deashing intensity based on the target transmittance includes: acquiring a deashing intensity setting value, and obtaining a reference transmittance based on the deashing intensity setting value; and determining a target deashing intensity based on a maximum value between the reference transmittance and the target transmittance.
[0010] Optionally, degragging the first image according to the target degragging intensity to obtain a target image includes: obtaining a degragging intensity setting value, and decolorizing the first image based on the degragging intensity setting value to obtain a second image; degragging the second image based on the target degragging intensity and a preset light intensity to obtain a third image; and color-adjusting a target area in the third image to obtain a target image.
[0011] Optionally, the de-noising the first image based on the de-noising intensity setting value includes: determining the de-noising intensity based on the de-noising intensity setting value; based on the de-noising intensity, performing de-noising on the first image using a preset bilateral filtering algorithm; wherein, the number of associated points corresponding to the pixel points of the first image used in the preset bilateral filtering algorithm is a preset value, and the relative position relationship between the associated points corresponding to the pixel points and the pixel points is a preset relationship.
[0012] Optionally, performing color adjustment processing on the target area in the third image to obtain the target image includes: performing color adjustment processing on the target area based on a preset saturation adjustment curve and / or a preset brightness adjustment curve to obtain the target image.
[0013] Optionally, the target area includes a skin area; and the designated feature includes a skin feature.
[0014] The disclosed embodiment also provides an image processing device, including: an image acquisition module, used to acquire a first image to be processed; an area detection module, used to detect a target area in the first image and obtain a detection result of the target area; wherein the target area is an area with specified features; a transmittance determination module, used to determine a target transmittance corresponding to the first image based on the detection result of the target area; and a degraving processing module, used to determine a target degraving intensity based on the target transmittance, and degraving the first image according to the target degraving intensity to obtain a target image.
[0015] An embodiment of the present disclosure also provides an electronic device, which includes: a processor; a memory for storing executable instructions of the processor; the processor is used to read the executable instructions from the memory and execute the instructions to implement the image processing method provided by the embodiment of the present disclosure.
[0016] The embodiment of the present disclosure further provides a computer-readable storage medium, wherein the storage medium stores a computer program, and the computer program is used to execute the image processing method provided by the embodiment of the present disclosure.
[0017] The above technical solution provided by the embodiment of the present disclosure fully takes into account that the target area with specified characteristics may be an area that the user pays more attention to, and its de-graying effect will greatly affect the user's perception. Therefore, when the first image is de-grayed, the target transmittance corresponding to the first image will be determined in combination with the detection result of the target area, so as to determine a reasonable target de-graying intensity, which helps to ensure the overall de-graying effect of the target image. On this basis, the target area after de-graying can also present a better user perception and better meet user needs.
[0018] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0020] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0021] Figure 1 A flowchart of an image processing method provided by an embodiment of the present disclosure;
[0022] Figure 2 A schematic diagram of the association points of a bilateral filtering algorithm provided in an embodiment of the present disclosure;
[0023] Figure 3 A schematic diagram of an adjustment curve provided in an embodiment of the present disclosure;
[0024] Figure 4 A flowchart of an image processing method provided by an embodiment of the present disclosure;
[0025] Figure 5 A schematic diagram of image processing provided by an embodiment of the present disclosure;
[0026] Figure 6 A schematic diagram of the structure of an image processing device provided by an embodiment of the present disclosure;
[0027] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0028] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.
[0029] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.
[0030] Figure 1 The following is a flow chart of an image processing method provided by an embodiment of the present disclosure. The method can be executed by an image processing device, wherein the device can be implemented by software and / or hardware and can generally be integrated in an electronic device. Figure 1 As shown, the method mainly includes the following steps S102 to S108:
[0031] Step S102, obtaining a first image to be processed. The disclosed embodiment does not limit the content of the first image, and any image that needs to be degreased can be used as the first image. In practical applications, the color value of the first image can be normalized to between 0 and 1 for ease of processing.
[0032] Step S104, detecting a target area in the first image to obtain a detection result of the target area; wherein the target area is an area having specified features.
[0033] In practical applications, the target area can be detected and processed, such as by using a target area detection algorithm or a target area segmentation model, so as to obtain a detection result of the target area. The detection result of the target area can be used to indicate whether the target area exists in the first image, and the regional information of the detected target area, which includes but is not limited to the regional area of the target area, the regional position of the target area, and other information. The disclosed embodiment does not limit the specified feature, and the specified feature can be a feature of a body part that most users are concerned about or a feature of a specific target object. The specified feature can also be a feature that is greatly affected by the de-ashing process, such as a feature that is easily regarded as a fog area in the de-ashing process due to its own characteristics. Exemplarily, the target area includes a skin area, and the specified feature includes a skin feature. It can be understood that most users will pay more attention to the skin effect presented in the image, and the skin presentation effect will also directly affect the user's perception and image processing experience. In addition, the skin characteristics will also cause the skin area to be easily regarded as a fog area. Considering the above reasons, the disclosed embodiment will fully consider the target area in the image when performing image de-ashing processing, and first detect the target area for subsequent analysis and processing.
[0034] Step S106, based on the detection result of the target area, determine the target transmittance corresponding to the first image. In some embodiments, the transmittance mentioned in the embodiment of the present disclosure is the atmospheric transmittance, and the target transmittance is the atmospheric transmittance, which can also be called the target atmospheric transmittance; in addition, the target transmittance can also be a calculated value.
[0035] In the related art, the transmittance is usually determined directly for the whole image without considering the local area, but in the embodiment of the present disclosure, the transmittance of the whole image is determined by making full reference to the detection result of the target area. For example, different strategies can be used to determine the target transmittance corresponding to the first image based on information such as whether the target area is detected and the area size of the detected target area, so as to ensure the accuracy and reliability of the target transmittance.
[0036] Step S108 , determining a target de-dusting intensity based on the target transmittance, and performing de-dusting processing on the first image according to the target de-dusting intensity to obtain a target image.
[0037] Transmittance and de-graving intensity are usually associated with each other. The magnitude of transmittance directly affects the magnitude of de-graving intensity. In the embodiment of the present disclosure, the target de-graving intensity can be determined based on the target transmittance, so that the first image can be de-graved according to the target de-graving intensity. It should be noted that the first image can be directly de-graved according to the target de-graving intensity, or the first image can be pre-processed first, and then the pre-processed first image can be de-graved according to the target de-graving intensity to obtain the target image; the embodiment of the present disclosure does not limit the pre-processing, and illustratively, the pre-processing includes de-noising.
[0038] The above technical solution provided by the embodiment of the present disclosure fully takes into account that the target area with specified characteristics may be an area that the user pays more attention to, and its de-graying effect will greatly affect the user's perception. Therefore, when the first image is de-grayed, the target transmittance corresponding to the first image will be determined in combination with the detection result of the target area, so as to determine a reasonable target de-graying intensity, which helps to ensure the overall de-graying effect of the target image. On this basis, the target area after de-graying can also present a better user perception and better meet user needs.
[0039] In some implementations, step S106, i.e., the step of determining the target transmittance corresponding to the first image based on the detection result of the target area, can be performed with reference to the following steps A to C:
[0040] Step A, obtaining a dark channel map corresponding to the first image. The dark channel map is used to indicate the dark channel value corresponding to each pixel in the first image. The embodiment of the present disclosure does not limit the method of obtaining the dark channel map. For example, the dark channel map can be obtained by using an image minimum filtering algorithm. For details, please refer to the relevant technology and will not be repeated here.
[0041] Step B, when the detection result of the target area indicates that there is a target area in the first image, based on the dark channel image and the comparison result of the area of the target area with the preset area threshold, determine the target transmittance corresponding to the first image. That is, the disclosed embodiment will take into account the area of the target area, and the size of the area will also affect the determination method of the target transmittance. This method of determining the target transmittance based on the comparison result of the area with the preset area threshold is also more reasonable; wherein, the preset area threshold can be flexibly set according to demand and is not limited here.
[0042] In some specific implementation examples, it can be implemented based on the following steps B1 and B2:
[0043] Step B1, when the area of the target area is greater than the preset area threshold, determine the dark channel average value corresponding to the target area based on the dark channel map, and determine the target transmittance corresponding to the first image based on the dark channel average value corresponding to the target area. That is, when the area of the target area is large, the transmittance of the target area can be directly determined by using the dark channel average value corresponding to the target area, and then the transmittance of the target area is used as the target transmittance corresponding to the first image. It can be understood that when the area of the target area is large, the transmittance determined based on the target area can effectively ensure that the final de-graying effect meets the requirements, and the target area in the obtained target image can present a satisfactory visual effect. Among them, the dark channel average value corresponding to the target area is the value obtained by averaging the pixel values of all pixels in the target area.
[0044] The transmittance of the target area determined by the obtained dark channel average value corresponding to the target area is also a value, which can be uniformly applied to the first image, that is, the target transmittances corresponding to all pixels in the first image are equal to the transmittance of the target area. The disclosed embodiment does not limit the method of determining the transmittance of the target area based on the dark channel average value corresponding to the target area. In the specific implementation example of determining the target transmittance corresponding to the first image based on the dark channel average value corresponding to the target area in step B1, it can be implemented by referring to the following (1) to (4):
[0045] (1) Obtain the theoretical transmittance corresponding to the target area based on the dark channel average value corresponding to the target area. Exemplarily, the theoretical air permeability is the theoretical atmospheric transmittance. The theoretical transmittance is negatively correlated with the dark channel average value. Exemplarily, the theoretical transmittance corresponding to the target area can be obtained by referring to the following method: tv=ab*(sc); wherein a, b, and c are all preset fixed parameter values, ranging from 0 to 1, which can be flexibly set according to specific needs, and s represents the dark channel average value corresponding to the target area. In practical applications, determining the transmittance based on the dark channel average value can also be achieved in other ways, which are not limited here.
[0046] (2) When the theoretical transmittance is greater than a preset upper limit of the transmittance, the target transmittance corresponding to the first image is set equal to the upper limit of the transmittance.
[0047] (3) When the theoretical transmittance is less than the preset transmittance lower limit, the target transmittance corresponding to the first image is set to be equal to the transmittance lower limit.
[0048] (4) When the theoretical transmittance is between the lower limit value and the upper limit value of the transmittance, the target transmittance corresponding to the first image is set equal to the theoretical transmittance.
[0049] In order to control the target transmittance to be within a reasonable range, the embodiment of the present disclosure sets an upper limit value and a lower limit value of the transmittance to constrain the target transmittance. When the calculated theoretical transmittance is between the upper and lower limits of the transmittance, it can be directly used as the target transmittance of the first image. When the theoretical transmittance is outside the upper and lower limits of the transmittance, the corresponding transmittance threshold value is used as the target transmittance of the first image. In this way, the validity of the target transmittance obtained in the end can be guaranteed, and it is avoided that the pixel points are too dark or too bright due to the target transmittance being too high or too low, thereby affecting the gray removal effect of the target image.
[0050] Step B2, when the area of the target area is not greater than the preset area threshold, determine the target transmittance corresponding to the first image based on the dark channel map and the preset light intensity. Exemplarily, the aforementioned light intensity can be specifically the atmospheric light intensity. That is, when the area of the target area is small, in order to ensure the overall de-graying effect of the whole image, the influence of the target area can be ignored, but the dark channel map and the light intensity are directly used to determine the target transmittance corresponding to the first image. Specifically, the target transmittance corresponding to the first image includes the target transmittance corresponding to each pixel in the first image. The method of determining the transmittance using the dark channel map and the light intensity can refer to the relevant technology, such as processing using the image minimum filtering algorithm, which will not be repeated here. It is worth noting that the light intensity in the embodiment of the present disclosure is not obtained by calculation, but a preset value is used. This method can avoid the uncontrollable situation that may occur in the conventional light intensity calculation method, and the method of using the preset light intensity is more robust; exemplarily, the preset light intensity A = [0.8, 0.8, 0.8].
[0051] In a specific implementation example of determining the target transmittance corresponding to the first image based on the dark channel image and the preset light intensity in step B2, it can be implemented by referring to the following steps 1 to 2:
[0052] Step 1, based on the dark channel map and the preset light intensity, determine the first transmittance corresponding to the first image. For example, based on the dark channel map and the preset light intensity, use the image minimum filter algorithm to determine the first transmittance corresponding to each pixel in the first image. Exemplarily, the first transmittance may be the first atmospheric transmittance. The specific method of determining the transmittance based on the dark channel map and the light intensity can refer to the relevant technology and is not limited here.
[0053] Step 2, using the guided filtering algorithm to adjust the first transmittance to obtain the target transmittance. In order to further optimize the first transmittance, the embodiment of the present disclosure also uses a guided filtering algorithm to adjust the first transmittance, thereby ensuring the accuracy of the target transmittance. Exemplarily, the filter kernel size corresponding to the guided filtering algorithm is larger than the filter kernel size corresponding to the minimum filtering algorithm used to determine the first transmittance in step 1, such as the filter kernel size corresponding to the guided filtering algorithm is eight times the filter kernel size corresponding to the minimum filtering algorithm used to determine the first transmittance. The above method helps to eliminate halo and improve the image refinement.
[0054] Step C: when the detection result of the target area indicates that the target area does not exist in the first image, determine the target transmittance corresponding to the first image based on the dark channel image and the preset light intensity.
[0055] Among them, the implementation method of determining the target transmittance corresponding to the first image based on the dark channel image and the preset light intensity in the above step C can be performed with reference to the above steps 1 and 2, and will not be repeated here.
[0056] In some embodiments, the step of determining the target deashing intensity based on the target transmittance in step S108 can be performed with reference to the following steps 1 to 2:
[0057] Step 1: Obtain a de-dusting intensity setting value, and obtain a reference transmittance based on the de-dusting intensity setting value. Exemplarily, the reference transmittance may be a reference atmospheric transmittance.
[0058] In practical applications, a control for setting a de-graying intensity setting value can be provided for the user. The control can be a parameter input control or a slider control, etc., and there is no restriction on this. The de-graying intensity setting value (a value between 0 and 1) set by the user can be obtained through the control, and the de-graying intensity setting value has a direct relationship with the reference transmittance. In some implementation examples, according to the user's conventional understanding, the larger the de-graying intensity setting value, the more the user usually wants to perform a stronger de-graying process on the image, and the more obvious the de-graying effect of the image. However, considering that the larger the transmittance in practical applications, the smaller the corresponding de-graying intensity, the transmittance is between 0 and 1. Assuming that the transmittance is 1, it means that the de-graying intensity is 0, and there is no de-graying effect at all; the smaller the transmittance, the larger the corresponding de-graying intensity. For this reason, the reference transmittance can be set to 1-de-graying intensity setting value. For example, assuming that the de-graying intensity setting value input by the user is 0.1, it means that the reference transmittance is 0.9.
[0059] Step 2, based on the maximum value between the reference transmittance and the target transmittance, determine the target de-graying intensity. The target de-graying intensity includes the target de-graying intensity corresponding to each pixel in the first image, that is, for each pixel in the first image, the target transmittance corresponding to the pixel is compared with the reference transmittance, and the maximum value between the two is used as the target de-graying intensity corresponding to the pixel. By taking the maximum value as described above, the lower limit of the target de-graying intensity can be constrained, such as, the lower limit value is at least the reference transmittance obtained based on the user setting, in other words, the reference transmittance obtained based on the user setting can be used to limit the minimum transmittance. Exemplarily, assuming that the target transmittance of all pixels corresponding to the first image ranges from 0.2 to 1, and the de-graying intensity setting value (such as a slider value) is 0.1, then the minimum transmittance is the reference transmittance 0.9, and the corrected transmittance is 0.9 to 1, and then based on the corrected transmittance corresponding to the first image, the target de-graying intensity corresponding to each pixel in the first image is obtained, such as a range of 0 to 0.1.
[0060] In some implementations, the step of performing gray removal processing on the first image according to the target gray removal intensity to obtain the target image in step S108 may be performed with reference to the following steps a to c:
[0061] Step a: obtaining a gray removal intensity setting value, and performing a color removal process on the first image based on the gray removal intensity setting value to obtain a second image.
[0062] In some specific implementation examples of performing de-noising processing on the first image based on the de-noising intensity setting value, the de-noising intensity can be first determined based on the de-noising intensity setting value, and then based on the de-noising intensity, the first image is de-noised using a preset bilateral filtering algorithm. Exemplarily, the de-noising intensity is positively correlated with the de-noising intensity setting value, such as the de-noising intensity is equal to the de-noising intensity setting value. The bilateral filtering algorithm can effectively retain the edge information of the image while smoothing the image and reducing noise, thereby achieving a better de-noising effect.
[0063] Furthermore, the bilateral filtering algorithm adopted in the embodiment of the present disclosure is an improvement on the existing two-color filtering algorithm. Specifically, in the preset bilateral filtering algorithm adopted in the embodiment of the present disclosure, the number of associated points corresponding to the pixels of the first image is a preset value, and the relative position relationship between the associated points corresponding to the pixels and the pixels is a preset relationship. It can be understood that the bilateral filtering algorithm usually requires the associated points corresponding to each pixel to determine the color value of the pixel, while the associated points corresponding to the pixels of the first image adopted in the existing bilateral filtering algorithm are all the pixels in the first image, that is, each pixel needs to determine the corresponding color value based on all the pixels in the image, but this method requires a huge amount of calculation, has high requirements on device performance, is not convenient for application on mobile terminals, and has low processing efficiency. To this end, the embodiment of the present disclosure directly presets the number of associated points corresponding to the pixel, and sets the relative position relationship between each associated point and the pixel, so that the corresponding associated point can be accurately and conveniently determined based on each pixel in the first image. The associated point can also be called a sampling point. For ease of understanding, please refer to Figure 2 The schematic diagram of the associated points of a bilateral filtering algorithm shown in the figure takes the black point A as the pixel point (i.e., the center point) whose color value is to be determined. It is only necessary to determine the 10 associated points (i.e., gray points) corresponding to the center point based on the preset relative position relationship, and then obtain the color value of the black point A based on the color values of the 10 associated points and the relative position relationship between the associated points and the black point A. In this way, the amount of computation for the de-noising process can be greatly reduced, and the efficiency of the de-noising process can be improved.
[0064] Step b: performing de-dusting processing on the second image based on the target de-dusting intensity and the preset light intensity to obtain a third image.
[0065] Specifically, for each pixel in the second image, the difference between the color value of the pixel and the preset light intensity is obtained, and then the ratio between the difference and the transmittance corresponding to the target degraving intensity corresponding to the pixel is calculated. After that, the ratio is summed with the light intensity to obtain the target color value of the pixel. Based on the target color values corresponding to all pixels, the third image can be obtained.
[0066] Step c: performing color adjustment processing on the target area in the third image to obtain a target image.
[0067] In order to further optimize the visual perception of the target area, such as improving the poor saturation or brightness of the target area, the embodiment of the present disclosure, based on obtaining the third image, will further perform color adjustment processing on the target area in the third image, so as to obtain a target image with better degraving effect and better visual perception of the target area.
[0068] For example, the target area can be color-adjusted based on a preset saturation adjustment curve and / or a preset brightness adjustment curve to obtain a target image. The saturation adjustment curve and the brightness adjustment curve can be flexibly set according to needs. In this way, the color value of the target area can be optimized conveniently and quickly to meet user needs.
[0069] For ease of understanding, see, for example, Figure 3 A schematic diagram of an adjustment curve is shown, which illustrates a saturation adjustment curve and a brightness adjustment curve. Taking the saturation adjustment curve as an example, the horizontal axis is used to indicate the existing saturation, and the vertical axis is used to indicate the adjusted saturation. L0 indicates unadjusted, that is, the horizontal and vertical axes are consistent. L1 represents the saturation adjustment curve, which is used to indicate that the saturation corresponding to the horizontal axis is changed to the saturation corresponding to the vertical axis; wherein the saturation can be calculated based on the RGB value of the pixel, and the corrected saturation can be finally obtained, and then the corrected RGB value can be obtained. The brightness adjustment curve is similar. L2 represents the brightness adjustment curve, which is used to indicate that the brightness corresponding to the horizontal axis is changed to the brightness corresponding to the vertical axis; wherein the brightness can be calculated based on the RGB value of the pixel, and the corrected brightness can be finally obtained, and then the corrected RGB value can be obtained. In practical applications, the saturation adjustment curve and / or the brightness adjustment curve can be flexibly used for color adjustment according to needs, thereby improving the problem of poor saturation or brightness in the target area caused by de-ashing.
[0070] Further, the embodiment of the present disclosure provides an image processing method, in which the target transmittance is specifically the target atmospheric transmittance, the light intensity is specifically the atmospheric light intensity, the first transmittance is specifically the first atmospheric transmittance, and the reference transmittance is specifically the reference atmospheric transmittance. Figure 4 A schematic flow chart of an image processing method provided in an embodiment of the present disclosure mainly includes the following steps S402 to S422:
[0071] Step S402, obtaining a first image to be processed, and performing skin area detection on the first image. In this example, the skin area corresponds to the aforementioned target area.
[0072] Step S404: Obtain a dark channel image corresponding to the first image.
[0073] Step S406, determining whether there is a skin area in the first image; if yes, executing step S408, if not, executing step S412;
[0074] Step S408, determining whether the skin area is greater than a preset area threshold, if yes, executing step S410, if no, executing step S412;
[0075] Step S410, determining the dark channel average value corresponding to the target area based on the dark channel map, and determining the target atmospheric transmittance corresponding to the first image based on the dark channel average value corresponding to the target area. Then, step S414 is executed.
[0076] Step S412, based on the dark channel image and the preset atmospheric light intensity, determine the first atmospheric transmittance corresponding to the first image, and adjust the first atmospheric transmittance using a guided filtering algorithm to obtain a target atmospheric transmittance. Then, execute step S414.
[0077] Step S414, obtaining a gray removal intensity setting value.
[0078] Step S416: obtaining a reference atmospheric transmittance based on the de-dusting intensity setting value, and determining a target de-dusting intensity based on a maximum value between the reference atmospheric transmittance and the target atmospheric transmittance.
[0079] Step S418: performing a de-noising process on the first image based on the de-noising intensity setting value to obtain a second image.
[0080] Step S420 , performing de-dusting processing on the second image based on the target de-dusting intensity and the preset atmospheric light intensity to obtain a third image.
[0081] Step S422: Perform color adjustment processing on the skin area in the third image to obtain a target image.
[0082] The specific implementation of the above steps can refer to the above related content, which will not be repeated here. Through the above method, it is helpful to ensure the overall de-graying effect of the target image, and on this basis, the skin area after de-graying can also present a better user experience and better meet user needs.
[0083] On the basis of the above, Figure 5A schematic diagram of image processing provided for an embodiment of the present disclosure illustrates that the image processing method of the embodiment of the present disclosure can be implemented by using the CPU (Central Processing Unit) and the GPU (Graphics Processing Unit) in the electronic device in collaboration, illustrating that the CPU needs to perform skin detection processing based on the first image (input image) and obtain skin area detection results. At the same time, the CPU also needs to determine the dark channel image based on the first image, and determine the target transmittance in combination with the skin area detection results, and then provide the skin area detection information and the target transmittance to the GPU. The GPU can perform de-noising processing based on the first image and the de-noising intensity setting value to obtain a second image, and determine the target de-noising intensity based on the de-noising intensity setting value and the target transmittance, thereby de-noising the second image based on the target de-noising intensity to obtain a third image, and then perform skin area color adjustment on the third image to obtain the target image.
[0084] To sum up, the above technical solution provided by the embodiment of the present disclosure fully takes into account that the target area with specified characteristics may be the area that the user pays more attention to, and its de-graying effect will greatly affect the user's perception. Therefore, when the first image is de-grayed, the target transmittance corresponding to the first image will be determined in combination with the detection result of the target area, so as to determine a reasonable target de-graying intensity, which helps to ensure the overall de-graying effect of the target image. On this basis, the target area after de-graying can also present a better user perception and better meet user needs.
[0085] Corresponding to the aforementioned image processing method, the embodiment of the present disclosure further provides an image processing device, Figure 6 FIG. 1 is a schematic diagram of the structure of an image processing device provided by an embodiment of the present disclosure. The device can be implemented by software and / or hardware and can generally be integrated in an electronic device, such as Figure 6 As shown, the image processing device includes:
[0086] An image acquisition module 602 is used to acquire a first image to be processed;
[0087] The region detection module 604 is used to detect the target region in the first image and obtain the detection result of the target region; wherein the target region is a region having a specified feature;
[0088] A transmittance determination module 606, configured to determine a target transmittance corresponding to the first image based on the detection result of the target area;
[0089] The de-dusting processing module 608 is used to determine a target de-dusting intensity based on a target transmittance, and perform de-dusting processing on the first image according to the target de-dusting intensity to obtain a target image.
[0090] The above-mentioned device provided by the embodiment of the present disclosure fully takes into account that the target area with specified characteristics may be an area that the user pays more attention to, and its de-graying effect will greatly affect the user's perception. Therefore, when the first image is de-grayed, the target transmittance corresponding to the first image will be determined in combination with the detection result of the target area, so as to determine a reasonable target de-graying intensity, which helps to ensure the overall de-graying effect of the target image. On this basis, the target area after de-graying can also present a better user perception and better meet user needs.
[0091] In some embodiments, the transmittance determination module 606 is specifically used to: obtain a dark channel map corresponding to the first image; when the detection result of the target area indicates that the target area exists in the first image, determine the target transmittance corresponding to the first image based on the dark channel map and a comparison result of the area of the target area with a preset area threshold; when the detection result of the target area indicates that the target area does not exist in the first image, determine the target transmittance corresponding to the first image based on the dark channel map and a preset light intensity.
[0092] In some embodiments, the transmittance determination module 606 is specifically used to: when the area of the target area is greater than a preset area threshold, determine the dark channel average value corresponding to the target area based on the dark channel map, and determine the target transmittance corresponding to the first image based on the dark channel average value corresponding to the target area; when the area of the target area is not greater than the preset area threshold, determine the target transmittance corresponding to the first image based on the dark channel map and a preset light intensity.
[0093] In some embodiments, the transmittance determination module 606 is specifically used to: obtain the theoretical transmittance corresponding to the target area based on the dark channel average value corresponding to the target area; when the theoretical transmittance is greater than a preset upper limit of the transmittance, set the target transmittance corresponding to the first image equal to the upper limit of the transmittance; when the theoretical transmittance is less than a preset lower limit of the transmittance, set the target transmittance corresponding to the first image equal to the lower limit of the transmittance; when the theoretical transmittance is between the lower limit of the transmittance and the upper limit of the transmittance, set the target transmittance corresponding to the first image equal to the theoretical transmittance.
[0094] In some embodiments, the transmittance determination module 606 is specifically used to: determine the first transmittance corresponding to the first image based on the dark channel image and a preset light intensity; and adjust the first transmittance using a guided filtering algorithm to obtain a target transmittance.
[0095] In some embodiments, the deashing processing module 608 is specifically used to: obtain a deashing intensity setting value, and obtain a reference transmittance based on the deashing intensity setting value; and determine a target deashing intensity based on a maximum value between the reference transmittance and the target transmittance.
[0096] In some embodiments, the de-graying processing module 608 is specifically used to: obtain a de-graying intensity setting value, and perform de-noise processing on the first image based on the de-graying intensity setting value to obtain a second image; perform de-graying processing on the second image based on the target de-graying intensity and a preset light intensity to obtain a third image; perform color adjustment processing on the target area in the third image to obtain a target image.
[0097] In some embodiments, the de-noising module 608 is specifically used to: determine the de-noising intensity based on the de-noising intensity setting value; based on the de-noising intensity, perform de-noising on the first image using a preset bilateral filtering algorithm; wherein the number of associated points corresponding to the pixel points of the first image used in the preset bilateral filtering algorithm is a preset value, and the relative position relationship between the associated points corresponding to the pixel points and the pixel points is a preset relationship.
[0098] In some implementations, the de-dusting processing module 608 is specifically configured to perform color adjustment processing on the target area based on a preset saturation adjustment curve and / or a preset brightness adjustment curve to obtain a target image.
[0099] In some embodiments, the target area comprises a skin area; and the designated feature comprises a skin feature.
[0100] The image processing device provided in the embodiments of the present disclosure can execute the image processing method provided in any embodiment of the present disclosure, and has the corresponding functional modules and beneficial effects of the execution method.
[0101] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described device embodiment can refer to the corresponding process in the method embodiment, and will not be repeated here.
[0102] An embodiment of the present disclosure provides an electronic device, which includes: a storage device on which a computer program is stored; and a processing device for executing the computer program in the storage device to implement the steps of any method in the present disclosure.
[0103] Reference below Figure 7, which shows a schematic diagram of the structure of an electronic device 700 suitable for implementing the embodiment of the present disclosure. The terminal device in the embodiment of the present disclosure may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle terminals (such as vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 7 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0104] like Figure 7 As shown, the electronic device 700 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage device 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the electronic device 700 are also stored. The processing device 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0105] Typically, the following devices may be connected to the I / O interface 705: an input device 706 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 707 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 708 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 709. The communication device 709 may allow the electronic device 700 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 7 The electronic device 700 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0106] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 709, or installed from a storage device 708, or installed from a ROM 702. When the computer program is executed by the processing device 701, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0107] In addition to the above-mentioned methods and devices, the embodiments of the present disclosure may also be a computer program product, which includes computer program instructions, which, when executed by a processor, cause the processor to perform the image processing method provided by the embodiments of the present disclosure. The computer program product may be written in any combination of one or more programming languages to write program codes for performing the operations of the embodiments of the present disclosure, the programming languages including object-oriented programming languages such as Java, C++, etc., and also conventional procedural programming languages such as "C" language or similar programming languages. The program code may be executed entirely on a user computing device, partially on a user device, as an independent software package, partially on a user computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0108] In addition, the embodiment of the present disclosure may also be a computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are executed by a processor, the processor executes the image processing method provided by the embodiment of the present disclosure.
[0109] The computer readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0110] The embodiment of the present disclosure further provides a computer program product, including a computer program / instruction, which implements the image processing method in the embodiment of the present disclosure when the computer program / instruction is executed by a processor.
[0111] It is understandable that before using the technical solutions disclosed in the various embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0112] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can autonomously choose whether to provide personal information to software or hardware such as an electronic device, application, server, or storage medium that performs the operation of the technical solution of the present disclosure according to the prompt message.
[0113] As an optional but non-limiting implementation, in response to receiving an active request from the user, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0114] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0115] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0116] The above description is only a specific embodiment of the present disclosure, so that those skilled in the art can understand or implement the present disclosure. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to the embodiments described herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. An image processing method, characterized in that: include: Acquire a first image to be processed; Detecting a target area in the first image to obtain a detection result of the target area; wherein the target area is an area with specified features; Determining a target transmittance corresponding to the first image based on a detection result of the target area; A target de-dusting intensity is determined based on the target transmittance, and de-dusting is performed on the first image according to the target de-dusting intensity to obtain a target image.
2. The method according to claim 1, characterized in that The determining, based on the detection result of the target area, a target transmittance corresponding to the first image includes: Obtaining a dark channel image corresponding to the first image; When the detection result of the target area indicates that the target area exists in the first image, determining the target transmittance corresponding to the first image based on the dark channel image and a comparison result of the area of the target area and a preset area threshold; In a case where the detection result of the target area indicates that the target area does not exist in the first image, a target transmittance corresponding to the first image is determined based on the dark channel image and a preset light intensity.
3. The method according to claim 2, characterized in that The determining, based on the dark channel image and a comparison result between the area of the target area and a preset area threshold, a target transmittance corresponding to the first image comprises: When the area of the target region is greater than a preset area threshold, determining a dark channel average value corresponding to the target region based on the dark channel map, and determining a target transmittance corresponding to the first image based on the dark channel average value corresponding to the target region; When the area of the target region is not greater than the preset area threshold, the target transmittance corresponding to the first image is determined based on the dark channel image and a preset light intensity.
4. The method according to claim 3, characterized in that The determining the target transmittance corresponding to the first image based on the dark channel average value corresponding to the target area includes: Obtaining a theoretical transmittance corresponding to the target area based on an average value of a dark channel corresponding to the target area; When the theoretical transmittance is greater than a preset transmittance upper limit value, setting the target transmittance corresponding to the first image equal to the transmittance upper limit value; When the theoretical transmittance is less than a preset transmittance lower limit value, setting the target transmittance corresponding to the first image equal to the transmittance lower limit value; When the theoretical transmittance is between the lower transmittance limit value and the upper transmittance limit value, the target transmittance corresponding to the first image is set equal to the theoretical transmittance.
5. The method according to claim 2, characterized in that: The determining the target transmittance corresponding to the first image based on the dark channel image and a preset light intensity includes: Determining a first transmittance corresponding to the first image based on the dark channel image and a preset light intensity; The first transmittance is adjusted using a guided filtering algorithm to obtain a target transmittance.
6. The method according to claim 1, characterized in that The step of determining a target deashing intensity based on the target transmittance includes: Acquire a gray removal intensity setting value, and obtain a reference transmittance based on the gray removal intensity setting value; A target dedubbing intensity is determined based on a maximum value between the reference transmittance and the target transmittance.
7. The method according to claim 1, characterized in that The step of performing de-ashing processing on the first image according to the target de-ashing intensity to obtain a target image includes: Acquire a gray removal intensity setting value, and perform a color removal process on the first image based on the gray removal intensity setting value to obtain a second image; Performing deashing processing on the second image based on the target deashing intensity and a preset light intensity to obtain a third image; Performing color adjustment processing on the target area in the third image to obtain a target image.
8. The method according to claim 7, characterized in that The performing de-noising processing on the first image based on the de-noising intensity setting value comprises: Determining a color removal intensity based on the gray removal intensity setting value; Based on the de-noising intensity, the first image is de-noised using a preset bilateral filtering algorithm; wherein the number of associated points corresponding to the pixel points of the first image used in the preset bilateral filtering algorithm is a preset value, and the relative position relationship between the associated points corresponding to the pixel points and the pixel points is a preset relationship.
9. The method according to claim 7, characterized in that: The step of performing color adjustment processing on the target area in the third image to obtain the target image includes: The target area is subjected to color adjustment processing based on a preset saturation adjustment curve and / or a preset brightness adjustment curve to obtain a target image.
10. The method according to any one of claims 1 to 9, characterized in that: The target area comprises a skin area; and the designated feature comprises a skin feature.
11. An image processing device, characterized in that: include: An image acquisition module, used for acquiring a first image to be processed; A region detection module, used to detect a target region in the first image and obtain a detection result of the target region; wherein the target region is a region having specified features; a transmittance determination module, configured to determine a target transmittance corresponding to the first image based on a detection result of the target area; The de-dusting processing module is used to determine a target de-dusting intensity based on the target transmittance, and perform de-dusting processing on the first image according to the target de-dusting intensity to obtain a target image.
12. An electronic device, characterized in that: The electronic device comprises: a storage device having a computer program stored thereon; A processing device, used to execute the computer program in the storage device to implement the steps of the image processing method according to any one of claims 1 to 10.
13. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and the computer program is used to execute the image processing method described in any one of claims 1 to 10.
Citation Information
Patent Citations
Portrait image color enhancement method and device
CN110009588A
Image defogging method and system, electronic equipment and storage medium
CN110648297A
Video image noise reduction method and device based on improved local filtering algorithm, and medium
CN115546047A
Image defogging method and device, computer equipment and storage medium
CN116883257A
Image defogging method based on region segmentation, storage medium and terminal equipment
CN117952864A
