Method and apparatus for generating special effect graph, and device and storage medium

By determining the directed distance information of the original image and setting the noise map, generating the initial special effects diagram and fusing it with the original image, the problem of single image stroke special effects in the prior art is solved, and high-quality stroke effects are achieved.

WO2024016923A9PCT designated stage expired Publication Date: 2025-02-06BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2023/101015
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2022-07-18
Filing Date
2023-06-19
Publication Date
2025-02-06

AI Technical Summary

Technical Problem

When generating image stroke special effects in the prior art, the effect is single and unnatural, and it is difficult to quickly generate images with realistic stroke effects.

Method used

By determining the directed distance information of the original image and generating the initial effect map with the set noise map, the initial effect map is finally fused with the original image to obtain the target effect map.

Benefits of technology

It realizes the rapid generation of images with realistic stroke effects, improving the display effect and richness of special effects images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2023101015_06022025_PF_FP_ABST
    Figure CN2023101015_06022025_PF_FP_ABST
Patent Text Reader

Abstract

Provided in the embodiments of the present disclosure are a method and apparatus for generating a special effect graph, and a device and a storage medium. The method comprises: determining directed distance information corresponding to an original image, wherein the directed distance information represents grayscale information of a segmentation result of the original image or distance information between a pixel point and an image segmentation boundary; generating an initial special effect graph according to the directed distance information and a set noise graph; and fusing the initial special effect graph and the original image, so as to obtain a target special effect graph.
Need to check novelty before this filing date? Find Prior Art

Description

Method, device, equipment and storage medium for generating special effects images

[0001] This disclosure claims priority to the Chinese patent application filed with the China Patent Office on July 18, 2022, with application number 202210840518.0, the entire contents of which are incorporated by reference into this disclosure. Technical Field

[0002] The embodiments of the present disclosure relate to the field of image processing technology, for example, to a method, apparatus, device, and storage medium for generating special effect images. Background Art

[0003] Smart devices have become an indispensable tool in users' lives. They enable users to engage in a range of entertainment activities, such as adding special effects to images to enhance their enjoyment. Adding special effects edges (also known as strokes) to images is one such image effect processing method.

[0004] In related technologies, when generating an "image stroke" special effect, a linear grid or strip network is constructed through contour points, and then a stroke special effect is generated based on the linear grid or strip grid. The special effect image generated in this way has a single and unnatural effect.

[0005] Summary of the Invention

[0006] The embodiments of the present disclosure provide a method, apparatus, device, and storage medium for generating special effects images, which can quickly generate images with a "stroke" special effect with realistic effects.

[0007] In a first aspect, an embodiment of the present disclosure provides a method for generating a special effect image, comprising:

[0008] Determine directed distance information corresponding to the original image; wherein the directed distance information represents grayscale information of the segmentation result of the original image or distance information between a pixel point and an image segmentation boundary;

[0009] Generate an initial special effect map according to the directed distance information and the set noise map;

[0010] The initial special effects image and the original image are fused to obtain a target special effects image.

[0011] In a second aspect, the embodiments of the present disclosure further provide a device for generating a special effect image, including:

[0012] A directed distance information determination module is configured to determine directed distance information corresponding to the original image; wherein the directed distance information represents the grayscale information of the segmentation result of the original image or the distance information between the pixel point and the image segmentation boundary;

[0013] an initial special effect graph generating module, configured to generate an initial special effect graph according to the directed distance information and a set noise graph;

[0014] The target special effect image acquisition module is configured to fuse the initial special effect image with the original image to obtain a target special effect image.

[0015] In a third aspect, an embodiment of the present disclosure further provides an electronic device, the electronic device comprising:

[0016] one or more processors;

[0017] a storage device for storing one or more programs,

[0018] When the one or more programs are executed by the one or more processors, the one or more processors implement the method for generating a special effect graph as described in the embodiment of the present disclosure.

[0019] In a fourth aspect, an embodiment of the present disclosure further provides a storage medium comprising computer-executable instructions, which, when executed by a computer processor, are used to execute the method for generating a special effect graph as described in the embodiment of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] The above and other features, advantages, and aspects of the various embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and that the originals and elements are not necessarily drawn to scale.

[0021] FIG1 is a flow chart of a method for generating a special effect image provided by an embodiment of the present disclosure;

[0022] FIG2a is an example diagram of a target object mask provided by an embodiment of the present disclosure;

[0023] FIG2 b is a schematic diagram of an expansion mask provided by an embodiment of the present disclosure;

[0024] FIG2c is an example diagram of a fuzzy mask image provided by an embodiment of the present disclosure;

[0025] FIG2 d is an example diagram of a setting noise map provided by an embodiment of the present disclosure;

[0026] FIG2e is a schematic diagram of an initial special effect image provided by an embodiment of the present disclosure;

[0027] FIG3a is an example diagram of a first intermediate special effect diagram provided by an embodiment of the present disclosure;

[0028] FIG3 b is a schematic diagram of a second intermediate special effect image provided by an embodiment of the present disclosure;

[0029] FIG3c is an example diagram of a target special effect diagram provided by an embodiment of the present disclosure;

[0030] FIG4 is a schematic diagram of the structure of a device for generating a special effect image provided by an embodiment of the present disclosure;

[0031] FIG5 is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION

[0032] The following describes embodiments of the present disclosure in more detail with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms, and these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustrative purposes only.

[0033] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown.

[0034] As used herein, the term "including" and its variations are open-ended, i.e., "including but not limited to." The term "based on" means "based, at least in part, on." The term "one embodiment" means "at least one embodiment," the term "another embodiment" means "at least one additional embodiment," and the term "some embodiments" means "at least some embodiments." Other terms are defined in the following description.

[0035] It should be noted that the concepts of “first”, “second”, etc. mentioned in this disclosure are only used to distinguish different devices, modules or units.

[0036] It should be noted that the modifications of “one” and “multiple” mentioned in the present disclosure are illustrative, and those skilled in the art should understand that unless otherwise clearly indicated in the context, they should be understood as “one or more”.

[0037] The names of messages or information exchanged between multiple devices in the embodiments of the present disclosure are for illustrative purposes only.

[0038] It is understandable that before using the technical solutions disclosed in the various embodiments of this disclosure, the type, scope of use, usage scenarios, etc. of the personal information involved in this disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.

[0039] For example, in response to a user's active request, a prompt message is sent to the user to clearly inform the user that the operation requested will require the acquisition and use of the user's personal information. This allows the user to independently choose whether to provide personal information to the electronic device, application, server, storage medium, or other software or hardware that performs the operations of the disclosed technical solution based on the prompt message.

[0040] As an optional implementation, in response to receiving a user's active request, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. In addition, the pop-up window may also contain a selection control for the user to select "agree" or "disagree" to provide personal information to the electronic device.

[0041] It is understandable that the above notification and user authorization process is only illustrative, and other methods that meet relevant laws and regulations can also be applied to the implementation of the present disclosure.

[0042] It is understandable that the data involved in this technical solution (including the data itself, the acquisition or use of the data) must comply with the requirements of relevant laws, regulations and relevant provisions.

[0043] Figure 1 is a flow chart of a method for generating a special effect image provided by an embodiment of the present disclosure. The embodiment of the present disclosure is applicable to the situation of generating a special effect image. The method can be executed by a special effect image generation device, which can be implemented in the form of software and / or hardware. Optionally, it can be implemented by an electronic device, which can be a mobile terminal, a PC or a server, etc.

[0044] As shown in FIG1 , the method includes:

[0045] S110: Determine the directed distance information corresponding to the original image.

[0046] Among them, the directed distance information represents the grayscale information of the segmentation result of the original image or the distance information between the pixel point and the image segmentation boundary. Among them, the segmentation result can be represented by a segmentation mask. In this embodiment, if the directed distance information represents the grayscale information of the segmentation result of the original image, the grayscale value of the pixel point in the segmentation mask is set to a linear transformation to obtain the directed distance information. If the directed distance information represents the distance information between the pixel point and the image segmentation boundary, the directed distance information can be understood as the shortest distance between the pixel point in the original image and the pixel point at the boundary of the target area. If the pixel point is within the target area, the distance can be set to negative. If the pixel point is on the boundary of the target area, the distance can be set to 0. If the pixel point is outside the target area, the distance can be set to positive. In this embodiment, the definition of the distance value can be numerically mapped according to actual needs.

[0047] In this embodiment, the target area can be the area corresponding to the target object in the original image or the area corresponding to the entire original image. The target object can be any object such as a portrait, an animal, a plant, a building, etc., and can be selected according to needs.

[0048] Optionally, if the target area is the area corresponding to the target object in the original image, the method for determining the directed distance information corresponding to the original image can be: segmenting the target object in the original image to obtain a target object mask map; blurring the target object mask map to obtain a blurred mask map; and determining the directed distance information based on the blurred mask map.

[0049] Among them, the distance information is composed of the directed distance values ​​of the pixel points. In this embodiment, any segmentation (matting) algorithm can be used to segment the target object in the original image. Exemplarily, assuming that the target object is a portrait, Figure 2a is an example diagram of the target object mask map. As shown in Figure 2a, the white area is the segmented portrait area, and the black area is the background area. The target object mask map can be blurred in any of the following ways: Gaussian blur, salt and pepper blur or mean blur, etc., which are not processed here. The method of determining the directed distance information based on the blurred mask map can be: determining the directed distance information based on the grayscale value of the pixel point in the blurred mask map. In this embodiment, by determining the directed distance information based on the blurred mask map, the directed distance information can be accurately determined, which is conducive to the generation of subsequent special effects maps.

[0050] Optionally, after obtaining the target object mask image, the method further includes the following step: performing image expansion processing on the target object mask image to obtain an expanded mask image.

[0051] Image dilation can be implemented using the dilation principle in morphology. The image dilation process can be understood as: traversing the pixels in the target object mask, aligning the center of the set dilation kernel with the traversed pixel, then taking the maximum grayscale value in the target object mask aligned with the position where the set dilation kernel has a value of 1, and replacing the current grayscale value of the traversed pixel with this maximum grayscale value. The set dilation kernel can be a binary matrix of a set size; the binary matrix can be understood as a matrix in which the values ​​of the elements are 0 or 1; the set size can be set arbitrarily, for example, it can be 3*3, 5*5. For example, Figure 2b is a schematic diagram of an expanded mask image. As shown in Figure 2b, compared with Figure 2a, the portrait area is expanded. Accordingly, the target object mask image is blurred to obtain a blurred mask image. The process can be: blurring the expanded mask image to obtain a blurred mask image. In this embodiment, performing image dilation on the target object mask image can prevent special effects generated at the boundary of the target object from occluding the target object.

[0052] Optionally, the target object mask image is blurred to obtain the blurred mask image by: downsampling the target object mask image to obtain the downsampled mask image; and blurring the downsampled mask image to obtain the blurred mask image.

[0053] Among them, downsampling the target object mask image can be understood as reducing the target object mask image. The downsampling process can be understood as: changing the S*S window in the target object mask image to one pixel. If the size of the target object mask image is X*Y, the size of the downsampled mask image is (x / s)*(y / s). After obtaining the downsampled mask image, Gaussian blur processing or mean blur processing is performed on the downsampled mask image to obtain a blurred mask image. For example, Figure 2c is an example diagram of a blurred mask image. As shown in Figure 2c, in this embodiment, the target object mask image is first downsampled and then blurred, which can greatly reduce the amount of calculation, thereby improving the efficiency of special effect image generation.

[0054] Optionally, a method of determining the directed distance information according to the fuzzy mask image may be: obtaining grayscale values ​​of pixels in the fuzzy mask image; and performing a set linear transformation on the grayscale values ​​to obtain the directed distance information.

[0055] The grayscale value of the pixel in the fuzzy mask image can be a normalized grayscale value. The grayscale value can be linearly transformed by subtracting N times the grayscale value from 1. N can be a positive integer greater than or equal to 2, for example, N=2. In this embodiment, the value after the grayscale value is linearly transformed is directly used as the directed distance value of the pixel, without calculating the shortest distance between the pixel and the boundary of the target object, which can improve the speed of determining the directed distance information.

[0056] Optionally, if the target area is the entire original image, the manner of determining the directed distance information corresponding to the original image may be: obtaining boundary information of the original image; and determining the directed distance information based on the boundary information and pixel coordinates.

[0057] The boundary information of the original image may include coordinate information of the four vertices of the original image boundary. In this embodiment, a rectangular coordinate system can be established with the center point of the circular image as the origin, the horizontal direction as the x-axis, and the vertical direction as the y-axis. The vertex coordinates of the original image boundary and the pixel coordinates of the pixel points can be determined based on the established rectangular coordinate system.

[0058] In one embodiment, the process of determining the directed distance information based on the boundary information and pixel coordinates can be: first determine the coordinate difference (including the horizontal coordinate difference and the vertical coordinate difference) between the pixel coordinates and the coordinates of the upper right corner vertex of the boundary, take the maximum value of the horizontal coordinate difference and 0 as the horizontal coordinate of the new coordinate, take the maximum value of the vertical coordinate difference and 0 as the vertical coordinate of the new coordinate, and calculate the modulus of the new coordinate; compare the maximum value of the horizontal coordinate difference and the vertical coordinate difference with 0, if the maximum value is greater than 0, then take the modulus as the directed distance information, if the maximum value is less than 0, then sum the modulus with the maximum value to obtain the directed distance information. In this embodiment, by determining the directed distance information based on the boundary information and pixel coordinates, the directed distance value of the pixel point can be accurately and quickly determined. And taking the entire original image as the target area, the "stroke" processing of the entire image can be achieved.

[0059] S120 , generating an initial special effect graph according to the directed distance information and the set noise graph.

[0060] The set noise map may be a noise map with the same size as the original image, generated by a set noise function. The noise map may be a grayscale image. For example, FIG2d is an example diagram of the set noise map in this embodiment.

[0061] Optionally, the process of generating an initial special effects image based on the directed distance information and the set noise image may be: normalizing the directed distance information according to a set method; fusing the normalized directed distance information and the grayscale information of the set noise image to obtain the initial special effects image.

[0062] The process of normalizing the directed distance information according to a set method may be: first, calculating the directed distance value of the pixel point according to the set method; if the calculated value is between 0 and 1, retaining the value; if the value is less than 0, adjusting the value to 0; and if the value is greater than 1, adjusting the value to 1. The process of calculating the directed distance value of the pixel point according to the set method may be: multiplying the nth power (e.g., square) of the directed distance value by a first set value (e.g., 0.16) and then negating the value; and finally adding the negated value to a second set value (e.g., 0.15).

[0063] Optionally, the normalized directed distance information and the grayscale information of the set noise map are fused to obtain the initial special effects map. The process can be: linearly superimposing the normalized directed distance information and the grayscale information of the set noise map to obtain first intermediate information; performing a set index calculation on the first intermediate information to obtain second intermediate information; performing a linear transformation on the second intermediate information, and performing a set index calculation on the second intermediate information after the linear transformation to obtain target information; and generating the initial special effects map based on the target information.

[0064] The process of linearly superimposing the normalized directed distance information and the grayscale information of the set noise map may include first multiplying the normalized directed distance value by the grayscale value of the pixel in the set noise map, taking the negative value, then accumulating the product of the normalized directed distance value and the grayscale value of the pixel in the set noise map (e.g., 0.7), and finally taking the absolute value of the accumulated result. The method of calculating the set exponent of the first intermediate information may include exponentially increasing the first intermediate information by the set value (e.g., 0.13). The process of linearly transforming the second intermediate information may include obtaining initial values ​​for the three color channels and linearly transforming the second intermediate information based on the initial values. The process of exponentially transforming the second intermediate information after the linear transformation may include first subtracting the second intermediate information from 1, then multiplying the calculated result by the initial values ​​of the three color channels and the set value (e.g., 1.5), and finally exponentially increasing the accumulated result by the set value (e.g., 4). The initial values ​​of the three color channels can be set as needed. Optionally, by fusing the normalized directed distance information with the grayscale information of the set noise map, an initial special effects image can be obtained. For example, Figure 2e is a schematic diagram of the initial special effects image in this embodiment. As shown in Figure 2e, a highlight curve is generated at the edge of the portrait area. In this embodiment, the directed distance information and the grayscale information of the set noise map are fused to generate the "electric light effect" portrait edge line.

[0065] S130: Fusing the initial special effects image with the original image to obtain a target special effects image.

[0066] The fusion of the initial special effects image and the original image can be understood as fusing the pixel values ​​of the initial special effects image and the pixel values ​​of the original image objects to obtain the target special effects image.

[0067] Optionally, the process of fusing the initial special effects image with the original image to obtain the target special effects image can be: performing a color filter mode processing on the original image based on the set color map; fusing the original image and the original image processed with the color filter mode based on the fuzzy mask map to obtain a first intermediate special effects image; fusing the first intermediate special effects image with the initial special effects image to obtain a second intermediate special effects image; and fusing the second intermediate special effects image with the original image based on the target object mask map to obtain the target special effects image.

[0068] The set color map may be a monochrome image of the set color, i.e., all pixels in the image have the same color value. The process of performing a blendscreen on the original image based on the set color map may include: subtracting the color value of the set color map from 1 to obtain a first result; subtracting the color value of the original image from 1 to obtain a second result; and finally subtracting the product of the first and second results from 1 to obtain the color value after the blendscreen process.

[0069] Optionally, the process of fusing the original image and the original image processed by the color filter pattern based on the fuzzy mask image to obtain the first intermediate special effects image can be: determining a first fusion coefficient based on the grayscale value of the pixel point in the fuzzy mask image; fusing the original image and the original image processed by the color filter pattern based on the first fusion coefficient to obtain the first intermediate special effects image.

[0070] Among them, the first fusion coefficient may include the fusion coefficients corresponding to the original image and the original image after the color filter mode processing. In this embodiment, the grayscale value of the pixel point in the fuzzy mask image is a normalized value, that is, a value between 0 and 1. Assuming that the grayscale value of the pixel point in the fuzzy mask image is represented by a1, the first fusion coefficient corresponding to the original image is 1-a1, and the first fusion coefficient corresponding to the original image after the color filter mode processing is a1. Then, the process of fusing the original image and the original image after the color filter mode processing according to the first fusion coefficient can be: using the difference between 1 and the grayscale value of the pixel point in the fuzzy mask image as the weighting coefficient of the color value of the original image, and using the grayscale value of the pixel point in the fuzzy mask image as the weighting coefficient of the color after the color filter mode processing, so as to perform a weighted summation on the color value of the original image and the color value after the color filter mode processing to obtain the first intermediate special effect image. For example, Figure 3a is an example diagram of the first intermediate special effect image in this embodiment. As shown in Figure 3a, the portrait area presents a "glow" effect.

[0071] Optionally, the first intermediate special effect image and the initial special effect image may be merged by accumulating the color values ​​of corresponding pixels in the first intermediate special effect image and the initial special effect image to obtain a second intermediate special effect image. For example, FIG3 b is a schematic diagram of the second intermediate special effect image in this embodiment.

[0072] Optionally, the second intermediate special effects image and the original image are fused based on the target object mask image to obtain the target special effects image by: determining a second fusion coefficient based on the grayscale value of the pixel point in the target object mask image; and fusing the second intermediate special effects image and the original image based on the second fusion coefficient to obtain the target special effects image.

[0073] The second fusion coefficient may include fusion coefficients corresponding to the original image and the second intermediate special effect image, respectively. In this embodiment, the grayscale values ​​of the pixels in the target object mask image are normalized values, i.e., values ​​between 0 and 1. Assuming the grayscale value of the target object mask image is represented as a2, the second fusion coefficient corresponding to the original image is a2, and the second fusion coefficient corresponding to the second intermediate special effect image is 1-a2. The process of fusing the second intermediate special effect image and the original image based on the second fusion coefficient may include: using the second fusion coefficient as a weighting coefficient for the color value of the original image, using the grayscale value of the target object mask image as a weighting coefficient for the color value of the original image, and using the difference between 1 and the grayscale value of the target object mask image as a weighting coefficient for the color value of the second intermediate special effect image, thereby performing a weighted summation of the color values ​​of the original image and the second intermediate special effect image to obtain the target image. In this embodiment, fusing the second intermediate special effect image and the original image based on the target object mask image can highlight the human portrait. Exemplarily, FIG3 c is an example diagram of the target special effect diagram in this embodiment. As shown in FIG3 c , a diagram with an “electric light surround” special effect is generated at the edge of the portrait.

[0074] The method of the disclosed embodiment determines the directed distance information corresponding to the original image; generates an initial special effect image based on the directed distance information and a set noise map; and fuses the initial special effect image with the original image to obtain a target special effect image. The method for generating a special effect image provided by the disclosed embodiment generates a special effect image based on the directed distance information of the original image and a set noise map. This method can generate an image with a set special effect, which not only speeds up the generation of the special effect image but also improves the display effect of the special effect image, making the special effect image more vivid.

[0075] FIG4 is a schematic diagram of the structure of a device for generating a special effect image provided by an embodiment of the present disclosure. As shown in FIG2 , the device includes:

[0076] A directed distance information determination module 410 is configured to determine directed distance information corresponding to the original image; wherein the directed distance information represents grayscale information of the segmentation result of the original image or distance information between a pixel point and an image segmentation boundary;

[0077] An initial special effect graph generating module 420 is configured to generate an initial special effect graph according to the directed distance information and a set noise graph;

[0078] The target special effect image acquisition module 430 is configured to fuse the initial special effect image with the original image to obtain a target special effect image.

[0079] Optionally, the directed distance information determining module 410 is configured to determine the directed distance information corresponding to the original image in the following manner:

[0080] Segmenting the target object in the original image to obtain a target object mask image;

[0081] Performing fuzzy processing on the target object mask image to obtain a fuzzy mask image;

[0082] Directed distance information is determined according to the fuzzy mask image; wherein the distance information is composed of directed distance values ​​of pixel points.

[0083] Optionally, it further includes: an expansion processing module, configured to:

[0084] Performing image expansion processing on the target object mask image to obtain an expanded mask image;

[0085] The target object mask image is fuzzy processed to obtain a fuzzy mask image, comprising:

[0086] The expanded mask image is blurred to obtain a blurred mask image.

[0087] Optionally, the directed distance information determining module 410 is configured to perform blurring processing on the target object mask image to obtain a blurred mask image in the following manner:

[0088] Performing downsampling processing on the target object mask image to obtain a downsampled mask image;

[0089] The down-sampled mask image is blurred to obtain a blurred mask image.

[0090] Optionally, the directed distance information determining module 410 is configured to determine the directed distance information according to the fuzzy mask image in the following manner:

[0091] Obtaining the grayscale value of the pixel in the fuzzy mask image;

[0092] A linear transformation is performed on the grayscale value to obtain directed distance information.

[0093] Optionally, the directed distance information determining module 410 is configured to determine the directed distance information corresponding to the original image in the following manner:

[0094] Acquiring boundary information of the original image;

[0095] Directed distance information is determined based on the boundary information and pixel coordinates.

[0096] Optionally, the initial special effect image generation module 420 is configured to generate the initial special effect image according to the directed distance information and the set noise image in the following manner:

[0097] Normalizing the directed distance information according to a set method;

[0098] The normalized directed distance information and the grayscale information of the set noise image are fused to obtain an initial special effect image.

[0099] Optionally, the initial special effect image generation module 420 is configured to fuse the normalized directed distance information and the grayscale information of the set noise image to obtain the initial special effect image in the following manner:

[0100] Superimposing the normalized directed distance information and the grayscale information of the set noise map to obtain first intermediate information;

[0101] performing a set index calculation on the first intermediate information to obtain second intermediate information;

[0102] performing a linear transformation on the second intermediate information, and performing a set exponent calculation on the second intermediate information after the linear transformation to obtain target information;

[0103] An initial special effects graph is generated according to the target information.

[0104] Optionally, the target special effect image acquisition module 430 is configured to fuse the initial special effect image with the original image in the following manner to obtain the target special effect image:

[0105] Performing color filter processing on the original image based on a set color map;

[0106] fusing the original image and the original image processed by the color filter mode based on the fuzzy mask image to obtain a first intermediate special effect image;

[0107] Fusing the first intermediate special effects image with the initial special effects image to obtain a second intermediate special effects image;

[0108] The second intermediate special effect image and the original image are fused based on the target object mask image to obtain a target special effect image.

[0109] Optionally, the target special effect image acquisition module 430 is configured to fuse the original image and the original image processed by the color filter mode based on the blur mask image in the following manner to obtain a first intermediate special effect image:

[0110] Determining a first fusion coefficient according to the grayscale value of the pixel point in the fuzzy mask image;

[0111] The original image and the original image processed by the color filter mode are fused according to the first fusion coefficient to obtain a first intermediate special effect image.

[0112] Optionally, the target special effect image acquisition module 430 is configured to fuse the second intermediate special effect image and the original image based on the target object mask image in the following manner to obtain the target special effect image:

[0113] Determining a second fusion coefficient according to the grayscale value of the pixel point in the target object mask image;

[0114] The second intermediate special effect image and the original image are fused according to the second fusion coefficient to obtain a target special effect image.

[0115] The device for generating special effects images provided in the embodiments of the present disclosure can execute the method for generating special effects images provided in any embodiment of the present disclosure, and has functional modules and beneficial effects corresponding to the execution method.

[0116] It is worth noting that the various units and modules included in the above-mentioned device are only divided according to functional logic, and the actual division is sufficient as long as the corresponding functions can be achieved; in addition, the names of the functional units are only for the convenience of distinguishing them from each other.

[0117] FIG5 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. Referring to FIG5 , a schematic diagram of the structure of an electronic device (e.g., a terminal device or server in FIG5 ) 500 suitable for implementing an embodiment of the present disclosure is shown below. The terminal device in the embodiment of the present disclosure may include a mobile phone, a laptop computer, a digital broadcast receiver, a personal digital assistant (PDA), a tablet computer (Portable Android Device, PAD), a portable multimedia player (PMP), a vehicle-mounted terminal (e.g., a vehicle-mounted navigation terminal), and the like, as well as a fixed terminal such as a digital television (TV), a desktop computer, and the like. The electronic device shown in FIG5 is merely an example.

[0118] As shown in Figure 5, the electronic device 500 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage device 508 into a random access memory (RAM) 503. Various programs and data required for the operation of the electronic device 500 are also stored in the RAM 503. The processing device 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0119] Typically, the following devices may be connected to the I / O interface 505: an input device 506 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 507 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 508 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 509. The communication device 509 may allow the electronic device 500 to communicate with other devices wirelessly or by wire to exchange data. Although FIG. 5 shows the electronic device 500 with various devices, it should be understood that it is not required to implement or have all of the devices shown. More or fewer devices may be implemented or have alternatively.

[0120] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 509, or installed from the storage device 508, or installed from the ROM 502. When the computer program is executed by the processing device 501, the above-mentioned functions in the method of the embodiment of the present disclosure are performed.

[0121] The names of messages or information exchanged between multiple devices in the embodiments of the present disclosure are for illustrative purposes only.

[0122] The electronic device provided in the embodiment of the present disclosure and the method for generating special effect images provided in the above embodiment belong to the same inventive concept. For technical details not fully described in this embodiment, please refer to the above embodiment, and this embodiment has the same beneficial effects as the above embodiment.

[0123] An embodiment of the present disclosure provides a computer storage medium having a computer program stored thereon. When the program is executed by a processor, the method for generating a special effect graph provided in the above embodiment is implemented.

[0124] It should be noted that the computer-readable medium mentioned in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium may, for example, be an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination thereof. Computer-readable storage media may include: an electrical connection having one or more wires, a portable computer disk, a hard disk, RAM, ROM, Erasable Programmable Read-Only Memory (EPROM or flash memory), optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device, or component. In the present disclosure, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. This propagated data signal may take a variety of forms, including electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transfer a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including wires, optical cables, radio frequency (RF), etc., or any suitable combination thereof.

[0125] In some embodiments, the client and server can communicate using any currently known or later developed network protocol, such as the HyperText Transfer Protocol (HTTP), and can be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), internets (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or later developed networks.

[0126] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.

[0127] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: determines the directed distance information corresponding to the original image; wherein the directed distance information represents the grayscale information of the segmentation result of the original image or the distance information between the pixel point and the image segmentation boundary; generates an initial special effect image based on the directed distance information and a set noise map; and fuses the initial special effect image with the original image to obtain a target special effect image.

[0128] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages, or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on the remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).

[0129] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the module, program segment, or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0130] The units involved in the embodiments described in this disclosure may be implemented in software or hardware. The names of the units may be set based on actual circumstances. For example, the first acquisition unit may be described as a "unit for acquiring at least two Internet Protocol addresses."

[0131] The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that may be used include: Field Programmable Gate Array (FPGA), Application Specific Integrated Circuit (ASIC), Application Specific Standard Parts (ASSP), System on Chip (SOC), Complex Programmable Logic Device (CPLD), and the like.

[0132] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a RAM, a ROM, an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a CD-ROM, an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0133] According to one or more embodiments of the present disclosure, a method for generating a special effect graph is provided, comprising:

[0134] Determine directed distance information corresponding to the original image; wherein the directed distance information represents grayscale information of the segmentation result of the original image or distance information between a pixel point and an image segmentation boundary;

[0135] Generate an initial special effect map according to the directed distance information and the set noise map;

[0136] The initial special effects image and the original image are fused to obtain a target special effects image.

[0137] Optionally, determining the directed distance information corresponding to the original image includes:

[0138] Segmenting the target object in the original image to obtain a target object mask image;

[0139] Performing fuzzy processing on the target object mask image to obtain a fuzzy mask image;

[0140] Directed distance information is determined according to the fuzzy mask image; wherein the distance information is composed of directed distance values ​​of pixel points.

[0141] Optionally, after obtaining the target object mask image, the method further includes:

[0142] Performing image expansion processing on the target object mask image to obtain an expanded mask image;

[0143] The target object mask image is fuzzy processed to obtain a fuzzy mask image, comprising:

[0144] The expanded mask image is blurred to obtain a blurred mask image.

[0145] Optionally, performing blur processing on the target object mask image to obtain a blurred mask image includes:

[0146] Performing downsampling processing on the target object mask image to obtain a downsampled mask image;

[0147] The down-sampled mask image is blurred to obtain a blurred mask image.

[0148] Optionally, determining directed distance information according to the fuzzy mask image includes:

[0149] Obtaining the grayscale value of the pixel in the fuzzy mask image;

[0150] A linear transformation is performed on the grayscale value to obtain directed distance information.

[0151] Optionally, determining the directed distance information corresponding to the original image includes:

[0152] Acquiring boundary information of the original image;

[0153] Directed distance information is determined based on the boundary information and pixel coordinates.

[0154] Optionally, generating an initial special effect graph according to the directed distance information and a set noise graph includes:

[0155] Normalizing the directed distance information according to a set method;

[0156] The normalized directed distance information and the grayscale information of the set noise image are fused to obtain an initial special effect image.

[0157] Optionally, fusing the normalized directed distance information and the grayscale information of the set noise map to obtain an initial special effect map includes:

[0158] Superimposing the normalized directed distance information and the grayscale information of the set noise map to obtain first intermediate information;

[0159] performing a set index calculation on the first intermediate information to obtain second intermediate information;

[0160] performing a linear transformation on the second intermediate information, and performing a set exponent calculation on the second intermediate information after the linear transformation to obtain target information;

[0161] An initial special effects graph is generated according to the target information.

[0162] Optionally, fusing the initial special effect image with the original image to obtain a target special effect image includes:

[0163] Performing color filter processing on the original image based on a set color map;

[0164] fusing the original image and the original image processed by the color filter mode based on the fuzzy mask image to obtain a first intermediate special effect image;

[0165] Fusing the first intermediate special effects image with the initial special effects image to obtain a second intermediate special effects image;

[0166] The second intermediate special effect image and the original image are fused based on the target object mask image to obtain a target special effect image.

[0167] Optionally, fusing the original image and the original image processed by the color filter mode based on the fuzzy mask image to obtain a first intermediate special effect image includes:

[0168] Determining a first fusion coefficient according to the grayscale value of the pixel point in the fuzzy mask image;

[0169] The original image and the original image processed by the color filter mode are fused according to the first fusion coefficient to obtain a first intermediate special effect image.

[0170] Optionally, fusing the second intermediate special effect image and the original image based on the target object mask image to obtain a target special effect image includes:

[0171] Determining a second fusion coefficient according to the grayscale value of the pixel point in the target object mask image;

[0172] The second intermediate special effect image and the original image are fused according to the second fusion coefficient to obtain a target special effect image.

[0173] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination.

Claims

1. A method for generating a special effect image, comprising: Determine the directed distance information corresponding to the original image; wherein the directed distance information represents the grayscale information of the segmentation result of the original image or the distance information between the pixel point and the image segmentation boundary; Generate an initial special effect map according to the directed distance information and the set noise map; The initial special effects image and the original image are fused to obtain a target special effects image.

2. The method according to claim 1, wherein: Determine the directed distance information corresponding to the original image, including: Segmenting the target object in the original image to obtain a target object mask image; Performing fuzzy processing on the target object mask image to obtain a fuzzy mask image; Directed distance information is determined according to the fuzzy mask image; wherein the distance information is composed of directed distance values ​​of pixel points.

3. The method according to claim 2, after obtaining the target object mask image, the method further comprises: Performing image dilation processing on the target object mask image to obtain an expanded mask image; The target object mask image is fuzzy processed to obtain a fuzzy mask image, including: The dilated mask image is blurred to obtain a blurred mask image.

4. The method according to claim 2 or 3, wherein: The target object mask image is fuzzy processed to obtain a fuzzy mask image, including: Downsampling the target object mask image to obtain a downsampled mask image; The down-sampled mask image is blurred to obtain a blurred mask image.

5. The method according to claim 2, wherein: Determining directed distance information according to the fuzzy mask image includes: Obtaining the grayscale value of the pixel in the fuzzy mask image; A linear transformation is set on the grayscale value to obtain directed distance information.

6. The method according to claim 1, wherein: Determine the directed distance information corresponding to the original image, including: Acquiring boundary information of the original image; Directed distance information is determined based on the boundary information and the pixel coordinates.

7. The method according to claim 1, wherein: Generating an initial special effect map according to the directed distance information and the set noise map, including: Normalizing the directed distance information according to a set method; The normalized directed distance information and the grayscale information of the set noise image are fused to obtain an initial special effect image.

8. The method according to claim 7, wherein: The normalized directed distance information and the grayscale information of the set noise image are merged to obtain an initial special effect image, including: Superimposing the normalized directed distance information and the grayscale information of the set noise map to obtain first intermediate information; Performing a set index calculation on the first intermediate information to obtain second intermediate information; performing a linear transformation on the second intermediate information, and performing a set index calculation on the second intermediate information after the linear transformation to obtain target information; An initial special effects graph is generated according to the target information.

9. The method according to claim 2, wherein: The initial special effect image and the original image are merged to obtain a target special effect image, including: Performing color filter mode processing on the original image based on a set color map; Based on the fuzzy mask image, the original image and the original image processed by the color filter mode are merged to obtain a first intermediate special effect image; Merging the first intermediate special effects image with the initial special effects image to obtain a second intermediate special effects image; The second intermediate special effect image and the original image are fused based on the target object mask image to obtain a target special effect image.

10. The method according to claim 9, wherein: The original image and the original image processed by the color filter mode are fused based on the fuzzy mask image to obtain a first intermediate special effect image, including: Determine a first fusion coefficient according to the grayscale value of the pixel point in the fuzzy mask image; The original image and the original image processed by the color filter mode are fused according to the first fusion coefficient to obtain a first intermediate special effect image.

11. The method according to claim 9, wherein: The method further comprises: fusing the second intermediate special effect image and the original image based on the target object mask image to obtain a target special effect image, including: Determining a second fusion coefficient according to the grayscale value of the pixel point in the target object mask image; The second intermediate special effect image and the original image are fused according to the second fusion coefficient to obtain a target special effect image.

12. A device for generating a special effect image, comprising: A directed distance information determination module, configured to determine directed distance information corresponding to the original image; wherein the directed distance information represents the grayscale information of the segmentation result of the original image or the distance information between the pixel point and the image segmentation boundary; An initial special effect graph generation module, configured to generate an initial special effect graph according to the directed distance information and a set noise graph; The target special effect image acquisition module is configured to fuse the initial special effect image with the original image to obtain a target special effect image.

13. An electronic device, comprising: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method for generating a special effect graph as described in any one of claims 1-11.

14. A storage medium comprising computer executable instructions, wherein the computer executable instructions are used to execute the method for generating a special effect image as described in any one of claims 1 to 11 when executed by a computer processor.