Image processing method, device, electronic device and storage medium

By obtaining the initial mask texture image of the target image, filling the transparent area with a preset color, performing Gaussian blur processing, scaling the transparent area according to the preset blocking parameters, and integrating the Alpha channel, the efficiency of image floating special effects processing in the existing technology is solved. It reduces problems and realizes automatic and efficient generation of floating light effects.

CN114758046BActive Publication Date: 2024-10-25BEIJING DAJIA INTERNET INFORMATION TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202210311917.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-28
Publication Date
2024-10-25
Estimated Expiration
2042-03-28

AI Technical Summary

Technical Problem

It is difficult to efficiently add floating light effects to images with existing technology, especially when the video duration is long, and manual processing of each frame of the image is inefficient.

Method used

By obtaining the initial mask texture image of the target image, filling the transparent area with the preset color, performing Gaussian blur processing, and scaling the transparent area according to the preset blocking parameters, and finally fusing the filled Alpha channel with the blurred Alpha channel to generate A matte texture image with a glow effect.

Benefits of technology

Automatically processes each frame of the video, reducing manual steps and improving efficiency. It can significantly reduce the processing time for a large number of images and generate floating light effects with natural light and shadow effects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114758046B_ABST
    Figure CN114758046B_ABST
Patent Text Reader

Abstract

The present application provides an image processing method, device, electronic device and storage medium, and relates to the field of image processing technology. The method includes: obtaining an initial mask texture image of a target image, and filling the transparent area of ​​the initial mask texture image; using the geometric softness of the initial mask texture image as the blur radius, performing Gaussian blur processing on the initial mask texture image to obtain a first mask texture image; scaling the transparent area of ​​the first mask texture image according to the blocking parameter to obtain a second mask texture image; using the grayscale softness of the second mask texture image as the blur radius, performing Gaussian blur processing on the second mask texture image to obtain a third mask texture image; merging the Alpha channel of the filled mask texture image with the Alpha channel of the third mask texture image to obtain a target mask texture image. By expanding or blocking the mask texture image of the image, the edge of the mask texture image is smooth and has grayscale, presenting a floating light effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of image processing technology, and in particular to an image processing method, device, electronic device and storage medium. Background Art

[0002] In the field of image processing technology, special effects can usually be added to images in order to increase the interest of the image. For example, special effects can include three-dimensional special effects and post-processing special effects. Among them, three-dimensional special effects refer to the production of three-dimensional related content through three-dimensional software technology. Post-processing special effects refer to the technology of reprocessing the image after rendering (such as filters, etc.). Post-processing special effects can achieve the effect of simulating material camera shooting, or the effect of movie pictures.

[0003] In one example, in order to achieve the effect of simulating the adhesion between images, a floating light effect is added to the image through post-processing effects. The image with the floating light effect can improve the viewing quality of the image because of its gentle tone and natural transition between light and shadow. Therefore, how to add the floating light effect to the image has become an urgent problem to be solved. Summary of the invention

[0004] The present disclosure provides an image processing method, device, electronic device and storage medium, which can increase the floating light effect of an image.

[0005] The technical solution of the embodiment of the present disclosure is as follows:

[0006] According to a first aspect of an embodiment of the present disclosure, an image processing method is provided, which may include: obtaining an initial mask texture image of a target image, and filling a transparent area of ​​the initial mask texture image with a preset color to obtain a filled mask texture image, wherein the initial mask texture image is an area with an alpha channel in the target image; using the geometric softness of the initial mask texture image as a blur radius, performing Gaussian blur processing on the initial mask texture image to obtain a first mask texture image; scaling the transparent area of ​​the first mask texture image according to a preset blocking parameter to obtain a second mask texture image; using the grayscale softness of the second mask texture image as a blur radius, performing Gaussian blur processing on the second mask texture image to obtain a third mask texture image; and merging the alpha channel of the filled mask texture image with the alpha channel of the third mask texture image to obtain a target mask texture image.

[0007] Optionally, the above-mentioned “scaling the transparent area of ​​the first mask texture image according to the preset blocking parameter to obtain the second mask texture image” includes: when the preset blocking parameter is less than 0, expanding the area of ​​the non-transparent area of ​​the first mask texture image and reducing the area of ​​the transparent area to obtain the second mask texture image; when the preset blocking parameter is greater than 0, expanding the area of ​​the transparent area and reducing the area of ​​the non-transparent area.

[0008] Optionally, the method also includes: in response to an input operation, obtaining a preset blocking parameter, and normalizing the preset blocking parameter to obtain a processed blocking parameter; wherein, for any pixel point among the multiple pixel points of the second mask texture image, the above-mentioned method of "expanding the area of ​​the non-transparent area of ​​the first mask texture image" specifically includes: when the transparency of the pixel point is greater than the processed blocking parameter, the transparency of the pixel point at the corresponding position of the pixel point in the filled mask texture image is used as the transparency of the pixel point.

[0009] Optionally, the above-mentioned "expanding the area of ​​the transparent region" method may specifically include: when the transparency of the pixel point is less than or equal to the processed blocking parameter, setting the transparency of the pixel point to a preset value, which is less than the transparency of the pixel point.

[0010] Optionally, the above-mentioned method of "merging the Alpha channel of the filled mask texture image with the Alpha channel of the third mask texture image" can specifically include: replacing the Alpha channel of each pixel in the filled mask texture image with the Alpha channel of the pixel in the third mask texture image corresponding to the position of the pixel, to obtain the target mask texture image.

[0011] According to a second aspect of an embodiment of the present disclosure, an image processing device is provided, which may include: an acquisition unit, a processing unit and a fusion unit; the acquisition unit is used to acquire an initial mask texture image of a target image, wherein the initial mask texture image is an area with an alpha channel in the target image; the processing unit is used to fill the transparent area of ​​the initial mask texture image with a preset color to obtain the filled mask texture image; the processing unit is also used to use the geometric softness of the initial mask texture image as a blur radius to perform Gaussian blur processing on the initial mask texture image to obtain a first mask texture image; the processing unit is also used to scale the transparent area of ​​the first mask texture image according to a preset blocking parameter to obtain a second mask texture image; the processing unit is also used to use the grayscale softness of the second mask texture image as a blur radius to perform Gaussian blur processing on the second mask texture image to obtain a third mask texture image; the fusion unit is used to fuse the alpha channel of the filled mask texture image with the alpha channel of the third mask texture image to obtain a target mask texture image.

[0012] Optionally, the processing unit is specifically used to: when the preset blocking parameter is less than 0, expand the area of ​​the non-transparent area of ​​the first mask texture image and reduce the area of ​​the transparent area to obtain a second mask texture image; when the preset blocking parameter is greater than 0, expand the area of ​​the transparent area and reduce the area of ​​the non-transparent area.

[0013] Optionally, the acquisition unit is also used to obtain a preset blocking parameter in response to an input operation; the processing unit is also used to normalize the preset blocking parameter to obtain a processed blocking parameter; wherein, for any pixel point among the multiple pixel points of the second mask texture image, the processing unit is specifically used to use the transparency of the pixel point at the corresponding position in the filled mask texture image as the transparency of the pixel point when the transparency of the pixel point is greater than the processed blocking parameter.

[0014] Optionally, the processing unit is specifically configured to set the transparency of the pixel to a preset value when the transparency of the pixel is less than or equal to the processed blocking parameter, and the preset value is less than the transparency of the pixel.

[0015] Optionally, the processing unit is specifically configured to replace the Alpha channel of each pixel in the filled mask texture image with the Alpha channel of the pixel corresponding to the position of the pixel in the third mask texture image to obtain a target mask texture image.

[0016] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, which may include: a processor and a memory for storing processor executable instructions; wherein the processor is configured to execute the instructions to implement any one of the optional image processing methods in the above-mentioned first aspect.

[0017] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, on which instructions are stored. When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform any one of the optional image processing methods in the above-mentioned first aspect.

[0018] According to a fifth aspect of an embodiment of the present disclosure, a computer program product is provided, which includes computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the image processing method as described in any optional implementation of the first aspect.

[0019] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure.

[0020] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:

[0021] Based on any of the above aspects, in the present disclosure, after obtaining the initial mask texture image of the target image, the initial mask texture image is first filled with a preset color to obtain a filled mask texture image, and the geometric softness of the initial mask texture image is used as the blur radius to perform Gaussian blur processing on the initial mask texture image to obtain a first mask texture image. The first mask texture image has relatively smooth edges. Then, the transparent area of ​​the first mask texture image is scaled according to the preset blocking parameters to obtain a second mask texture image, thereby ensuring that the edge of the mask texture image can have an opaque area. Then, the grayscale softness of the second mask texture image is used as the blur radius, and the second mask texture image is blurred again to obtain a third mask texture image with grayscale. Finally, the third mask texture image is fused with the filled mask texture image to obtain a mask texture image with smooth edges and grayscale, that is, a mask texture image with a floating light effect. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.

[0023] Figure 1 A schematic diagram of the structure of a communication system provided by an embodiment of the present disclosure is shown;

[0024] Figure 2 A schematic diagram of an image processing method provided by an embodiment of the present disclosure is shown;

[0025] Figure 3 A schematic diagram of a mask texture image provided by an embodiment of the present disclosure is shown;

[0026] Figure 4 A schematic diagram of another mask texture image provided by an embodiment of the present disclosure is shown;

[0027] Figure 5 A schematic diagram of another mask texture image provided by an embodiment of the present disclosure is shown;

[0028] Figure 6 A schematic diagram of another mask texture image provided by an embodiment of the present disclosure is shown;

[0029] Figure 7 A schematic diagram of another mask texture image provided by an embodiment of the present disclosure is shown;

[0030] Figure 8 A schematic diagram of another mask texture image provided by an embodiment of the present disclosure is shown;

[0031] Fig. 9 A schematic diagram showing a pixel arrangement of an image provided by an embodiment of the present disclosure is shown;

[0032] Fig.10 A schematic diagram of the structure of an image processing device provided by an embodiment of the present disclosure is shown;

[0033] Fig.11 A schematic structural diagram of another image processing device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0034] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.

[0035] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0036] It should also be understood that the term “comprising” indicates the presence of described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements and / or components.

[0037] The data involved in the present disclosure may be data authorized by the user or fully authorized by all parties.

[0038] As described in the background art, in order to make a video have liquid motion effects or streamer effects, a floating light effect can be added to each frame of the video. In this way, when multiple consecutive frames of images have the floating light effect, the video can have the streamer effect.

[0039] Normally, videos can be debugged and processed manually to make them have a light-streaming effect. For example, the manual method can be: the editor uses special effects software to process and debug each frame of the video so that the image has a floating light effect; then, the editor sorts the processed multiple frames in sequence to obtain a video with a light-streaming effect. However, in the case of a long video, the video may include a large number of images. If the manual method is used, the editor needs to spend a lot of time and energy to process each frame of the video, which is inefficient.

[0040] In view of this, an embodiment of the present application provides an image processing method, which may include: obtaining an initial mask texture image of a target image, and filling a transparent area of ​​the initial mask texture image with a preset color to obtain a filled mask texture image, wherein the initial mask texture image is an area with an alpha channel in the target image; using the geometric softness of the initial mask texture image as a blur radius, performing Gaussian blur processing on the initial mask texture image, and obtaining a first mask texture image; scaling the transparent area of ​​the first mask texture image according to a preset blocking parameter to obtain a second mask texture image; using the grayscale softness of the second mask texture image as a blur radius, performing Gaussian blur processing on the second mask texture image to obtain a third mask texture image; merging the Alpha channel of the filled mask texture image and the Alpha channel of the third mask texture image to obtain a target mask texture image.

[0041] Based on the technical solution provided by the embodiment of the present application, after obtaining the initial mask texture image of the target image, the initial mask texture image is first filled with a preset color to obtain a filled mask texture image, and the geometric softness of the initial mask texture image is used as the blur radius to perform Gaussian blur processing on the initial mask texture image to obtain a first mask texture image. The first mask texture image has relatively smooth edges. Then, the transparent area of ​​the first mask texture image is scaled according to the preset blocking parameters to obtain a second mask texture image, thereby ensuring that the edge of the mask texture image can have an opaque area. Then, the grayscale softness of the second mask texture image is used as the blur radius, and the second mask texture image is blurred again to obtain a third mask texture image with grayscale. Finally, the third mask texture image is fused with the filled mask texture image to obtain a mask texture image with smooth edges and grayscale, that is, a mask texture image with a floating light effect.

[0042] Furthermore, based on the above scheme, each frame of the video can be processed in a targeted manner, so that there is no need for manual processing and adjustment of the image, thereby reducing the number of operation steps. For the situation where a large number of images need to be processed, manual operations can be greatly reduced, thereby improving efficiency.

[0043] The following is an exemplary description of the image processing method provided by the embodiment of the present disclosure in conjunction with the accompanying drawings:

[0044] Figure 1 A schematic diagram of a communication system provided in an embodiment of the present application. The communication system may include an image processing device 100 and a collection device 200.

[0045] The image processing device 100 can be used to process images. For example, the image processing device 100 can be a computer, a desktop computer, a laptop computer, an ultra-mobile personal computer (UMPC), etc. The present disclosure does not impose any special restrictions on the specific form of the image processing device. It can interact with the user through one or more methods such as a keyboard, a touch pad, a touch screen, a remote control, voice interaction, or a handwriting device.

[0046] In some embodiments, the image processing device 100 may also be a single server, or may also be a server cluster composed of multiple servers. In some implementations, the server cluster may also be a distributed cluster.

[0047] The acquisition device 200 may be used to acquire videos or images, and send the acquired videos or images to the image processing device 100. For example, the acquisition device 200 may be an acquisition device such as a mobile phone, a video camera, or a still camera.

[0048] In some embodiments, the image processing device 100 and the acquisition device 200 may be independent devices or may be integrated together, which is not limited in the embodiments of the present disclosure.

[0049] The image processing method provided by the embodiment of the present disclosure can be applied to the aforementioned Figure 1 The image processing device shown in .

[0050] It should be noted that the execution subject of the image processing method provided by the present disclosure is an image processing device, and may also be a chip or system on chip in the image processing device, etc., without limitation.

[0051] like Figure 2 As shown, the image processing method provided by the embodiment of the present disclosure may include:

[0052] S201, obtaining an initial mask texture image of a target image.

[0053] Among them, the target image can be any frame image in the video to be processed. The mask texture image can be an area with an Aplha channel in the image, or it can refer to an image that includes an object and has the outline of the object. The initial mask texture image may include transparent areas and non-transparent areas. The transparent area refers to the area where the transparency of the pixel points in the initial mask texture image is 0, and the non-transparent area refers to the area where the transparency of the pixel points in the initial mask texture image is greater than 0. For example, as shown in Figure 3, it is a schematic diagram of an initial mask texture map of a target image provided in an embodiment of the present application, and the initial mask texture image may include a transparent area 30( Figure 3 The white area in the image has a transparency of 0) and the non-transparent area 31 ( Figure 3 The area except the white area, the transparency of the pixels in this area is greater than 0).

[0054] In a possible implementation, the image processing device can actively Figure 1 The acquisition device 200 in the image processing apparatus acquires the target image, or the acquisition device 200 actively sends the target image to the image processing apparatus after acquiring the target image. After acquiring the target image, the image processing apparatus can respond to the user's cutout operation to obtain an initial mask texture image of the target image.

[0055] The cutout operation may refer to a user cutting out a target image through a cutout software pre-configured in the image processing device to obtain an initial mask texture image.

[0056] Furthermore, when the acquisition device acquires video data, the image processing device may extract multiple frames of images from the video data. The target image is any one of the multiple frames of images.

[0057] S202: Fill the transparent area of ​​the initial texture image with a preset color to obtain a filled mask texture image.

[0058] The transparency of all pixels in the filled transparent area is greater than 0. The preset color can be set as needed, for example, black. Figure 4 As shown, use black Figure 3 The transparent area 30 of the initial mask texture image is filled to obtain a filled mask texture image.

[0059] S203 , taking the geometric softness of the initial mask texture image as a blur radius, performing Gaussian blur processing on the initial mask texture image to obtain a first mask texture image.

[0060] Among them, performing Gaussian blur processing on the initial mask texture image may refer to using a preset blur algorithm to perform Gaussian blur processing on the initial mask texture image. The preset Gaussian blur algorithm can be used to reduce the noise and detail level of the mask texture image. For example, the preset blur algorithm may include a Gaussian blur algorithm, a mean blur algorithm, etc. The description of the Gaussian blur algorithm and the mean blur algorithm please refer to the prior art and will not be traced back.

[0061] The geometric softness can be used to reflect the edge smoothness of the mask texture image. The greater the geometric softness, the softer the edge of the mask texture image. Figure 5 As shown in FIG. 1 , the geometric softness of the initial mask texture image is used as the blur radius, and the initial mask texture image is subjected to Gaussian blur processing to obtain the mask texture image (ie, the first mask texture image). Compared to Figure 3 In the mask texture image of FIG. 32 , the edge of the mask texture image of FIG. 32 after Gaussian blur processing is clear and has no burrs.

[0062] S204 . Scaling the transparent area of ​​the first mask texture image according to preset blocking parameters to obtain a second mask texture image.

[0063] The preset blocking parameter may be used to enlarge (or extend) or reduce (block) the edge area of ​​the transparent region of the mask texture image.

[0064] In one example, when the preset blocking parameter is greater than 0, the area of ​​the transparent area of ​​the first mask texture image can be expanded, and the area of ​​the non-transparent area of ​​the first mask texture image can be reduced; when the preset blocking parameter is less than 0, the area of ​​the non-transparent area can be expanded, and the area of ​​the transparent area can be reduced. In this way, by adjusting the size of the preset blocking parameter, the mask texture image can be flexibly blocked or expanded.

[0065] The preset blocking parameter can be set as needed, for example, it can be any value between -127 and 127. Figure 6 As shown in (a), it is the mask texture image corresponding to the preset blocking parameter of -127. Figure 6 As shown in (b), it is the mask texture image corresponding to the preset blocking parameter of 127.

[0066] In a possible implementation, a preset blocking parameter can be obtained in response to an input operation, and the preset blocking parameter can be normalized to obtain a processed blocking parameter. For a first pixel point, the first pixel point is any pixel point in the first mask texture image. When the transparency of the first pixel point is greater than the processed blocking parameter, the transparency of the second pixel point of the filled mask texture image is used as the transparency of the first pixel point. The input operation may refer to an operation for inputting a preset blocking parameter through the input interface of the image processing device. Normalizing the preset blocking parameter can make the processed preset blocking parameter be between [0,1]. The second pixel point is a pixel point in the filled mask texture image corresponding to the position of the first pixel point.

[0067] Based on this implementation method, since the transparency of the pixels of the filled mask texture image is 1, and the transparency of the pixels of the first mask texture image is less than 1, the transparency of the filled mask texture image is used as the transparency of the first mask texture image, which expands the area of ​​the transparent region of the first mask texture image, thereby achieving the reduction / blocking of the mask texture image.

[0068] In another possible implementation, when the transparency of the first pixel is less than or equal to the processed blocking parameter, the transparency of the first pixel is set to a preset value. The preset value is less than the transparency of the first pixel, for example, the preset value may be 0.

[0069] Based on this implementation method, since the preset value is smaller than the transparency of the first pixel, the transparency of the pixel of the first mask texture image is set to the preset value, for example, to 0, which is equivalent to expanding the area of ​​the transparent region of the first mask texture image, thereby achieving the expansion / extension of the first mask texture image.

[0070] S205 , taking the grayscale softness of the second mask texture image as a blur radius, performing Gaussian blur radius processing on the second mask texture image to obtain a third mask texture image.

[0071] The description of performing Gaussian blur radius processing on the second mask texture image may refer to the description of S203 above, which will not be described in detail.

[0072] It should be noted that the preset fuzzy algorithm in S205 and the preset fuzzy algorithm in S203 can be the same fuzzy algorithm, such as both are Gaussian fuzzy algorithms, or they can be different fuzzy algorithms, such as the preset fuzzy algorithm in S205 is the Gaussian fuzzy algorithm, and the preset fuzzy algorithm in S203 is the mean fuzzy algorithm, without limitation.

[0073] The grayscale softness can be used to reflect the feathering degree of the edge of the mask texture image. The greater the grayscale softness, the richer the feathering degree of the edge of the mask texture image.

[0074] S206 , merging the Alpha channel of the filled mask texture image and the Alpha channel of the third mask texture image to obtain a target mask texture image.

[0075] The target mask texture image refers to a mask texture image with a floating light effect. Figure 7 As shown in FIG. 1 , a mask texture image with a floating light effect is provided in an embodiment of the present application. Figure 3 The initial mask texture image, Figure 7 The edge region of the mask texture image in FIG. 3 has a gray scale, and the edge region is smoother. For example, the edge region 32 does not have burrs.

[0076] In a possible implementation, the method of fusing the Aplha channel of the filled mask texture image and the Aplha channel of the third mask texture image may specifically include: replacing the transparency of each pixel in the filled mask texture image with the transparency of the pixel 9 at the corresponding position in the third mask texture image. In this way, the fusion of the filled mask texture image and the third mask texture image can be achieved. In addition, the non-transparent area of ​​the third mask texture image has a clear edge, and the edge has rich gray levels. Therefore, the transparency of the transparent area of ​​the fused image may not be 0, and the image in the opaque area may have a floating light effect.

[0077] For example, the pixels of the filled texture image are pixel A1, pixel A2, ..., pixel An, and the pixels of the third mask texture image are pixel B1, pixel B2, ..., pixel Bn. Wherein, n is a positive integer. There is a positional correspondence between pixel A1 and pixel B1, there is a positional correspondence between pixel A2 and pixel B2, and there is a positional correspondence between An and Bn. The image processing device can replace the transparency of pixel A1 to pixel An with the transparency of pixel B1 to pixel Bn, respectively. In this way, the target mask texture image can be obtained. Figure 8 As shown, Figure 8 (a) is an image not processed using the technical solution provided in the embodiment of the present application; Figure 8 (b) in FIG. 1 is an image processed using the technical solution provided in the embodiment of the present application. Figure 8 It can be seen that the light and shadow effects of the image processed using the technical solution of the embodiment of the present application are better, for example, the light transition at the bridge of the nose of the character in the image is softer, and the pants area in the image is clearer.

[0078] In an embodiment of the present application, after obtaining the initial mask texture image of the target image, the initial mask texture image is first filled with a preset color to obtain a filled mask texture image, and the geometric softness of the initial mask texture image is used as the blur radius to perform Gaussian blur processing on the initial mask texture image to obtain a first mask texture image. The first mask texture image has relatively smooth edges. Then, the transparent area of ​​the first mask texture image is scaled according to the preset blocking parameters to obtain a second mask texture image, thereby ensuring that the edge of the mask texture image can have an opaque area. Then, the grayscale softness of the second mask texture image is used as the blur radius, and the second mask texture image is blurred again to obtain a third mask texture image with grayscale. Finally, the third mask texture image is fused with the filled mask texture image to obtain a mask texture image with smooth edges and grayscale, that is, a mask texture image with a floating light effect.

[0079] In one embodiment, in the above S203 and S205, the method of performing Gaussian blur processing on the mask texture image may specifically include: adjusting the transparency of the pixel points of the mask texture image according to a preset blur algorithm.

[0080] Here, adjusting the transparency of the pixel may refer to adjusting the transparency of the Alpha channel of the pixel.

[0081] It should be pointed out that, from the above S204, it can be seen that due to the reduction or expansion of the non-transparent area of ​​the initial mask texture image, the edge of the mask texture image also changes accordingly, that is, compared with the initial mask texture image, the position of the adjacent area of ​​the non-transparent area and the transparent area of ​​the second mask texture image is offset.

[0082] In one possible implementation, for any pixel of the multiple pixels of the mask texture image (referred to as the third pixel for ease of description), the transparency of the first pixel can be determined based on a preset blur algorithm and the transparency of multiple pixels within a preset range.

[0083] The first pixel is the center pixel of the preset range. The size of the preset range can be set as needed, for example, it can be any value between 0 and 100 (in pixels). For example, when the size of the preset range is 50, the image processing device can determine the transparency of the first pixel based on the preset blur algorithm and the transparency of the 50 pixels adjacent to the first pixel. For example, Fig. 9As shown, there are 25 pixels within the preset range, and the central pixel is the first pixel. The image processing device can determine the transparency of the first pixel based on the preset blur algorithm and the transparency of the 24 pixels except the first pixel.

[0084] In a possible embodiment, the method provided in the embodiment of the present application may further include: outputting the target mask texture image, so that the processed mask texture image with floating light effect can be displayed to the user.

[0085] It is understandable that, in actual implementation, the mobile device described in the embodiments of the present disclosure may include one or more hardware structures and / or software modules for implementing the aforementioned corresponding image processing methods, and these execution hardware structures and / or software modules may constitute an electronic device. Those skilled in the art should easily realize that, in combination with the algorithm steps of each example described in the embodiments disclosed herein, the present disclosure can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present disclosure.

[0086] Based on such understanding, an embodiment of the present disclosure also provides an image processing device. Fig.10 FIG. 2 shows a schematic diagram of the structure of an image processing device provided by an embodiment of the present disclosure. Fig.10 As shown, the image processing device may include: an acquisition unit 1001 , a processing unit 1002 and a fusion unit 1003 .

[0087] Among them, the acquisition unit 1001 is used for the device to acquire the initial mask texture image of the target image, and the initial mask texture image is the area with an alpha channel in the target image; the processing unit 1002 is used to fill the transparent area of ​​the initial mask texture image with a preset color to obtain the filled mask texture image; the processing unit 1002 is also used to use the geometric softness of the initial mask texture image as the blur radius, and perform Gaussian blur processing on the initial mask texture image to obtain a first mask texture image; the processing unit 1002 is also used to scale the transparent area of ​​the first mask texture image according to the preset blocking parameter to obtain a second mask texture image; the processing unit 1002 is also used to use the grayscale softness of the second mask texture image as the blur radius, and perform Gaussian blur processing on the second mask texture image to obtain a third mask texture image; the fusion unit is used to fuse the filled mask texture image and the third mask texture image to obtain a target mask texture image. For example, the acquisition unit 1001 may be used to execute the above S201, the processing unit 1002 may be used to execute the above S202 to S205, and the fusion unit may be used to execute the above S206.

[0088] Optionally, the processing unit 1002 is specifically used to: when the preset blocking parameter is less than 0, expand the area of ​​the non-transparent area of ​​the first mask texture image and reduce the area of ​​the transparent area to obtain a second mask texture image; when the preset blocking parameter is greater than 0, expand the area of ​​the transparent area and reduce the area of ​​the non-transparent area.

[0089] Optionally, the acquisition unit 1001 is also used to obtain a preset blocking parameter in response to an input operation; the processing unit 1002 is also used to normalize the preset blocking parameter to obtain a processed blocking parameter; wherein, for any pixel point among the multiple pixel points of the second mask texture image, the processing unit 1002 is specifically used to use the transparency of the pixel point at the corresponding position in the filled mask texture image as the transparency of the pixel point when the transparency of the pixel point is greater than the processed blocking parameter.

[0090] Optionally, the processing unit 1002 is specifically configured to set the transparency of the pixel to a preset value when the transparency of the pixel is less than or equal to the processed blocking parameter, and the preset value is less than the transparency of the pixel.

[0091] Optionally, the fusion unit 1003 is specifically configured to replace the transparency of each pixel of the filled mask texture image with the transparency of a pixel corresponding to the position of the pixel in the third mask texture image to obtain a target mask texture image.

[0092] As described above, the embodiment of the present disclosure can divide the functional modules of the image processing device according to the above method example. Among them, the above integrated modules can be implemented in the form of hardware or in the form of software functional modules. In addition, it should be noted that the division of modules in the embodiment of the present disclosure is schematic and is only a logical function division. There may be other division methods in actual implementation. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing module.

[0093] Regarding the image processing device in the above embodiment, the specific manner in which each module performs operations and the beneficial effects possessed have been described in detail in the aforementioned method embodiment and will not be repeated here.

[0094] The embodiment of the present disclosure also provides an image processing device. Fig.11 The schematic diagram of the structure of the image processing device provided by the embodiment of the present disclosure is shown. The image processing device may include at least one processor 111, a communication bus 112, a memory 113 and at least one communication interface 114.

[0095] The processor 111 may be a processor (central processing unit, CPU), a microprocessor unit, an ASIC, or one or more integrated circuits for controlling the execution of the program of the disclosed solution. As an example, in conjunction with FIG. 10 , the functions implemented by the processing unit 1002 in the image processing device are similar to those of FIG. Fig.11 The functions implemented by the processor 111 in are the same.

[0096] The communication bus 112 may include a pathway for transmitting information between the above-mentioned components.

[0097] The communication interface 114 uses any transceiver or other device for communicating with other devices or communication networks, such as servers, Ethernet, radio access networks (RAN), wireless local area networks (WLAN), etc. As an example, in combination with Fig.10 The function implemented by the acquisition unit 1001 in the image processing device is similar to Fig.11 The communication interface 114 in FIG.

[0098] The memory 113 may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory may exist independently and be connected to the processing unit through a bus. The memory may also be integrated with the processing unit.

[0099] The memory 113 is used to store application code for executing the solution of the present disclosure, and the execution is controlled by the processor 111. The processor 111 is used to execute the application code stored in the memory 113, so as to realize the functions in the method of the present disclosure.

[0100] In a specific implementation, as an embodiment, the processor 111 may include one or more CPUs, such as Fig.11 CPU0 and CPU1 in.

[0101] In a specific implementation, as an embodiment, the mobile device may include multiple processors, such as Fig.11 1 and 115. Each of these processors may be a single-CPU processor or a multi-CPU processor. A processor herein may refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).

[0102] In a specific implementation, as an embodiment, the image processing apparatus may further include an input device 116 and an output device 117. The input device 116 communicates with the output device 117 and may accept user input in a variety of ways. For example, the input device 116 may be a mouse, a keyboard, a touch screen device, or a sensor device. The output device 117 communicates with the processor 111 and may display information in a variety of ways. For example, the output device 111 may be a liquid crystal display (LCD), a light emitting diode (LED) display device, or the like.

[0103] Those skilled in the art will understand that Fig.11 The structure shown in the figure does not constitute a limitation on the image processing device, and may include more or less components than those shown in the figure, or combine certain components, or adopt a different component arrangement.

[0104] The present disclosure also provides a computer-readable storage medium including instructions, and when the instructions in the computer-readable storage medium are executed by an electronic device, the electronic device can execute the image processing method provided by the above-mentioned embodiment. For example, the computer-readable storage medium may be a memory 113 including instructions, and the above instructions may be executed by the processor 111 of the image processing device to complete the above method. For another example, the computer-readable storage medium may be a memory 112 including instructions, and the above instructions may be executed by the processor 111 of the server to complete the above method. Optionally, the computer-readable storage medium may be a non-temporary computer-readable storage medium, for example, the non-temporary computer-readable storage medium may be a ROM, RAM, CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.

[0105] The present disclosure also provides a computer program product, which includes computer instructions. When the computer instructions are executed on a processor of an image processing device, the image processing device executes the above Figure 2 The image processing method shown.

[0106] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0107] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. An image processing method, characterized in that: The method comprises: Acquire an initial mask texture image of a target image, and fill a transparent area of ​​the initial mask texture image with a preset color to obtain a filled mask texture image, wherein the initial mask texture image is an area with an alpha channel in the target image; Using the geometric softness of the initial mask texture image as a blur radius, performing Gaussian blur processing on the initial mask texture image to obtain a first mask texture image; According to a preset blocking parameter, scaling the transparent area of ​​the first mask texture image to obtain a second mask texture image; Using the grayscale softness of the second mask texture image as a blur radius, performing Gaussian blur processing on the second mask texture image to obtain a third mask texture image; The Alpha channel of the filled mask texture image and the Alpha channel of the third mask texture image are merged to obtain a target mask texture image.

2. The method according to claim 1, characterized in that The step of scaling the transparent area of ​​the first mask texture image according to the preset blocking parameter to obtain the second mask texture image includes: When the preset blocking parameter is less than 0, the area of ​​the non-transparent region of the first mask texture image is enlarged, and the area of ​​the transparent region of the first mask texture image is reduced, so as to obtain the second mask texture image; When the preset blocking parameter is greater than 0, the area of ​​the transparent region of the first mask texture image is enlarged, and the area of ​​the non-transparent region of the first mask texture image is reduced to obtain the second mask texture image.

3. The method according to claim 2, characterized in that The method further comprises: In response to an input operation, obtaining the preset blocking parameter; Normalizing the preset blocking parameters to obtain processed blocking parameters; Wherein, for a first pixel point, the first pixel point is any pixel point of the first mask texture image, and the step of expanding the area of ​​a non-transparent region of the first mask texture image includes: When the transparency of the first pixel is greater than the processed blocking parameter, the transparency of the second pixel of the filled mask texture image is used as the transparency of the first pixel, and the second pixel is the pixel in the filled mask texture image corresponding to the position of the first pixel.

4. The method according to claim 3, characterized in that The step of enlarging the area of ​​the transparent region comprises: When the transparency of the first pixel is less than or equal to the processed blocking parameter, the transparency of the first pixel is set to a preset value, and the preset value is less than the transparency of the first pixel.

5. The method according to any one of claims 1 to 4, characterized in that: The step of fusing the alpha channel of the filled mask texture image with the alpha channel of the third mask texture image to obtain a target mask texture image includes: The Alpha channel of each pixel in the filled mask texture image is replaced with the Alpha channel of the pixel corresponding to the position of the pixel in the third mask texture image to obtain the target mask texture image.

6. An image processing device, characterized in that: The device comprises: an acquisition unit, a processing unit and a fusion unit; The acquisition unit is used to acquire an initial mask texture image of the target image, wherein the initial mask texture image includes a transparent area and a non-transparent area; The processing unit is used to fill the transparent area of ​​the initial mask texture image with a preset color to obtain a filled mask texture image, wherein the initial mask texture image is an area with an alpha channel in the target image; The processing unit is further configured to use the geometric softness of the initial mask texture image as a blur radius, perform Gaussian blur processing on the initial mask texture image, and obtain a first mask texture image; The processing unit is further used to perform scaling processing on the transparent area of ​​the first mask texture image according to a preset blocking parameter to obtain a second mask texture image; The processing unit is further configured to use the grayscale softness of the second mask texture image as a blur radius, perform Gaussian blur processing on the second mask texture image, and obtain a third mask texture image; The fusion unit is used to fuse the Alpha channel of the filled mask texture image and the Alpha channel of the third mask texture image to obtain a target mask texture image.

7. The device according to claim 6, characterized in that The processing unit is specifically used for: When the preset blocking parameter is less than 0, the area of ​​the non-transparent region of the first mask texture image is enlarged, and the area of ​​the transparent region of the first mask texture image is reduced, so as to obtain the second mask texture image; When the preset blocking parameter is greater than 0, the area of ​​the transparent region of the first mask texture image is enlarged, and the area of ​​the non-transparent region of the first mask texture image is reduced.

8. The device according to claim 7, characterized in that The acquisition unit is further configured to acquire the preset blocking parameter in response to an input operation; The processing unit is further used to perform normalization processing on the preset blocking parameter to obtain a processed blocking parameter; Wherein, for the first pixel point, the first pixel point is any pixel point of the first mask texture image, and the processing unit is specifically used to: When the transparency of the first pixel is greater than the processed blocking parameter, the transparency of the second pixel of the filled mask texture image is used as the transparency of the first pixel, and the second pixel is the pixel in the filled mask texture image corresponding to the position of the first pixel.

9. The device according to claim 8, characterized in that The processing unit is specifically used for: When the transparency of the first pixel is less than or equal to the processed blocking parameter, the transparency of the first pixel is set to a preset value, and the preset value is less than the transparency of the first pixel.

10. The device according to any one of claims 6 to 9, characterized in that: The fusion unit is specifically used for: The alpha channel of each pixel point of the filled mask texture image is replaced with the alpha channel of the pixel point corresponding to the position of the pixel point in the third mask texture image to obtain the target mask texture image.

11. An electronic device, characterized in that: The electronic device comprises: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the image processing method according to any one of claims 1 to 5.

12. A computer-readable storage medium, characterized in that: When the instructions in the computer-readable storage medium are executed by an electronic device, the electronic device is enabled to execute the image processing method according to any one of claims 1 to 5.

13. A computer program product comprising computer instructions, characterized in that: When the computer instructions are executed by a processor, the image processing method according to any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Color control method and device for role model

    CN106815881A

  • Digitally overlaying an image with another image

    CN108141547A

  • Lip makeup special effect display method, device and equipment and storage medium

    CN112037123A

  • Minimum-maximum filtering of graphical texture data

    US20150130819A1