Image processing method, device, electronic device and readable storage medium
By performing smooth filtering processing of different filtering intensities and calculating the difference image with different filtering intensities, and local processing combined with preset weights, the problem of poor facial wrinkle fading in the image is solved, and effective facial wrinkle fading and image naturalness are improved.
Patent Information
- Application Number
- CN202011059668.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-30
- Publication Date
- 2025-04-22
- Estimated Expiration
- 2040-09-30
AI Technical Summary
The prior art is difficult to effectively process and fade facial wrinkles in images while maintaining the natural effect of the image.
By performing smooth filtering processing of different filter intensities on the image to be processed, multiple filtered images are obtained, and the first difference image and the second difference image are calculated to characterize the difference between the pixel values of the face wrinkle area of the filtered image and the image to be processed. Then, the locally processed image is calculated based on these difference images and preset weights, and is superimposed with the facial wrinkle area in the to-process image to obtain the faded facial wrinkle area.
Effectively fade facial wrinkles in the image, while the image is natural through detail restoration, avoiding unnatural effects caused by excessive filtering intensity.
Smart Images

Figure CN112150353B_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, device, electronic device and readable storage medium. Background Art
[0002] As the imaging resolution of digital imaging devices increases, the facial wrinkles in the human face can generally be clearly shown in the images obtained by the digital imaging devices. Therefore, users have an increasing demand for facial wrinkle processing, and how to process facial wrinkles in images has become a technical problem that those skilled in the art need to solve. Summary of the invention
[0003] In view of this, the purpose of the present application is to provide an image processing method, device, electronic device and readable storage medium, which can reduce facial wrinkles while making the image natural.
[0004] The embodiments of the present application can be implemented as follows:
[0005] In a first aspect, an embodiment of the present application provides an image processing method, the method comprising:
[0006] Perform smoothing filtering on the image to be processed according to different filtering strengths to obtain filtered images corresponding to different filtering strengths;
[0007] Obtaining a first difference image and at least one second difference image, wherein the first difference image represents the difference in pixel values of the facial wrinkle regions of the filter image corresponding to the minimum filter strength and the image to be processed, and each second difference image represents the difference in pixel values of the facial wrinkle regions of the filter images corresponding to filter strengths of adjacent magnitudes;
[0008] Calculate a local processing image according to the first difference image, a first preset weight corresponding to the first difference image, each of the second difference images and a second preset weight corresponding to each of the second difference images;
[0009] In the image to be processed, the facial wrinkle region in the image to be processed is superimposed with the local processed image to obtain a first result image.
[0010] In a second aspect, an embodiment of the present application provides an image processing device, the device comprising:
[0011] A filtering module, used to perform smoothing filtering on the image to be processed according to different filtering intensities, to obtain filtered images corresponding to different filtering intensities;
[0012] A first processing module, configured to obtain a first difference image and at least one second difference image, wherein the first difference image represents the difference in pixel values of facial wrinkle regions between the filtered image corresponding to the minimum filtering strength and the image to be processed, and each second difference image represents the difference in pixel values of facial wrinkle regions between the filtered images corresponding to filtering strengths of adjacent magnitudes;
[0013] A second processing module, configured to calculate a local processing image according to the first difference image, a first preset weight corresponding to the first difference image, each of the second difference images and a second preset weight corresponding to each of the second difference images;
[0014] The third processing module is used to superimpose the facial wrinkle region in the image to be processed with the local processed image in the image to be processed to obtain a first result image.
[0015] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor can execute the machine executable instructions to implement the image processing method described in any one of the aforementioned embodiments.
[0016] In a fourth aspect, an embodiment of the present application provides a readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the image processing method as described in any one of the aforementioned embodiments.
[0017] The image processing method, device, electronic device and readable storage medium provided by the embodiments of the present application obtain a first difference image and at least one second difference image according to the image to be processed and the obtained filtered image, wherein the obtained filtered image is obtained after the image to be processed is processed at different filtering intensities, the first difference image represents the difference in pixel values between the filtered image corresponding to the minimum filtering intensity and the facial wrinkle area of the image to be processed, and each second difference image represents the difference in pixel values between the facial wrinkle areas of the filtered images corresponding to the filtering intensities of adjacent sizes. Then, based on each obtained difference image and the preset weight corresponding to each difference image, a local processing image is calculated. Finally, the local processing image is superimposed on the facial wrinkle area in the image to be processed. In this way, the facial wrinkles in the image to be processed can be faded, and since the details are restored according to each difference image, the image can also be made natural. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0019] Figure 1 is a block diagram of an electronic device provided in an embodiment of the present application;
[0020] Figure 2 This is one of the flowcharts of the image processing method provided in the embodiment of the present application;
[0021] Figure 3 is a schematic diagram of an image to be processed and a filtered image provided in an embodiment of the present application;
[0022] Figure 4 is a schematic diagram of obtaining a first result image provided by an embodiment of the present application;
[0023] Figure 5 yes Figure 2 One of the flowchart diagrams of the sub-steps included in step S110;
[0024] Figure 6 yes Figure 2 2 is a flow chart of the sub-steps included in step S110;
[0025] Figure 7 This is the second flowchart of the image processing method provided in the embodiment of the present application;
[0026] Figure 8 is a schematic diagram of a user setting wrinkle removal weights in an embodiment of the present application;
[0027] Fig. 9 It is a block diagram of an image processing device provided in an embodiment of the present application.
[0028] Icon: 100 - electronic device; 110 - memory; 120 - processor; 130 - communication unit; 200 - image processing device; 210 - filtering module; 220 - first processing module; 230 - second processing module; 240 - third processing module. DETAILED DESCRIPTION
[0029] 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 part of the embodiments of the present application, rather than all 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.
[0030] 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.
[0031] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0032] It should be noted that relational terms such as "first" and "second" are used only 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.
[0033] Please refer to Figure 1 , Figure 1 1 is a block diagram of an electronic device 100 provided in an embodiment of the present application. The electronic device 100 may be, but is not limited to, a personal computer (PC), a tablet computer, a smart phone, etc. The electronic device 100 may include a memory 110, a processor 120, and a communication unit 130. The memory 110, the processor 120, and the communication unit 130 are electrically connected to each other directly or indirectly to achieve data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines.
[0034] The memory 110 is used to store programs or data. For example, the memory 110 stores an image processing device 200, and the image processing device 200 includes at least one software function module that can be stored in the memory 110 in the form of software or firmware. The memory 110 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.
[0035] The processor 120 is used to read / write data or programs stored in the memory 110 and execute corresponding functions. For example, the processor 120 implements the image processing method in the embodiment of the present application based on the image processing device 200.
[0036] The communication unit 130 is used to establish a communication connection between the electronic device 100 and other communication terminals through a network, and to send and receive data through the network.
[0037] It should be understood that Figure 1 The structure shown is only a schematic diagram of the structure of the electronic device 100. The electronic device 100 may also include Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown. Figure 1 Each component shown in the figure can be implemented by hardware, software or a combination thereof.
[0038] Please refer to Figure 2 , Figure 2 This is one of the flow diagrams of the image processing method provided in the embodiment of the present application. The method can be applied to the above electronic device 100. The specific flow of the image processing method is described in detail below.
[0039] Step S110 , performing smoothing filtering on the image to be processed according to different filtering strengths to obtain filtered images corresponding to the different filtering strengths.
[0040] In this embodiment, the image to be processed may be an image specified by a user or an image in a video, which is not specifically limited here. After determining the image to be processed, the image to be processed is subjected to smoothing filtering processing at different filtering intensities to filter out some high-frequency information, thereby obtaining a plurality of filtered images. Each filtered image corresponds to a filtering intensity. The specific number of filtered images and the specific filtering intensity can be determined according to actual needs. The greater the filtering intensity, the more information is filtered out. The smoothing filtering processing may be, but is not limited to, mean filtering processing, bilateral filtering processing, Gaussian filtering processing, and the like.
[0041] Please refer to Figure 3 , Figure 3 Schematic diagram of the image to be processed and the filtered image provided by the embodiment of the present application. Figure 3 , the filtered images corresponding to the different filtering intensities are illustrated with examples.
[0042] There is an image to be processed Image0 and filter strengths S1, S2, and S3. By performing smoothing filtering processing on the image to be processed Image0 at filter strength S1, a filtered image Image1 corresponding to filter strength S1 can be obtained; by performing smoothing filtering processing on the image to be processed Image0 at filter strength S2, a filtered image Image2 corresponding to filter strength S2 can be obtained; by performing smoothing filtering processing on the image to be processed Image0 at filter strength S3, a filtered image Image3 corresponding to filter strength S3 can be obtained. In this way, the filtered images corresponding to the filter strengths S1, S2, and S3 can be obtained.
[0043] Step S120: obtaining a first difference image and at least one second difference image.
[0044] In this embodiment, under the condition of obtaining a filtered image, the pixel value of each pixel point in the filtered image corresponding to the minimum filtering intensity can be subtracted from the pixel value of each corresponding pixel point in the image to be processed, so as to obtain a difference image. The minimum filtering intensity is the minimum value among the different filtering intensities. The pixel value can be the color value of R (Red), G (Green) and B (Blue). Then, based on the obtained difference image, a first difference image corresponding to the facial wrinkle area can be obtained. The first difference image represents the difference in pixel values between the filtered image corresponding to the minimum filtering intensity and the facial wrinkle area of the image to be processed. Facial wrinkles can be nasolabial folds and / or forehead wrinkles, etc.
[0045] Similarly, for the filtered images corresponding to adjacent filtering intensities in terms of magnitude, the pixel values of each pixel point in the filtered image corresponding to the larger filtering intensity can be subtracted from the pixel values of each pixel point in the filtered image corresponding to the smaller filtering intensity, so as to obtain an image that can be used to obtain the second difference image. It can be seen from this that each second difference image represents the difference in pixel values of the facial wrinkle regions of the filtered images corresponding to adjacent filtering intensities in terms of magnitude; that is, each second difference image represents the result of subtracting the pixel values of the facial wrinkle region in the filtered image corresponding to the smaller filtering intensity from the pixel values of the facial wrinkle region in the filtered image corresponding to the larger filtering intensity in the filtered images corresponding to adjacent filtering intensities in terms of magnitude.
[0046] Continue with the following Figure 3 as an example to illustrate the acquisition of the first difference image and the second difference image.
[0047] Assume that: S1 < S2 < S3, then the filtering intensity S1 can be determined as the minimum filtering intensity.
[0048] Subtract the pixel values of each corresponding pixel point in the filtered image Image1 from the pixel values of each corresponding pixel point in the image to be processed Image0, and the difference in pixel values of the facial wrinkle regions of the filtered image Image1 and the image to be processed Image0 can be obtained, that is, the first difference image is obtained. Among them, in the subtraction process, the pixel values of the filtered image Image1 are subtracted from the pixel values of the image to be processed Image0. Similarly, subtract the pixel values of each corresponding pixel point in the filtered image Image2 from the pixel values of each corresponding pixel point in the filtered image Image1, and the difference in pixel values of the facial wrinkle regions of the filtered image Image2 and the filtered image Image1 can be obtained, that is, a second difference image is obtained. By analogy, another second difference image can also be obtained based on the filtered image Image3 and the filtered image Image2.
[0049] Step S130, calculate and obtain a local processed image according to the first difference image, the first preset weight corresponding to the first difference image, each second difference image, and the second preset weight corresponding to each second difference image.
[0050] In the case of obtaining the first difference image and the second difference image, weighted summation operations can be performed according to the first difference image, the first preset weight corresponding to the first difference image, each second difference image, and the second preset weight corresponding to each second difference image, and the operation result is used as the local processed image. Among them, the sum of the first preset weight and all the second preset weights can be 1 or not 1, which can be determined according to actual requirements.
[0051] Step S140: In the image to be processed, the facial wrinkle region in the image to be processed is superimposed with the local processed image to obtain a first result image.
[0052] The image to be processed includes a facial wrinkle region and a non-facial wrinkle region. The pixel value of each pixel in the local processed image can be added to the pixel value of each corresponding pixel in the image to be processed, so as to obtain a processed facial wrinkle region. The first result image includes a processed facial wrinkle region and a non-facial wrinkle region. The non-facial wrinkle region is not processed, thereby avoiding that the non-facial wrinkle region is affected when the facial wrinkle region is processed.
[0053] Please refer to Figure 4 , Figure 4 : is a schematic diagram of obtaining a first result image provided by an embodiment of the present application. A1 represents the facial wrinkle region image in the image to be processed Image0, A2 represents the local processing result, and A3 represents the facial wrinkle region image after processing. In the image to be processed Image0, the pixel values of the corresponding pixels of A1 and A2 are added to obtain the first result image P1. The first result image P1 includes the non-facial wrinkle region image and the facial wrinkle region image A3 obtained by A1 and A2.
[0054] If the facial wrinkle area image after a filtering process is directly used as the facial wrinkle area image in the final result image, when the filtering intensity is small, the facial wrinkle reduction effect is not good, that is, the facial wrinkle difference before and after processing is not much; when the filtering intensity is large, facial wrinkles are likely to be completely eliminated, and the resulting image is unnatural, that is, the effect image is very unrealistic.
[0055] To avoid the above situation, after high-intensity filtering, detail restoration is performed to alleviate the unnatural effect image. However, if the detail restoration is performed directly based on the filtered image corresponding to the maximum filtering intensity and the image to be processed, the detail restoration may be abrupt, which may lead to the result image being still very unnatural. Based on this, the embodiment of the present application processes the image to be processed with different filtering intensities, uses the maximum filtering image as the reference effect image with reduced facial wrinkles, and then performs detail restoration based on different difference images, so as to finally obtain a first result image that has reduced facial wrinkles and has a natural effect.
[0056] Optionally, as an optional implementation, when filtering images corresponding to different filtering intensities are obtained, smoothing filtering can be directly performed on the complete image to be processed. Then, multiple difference images are obtained by subtracting pixel values from the obtained filtered image and the image to be processed. Then, the facial wrinkle area in the multiple difference images is determined, and the local image in the facial wrinkle area in the multiple difference images is used as the first difference image and the second difference image. In this way, it is convenient to directly perform filtering processing.
[0057] Optionally, as another optional implementation, smoothing filtering may be performed only on the face to-be-processed region in the to-be-processed image, thereby reducing the amount of calculation for smoothing filtering. Figure 5 , Figure 5 yes Figure 2 One of the flowcharts of the sub-steps included in step S110. Step S110 may include sub-steps S111 to S113.
[0058] Sub-step S111, performing face detection on the image to be processed to determine key points of the face in the image to be processed.
[0059] Sub-step S112, determining the face to-be-processed area of the image to be processed according to the face key points in the image to be processed.
[0060] Sub-step S113, performing smoothing filtering on the face to-be-processed area according to different filtering intensities, to obtain filtered images corresponding to the different filtering intensities.
[0061] A face recognition algorithm can be used to perform face detection on the image to be processed to determine the key points of the face in the image to be processed. The key points of the face may include contour key points and / or nose key points, etc. When the key points of the face are determined, the area to be processed of the face can be determined based on the key points of the face, and the area to be processed of the face includes the area of facial wrinkles. Next, smoothing filtering can be performed on the area to be processed of the face in the image to be processed according to different filtering intensities, to obtain filtered images corresponding to different filtering intensities. In other words, the filtered images corresponding to different filtering intensities may be images that only include the area to be processed of the face. In this way, the amount of calculation of the smoothing filtering process can be reduced, and the image processing speed can be accelerated.
[0062] Optionally, as another optional implementation, in order to further reduce the computational complexity of filtering processing, the facial wrinkle area in the image to be processed may be determined in advance, and then the image of the facial wrinkle area in the image to be processed may be smoothed by filtering according to different filtering intensities to obtain filtered images corresponding to the different filtering intensities.
[0063] Optionally, as an optional implementation, the image to be processed may be subjected to a single filtering process according to the different filtering strengths to obtain a filtered image corresponding to the different filtering strengths. Figure 3 For example, a filtering process can be performed once on the image to be processed Image0 to obtain a filtered image Image1 corresponding to the filtering strength S1; a filtering process can be performed once on the image to be processed Image0 to obtain a filtered image Image2 corresponding to the filtering strength S2. The specific object of a single filtering process can be the complete image to be processed, or a part of the complete image to be processed (for example, an image of the area to be processed on the face, or an image of the facial wrinkle area).
[0064] As another optional implementation, after the image to be processed is filtered for the first time, the result of the filtering process can be used as the object of the next filtering process, and the result of each filtering process can be used as one of the filtered images corresponding to the different filtering strengths. In this way, the filtered images corresponding to the different filtering strengths can be obtained, and at the same time, the amount of calculation can be reduced. The specific object of the first filtering process can be the complete image to be processed, or a part of the complete image to be processed (for example, an image of the area to be processed of a human face, or an image of the area of facial wrinkles).
[0065] Please refer to Figure 6 , Figure 6 yes Figure 2 The second flowchart diagram of the sub-steps included in step S110. Step S110 may include sub-step S115 and sub-step S116.
[0066] Sub-step S115, performing smoothing filtering on the image to be processed according to a first preset filtering strength to obtain a first filtered image.
[0067] Sub-step S116, performing smoothing filtering on the first filtered image according to a second preset filtering strength to obtain a second filtered image.
[0068] In a specific application example, at a first preset filter strength, the image to be processed is smoothed and filtered, and the processing result is used as the first filtered image. Then, at the second preset filter image, the first filtered image is smoothed and filtered, and the processing result is used as the second filtered image. The filtered images corresponding to the different filter strengths include the first filtered image and the second filtered image. In this example, the required filtered image can be quickly obtained by smoothing and filtering the images twice, thereby improving the image processing speed. Due to the high image processing speed, this solution can be applied to video streams to reduce facial wrinkles in the video in real time, and the processing result is natural.
[0069] Wherein, when the filter images corresponding to the different filter strengths are obtained through sub-steps S115 and S116, the first preset filter strength is the minimum filter strength, and the minimum filter strength is the filter strength corresponding to the filter image used when obtaining the first difference image; the filter strength corresponding to the second filter image is determined by the first preset filter strength and the second preset filter strength. The first preset filter strength and the second preset filter strength can be the same or different, and can be set according to actual needs.
[0070] Optionally, as an optional implementation, the smoothing filter processing is a mean filter processing, and the filter radius under the first preset filter strength is the same as the filter radius under the second preset filter strength, and both are close to 1 / 20 of the width of the face.
[0071] Next, continue to combine Figure 3 ,right Figure 6 The method shown is used as an example. The image to be processed Image0 can be filtered once at a first preset filtering intensity S1 to obtain a filtered image Image1 corresponding to the filtering intensity S1; then, the filtered image Image1 is filtered once at a second preset filtering intensity S2 to obtain a filtered image Image2 corresponding to the filtering intensity S2. The filtering intensity S2 is determined by the first preset filtering intensity S1 and the second preset filtering intensity.
[0072] Of course, it is understandable that when smoothing filtering is performed according to the first preset filtering intensity, the specific object targeted can be the complete image to be processed, or a part of the complete image to be processed (for example, an image of the face area to be processed, or an image of the facial wrinkle area).
[0073] When the filter images corresponding to different filter intensities are obtained, the local processed image can be calculated. Then, the first result image is obtained based on the local processed image and the image to be processed. Optionally, after the first result image is obtained, the first result image can be directly displayed. Before superimposing the facial wrinkle area of the image to be processed with the local processed image, it is necessary to first determine the facial wrinkle area in the image to be processed.
[0074] As an optional implementation, a mask image may be pre-stored in the electronic device 100. The foreground area in the mask image is a calibrated facial wrinkle area. The mask image includes facial key points. The facial key points of the mask image may be mapped one-to-one with the facial key points of the image to be processed, thereby determining the area in the image to be processed that corresponds to the foreground area, and using the area as the facial wrinkle area in the image to be processed.
[0075] The mask image can be obtained in the following manner: performing face detection on a standard face image to obtain position information of facial key points in the standard face image; creating an image with the same size as the standard face image as an initial mask image; marking the foreground area on the initial mask image according to a received marking operation to obtain the mask image, wherein points in the mask image whose position information is the same as the position information of facial key points in the standard face image are facial key points of the mask image.
[0076] The standard face image represents an image of a normal face with a positive expression. Face detection is performed on the standard face image to determine the key points of the face in the standard face image. A mask of the same size as the standard face image is created as an initial mask image. The positions in the initial mask image corresponding to the position information of the key points of the face in the standard face image are the positions of the key points of the face in the initial mask image. Based on the received marking operation, a foreground area as a facial wrinkle area and a background area as a non-facial wrinkle area are marked on the initial mask image, wherein the foreground area is generally white and the background area is black.
[0077] Optionally, the key points of the face may be directly marked on the mask image, or the position information of the key points of the face in the mask image may be separately saved, etc., so as to determine the facial wrinkle area through subsequent facial key point mapping.
[0078] As another optional implementation, the facial wrinkle region in the image to be processed may also be directly determined based on the facial key points in the image to be processed. For example, when the facial wrinkles are nasolabial folds, the region between the cheek key points and the key points on both sides of the nose may be used as the facial wrinkle region.
[0079] Of course, it is understandable that the above method is only an example, and the facial wrinkle area in the image to be processed can also be determined by other methods.
[0080] In the process of obtaining the first difference image and the second difference image, if it is necessary to determine the facial wrinkle area in the image, the facial wrinkle area in the image may be determined by using the method of determining the facial wrinkle area in the image to be processed.
[0081] Please refer to Figure 7 , Figure 7 This is the second flow chart of the image processing method provided by the embodiment of the present application. The method may further include step S150 and step S160, step S150 may be executed at any time, step S160 is executed after step S140, and the specific execution order of step S150 and step S160 is not specifically limited.
[0082] Step S150: determining a wrinkle removal weight according to the received user operation.
[0083] Step S160, obtaining a second result image according to the wrinkle removal weights, the first result image and the image to be processed.
[0084] In this embodiment, the electronic device 100 can obtain the user operation by receiving the wrinkle removal weight value input by the user on the wrinkle removal weight setting page, or by operating the volume plus or minus key, and determine the wrinkle removal weight according to the user operation. Then, the second result image is obtained according to the wrinkle removal weight, the first result image and the image to be processed. Thus, the second result image is generated according to the user's needs.
[0085] Please refer to Figure 8 , Figure 8 Schematic diagram of a user setting wrinkle removal weights according to an embodiment of the present application. Figure 8 A pull rod is included, and the user can set the wrinkle removal weight by adjusting the position of the white point on the pull rod.
[0086] Optionally, the weight corresponding to the image to be processed may be determined according to the wrinkle removal weight. The sum of the wrinkle removal weight and the weight corresponding to the image to be processed is a preset value, for example, 1. Then, the second result image is obtained by weighted summation according to the wrinkle removal weight, the first result image, the image to be processed and the weight corresponding to the image to be processed.
[0087] In order to execute the corresponding steps in the above embodiments and various possible methods, an implementation method of an image processing device 200 is given below. Optionally, the image processing device 200 can adopt the above Figure 1 The device structure of the electronic device 100 is shown. Fig. 9 , Fig. 9 2 is a block diagram of an image processing device 200 provided in an embodiment of the present application. It should be noted that the basic principle and technical effects of the image processing device 200 provided in this embodiment are the same as those of the above-mentioned embodiments. For the sake of brief description, for parts not mentioned in this embodiment, reference can be made to the corresponding contents in the above-mentioned embodiments. The image processing device 200 may include: a filtering module 210, a first processing module 220, a second processing module 230 and a third processing module 240.
[0088] The filtering module 210 is used to perform smoothing filtering on the image to be processed according to different filtering strengths to obtain filtered images corresponding to the different filtering strengths.
[0089] The first processing module 220 is used to obtain a first difference image and at least one second difference image. The first difference image represents the difference in pixel values between the facial wrinkle regions of the filtered image corresponding to the minimum filtering strength and the image to be processed, and each second difference image represents the difference in pixel values between the facial wrinkle regions of the filtered images corresponding to filtering strengths of adjacent magnitudes.
[0090] The second processing module 230 is used to calculate a local processing image according to the first difference image, the first preset weight corresponding to the first difference image, each of the second difference images and the second preset weight corresponding to each of the second difference images.
[0091] The third processing module 240 is used to superimpose the facial wrinkle region in the image to be processed with the local processed image in the image to be processed to obtain a first result image.
[0092] In an optional embodiment, the third processing module 240 is further used to: determine a wrinkle removal weight according to a received user operation; and obtain a second result image according to the wrinkle removal weight, the first result image and the image to be processed.
[0093] Optionally, the above modules can be stored in the form of software or firmware. Figure 1 The memory 110 shown in the figure may be fixed in the operating system (OS) of the electronic device 100 and may be Figure 1Meanwhile, the data and program codes required for executing the above modules may be stored in the memory 110.
[0094] Optionally, an embodiment of the present application further provides a readable storage medium having a computer program stored thereon, wherein the computer program implements the image processing method when executed by a processor.
[0095] In summary, the embodiments of the present application provide an image processing method, device, electronic device and readable storage medium, and obtain a first difference image and at least one second difference image according to the image to be processed and the obtained filtered image, wherein the obtained filtered image is obtained after the image to be processed is processed under different filtering intensities, the first difference image represents the difference in pixel values between the filtered image corresponding to the minimum filtering intensity and the facial wrinkle area of the image to be processed, and each second difference image represents the difference in pixel values between the facial wrinkle areas of the filtered images corresponding to the filtering intensities of adjacent sizes. Then, based on each obtained difference image and the preset weight corresponding to each difference image, a local processing image is calculated. Finally, the local processing image is superimposed on the facial wrinkle area in the image to be processed. In this way, the facial wrinkles in the image to be processed can be faded, and since the details are restored according to each difference image, the image can also be made natural.
[0096] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device 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 devices, methods and computer program products 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 the 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.
[0097] 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.
[0098] 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 this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or 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: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, and other media that can store program codes.
[0099] 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: The method comprises: Perform smoothing filtering on the image to be processed according to different filtering strengths to obtain filtered images corresponding to different filtering strengths; Obtaining a first difference image and at least one second difference image, wherein the first difference image represents the difference in pixel values of the facial wrinkle regions of the filter image corresponding to the minimum filter strength and the image to be processed, and each second difference image represents the difference in pixel values of the facial wrinkle regions of the filter images corresponding to filter strengths of adjacent magnitudes; Obtaining a local processed image by weighted summation based on the first difference image, the first preset weight corresponding to the first difference image, each of the second difference images and the second preset weight corresponding to each of the second difference images; In the image to be processed, superimposing the facial wrinkle region in the image to be processed with the local processed image to obtain a first result image; Determining wrinkle removal weights according to received user operations; Obtaining a second result image according to the wrinkle removal weight, the first result image and the image to be processed; The step of performing smoothing filtering on the image to be processed according to different filtering strengths to obtain filtered images corresponding to different filtering strengths includes: According to a first preset filtering strength, performing smoothing filtering on the image to be processed to obtain a first filtered image; According to a second preset filtering strength, a smoothing filtering process is performed on the first filtered image to obtain a second filtered image, wherein the filtered images corresponding to the different filtering strengths include the first filtered image and the second filtered image.
2. The method according to claim 1, characterized in that The smoothing filtering is performed on the image to be processed according to different filtering strengths to obtain filtered images corresponding to different filtering strengths, including: Performing face detection on the image to be processed to determine key points of the face in the image to be processed; Determine a face area to be processed of the image to be processed according to key points of the face in the image to be processed, wherein the face area to be processed includes a facial wrinkle area; Smoothing filtering is performed on the face to-be-processed area according to different filtering intensities to obtain filtered images corresponding to the different filtering intensities.
3. The method according to claim 1, characterized in that The facial wrinkle area in the image to be processed is determined by: The facial key points of the mask image are mapped with the facial key points of the image to be processed to determine the facial wrinkle area in the image to be processed according to the foreground area in the mask image, wherein the mask image is a pre-stored image and the foreground area of the mask image is the facial wrinkle area.
4. The method according to claim 3, characterized in that The mask image is obtained by: Performing face detection on a standard face image to obtain position information of key face points in the standard face image; Creating an image with the same size as the standard face image as an initial mask image; According to the received marking operation, the foreground area is marked on the initial mask image to obtain the mask image, wherein the points in the mask image whose position information is the same as the position information of the facial key points in the standard face image are the facial key points of the mask image.
5. The method according to claim 1, characterized in that The step of obtaining a second result image according to the wrinkle removal weight, the first result image and the image to be processed comprises: Determining a weight corresponding to the image to be processed according to the wrinkle removal weight, wherein the sum of the wrinkle removal weight and the weight corresponding to the image to be processed is a preset value; The second result image is obtained by weighted summing according to the wrinkle removal weight, the first result image, the image to be processed and the weight corresponding to the image to be processed.
6. An image processing device, characterized in that: The device comprises: A filtering module is used to perform smoothing filtering on the image to be processed according to different filtering intensities to obtain filtered images corresponding to different filtering intensities; A first processing module, configured to obtain a first difference image and at least one second difference image, wherein the first difference image represents the difference in pixel values of facial wrinkle regions between the filtered image corresponding to the minimum filtering strength and the image to be processed, and each second difference image represents the difference in pixel values of facial wrinkle regions between the filtered images corresponding to filtering strengths of adjacent magnitudes; A second processing module, configured to calculate a local processing image by weighted summation based on the first difference image, the first preset weight corresponding to the first difference image, each of the second difference images and the second preset weight corresponding to each of the second difference images; A third processing module is used to superimpose the facial wrinkle region in the image to be processed with the local processed image in the image to be processed to obtain a first result image; Wherein, the filtering module is specifically used for: According to a first preset filtering strength, performing smoothing filtering on the image to be processed to obtain a first filtered image; According to a second preset filtering strength, performing smoothing filtering on the first filtered image to obtain a second filtered image, wherein the filtered images corresponding to the different filtering strengths include the first filtered image and the second filtered image; The third processing module is further used to: determine a wrinkle removal weight according to a received user operation; and obtain a second result image according to the wrinkle removal weight, the first result image and the image to be processed.
7. An electronic device, characterized in that: The invention comprises a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor can execute the machine executable instructions to implement the image processing method according to any one of claims 1 to 5.
8. A readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the image processing method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Image buffing method and device, and electronic device
CN106169177A
Image processing method and device, and terminal equipment
CN108550117A
Image fusion method and device, electronic equipment and storage medium
CN110415202A
Digital makeup
US20140328509A1
Image processing method and apparatus, and computer device and storage medium
WO2020097836A1