Image processing method, device, equipment and medium
By generating and processing contour maps to adjust image pixel parameter values, it solves the problem of poor dermabrasion effect in the existing technology, achieves more natural and uniform skin texture retention and light and shadow transition, and satisfies users' needs for dermabrasion processing. needs.
Patent Information
- Application Number
- CN202011482709.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-16
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2040-12-16
AI Technical Summary
The effect of microdermabrasion in the existing technology is poor and difficult to meet user needs, especially in retaining the natural texture of the skin and the transition between light and shadow.
By generating an initial contour map and processing it, a target contour map is obtained, and the pixel parameter values in the image are adjusted according to the target contour map to achieve a more natural and uniform microdermabrasion effect.
It effectively retains the natural texture in the skin, improves the microdermabrasion effect, meets users' needs for microdermabrasion processing, reduces dependence on light environment and shadow recognition, and simplifies the development of microdermabrasion algorithms.
Smart Images

Figure CN112581394B
Abstract
Description
Technical Field
[0001] The present application belongs to the field of image processing technology, and specifically relates to an image processing method, device, equipment and medium. Background Art
[0002] At present, image beautification has been increasingly used in image processing to obtain images with better visual effects and meet users' aesthetic needs. Skin resurfacing, as one of the functions of image beautification, can be used to process images to make the skin in the image more delicate.
[0003] In the prior art, the skin resurfacing process is mainly performed by high-low frequency division, that is, the image information is divided into high-frequency and low-frequency parts according to the detail frequency. The high-frequency part is the texture details of the skin, and the low-frequency part is the overall transition and color of the skin. In the high-frequency part, the obvious discordant skin texture is filtered out to make the skin more delicate and the pore texture more uniform. In the low-frequency part, the blurring process is performed to make the light and shadow transition of the skin uniform and smooth. However, the prior art has the defect of poor skin resurfacing effect and is difficult to meet user needs. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide an image processing method, device, equipment and medium, which can solve the problem that the skin resurfacing effect in the prior art is poor and difficult to meet user needs.
[0005] In order to solve the above technical problems, this application is implemented as follows:
[0006] In a first aspect, an embodiment of the present application provides an image processing method, comprising:
[0007] Obtaining image parameter values of each pixel in the first image;
[0008] generating an initial contour map according to the image parameter value of each pixel in the first image;
[0009] Processing the initial contour map to obtain a target contour map;
[0010] According to the target contour map, the image parameter value of each pixel in the first image is adjusted to obtain a second image.
[0011] In a second aspect, an embodiment of the present application provides an image processing device, including:
[0012] An acquisition module, used to acquire an image parameter value of each pixel in the first image;
[0013] A generating module, used for generating an initial contour map according to the image parameter value of each pixel in the first image;
[0014] A first processing module is used to process the initial contour map to obtain a target contour map;
[0015] The adjustment module is used to adjust the image parameter value of each pixel in the first image according to the target contour map to obtain a second image.
[0016] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the method described in the first aspect.
[0017] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.
[0018] In a fifth aspect, an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the steps of the method described in the first aspect.
[0019] The image processing method provided in the embodiment of the present application generates initial contour lines according to the image parameter values of each pixel in the first image, processes the initial contour lines to obtain a target contour map, and adjusts the image parameter values of each pixel according to the target contour map to obtain a second image. The embodiment of the present application performs skin resurfacing processing on the image based on the contour map, which can effectively preserve the natural texture of the skin. At the same time, the distribution of the image parameter values of the pixels in the second image can correspond to the target contour map obtained after processing, which helps to make the image parameter values between the pixels in the second image have a better transition, thereby effectively improving the skin resurfacing effect and meeting the skin resurfacing processing needs of users. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 is a flowchart of an image processing method provided in an embodiment of the present application;
[0021] Figure 2a is an example diagram of the initial contour map in the embodiment of the present application;
[0022] Figure 2b It is an example diagram of the target contour map in the embodiment of the present application;
[0023] Figure 3 is a flowchart of an image processing method provided by another embodiment of the present application;
[0024] Figure 4is a structural diagram of an image processing apparatus provided in an embodiment of the present application;
[0025] Figure 5 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0026] Figure 6 It is a schematic diagram of the hardware structure of the electronic device provided in the embodiment of the present application. DETAILED DESCRIPTION
[0027] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0028] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0029] The image processing method, apparatus, device and medium provided in the embodiments of the present application are described in detail below with reference to the accompanying drawings through specific embodiments and their application scenarios.
[0030] Figure 1 : is a flowchart of an image processing method provided in an embodiment of the present application. The image processing method may include:
[0031] Step 101, obtaining an image parameter value of each pixel in a first image;
[0032] Step 102, generating an initial contour map according to the image parameter value of each pixel in the first image;
[0033] Step 103, processing the initial contour map to obtain a target contour map;
[0034] Step 104: adjusting the image parameter value of each pixel in the first image according to the target contour map to obtain a second image.
[0035] In the embodiment of the present application, the purpose of performing image processing on the first image can be considered to be skin resurfacing. Accordingly, the first image may be an image including a face, a hand, and the like. The following embodiments will mainly illustrate the image processing process for a face image as an example.
[0036] The first image can generally be considered to be composed of a plurality of pixels, and each pixel may have a corresponding image parameter value, such as a brightness value, a lightness value, or a saturation value.
[0037] The brightness value can be considered as a parameter value that represents the degree of brightness. For example, in an image in RGB color mode, the brightness value can be calculated based on the values of the three color channels in the RGB color mode; or, for a grayscale image, the brightness value can be considered as a grayscale value. Generally speaking, the brightness value can range from 0 to 255.
[0038] Lightness value can also be used to indicate the brightness of a color. To a certain extent, brightness can be considered as lightness, but the value range of lightness value is usually 0 to 1. In addition, lightness value and brightness value can be converted by a specific formula.
[0039] To simplify the description, the following embodiments will mainly use the image parameter value as a brightness value as an example for description.
[0040] Each pixel in the first image corresponds to a brightness value, and an initial contour map can be generated based on the brightness values of these pixels. Generally speaking, a contour map can be a type of graph that uses lines connecting points of equal values to represent a continuously distributed and gradually changing quantitative feature. In this embodiment, the brightness value can be considered as the quantitative feature shown here; and the initial contour map can include multiple contour lines, and the brightness values of each pixel on the same contour line are equal, that is, a contour line can correspond to a brightness value; in addition, the brightness value of a pixel between two adjacent contour lines can be matched to the brightness value corresponding to one of the contour lines, for example, the brightness value of a pixel between two adjacent contour lines can be equal to the brightness value corresponding to one of the contour lines.
[0041] For details, please refer to Figure 2a , Figure 2aThis is an example of an initial contour map generated for an initial face image. The initial face image may correspond to the first image mentioned above. In the initial contour map, there are multiple contour lines; for example, the brightness value may be divided into 17 brightness levels from 0 to 255, and the brightness value span in each brightness level is 15. Thus, in the initial contour map, there may be multiple contour lines, and the brightness values corresponding to each contour line may be 0, 15, 30, 45, ..., 255. The brightness values of each pixel on the same contour line may be equal. Of course, the contour lines may also be obtained based on an interpolation algorithm or other algorithms. That is to say, the actual brightness values of each pixel on the same contour line may also be different. In addition, the above division method for brightness levels is only an example. In actual applications, it may also be divided into other numbers of brightness levels as needed, and the brightness value spans in each brightness level may also be different.
[0042] Since the initial face image may contain spots, blemishes or mottled colors, the initial contour lines in the generated initial contour map may have low smoothness or may have contour line jumps; therefore, in this embodiment, the initial contour map may be processed to obtain a target contour map. It is worth noting that the processing of the initial contour map here may be smoothing of the edges of the initial contour lines, or non-jump processing of the jumped initial contour lines, or both. To a certain extent, non-jump processing can also be considered as a smoothing process, so in the following embodiments, the smoothing process may be mainly used as an example for explanation.
[0043] The target contour map may also have multiple contour lines, each of which may also correspond to a brightness value, and the pixels between two adjacent contour lines may also be matched to the brightness value corresponding to one of the contour lines. The difference between the target contour map and the initial contour map is that the contour lines in the target contour map may be obtained through the above-mentioned smoothing process. Accordingly, the contour lines in the target contour map may have relatively smooth edges and relatively fewer jumps than the contour lines in the initial contour map, and the quality of the contour lines is relatively higher.
[0044] For details, please refer to Figure 2b , Figure 2b Shows the Figure 2a The target contour map after processing the initial contour map in . By comparing Figure 2a and Figure 2b The contour line details shown in the rectangular box in the figure show that the contour lines in the processed target contour line map are smoother, and the jump of brightness values in the internal area enclosed by the contour lines is also effectively improved.
[0045] The initial contour map is processed, and specifically, image processing methods such as median filtering, mean filtering, box filtering or Gaussian filtering can be used. There is no specific limitation here and it can be selected according to actual needs.
[0046] After obtaining the target contour map, the brightness value of each pixel in the first image can be adjusted according to the target contour map to obtain the second image. For example, for pixels located within the area enclosed by a target contour line in the target contour map, a specific brightness value can be assigned. Of course, when there are other target contour lines within the area enclosed by a target contour line, the pixels located within the area enclosed by the target contour line and another target contour line can be assigned a specific brightness value; for ease of explanation, the above-mentioned one target contour line can be defined as the first target contour line, and the above-mentioned other target contour line can be defined as the second target contour line, wherein the second target contour line is located within the area enclosed by the first target contour line and is adjacent to the first target contour line.
[0047] The specific manner of adjusting the brightness value of each pixel in the first image according to the target contour map will be further described in the following embodiments, and here only the feasibility of the brightness value adjustment process is briefly described.
[0048] The image processing method provided in the embodiment of the present application generates initial contour lines according to the image parameter values of each pixel in the first image, processes the initial contour lines to obtain a target contour map, and adjusts the image parameter values of each pixel according to the target contour map to obtain a second image. The embodiment of the present application performs skin resurfacing processing on the image based on the contour map, which can effectively preserve the natural texture of the skin. At the same time, the distribution of the image parameter values of the pixels in the second image can correspond to the target contour map obtained after processing, which helps to make the image parameter values between the pixels in the second image have a better transition, thereby effectively improving the skin resurfacing effect and meeting the skin resurfacing processing needs of users.
[0049] Optionally, the image parameter value includes a brightness value or a luminance value.
[0050] It is worth emphasizing again that in the embodiment of the present application, the image parameter value of each pixel can be a brightness value or a lightness value, etc., which can be selected according to actual needs. Unless otherwise specified, the image parameter value is taken as a brightness value for explanation.
[0051] In the embodiment of the present application, it can be considered that the initial contour map is obtained by numerically grading the brightness value differences of each pixel in the first image, and then the initial contour map can be smoothed to obtain the target contour map, and the target contour map is used to guide the skin resurfacing process. Compared with the existing method of performing skin resurfacing based on high and low frequency division of the image, this embodiment can directly extract the brightness value from the first image and perform skin resurfacing based on the single dimension of the brightness value, thereby omitting the process of performing high and low frequency division of the image information detail frequency and processing the high frequency part and the low frequency part separately, and the skin resurfacing algorithm is more concise and efficient.
[0052] In addition, from the perspective of the principle of skin refining, skin refining based on the high and low frequency division of the image usually filters out the obvious discordant skin texture in the high-frequency part, making the skin more delicate and the pore texture more uniform. Blurring is performed in the low-frequency part to make the light and shadow transition of the skin uniform and smooth.
[0053] However, the details of human skin texture are usually complex. When filtering discordant skin textures in the high-frequency part, if the filtering is too strong, the texture will be too delicate and many natural textures will be filtered out; if the filtering is too weak, the skin smoothing effect will be unclear and weak. In addition, in different shooting scenes, the light environment is more variable, and the light and shadow transition is more important; when blurring the low-frequency part to solve the skin transition problem, if there are red spots on the skin, the use of blurring will inevitably lead to uneven color in the area, forming spots and blocks, and the original light and shadow transition will be weaker, and the image obtained after processing will be too flat. In more extreme cases, there may be certain defects in the processing of both the high-frequency part and the low-frequency part. The combination of the defects of the two parts will make the image content obtained after skin smoothing too smooth and unnatural; for facial images, there will be defects such as too stiff facial transition, strong smearing, and unclear skin details, resulting in the face looking like a fake person.
[0054] In the embodiment of the present application, the essence of the image processing method is to change the brightness of the local problem areas in the image by processing the image brightness contour lines, so that the brightness of these local problem areas is consistent with the brightness of the surrounding normal areas, thereby eliminating the problem areas from the light and dark relationship and achieving the skin grinding effect. In this way, when some areas in the image are actually smeared, the smearing feeling caused by the weak transition of light and shadow can be effectively reduced; at the same time, the use of brightness contour lines also makes it possible to retain the details of the skin texture in the image and ensure a certain texture clarity; and the processing of brightness contour lines also makes the skin transition and texture distribution more uniform. In addition, the image processing method of the embodiment of the present application uses the brightness value as the parameter basis for skin grinding, which can effectively adapt to the light environment and shadows. Therefore, in the operation process related to skin grinding, it is not necessary to rely on additional recognition property algorithms such as light environment recognition or shadow recognition, which reduces the difficulty of developing the skin grinding algorithm.
[0055] Optionally, the above step 102, generating an initial contour map according to the image parameter value of each pixel in the first image, includes:
[0056] According to the image parameter value of each pixel in the first image, the first image is divided into regions to obtain a plurality of initial regions, wherein the image parameter value of each pixel in the first initial region is within a first image parameter value range, the first image parameter value range is an image parameter value range matching the first initial region, and the first initial region is any initial region among the plurality of initial regions;
[0057] Extracting an initial boundary line between any two adjacent initial regions among the plurality of initial regions;
[0058] An initial contour map is generated according to the initial dividing line.
[0059] In combination with actual application scenarios, in the above-mentioned initial face image, the brightness levels may not transition sequentially. For example, in two adjacent pixels, one pixel may be white, and the corresponding brightness value may be 255, while the other pixel may be black, and the corresponding brightness value may be 0. In these cases, it may be difficult to generate brightness contour lines corresponding to each brightness level according to the brightness level sequence; therefore, in this embodiment, pixels with brightness values at the same brightness level may be divided into regions, and the boundary lines of these regions may be used as brightness contour lines.
[0060] Specifically, taking the method of dividing the brightness values 0 to 255 into 17 brightness levels in the above embodiment as an example, the pixels in the initial face image can be divided into regions to obtain multiple initial regions. The brightness values of all pixels in a single initial region can be within the same brightness value range. For example, the brightness value range can be 0 to 14, 15 to 29, or 30 to 44, etc., and one brightness value range can correspond to one brightness level.
[0061] After obtaining multiple initial regions, the initial dividing line between any two adjacent initial regions can be extracted, and each initial dividing line can correspond to a corresponding brightness value. In view of the fact that the brightness levels between the above initial regions do not transition sequentially, the brightness values corresponding to the initial contour lines corresponding to the initial dividing lines between these initial regions can be assigned according to preset rules or brightness change trends. Generally speaking, by assigning values, the brightness value corresponding to any initial contour line can be used to reflect the brightness level of the brightness values of all pixels in a matching initial region.
[0062] It is easy to understand that the above initial face image can correspond to the first image, and the brightness contour lines obtained based on the dividing line can be considered as initial contour lines in the initial contour line map.
[0063] It can be seen that this embodiment divides the pixels of the first image into regions according to the image parameter values of each pixel in the first image, obtains multiple initial regions, and further generates an initial contour map according to the dividing lines between the initial regions; it can effectively generate an initial contour map for the first image with different pixel brightness value distribution states, and improve the quality of the initial contour lines in the initial contour map.
[0064] In one example, the above step 103, processing the initial contour map to obtain a target contour map, includes:
[0065] The initial contour map is subjected to median filtering to obtain a target contour map.
[0066] Median filtering is a nonlinear processing method, and its basic principle is to replace the value of a certain pixel in the image with the median of each pixel in a neighborhood of the pixel, thereby eliminating isolated noise points and effectively protecting the edges. Specifically in this embodiment, the initial contour map is processed using a median filter, so that the target contour lines in the obtained target contour map are smoother, and at the same time, there are fewer jumps in the area enclosed by the target contour lines.
[0067] In an example, for the comparison between the initial contour map and the target contour map, you can refer to Figure 2a and Figure 2b ;in, Figure 2aCorresponding to the initial contour map, Figure 2b It corresponds to the target contour map. As can be seen from the figure, Figure 2b The distribution of medium brightness contour lines is smoother, and the jumps in brightness contour lines caused by skin spots, blemishes or noise are reduced, which is more in line with the ideal skin texture law.
[0068] Optionally, the above step 104, adjusting the image parameter value of each pixel in the first image according to the target contour map, includes:
[0069] Obtaining image parameter values corresponding to target contour lines in the target contour map;
[0070] The image parameter value of each pixel in the first image is adjusted to the image parameter value corresponding to the target contour line matching each pixel.
[0071] It is easy to understand that, for a contour map, the value corresponding to any contour line can usually be used to reflect the distribution of parameters in the area corresponding to the contour line. For a target contour map, each target contour line can be used to divide the pixels at different brightness levels into regions; that is, each target contour line will correspond to a region, and the brightness value corresponding to the target contour line can be used to reflect the overall distribution of the brightness values of the pixels in the area corresponding to the target contour line.
[0072] In this embodiment, the target contour map can be equivalent to redividing the initial area in the above embodiment to obtain the target area. After obtaining the target contour map, the brightness values of the pixels in the target area corresponding to each target contour line can be reassigned according to the brightness values corresponding to the target contour lines.
[0073] For example, in the target contour map, there may be target contours with corresponding brightness values of 30, 45, and 60, which are respectively corresponding to the first target contour, the second target contour, and the third target contour for ease of explanation. Among them: the area corresponding to the first target contour may be located between the first target contour and the second target contour, and the brightness value of each pixel in the area may be updated to the brightness value of 30 corresponding to the first target contour; the area corresponding to the second target contour may be located between the second target contour and the third target contour, and the brightness value of each pixel in the area may be updated to the brightness value of 45 corresponding to the second target contour.
[0074] In this embodiment, after obtaining the target contour map, the brightness value of each pixel in the first image can be adjusted more efficiently by adjusting the image parameter value of each pixel in the first image to the image parameter value corresponding to the target contour line matching the pixel, thereby obtaining the second image.
[0075] In order to further improve the skin smoothing effect of the first image, another embodiment of the present application provides an image processing method, such as Figure 3 As shown, the specific steps include:
[0076] Step 301, obtaining image parameter values of each pixel in a first image;
[0077] Step 302, generating an initial contour map according to the image parameter value of each pixel in the first image;
[0078] Step 303, processing the initial contour map to obtain a target contour map;
[0079] Step 304: According to the target contour map, adjust the image parameter value of each pixel in the first image to obtain a second image.
[0080] Step 305, determining a target pixel from the second image according to the target contour line in the target contour map, wherein the target pixel is a pixel located within a preset distance range of the target contour line;
[0081] Step 306: Perform edge blurring processing of the image parameter value on the target pixel to obtain a third image.
[0082] In this embodiment, the image parameter value is also mainly described by taking the brightness value as an example. According to the brightness value of each pixel in the first image, an initial contour map can be generated to reflect the brightness distribution of each pixel in the first image.
[0083] By processing the initial contour map, a target contour map can be obtained. The processing method may be median filtering or the like. In the processed target contour map, the target contour lines may be smoother and have fewer jumps, which is more in line with the ideal skin texture law.
[0084] According to the target contour map, the brightness value of each pixel in the first image is adjusted to obtain the second image. The brightness value of each pixel can be adjusted as mentioned in the above embodiment, that is, the brightness value of any pixel is adjusted to the brightness value corresponding to the target contour corresponding to the pixel; of course, in practical applications, the brightness value of each pixel can also be adjusted according to actual needs, for example, the brightness value of any pixel is adjusted to the average brightness value corresponding to the two target contours adjacent to the pixel, etc.
[0085] In this embodiment, the second image can be considered as an image obtained by preliminary skin grinding of the first image, by adjusting the brightness value of each pixel in the first image; and in this skin grinding process stage, when there are fewer divisions of brightness levels, that is, the brightness value span of each brightness level is large, there may be a large brightness difference between the pixels on both sides of the target contour line in the second image. For example, taking the method of dividing the brightness value 0 to 255 into 17 brightness levels in the above embodiment as an example, the brightness values of the pixels on both sides of the target contour line corresponding to the brightness value of 30 may be 15 and 30 respectively, so that in some skin areas that require smooth transition, it may bring a more obvious light and dark gradient visually.
[0086] Therefore, in this embodiment, the edge blurring of the brightness value can be performed on the pixels within the preset range of the target contour line, that is, the target pixels mentioned above, to obtain a third image. For example, assume that the second image has the following sequence of pixel brightness values: 15, 15, 15, 30, 30, 30; and after the edge blurring process, the brightness values of several pixels corresponding to this sequence may be adjusted to: 15, 18, 21, 24, 27, 30. In this way, the brightness values of the pixels near the target contour line can be smoothly transitioned, effectively avoiding the brightness fault phenomenon and improving the skin refining effect of the image.
[0087] Similarly, in combination with the above pixel brightness value sequence of 15, 15, 15, 30, 30, 30, assuming that a target contour line L passes through pixel A corresponding to the brightness of the fourth pixel, and the brightness value corresponding to the target contour line L is 30, then the pixels located within the preset distance range of the target contour line L may include pixel A, three pixels sequentially determined from pixel A along the first direction, and two pixels sequentially determined from pixel A along the second direction. Among them, the first direction and the second direction may be two opposite directions, specifically corresponding to the left-right direction, the up-down direction of the second image, or the normal direction of the target contour line L at pixel A, etc. In other words, the pixels within the preset distance range of the above target contour line may be pixels sequentially determined within the preset distance range along the preset direction based on the pixels located on the target contour line.
[0088] From another perspective, the target contour line can also be offset to the inside and outside by a preset distance to obtain two offset lines, and the target pixel can be the pixel between the two offset lines; of course, the offset of the target contour line can also be offset to one side. It is worth emphasizing that the offset line mentioned here is mainly for the convenience of understanding the corresponding relationship between the target pixel and the target contour line. In the actual edge blurring process, there may be no process of obtaining the offset line.
[0089] In other words, the above edge blurring process can be considered as a transition process for the edge of the target contour line. It is worth emphasizing that the above adjustment of the pixel brightness sequence is only an exemplary description of the edge blurring process. In practical applications, the parameters of the edge blurring, such as the pixel distance range used for the edge blurring process and the gradient of the adjusted pixel brightness value, can be set according to actual needs.
[0090] It should be noted that the image processing method provided in the embodiment of the present application can be executed by an image processing device or a control module in the image processing device for executing the image processing method. In the embodiment of the present application, the image processing device provided in the embodiment of the present application is described by taking the image processing device executing the image processing method as an example.
[0091] Figure 4 : is a schematic diagram of the structure of an image processing device provided in an embodiment of the present application. The image processing device may include:
[0092] An acquisition module 401 is used to acquire an image parameter value of each pixel in the first image;
[0093] A generating module 402, configured to generate an initial contour map according to the image parameter value of each pixel in the first image;
[0094] A first processing module 403 is used to process the initial contour map to obtain a target contour map;
[0095] The adjustment module 404 is used to adjust the image parameter value of each pixel in the first image according to the target contour map to obtain a second image.
[0096] The image processing device provided in the embodiment of the present application, on the one hand, generates an initial contour map about image parameter values for a first image, and adjusts the image parameter values of the pixels of the first image to obtain a second image based on a target contour map obtained by processing the initial contour map, so that the image parameter values of each pixel in the second image can obtain a smoother transition; on the other hand, the contour lines in the contour map can effectively correspond to the natural textures in the skin, so that these natural textures can be preserved, thereby effectively improving the skin resurfacing effect and meeting the user's skin resurfacing processing needs.
[0097] Optionally, the image parameter value includes a brightness value or a luminance value.
[0098] Optionally, the generating module 402 may include:
[0099] a dividing unit, configured to divide the first image into regions according to image parameter values of each pixel in the first image, so as to obtain a plurality of initial regions, wherein the image parameter value of each pixel in the first initial region is within a first image parameter value range, the first image parameter value range is an image parameter value range matching the first initial region, and the first initial region is any initial region among the plurality of initial regions;
[0100] an extraction unit, used for extracting an initial boundary line between any two adjacent initial areas among the plurality of initial areas;
[0101] A generating unit is used to generate an initial contour map according to the initial dividing line.
[0102] Optionally, the first processing module 403 may be specifically configured to perform median filtering on the initial contour map to obtain a target contour map.
[0103] Optionally, the adjustment module 404 may include:
[0104] An acquisition unit, used for acquiring an image parameter value corresponding to a target contour line in the target contour line map;
[0105] The adjusting unit is used to adjust the image parameter value of each pixel in the first image to the image parameter value corresponding to the target contour line matching each pixel.
[0106] Optionally, the above-mentioned image processing device may further include:
[0107] A determination module, configured to determine a target pixel from the second image according to a target contour line in the target contour map, wherein the target pixel is a pixel located within a preset distance range of the target contour line;
[0108] The second processing module is used to perform edge blurring processing of the image parameter value on the target pixel to obtain a third image.
[0109] The image processing device in the embodiment of the present application can be a device, or a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. Exemplarily, the mobile electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc. The non-mobile electronic device can be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.
[0110] The image processing device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0111] The image processing device provided in the embodiment of the present application can achieve Figures 1 to 3 To avoid repetition, the various processes implemented by the image processing device in the image processing method embodiment will not be described again here.
[0112] Optional, such as Figure 5 As shown, an embodiment of the present application also provides an electronic device 500, including a processor 501, a memory 502, and a program or instruction stored in the memory 502 and executable on the processor 501. When the program or instruction is executed by the processor 501, each process of the above-mentioned image processing method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.
[0113] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.
[0114] Figure 6 It is a schematic diagram of the hardware structure of an electronic device implementing an embodiment of the present application.
[0115] The electronic device 600 includes but is not limited to: a radio frequency unit 601, a network module 602, an audio output unit 603, an input unit 604, a sensor 605, a display unit 606, a user input unit 607, an interface unit 608, a memory 609, and a processor 610.
[0116] Those skilled in the art will appreciate that the electronic device 600 may also include a power source (such as a battery) for supplying power to each component, and the power source may be logically connected to the processor 610 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Figure 6 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.
[0117] The processor 610 is used to obtain an image parameter value of each pixel in the first image;
[0118] generating an initial contour map according to the image parameter value of each pixel in the first image;
[0119] Processing the initial contour map to obtain a target contour map;
[0120] According to the target contour map, the image parameter value of each pixel in the first image is adjusted to obtain a second image.
[0121] In an embodiment of the present application, the electronic device, on the one hand, generates an initial contour map about image parameter values for the first image, and adjusts the image parameter values of the pixels of the first image to obtain a second image based on the target contour map obtained by processing the initial contour map, so that the image parameter values of each pixel in the second image can be better transitioned; on the other hand, the contour lines in the contour map can effectively correspond to the natural textures in the skin, so that these natural textures can be preserved, thereby effectively improving the skin resurfacing effect and meeting the user's skin resurfacing processing needs.
[0122] Optionally, the processor 610 may also be configured to divide the first image into regions according to image parameter values of each pixel in the first image to obtain a plurality of initial regions, wherein the image parameter value of each pixel in the first initial region is within a first image parameter value range, the first image parameter value range is an image parameter value range matching the first initial region, and the first initial region is any initial region among the plurality of initial regions;
[0123] Extracting an initial boundary line between any two adjacent initial regions among the plurality of initial regions;
[0124] An initial contour map is generated according to the initial dividing line.
[0125] Optionally, the processor 610 may also be configured to perform median filtering on the initial contour map to obtain a target contour map.
[0126] Optionally, the processor 610 may also be configured to obtain an image parameter value corresponding to a target contour line in the target contour line map;
[0127] The image parameter value of each pixel in the first image is adjusted to the image parameter value corresponding to the target contour line matching each pixel.
[0128] Optionally, the processor 610 may also be configured to determine a target pixel from the second image according to the target contour line in the target contour map after obtaining the second image, the target pixel being a pixel located within a preset distance range of the target contour line;
[0129] The target pixel is subjected to edge blurring processing of the image parameter value to obtain a third image.
[0130] It should be understood that in the embodiment of the present application, the input unit 604 may include a graphics processor (GPU) 6041 and a microphone 6042, and the graphics processor 6041 processes the image data of the static picture or video obtained by the image capture device (such as a camera) in the video capture mode or the image capture mode. The display unit 606 may include a display panel 6061, and the display panel 6061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 607 includes a touch panel 6071 and other input devices 6072. The touch panel 6071 is also called a touch screen. The touch panel 6071 may include two parts: a touch detection device and a touch controller. Other input devices 6072 may include but are not limited to a physical keyboard, a function key (such as a volume control button, a switch button, etc.), a trackball, a mouse, and a joystick, which will not be repeated here. The memory 609 can be used to store software programs and various data, including but not limited to applications and operating systems. The processor 610 can integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, the user interface, and the application program, and the modem processor mainly processes wireless communication. It is understandable that the above-mentioned modem processor may not be integrated into the processor 610.
[0131] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the above-mentioned image processing method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0132] The processor is a processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0133] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned image processing method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0134] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0135] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are 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 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 one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0136] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the relevant technology, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0137] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. An image processing method, characterized in that: include: Obtaining image parameter values of each pixel in the first image; generating an initial contour map according to the image parameter value of each pixel in the first image; Processing the initial contour map to obtain a target contour map; According to the target contour map, adjusting the image parameter value of each pixel in the first image to obtain a second image; The processing of the initial contour map to obtain a target contour map includes: The initial contour map is subjected to edge smoothing and internal area non-jump processing to obtain a target contour map; The step of adjusting the image parameter value of each pixel in the first image according to the target contour map includes: Obtaining image parameter values corresponding to target contour lines in the target contour map; The image parameter value of each pixel in the first image is adjusted to the image parameter value corresponding to the target contour line matching each pixel.
2. The method according to claim 1, characterized in that The image parameter value includes a brightness value or a luminance value.
3. The method according to claim 1, characterized in that Generating an initial contour map according to the image parameter value of each pixel in the first image includes: According to the image parameter value of each pixel in the first image, the first image is divided into regions to obtain a plurality of initial regions, wherein the image parameter value of each pixel in the first initial region is within a first image parameter value range, the first image parameter value range is an image parameter value range matching the first initial region, and the first initial region is any initial region among the plurality of initial regions; Extracting an initial boundary line between any two adjacent initial regions among the plurality of initial regions; An initial contour map is generated according to the initial dividing line.
4. The method according to claim 1, characterized in that: The processing of the initial contour map to obtain a target contour map includes: The initial contour map is subjected to median filtering to obtain a target contour map.
5. The method according to claim 1, characterized in that After obtaining the second image, the method further includes: According to the target contour line in the target contour map, determining the target pixel from the second image, the target pixel being a pixel located within a preset distance range of the target contour line; The target pixel is subjected to edge blurring processing of the image parameter value to obtain a third image.
6. An image processing device, characterized in that: include: An acquisition module, used to acquire an image parameter value of each pixel in the first image; A generating module, used for generating an initial contour map according to the image parameter value of each pixel in the first image; A first processing module is used to process the initial contour map to obtain a target contour map; An adjustment module, used for adjusting the image parameter value of each pixel in the first image according to the target contour map to obtain a second image; The first processing module is specifically used for: The initial contour map is subjected to edge smoothing and internal area non-jump processing to obtain a target contour map; The adjustment module is specifically used for: Obtaining image parameter values corresponding to target contour lines in the target contour map; The image parameter value of each pixel in the first image is adjusted to the image parameter value corresponding to the target contour line matching each pixel.
7. The device according to claim 6, characterized in that The device also includes: A determination module, configured to determine a target pixel from the second image according to a target contour line in the target contour map, wherein the target pixel is a pixel located within a preset distance range of the target contour line; The second processing module is used to perform edge blurring processing of the image parameter value on the target pixel to obtain a third image.
8. An electronic device, characterized in that: The electronic device comprises: a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the image processing method according to any one of claims 1 to 5.
9. A readable storage medium, characterized in that: The readable storage medium stores a program or instruction, and when the program or instruction is executed by a processor, the steps of the image processing method according to any one of claims 1 to 5 are implemented.
