Image processing method and device, electronic device and storage medium
By performing first recognition processing and mapping processing on the image to be processed, and combining the results of the second recognition processing to determine the target area, the problem of low image area determination accuracy in the prior art is solved, and a more efficient image processing effect is achieved.
Patent Information
- Application Number
- CN202011048893.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-29
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2040-09-29
AI Technical Summary
The accuracy of image area determination in the prior art is not high, which affects the effect of image processing.
By performing first recognition processing and mapping processing on the image to be processed, a target mask image is generated, and the target area is determined in combination with the results of the second recognition processing, thereby improving the accuracy of area determination.
The accuracy of image area determination is improved, making subsequent processing more targeted and improving the image processing effect.
Smart Images

Figure CN112149672B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to an image processing method and device, an electronic device, and a storage medium. Background Art
[0002] In the application of image processing technology, in some cases, it is necessary to process some areas in the image separately (such as optimizing or beautifying some areas, etc.), so it is necessary to first determine the areas that need to be processed separately in the image. However, the inventors have found through research that in the prior art, the determination of image areas has the problem of low accuracy. Summary of the invention
[0003] In view of this, the purpose of the present application is to provide an image processing method and device, an electronic device and a storage medium to improve the problem of low accuracy in image region determination in existing image processing technologies.
[0004] To achieve the above purpose, the embodiment of the present application adopts the following technical solution:
[0005] An image processing method, comprising:
[0006] Performing a first recognition process on the target area of the image to be processed to obtain a first image;
[0007] Mapping the first image based on a preset mask image to obtain a target mask image, wherein the preset mask image is a template image pre-configured for the target area;
[0008] Performing a second recognition process of the target area on the image to be processed or the first image to obtain a second image;
[0009] The target area is determined based on the target mask image and the second image.
[0010] In a preferred embodiment of the present application, in the above-mentioned image processing method, the step of performing a second recognition process of the target area on the image to be processed or the first image to obtain a second image includes:
[0011] In the first image, a first eye bag region determined by the first recognition process is blurred to obtain a first blurred image, wherein the first eye bag region includes a target region;
[0012] The first blurred image is compared with the first image to obtain a second image, wherein the second image contains image information of a second eye bag area, the second eye bag area is included in the first eye bag area, and includes the target area.
[0013] In a preferred embodiment of the present application, in the above-mentioned image processing method, the step of performing blurring processing on the first eye bag area determined by the first recognition processing in the first image to obtain a first blurred image includes:
[0014] In the first image, a first eye bag region identified by performing a first identification process is used as a processing region;
[0015] In the first image, an eye area is determined based on the eye feature points, and the eye area is filled with white to serve as a non-processing area;
[0016] The processing area is filtered based on a predetermined filtering radius to obtain a first blurred image, wherein the object of the filtering does not include the non-processing area.
[0017] In a preferred embodiment of the present application, in the above-mentioned image processing method, the step of comparing the first blurred image with the first image to obtain the second image includes:
[0018] Performing brightness difference calculation processing on the first blurred image and the first image to obtain the brightness difference between the first blurred image and the first image for each pixel;
[0019] A second eye bag area is determined based on the pixel points whose brightness difference is greater than a preset difference to obtain a second image.
[0020] In a preferred embodiment of the present application, in the above-mentioned image processing method, the step of determining the target area based on the target mask image and the second image includes:
[0021] Multiplying the texture pixel values of the target mask image and the second image, wherein the texture pixel values are used to represent probability information of a pixel point belonging to a dark circle area;
[0022] The target area is determined based on the result of the multiplication process, wherein the target area is the dark circle area.
[0023] In a preferred embodiment of the present application, in the above-mentioned image processing method, the step of performing a first recognition process of a target area on the image to be processed to obtain a first image includes:
[0024] Performing facial feature point recognition processing on the image to be processed to obtain a feature recognition result, wherein the image to be processed includes a facial image;
[0025] Based on the feature recognition result, a first eye bag area is determined in the image to be processed to obtain a first image, wherein the first eye bag area includes a target area.
[0026] In a preferred embodiment of the present application, in the above-mentioned image processing method, the target area is a dark circle area, and the image processing method further includes a step of removing dark circles, which step includes:
[0027] Performing dark circle removal processing on the image to be processed or the first image to obtain a third image after the dark circles are removed;
[0028] Based on the target area, the third image is fused with the image to be processed or the third image is fused with the first image to obtain a target image, wherein the texture pixel value of each pixel point included in the target area is used as the fusion coefficient of the corresponding pixel point in the third image, and the target image includes a face image after removing dark circles.
[0029] In a preferred embodiment of the present application, in the above-mentioned image processing method, the step of performing dark circle removal processing on the image to be processed or the first image to obtain a third image after the dark circles are removed includes:
[0030] Performing blur processing on the first image to obtain a second blurred image;
[0031] Performing color channel value difference calculation processing on the second blurred image and the first image to obtain a color difference value of each pixel;
[0032] For each of the pixels, a weight image is obtained based on the square value of the texture pixel value corresponding to the color difference value of the pixel, wherein the square value is a weight coefficient of the corresponding pixel;
[0033] Performing fuzzy processing on the weighted image to obtain a third fuzzy image;
[0034] Additive denoising is performed on the third blurred image to obtain a third image, wherein the third image is an image after dark circles are removed.
[0035] In a preferred embodiment of the present application, in the above-mentioned image processing method, the step of obtaining a weighted image for each pixel point based on the square value of the texture pixel value corresponding to the color difference value of the pixel point includes:
[0036] For each of the pixel points, a square value of a texture pixel value corresponding to a color difference value of the pixel point is calculated to obtain a square value of a texture pixel value of each of the pixel points;
[0037] For each pixel point, multiply the texture pixel square value of the pixel point by a preset coefficient to obtain a weight coefficient of the pixel point, wherein the preset coefficient is greater than 1 and the weight coefficient is less than or equal to 1;
[0038] A weight image is formed based on the weight coefficient of each pixel.
[0039] In a preferred embodiment of the present application, in the above-mentioned image processing method, the step of performing additive denoising on the third blurred image to obtain the third image includes:
[0040] performing difference calculation on the third blurred image and the first image to obtain a detail image;
[0041] Performing additive denoising on the third blurred image to obtain a reference image, wherein the reference image is an image after dark circles are removed;
[0042] The reference image and the detail image are superimposed and calculated to obtain a third image.
[0043] The present application also provides an image processing device, including:
[0044] A first recognition processing module, used for performing a first recognition processing of a target area on the image to be processed to obtain a first image;
[0045] An image mapping processing module, used for performing mapping processing on the first image based on a preset mask image to obtain a target mask image, wherein the preset mask image is a template image pre-configured for the target area;
[0046] A second recognition processing module, used for performing a second recognition processing of the target area on the image to be processed or the first image to obtain a second image;
[0047] The target area determination module is used to determine the target area based on the target mask image and the second image.
[0048] Based on the above, an embodiment of the present application further provides an electronic device, including:
[0049] Memory for storing computer programs;
[0050] The processor connected to the memory is used to execute the computer program stored in the memory to implement the above-mentioned image processing method.
[0051] On the basis of the above, an embodiment of the present application further provides a computer-readable storage medium storing a computer program, which implements the above-mentioned image processing method when executed.
[0052] The image processing method and device, electronic device and storage medium provided by the present application obtain a first image by first performing a first recognition process, then map the first image with a preset mask image to obtain a target mask image, and process the target mask image with a second image obtained by performing a second recognition process, thereby determining the required target area. In this way, compared with the technical solution of directly determining the area based on the mask image, the basis for determining the area can be more sufficient, so that the determination result has higher accuracy, thereby improving the problem of low accuracy in determining the image area in the existing image processing technology, so that when performing subsequent processing based on the determined area, targeted processing can also be performed to ensure that the processed image effect is better, so that it has higher practical value.
[0053] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] Figure 1 A structural block diagram of an electronic device provided in an embodiment of the present application.
[0055] Figure 2 A flowchart of an image processing method provided in an embodiment of the present application.
[0056] Figure 3 for Figure 2 Schematic diagram of the flow chart of the sub-steps included in step S110.
[0057] Figure 4 A schematic diagram of the effect of the first eye bag area provided in an embodiment of the present application.
[0058] Figure 5 A schematic diagram of the effect of the dark circle mask area provided in an embodiment of the present application.
[0059] Figure 6 for Figure 2 Schematic diagram of the flow chart of the sub-steps included in step S130.
[0060] Figure 7 for Figure 6 Schematic diagram of the flow chart of the sub-steps included in step S131.
[0061] Figure 8 for Figure 6 Schematic diagram of the flow chart of the sub-steps included in step S132.
[0062] Fig. 9 for Figure 2 Schematic diagram of the flow chart of the sub-steps included in step S140.
[0063] Fig.10 A schematic diagram of the effect of the dark circle weight map provided in an embodiment of the present application.
[0064] Fig.11 A flowchart of other steps of the image processing method provided in an embodiment of the present application.
[0065] Fig.12 for Fig.11 Schematic diagram of the flow chart of the sub-steps included in step S150.
[0066] Fig.13 for Fig.12 Schematic diagram of the flow chart of the sub-steps included in step S153.
[0067] Fig.14 for Fig.12 Schematic diagram of the flow chart of the sub-steps included in step S155.
[0068] Fig.15 A block diagram of an image processing device provided in an embodiment of the present application.
[0069] Icons: 10 - electronic device; 12 - memory; 14 - processor; 100 - image processing device; 110 - first recognition processing module; 120 - image mapping processing module; 130 - second recognition processing module; 140 - target area determination module. DETAILED DESCRIPTION
[0070] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations.
[0071] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for which protection is sought, but merely represents selected embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.
[0072] like Figure 1 As shown, an embodiment of the present application provides an electronic device 10 , which may include a memory 12 , a processor 14 , and an image processing device 100 .
[0073] The memory 12 and the processor 14 are electrically connected directly or indirectly to achieve data transmission or interaction. For example, they can be electrically connected to each other through one or more communication buses or signal lines. The image processing device 100 includes at least one software function module that can be stored in the memory 12 in the form of software or firmware. The processor 14 is used to execute an executable computer program stored in the memory 12, for example, the software function module and computer program included in the image processing device 100, to implement the image processing method provided in the embodiment of the present application.
[0074] Optionally, the memory 12 can be, but is not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable read-only memory (EEPROM), etc.
[0075] Furthermore, the processor 14 may be a general-purpose processor, including a central processing unit (CPU), a graphics processing unit (GPU), and the like.
[0076] Understandably, Figure 1 The structure shown is for illustration only. The electronic device 10 may also include Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.
[0077] For example, the electronic device 10 may also include a communication unit for exchanging information with other devices, and when the electronic device 10 is used as a terminal device (such as a mobile phone, tablet computer, computer, etc.), it may also include an image acquisition device (such as a camera, etc.) for acquiring images to be processed.
[0078] Combination Figure 2 The present application also provides an image processing method applicable to the electronic device 10. The method steps defined in the process related to the image processing method can be implemented by the electronic device 10. Figure 2 The specific process shown is explained in detail.
[0079] Step S110 , performing a first recognition process on the image to be processed to obtain a first image.
[0080] In this embodiment, when it is necessary to determine the target area, the electronic device 10 may perform a first recognition process of the target area on the image to be processed, so as to obtain a first image.
[0081] Step S120: mapping the first image based on a preset mask image to obtain a target mask image.
[0082] In this embodiment, after obtaining the first image based on step S120, the electronic device 10 may perform mapping processing on the first image based on a preset mask image, so as to obtain a target mask image.
[0083] The preset mask image may be a template image pre-configured for the target area, that is, the preset mask image is a standard image of the target area.
[0084] Step S130: performing a second recognition process of the target area on the image to be processed or the first image to obtain a second image.
[0085] In this embodiment, when the target area needs to be determined or after the first image is obtained based on step S110, the electronic device 10 can perform a second recognition process of the target area on the image to be processed or the first image, so as to obtain a second image.
[0086] Step S140: determining a target area based on the target mask image and the second image.
[0087] In this embodiment, after obtaining the target mask image based on step S120 and obtaining the second image based on step S130, the electronic device 10 may determine the target area based on the target mask image and the second image.
[0088] Based on the above method, compared with the technical solution of directly determining the area based on the mask image, it can ensure that the basis for determining the area is more sufficient, so that the determination result has higher accuracy, thereby improving the problem of low accuracy in image area determination in existing image processing technology, so that when subsequent processing is performed based on the determined area, targeted processing can also be performed to ensure that the processed image effect is better (for example, if the non-target area is also processed, it may cause the image effect of the non-target area to be unnatural or distorted).
[0089] In the first aspect, it should be noted that for step S110, the specific method of performing the first recognition processing on the image to be processed is not limited and can be selected according to actual application requirements.
[0090] For example, in an alternative example, standard contour information of the target area may be preconfigured, and thus, the image to be processed may be subjected to comparison and recognition processing based on the contour information, thereby obtaining a first image.
[0091] For example, in another alternative example, the image to be processed may be subjected to feature point recognition processing to obtain a first image. Based on this, in a specific application example, the image to be processed includes a face image, the target area is a dark circle area, and Figure 3 , step S110 may include step S111 and step S112, the specific contents of which are described as follows.
[0092] Step S111, performing facial feature point recognition processing on the image to be processed to obtain a feature recognition result.
[0093] In this embodiment, when it is necessary to determine the target area (such as the dark circle area), the facial feature points of the image to be processed (the image to be processed may include a face image) may be identified, so that a feature recognition result may be obtained.
[0094] Step S112, determining a first eye bag region in the image to be processed based on the feature recognition result to obtain a first image.
[0095] In this embodiment, after the feature recognition result is obtained based on step S111, the first eye bag area can be determined in the image to be processed based on the feature recognition result, such as marking the first eye bag area, so that the first image can be obtained.
[0096] The first eye bag region may include a target region. That is, in order to determine the target region, that is, to determine the dark eye circle region, a preliminary region determination operation may be performed in the image to be processed to obtain a rough dark eye circle region, that is, the first eye bag region including the dark eye circle region.
[0097] Secondly, it should be noted that for step S120, the specific method of mapping the first image based on the preset mask image can be selected according to actual application requirements.
[0098] For example, in an alternative example, when step S110 is executed to perform the first recognition processing, feature point recognition processing is performed, and mapping processing can be performed based on the position coordinates in the preset mask image and the feature points recognized in the first image to obtain the target mask image.
[0099] In detail, in a specific example, the first recognition process may be a recognition process of facial feature points, such as Figure 4 As shown, the first eye bag area as described in the above example can be marked. The preset mask image can be a dark circle mask image, which can include a dark circle mask area, such as Figure 5 shown.
[0100] In the third aspect, it should be noted that for step S130, the specific method of performing the second recognition processing on the image to be processed or performing the second recognition processing on the first image is not limited and can be selected according to actual application requirements.
[0101] For example, in an alternative example, a second recognition process may be performed on the image to be processed to obtain a second image.
[0102] For example, in another alternative example, the first image may be subjected to a second recognition process to obtain a second image. Based on this, in a specific application example, when the target area is a dark circle area, combined with Figure 6 Step S130 may include step S131 and step S132, the specific contents of which are described as follows.
[0103] Step S131: In the first image, blurring is performed on the first eye bag region determined by the first recognition process to obtain a first blurred image.
[0104] In this embodiment, after obtaining the first image in which the first eye bag area is determined based on step S110, the first eye bag area (the first eye bag area includes the target area, i.e., the dark circle area) can be blurred in the first image to obtain a first blurred image.
[0105] Step S132: compare the first blurred image with the first image to obtain a second image.
[0106] In this embodiment, after the first blurred image is obtained based on step S131, the first blurred image may be compared with the first image, so as to obtain a second image.
[0107] Among them, the second image contains image information of the second eye bag area. Since the second image is obtained by comparing the first blurred image and the first image, and the first blurred image is obtained based on blurring the first eye bag area, the image information in the first eye bag area between the first blurred image and the first image will change to a certain extent, especially the change in the dark circle area will be larger. Therefore, the second eye bag area obtained based on the comparison processing can have higher accuracy than the first eye bag area.
[0108] Therefore, the first eye bag area, the second eye bag area and the target area may have the following relationship: the second eye bag area is included in the first eye bag area and includes the target area (ie, includes the dark circles area).
[0109] Optionally, the specific manner of executing step S131 to blur the first image is not limited and can be selected according to actual application requirements.
[0110] For example, in an alternative example, since the first eye bag region has been determined in the first image based on the first recognition process, the first eye bag region can be directly blurred to obtain a first blurred image.
[0111] For another alternative example, the inventor of the present application found through research that the eye area may cause great interference to the blurring process due to the large color difference. Therefore, in order to improve the quality of the first blurred image, the first eye bag area may be selectively blurred. Figure 7 Step S131 may include step S131a, step S131b and step S131c, the specific contents of which are described as follows.
[0112] Step S131a: In the first image, a first eye bag area identified by a first identification process is used as a processing area.
[0113] In this embodiment, after the first image in which the first eye bag area is determined based on step S110, the first eye bag area can be used as a processing area for blurring processing (eg, filled with black) in the first image.
[0114] Step S131b: In the first image, an eye area is determined based on the eye feature points, and the eye area is filled with white as a non-processing area.
[0115] In this embodiment, in order to avoid interference of the eye area with the blur processing, after obtaining the first image in which the first eye bag area is determined based on step S110, in the first image, the eye area can be first determined based on the eye feature points, and then the eye area can be used as a non-processed area for blur processing (such as filled with white).
[0116] Step S131c: filtering the processing area based on a predetermined filtering radius to obtain a first blurred image.
[0117] In this embodiment, after the processing area and the non-processing area are determined based on step S131a and step S131b, the processing area can be filtered based on a predetermined filtering radius, and the object of the filtering does not include the non-processing area. In this way, selective filtering processing can be implemented for the first eye bag area, that is, blur processing is completed, thereby obtaining the first blurred image.
[0118] It is understandable that, in step S131b, the specific method of determining the eye area based on the eye feature points is not limited and can be selected according to actual application requirements.
[0119] For example, in an alternative example, the eye region can be determined based on a triangle network. That is, for the eye feature points, each three adjacent eye feature points can be used as the vertices of a triangle, and then the middle point of each side of the triangle is used as a new eye feature point. In this way, the eye feature points can be continuously expanded through multiple iterations, thereby expanding the points into surfaces, that is, expanding the eye feature points into eye regions.
[0120] Furthermore, in step S131c, the specific method of filtering the processing area is not limited and can be selected according to actual application requirements.
[0121] For example, in an alternative example, mean filtering may be performed on the processing area to achieve blurring of the processing area.
[0122] Optionally, the specific manner of executing step S132 to compare the first image and the first blurred image is not limited and can be selected according to actual application requirements.
[0123] For example, in an alternative example, the second image may be constructed directly based on pixel points with different image parameters such as pixel values or brightness values in the first image and the second blurred image.
[0124] For example, in another alternative example, in order to reduce the range error between the second eye bag area and the dark circle area (ie, the target area), Figure 8 Step S132 may include step S132a and step S132b, the specific contents of which are described as follows.
[0125] Step S132a: performing brightness difference calculation processing on the first blurred image and the first image to obtain the brightness difference of each pixel between the first blurred image and the first image.
[0126] In this embodiment, after obtaining the first blurred image based on step S131, the brightness difference between the first blurred image and the first image can be calculated to obtain the brightness difference between each pixel point (in an alternative example, only the pixels of the first eye bag area can be used to reduce the amount of data processing; in other examples, other pixels may also be included) between the first blurred image and the first image.
[0127] Step S132b, determining a second eye bag area based on the pixel points whose brightness difference is greater than a preset difference, to obtain a second image.
[0128] In this embodiment, considering that the brightness of the pixels in the dark circle area will change greatly after being blurred, the pixels whose brightness difference is greater than the preset difference can be selected first. In this way, the second eye bag area can be determined based on the pixel points, that is, the second image can be obtained.
[0129] The brightness difference of each pixel in the second eye bag area can represent the probability that the pixel belongs to the target area, and the target area is the dark circle area.
[0130] That is, texture pixel mapping can be performed according to the brightness difference of each pixel in the second eye bag area to determine the probability that the pixel belongs to the dark circle area, thereby obtaining a probability map (that is, the second image can be a probability map or a weight map). The larger the brightness difference, the greater the probability that the corresponding pixel belongs to the dark circle area.
[0131] Fourthly, it should be noted that for step S140, the specific method of determining the target area based on the target mask image and the second image is not limited. For example, the specific method of determining the target area may be different depending on the specific content represented by the image information in the target mask image and the second image.
[0132] In detail, in a specific application example, the target area may be a dark eye circle area, and in the target mask image, it includes a white area and a black area, wherein the white area is used to characterize the dark eye circle area, and the texture pixel value of the corresponding pixel point is 1, and the black area is used to mark the non-dark eye circle area, and the texture pixel value of the corresponding pixel point is 0. In the second image, the probability that each pixel point belongs to the dark eye circle area (such as determined based on the brightness difference in the above example) can be carried, and the range value of the probability (such as mapping the texture pixel by the brightness value) is [0, 1].
[0133] Based on this, combined Fig. 9 Step S140 may include step S141 and step S142, the specific contents of which are described as follows.
[0134] Step S141, multiplying the texture pixel values of the target mask image and the second image.
[0135] In this embodiment, after obtaining the target mask image and the second image based on step S120 and step S130, multiplication processing can be performed based on the texture pixel values (used to characterize the probability information that the pixel point belongs to the dark circle area) of the target mask image and the second image.
[0136] Among them, if the target mask image and the second image themselves are represented by texture pixel values, the texture pixel values can be directly used. If the target mask image and the second image are not represented by texture pixel values, they can be mapped in the texture pixel space first to obtain corresponding texture pixel values.
[0137] Step S142: determining the target area based on the result of the multiplication process.
[0138] In this embodiment, after the texture pixel values are multiplied based on step S141, the target area, that is, the dark circle area, can be determined based on the result of the multiplication process.
[0139] That is, executing step S141 to multiply the texture pixel values of the target mask image and the second image, the result obtained is actually a dark circle weight map (such as Fig.10 As shown), in this way, whether it belongs to dark circles can be determined based on the weight of each pixel point, that is, executing step S142 to determine the target area, which can refer to marking the pixel points belonging to dark circles in the dark circle weight map, or directly using the dark circle weight map as the result of executing step S142.
[0140] Based on the above example, for example, when the target area is a dark circle area, after the dark circle area is determined, the dark circles may be removed. Therefore, the image processing method may further include the step of removing dark circles.
[0141] For example, in an alternative example, combining Fig.11 The step of removing dark circles may include step S150 and step S160, and the specific contents are as follows.
[0142] Step S150, performing dark circle removal processing on the image to be processed or the first image to obtain a third image after the dark circles are removed.
[0143] In this embodiment, the image to be processed or the first image may be first processed to remove dark circles, so that a third image after removing the dark circles may be obtained.
[0144] Step S160: Based on the target area, the third image is fused with the image to be processed or the third image is fused with the first image to obtain a target image.
[0145] In this embodiment, after obtaining the third image based on step S150, considering that the area for removing dark circles is generally larger than the actual dark circle area, the image to be processed or the first image can be further combined, and fusion processing can be performed based on the determined target area to obtain a target image for removing dark circles from the dark circle area, so that the target image includes the face image after removing the dark circles.
[0146] Among them, the texture pixel value of each pixel point included in the target area (for example, the weight value in the dark circle weight map in the above example) can be used as the fusion coefficient of the corresponding pixel point in the third image, so that the third image can be fused with the image to be processed or the first image based on the fusion coefficient to obtain the target image.
[0147] In the above example, it should be noted that for step S150, the specific method of performing the dark circle removal process is not limited and can be selected according to actual application requirements.
[0148] For example, in an alternative example, the image to be processed may be processed to remove dark circles, thereby obtaining a third image after the dark circles are removed.
[0149] For another example, in another alternative example, the first image may be processed to remove dark circles, thereby obtaining a third image after removing dark circles. Based on this example, the specific method of performing the dark circle removal process on the first image may not be limited. For example, in a specific application example, in combination with Fig.12 Step S150 may include step S151, step S152, step S153, step S154 and step S155, the specific contents of which are described as follows.
[0150] Step S151, blurring the first image to obtain a second blurred image.
[0151] In this embodiment, after the first image is obtained based on step S110, the first image can be blurred (the blurring process may be the same as or different from the blurring process performed on the first image when executing step S131, such as the filtering radius may be different, and the eye area may not be excluded, that is, non-selective blurring, etc.), so that a second blurred image can be obtained.
[0152] Step S152: performing color channel value difference calculation processing on the second blurred image and the first image to obtain the color difference of each pixel.
[0153] In this embodiment, after the second blurred image is obtained based on step S151, the color channel value difference calculation can be performed on the second blurred image (in other examples, the first blurred image obtained by executing step S131 can also be used as the second blurred image) and the first image (for example, the difference calculation can be performed separately for the three color channels of each pixel point), so that the color difference of each pixel point can be obtained.
[0154] Step S153: for each pixel point, a weighted image is obtained based on the square value of the texture pixel value corresponding to the color difference value of the pixel point.
[0155] In this embodiment, after obtaining the color difference value of each pixel based on step S152, the square value can be calculated for each pixel based on the texture pixel value corresponding to the color difference value of the pixel (such as mapping in the texture pixel space), so that the weighted image can be obtained.
[0156] Among them, in the weight image, the square value is the weight coefficient of the corresponding pixel point.
[0157] Step S154, blurring the weighted image to obtain a third blurred image.
[0158] In this embodiment, after the weight image is obtained based on step S153, the weight image can be blurred (the blur processing can be the same as the blur processing performed on the first image when executing step S151, such as both are achieved by mean filtering with the same radius). In this way, a third blurred image can be obtained (if the blur processing at this time is mean filtering, the third blurred image can also be called a mean image).
[0159] Step S155, performing additive denoising processing on the third blurred image to obtain a third image.
[0160] In this embodiment, after the third blurred image is obtained based on step S154, the third blurred image may be subjected to additive denoising, so as to obtain a third image, that is, an image after removing dark circles.
[0161] Optionally, in the above example, the specific method of executing step S153 to obtain the weight image is not limited and can be selected according to actual application requirements.
[0162] For example, in an alternative example, the obtained square value may be directly used as the weight coefficient of the corresponding pixel point, thereby obtaining the weight image.
[0163] For example, in another alternative example, in order to improve the reliability of the weight coefficient of each pixel in the obtained weight image, Fig.13 Step S153 may include step S153a, step S153b and step S153c, the specific contents of which are described as follows.
[0164] Step S153a: for each pixel point, calculate the square value of the texture pixel value corresponding to the color difference value of the pixel point to obtain the texture pixel square value of each pixel point.
[0165] In this embodiment, after the color difference value of each pixel point is obtained based on step S152, the square value of the texture pixel value corresponding to the color difference value of the pixel point (in an alternative example, it can be the average of the difference values of the three RGB channels) can be calculated for each pixel point. In this way, the square value of the texture pixel value of each pixel point can be obtained.
[0166] Step S153b: for each pixel point, multiply the texture pixel square value of the pixel point by a preset coefficient to obtain a weight coefficient of the pixel point.
[0167] In this embodiment, after the square value of the texture pixel of each pixel is obtained based on step S153a, the square value of the texture pixel of each pixel may be multiplied by a preset coefficient, so that a weight coefficient of each pixel may be obtained.
[0168] Among them, considering that the maximum value in the texture pixel space is 1, the texture pixel square value will be less than or equal to the corresponding texture pixel value. For example, the square of 0.2 is 0.04, which is much smaller than 0.2. Therefore, it is necessary to multiply it by a preset coefficient greater than 1 to avoid the problem of unreasonable weight coefficient. Similarly, based on the maximum value of 1 in the texture pixel space, the weight coefficient is less than or equal to 1.
[0169] Step S153c, forming a weight image based on the weight coefficient of each pixel point.
[0170] In this embodiment, after the weight coefficient of each pixel is obtained based on step S153b, a weight image can be formed based on the weight coefficient of each pixel.
[0171] Optionally, in the above example, the specific method of executing step S155 to obtain the third image is not limited and can be selected according to actual application requirements.
[0172] For example, in an alternative example, an image obtained by performing additive denoising processing on the third blurred image may be directly used as the third image.
[0173] For example, in another alternative example, in order to enhance the detail information of the obtained third image, Fig.14 Step S155 may include step S155a, step S155b and step S155c, the specific contents of which are described as follows.
[0174] Step S155a, performing difference calculation on the third blurred image and the first image to obtain a detail image.
[0175] In this embodiment, after obtaining the third blurred image based on step S154, a difference calculation can be performed between the third blurred image and the first image (such as a difference calculation of texture pixel values between corresponding pixel points. In some examples, the calculated difference can also be multiplied by a weight coefficient, and the weight coefficient can be set according to the demand for image details in actual applications). In this way, a detail image for enhancing image details can be obtained.
[0176] Step S155b, performing additive denoising processing on the third blurred image to obtain a reference image.
[0177] In this embodiment, after the third blurred image is obtained based on step S154, the third blurred image may be subjected to additive denoising, so that a reference image (ie, an image after removing dark circles) may be obtained.
[0178] Step S155c: performing superposition calculation on the reference image and the detail image to obtain a third image.
[0179] In this embodiment, after the detail image and the reference image are obtained based on step S155a and step S155b, the reference image and the detail image may be superimposed (such as superimposed calculation of texture pixel values between corresponding pixel points), so that a third image may be obtained.
[0180] Among them, since the detail image is added, the image details of the third image can be enhanced, so that the image area after the dark circles are removed will not be blurred.
[0181] In the above example, it should be noted that for step S160, the specific method of performing fusion processing based on the target area (ie, the fusion coefficient) is not limited and can be selected according to actual application requirements.
[0182] For example, in an alternative example, the texture pixel values of the pixels in the target area can be used as weight coefficients of the corresponding pixels in the third image, and the weight coefficients of the corresponding pixels in the image to be processed or the first image can be determined based on other rules. In this way, by performing weighted calculation on each pixel, the third image can be integrated with the image to be processed or the first image to obtain the target image.
[0183] For example, in another alternative example, the texture pixel value of the pixel point in the target area can be used as the weight coefficient of the corresponding pixel point in the third image, and the difference between 1 and the texture pixel value can be used as the weight coefficient of the image to be processed or the first image. In this way, weighted calculation is performed on each pixel point, so that the third image can be integrated with the image to be processed or the first image to obtain the target image.
[0184] Combination Fig.15 The embodiment of the present application further provides an image processing device 100 applicable to the electronic device 10. The image processing device 100 may include a first recognition processing module 110, an image mapping processing module 120, a second recognition processing module 130 and a target area determination module 140.
[0185] The first recognition processing module 110 can be used to perform a first recognition process on the target area of the image to be processed to obtain a first image. Figure 2 As shown in step S110 , the relevant contents of the first identification processing module 110 can refer to the above description of step S110 .
[0186] The image mapping processing module 120 may be used to perform mapping processing on the first image based on a preset mask image to obtain a target mask image, wherein the preset mask image is a template image pre-configured for the target area. Figure 2 As shown in step S120, the relevant contents of the image mapping processing module 120 can refer to the above description of step S120.
[0187] The second recognition processing module 130 may be used to perform a second recognition process on the target area of the image to be processed or the first image to obtain a second image. Figure 2 As shown in step S130, the relevant contents of the second identification processing module 130 can refer to the above description of step S130.
[0188] The target region determination module 140 may be used to determine the target region based on the target mask image and the second image. In this embodiment, the target region determination module 140 may be used to perform Figure 2 As shown in step S140, the relevant contents of the target area determination module 140 can refer to the above description of step S140.
[0189] It should be noted that, based on the above examples, the image processing device 100 may further include other modules, such as a dark circle removal module (the target area is the dark circle area).
[0190] Among them, the function of the dark circles removal module can be:
[0191] First, the image to be processed or the first image is processed to remove dark circles to obtain a third image after the dark circles are removed; secondly, the third image is fused with the image to be processed or the third image is fused with the first image based on the target area to obtain a target image, wherein the texture pixel value of each pixel point included in the target area is respectively used as the fusion coefficient of the corresponding pixel point in the third image, and the target image includes the face image after the dark circles are removed.
[0192] It is understandable that the specific function of the dark circle removal module can be combined with the explanation of the relevant steps of the image processing method in the previous text, and will not be repeated here.
[0193] In an embodiment of the present application, corresponding to the above-mentioned image processing method, a computer-readable storage medium is also provided, in which a computer program is stored, and when the computer program is run, each step of the above-mentioned image processing method is executed.
[0194] Among them, the steps executed when the aforementioned computer program is running will not be described one by one here, and reference may be made to the explanation of the aforementioned image processing method in the previous text.
[0195] In summary, the image processing method and device, electronic device and storage medium provided by the present application obtain a first image by first performing a first recognition process, then mapping the first image with a preset mask image to obtain a target mask image, and processing the target mask image with the second image obtained by performing a second recognition process, thereby determining the required target area. In this way, compared with the technical solution of directly determining the area based on the mask image, the basis for determining the area can be more sufficient, so that the determination result has a higher accuracy, thereby improving the problem of low accuracy in determining the image area in the existing image processing technology, so that when performing subsequent processing based on the determined area, targeted processing can also be performed to ensure that the processed image effect is better, so that it has a higher practical value.
[0196] In several embodiments provided in the embodiments of the present application, it should be understood that the disclosed device and method can also be implemented in other ways. The device and method embodiments described above are merely schematic, for example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the device, method and computer program product according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0197] In addition, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
[0198] If the function is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, an electronic device, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a disk or an optical disk. It should be noted that, in this article, the term "include", "include" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements that are not explicitly listed, or also includes elements inherent to such a process, method, article or device. Without more constraints, an element defined by the phrase "comprising a..." does not exclude the existence of other identical elements in the process, method, article or apparatus comprising the element.
[0199] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. An image processing method, characterized in that: include: Performing a first recognition process on the target area of the image to be processed to obtain a first image; Performing mapping processing on the first image based on a preset mask image to obtain a target mask image, wherein the preset mask image is a template image pre-configured for the target area; performing a second recognition process of the target area on the image to be processed or the first image to obtain a second image; multiplying the texture pixel values of the target mask image and the second image, wherein the texture pixel values are used to represent probability information of a pixel point belonging to a dark circle area; The target area is determined based on the result of the multiplication process, wherein the target area is the dark circle area.
2. The image processing method according to claim 1, wherein: The step of performing a second recognition process on the target area of the image to be processed or the first image to obtain a second image includes: In the first image, blurring the first eye bag region determined by the first recognition process to obtain a first blurred image, wherein the first eye bag region includes the target region; The first blurred image is compared with the first image to obtain a second image, wherein the second image contains image information of a second eye bag area, the second eye bag area is included in the first eye bag area, and includes the target area.
3. The image processing method according to claim 2, wherein: The step of performing blurring processing on the first eye bag region determined by the first recognition processing in the first image to obtain a first blurred image includes: In the first image, a first eye bag region identified by performing the first recognition process is used as a processing region; In the first image, an eye region is determined based on the eye feature points, and the eye region is filled with white to serve as a non-processing region; The processing area is filtered based on a predetermined filtering radius to obtain a first blurred image, wherein the object of the filtering does not include the non-processing area.
4. The image processing method according to claim 2, wherein: The step of comparing the first blurred image with the first image to obtain the second image comprises: Performing brightness difference calculation processing on the first blurred image and the first image to obtain the brightness difference between the first blurred image and the first image for each pixel; A second eye bag area is determined based on the pixel points whose brightness difference is greater than a preset difference to obtain a second image.
5. The image processing method according to claim 1, wherein: The step of performing a first recognition process on the target area of the image to be processed to obtain the first image comprises: Performing facial feature point recognition processing on the image to be processed to obtain a feature recognition result, wherein the image to be processed includes a facial image; A first eye bag region is determined in the image to be processed based on the feature recognition result to obtain a first image, wherein the first eye bag region includes a target region.
6. The image processing method according to any one of claims 1 to 5, characterized in that: The image processing method further includes a step of removing dark circles, which includes: performing dark circle removal processing on the image to be processed or the first image to obtain a third image after the dark circles are removed; Based on the target area, the third image and the image to be processed are fused or the third image and the first image are fused to obtain a target image, wherein the texture pixel value of each pixel point included in the target area is respectively used as the fusion coefficient of the corresponding pixel point in the third image, and the target image includes a facial image after removing dark circles.
7. The image processing method according to claim 6, characterized in that: The step of performing dark circle removal processing on the image to be processed or the first image to obtain a third image after the dark circles are removed comprises: performing blur processing on the first image to obtain a second blurred image; Performing color channel value difference calculation processing on the second blurred image and the first image to obtain a color difference value for each pixel; For each pixel, a weight image is obtained based on the square value of the texture pixel value corresponding to the color difference value of the pixel, wherein the square value is the weight coefficient of the corresponding pixel; Performing blur processing on the weighted image to obtain a third blurred image; Additive denoising is performed on the third blurred image to obtain a third image, wherein the third image is an image after dark circles are removed.
8. The image processing method according to claim 7, wherein: The step of obtaining a weighted image for each pixel based on the square value of the texture pixel value corresponding to the color difference value of the pixel point includes: For each pixel point, calculating the square value of the texture pixel value corresponding to the color difference value of the pixel point to obtain the texture pixel square value of each pixel point; For each pixel point, multiplying the texture pixel square value of the pixel point by a preset coefficient to obtain a weight coefficient of the pixel point, wherein the preset coefficient is greater than 1 and the weight coefficient is less than or equal to 1; A weight image is formed based on the weight coefficient of each pixel point.
9. The image processing method according to claim 7, wherein: The step of performing additive denoising on the third blurred image to obtain a third image comprises: performing a difference calculation on the third blurred image and the first image to obtain a detail image; Performing additive denoising on the third blurred image to obtain a reference image, wherein the reference image is an image after dark circles are removed; A superposition calculation is performed on the reference image and the detail image to obtain a third image.
10. An image processing device, characterized in that: include: A first recognition processing module is used to perform a first recognition process on the target area of the image to be processed to obtain a first image; an image mapping processing module, configured to perform mapping processing on the first image based on a preset mask image to obtain a target mask image, wherein the preset mask image is a template image pre-configured for the target area; A second recognition processing module is used to perform a second recognition process on the target area of the image to be processed or the first image to obtain a second image; The target area determination module is used to: multiplying the texture pixel values of the target mask image and the second image, wherein the texture pixel values are used to represent probability information of a pixel point belonging to a dark circle area; The target area is determined based on the result of the multiplication process, wherein the target area is the dark circle area.
11. An electronic device, characterized in that: include: Memory for storing computer programs; A processor connected to the memory, configured to execute a computer program stored in the memory to implement the image processing method according to any one of claims 1 to 9.
12. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed, the image processing method according to any one of claims 1 to 9 is implemented.
Citation Information
Patent Citations
Method for detecting multi-scale bottleneck defects, and device for achieving method
CN103308523A
