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

By determining the directional distance information of the original image and the fusion of the set noise map, the problem of single image stroke special effects in the existing technology is solved, and realistic special effects maps are quickly generated.

CN115063335BActive Publication Date: 2024-10-01BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210840518.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-18
Publication Date
2024-10-01
Estimated Expiration
2042-07-18

AI Technical Summary

Technical Problem

When the existing technology generates image stroke special effects, the effect is single and unnatural, making it difficult to quickly generate realistic special effects images.

Method used

By determining the directional distance information of the original image, and combining it with the set noise map to generate an initial special effects map, and finally merging it with the original image to obtain the target special effects map.

Benefits of technology

The generation speed and display effect of special effects images are improved, making the special effects images richer and more realistic.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115063335B_ABST
    Figure CN115063335B_ABST
Patent Text Reader

Abstract

The embodiments of the present disclosure provide a method, device, equipment and storage medium for generating a special effect image. 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 image according to the directed distance information and a set noise map; fuse 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 embodiments of the present disclosure generates a special effect image based on the directed distance information of the original image and a set noise map, and can generate an image with a set special effect, which can not only improve the speed of generating the special effect image, but also improve the display effect of the special effect image, making the effect of the special effect image richer.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] Smart terminals have become an indispensable tool in users' lives. Users can use smart terminals to carry out a series of entertainment activities, such as adding special effects to images to enhance entertainment. Among them, adding special effect edges (abbreviated as strokes) to images is one of the image special effect processing methods.

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

[0004] The embodiments of the present disclosure provide a method, device, equipment and storage medium for generating a special effect image, which can quickly generate an image with a "stroke" special effect with realistic effect.

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

[0006] 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;

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

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

[0009] In a second aspect, the embodiment of the present disclosure further provides a device for generating a special effect graph, including:

[0010] A directed distance information determination module, used 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;

[0011] An initial special effect graph generation module, used to generate an initial special effect graph according to the directed distance information and a set noise graph;

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

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

[0014] one or more processors;

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

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

[0017] In a fourth aspect, the embodiments of the present disclosure further provide 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 embodiments of the present disclosure.

[0018] The disclosed embodiments disclose a method, device, equipment and storage medium for generating special effects images. 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 effects image according to the directed distance information and a set noise map; fuse the initial special effects image with the original image to obtain a target special effects image. The method for generating special effects images provided by the disclosed embodiments generates special effects images based on the directed distance information of the original image and a set noise map, and can generate images with set special effects, which can not only improve the speed of generating special effects images, but also improve the display effect of special effects images, making the effects of special effects images richer. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0020] Figure 1 It is a schematic diagram of a flow chart of a method for generating a special effect graph provided by an embodiment of the present disclosure;

[0021] Figure 2a is an example diagram of a target object mask diagram provided by an embodiment of the present disclosure;

[0022] Figure 2b is a schematic diagram of an expansion mask image provided by an embodiment of the present disclosure;

[0023] Figure 2c is an example diagram of a fuzzy mask image provided by an embodiment of the present disclosure;

[0024] Figure 2dis an example diagram of setting a noise diagram provided by an embodiment of the present disclosure;

[0025] Figure 2e is a schematic diagram of an initial special effect graph provided by an embodiment of the present disclosure;

[0026] Figure 3a is an example diagram of the first intermediate special effect diagram provided by the embodiment of the present disclosure;

[0027] Figure 3b is a schematic diagram of a second intermediate special effect graph provided by an embodiment of the present disclosure;

[0028] Figure 3c is an example diagram of the target special effect diagram provided by the embodiment of the present disclosure;

[0029] Figure 4 It is a schematic diagram of the structure of a device for generating a special effect image provided by an embodiment of the present disclosure;

[0030] Figure 5 It is a structural schematic diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION

[0031] Embodiments of the present disclosure will be described in more detail below 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 should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.

[0032] 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. The scope of the present disclosure is not limited in this respect.

[0033] The term "including" and its variations used herein are open inclusions, 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"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.

[0034] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0035] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0036] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.

[0037] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present 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.

[0038] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can autonomously choose whether to provide personal information to software or hardware such as an electronic device, application, server, or storage medium that performs the operation of the technical solution of the present disclosure according to the prompt message.

[0039] As an optional but non-limiting implementation, in response to receiving an active request from the user, 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 carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.

[0040] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet the relevant laws and regulations may also be applied to the implementation of the present disclosure.

[0041] It is understandable that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and relevant provisions.

[0042] Figure 1 A flow chart of a method for generating a special effect graph provided in an embodiment of the present disclosure is provided. The embodiment of the present disclosure is applicable to the situation of generating a special effect graph. The method can be executed by a special effect graph generating 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.

[0043] like Figure 1 As shown, the method includes:

[0044] S110, determining the directed distance information corresponding to the original image.

[0045] 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 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 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 and the image segmentation boundary, the directed distance information can be understood as the shortest distance between the pixel in the original image and the pixel at the boundary of the target area. If the pixel is in the target area, the distance can be set to negative, if the pixel is on the boundary of the target area, the distance can be set to 0, if the pixel 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.

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

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

[0048] The distance information is composed of the directed distance values ​​of the pixel points. In this embodiment, any matting algorithm can be used to segment the target object in the original image. For example, assuming that the target object is a portrait, Figure 2a is an example of a target object mask map, such as Figure 2a As shown, the white area is the segmented portrait area, and the black area is the background area. The target object mask image 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 image can be: determining the directed distance information based on the grayscale value of the pixel point in the blurred mask image. In this embodiment, by determining the directed distance information based on the blurred mask image, the directed distance information can be accurately determined, which is conducive to the generation of subsequent special effects images.

[0049] 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.

[0050] Among them, image expansion can be understood as being implemented using the expansion principle in morphology. The process of image expansion processing can be understood as: traversing the pixel points in the target object mask image, aligning the center of the set expansion kernel with the traversed pixel points, and then taking the maximum value of the grayscale value in the target object mask image that is aligned with the position where the value of the set expansion kernel is 1, and replacing the current grayscale value of the traversed pixel points with the maximum grayscale value. Among them, the expansion and the binary matrix of the size can be set; the binary matrix can be understood as the value of the elements in the matrix is ​​0 or 1; the set size can be set arbitrarily, for example, it can be 3*3, 5*5. Exemplary, Figure 2b is a schematic diagram of the expansion mask image, such as Figure 2b As shown, Figure 2a In contrast, the portrait area is expanded. Accordingly, the target object mask image is blurred, and the process of obtaining the blurred mask image may be: blurring the expanded mask image to obtain the blurred mask image. In this embodiment, the target object mask image is expanded to prevent the special effects generated at the boundary of the target object from occluding the target object.

[0051] 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.

[0052] 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 a 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. Exemplarily, Figure 2c is an example of a fuzzy mask image. Figure 2c As shown, in this embodiment, the target object mask image is first downsampled and then blurred, which can greatly reduce the amount of calculation and thus improve the efficiency of special effect image generation.

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

[0054] Among them, the grayscale value of the pixel in the fuzzy mask image can be a normalized grayscale value. The way to set the linear transformation of the grayscale value can be: subtract N times the grayscale value from 1. Among them, N can be a positive integer greater than or equal to 2, for example, N=2. In this embodiment, the value of the linear transformation of the grayscale value is directly set as the directed distance value of the pixel point, without calculating the shortest distance between the pixel point and the boundary of the target object, which can improve the speed of determining the directed distance information.

[0055] 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.

[0056] The boundary information of the original image may include coordinate information of four vertices of the boundary of the original image. In this embodiment, a rectangular coordinate system may 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, and the vertex coordinates of the boundary of the original image and the pixel coordinates of the pixel points may be determined according to the established rectangular coordinate system.

[0057] Specifically, 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, the directed distance information is determined based on the boundary information and pixel coordinates, and 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.

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

[0059] The set noise image may be a noise image with the same size as the original image generated by using a set noise function, and the noise image may be a grayscale image. For example, Figure 2d This is an example diagram of a setting noise map in this embodiment.

[0060] 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.

[0061] The process of normalizing the directed distance information according to the set method may be: first, the directed distance value of the pixel point is calculated according to the set method, if the calculated value is between 0 and 1, the value is retained, if the value is less than 0, the value is adjusted to 0, and if the value is greater than 1, the value is adjusted 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 (for example, square) of the directed distance value by a first set value (for example, 0.16) and then negating it, and finally adding the negated value to the second set value (for example, 0.15).

[0062] Optionally, the normalized directed distance information and the grayscale information of the set noise map are merged to obtain the initial special effects map. The process may 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 according to the target information.

[0063] Among them, the process of linearly superimposing the normalized directed distance information and the grayscale information of the set noise map can be: first multiply the normalized directed distance value by the grayscale value of the pixel point in the set noise map and then take the negative, then accumulate it with the product of the first intermediate information and the set value (for example: 0.7), and finally take the absolute value of the accumulated result. The way of calculating the set exponent of the first intermediate information can be: perform an exponential operation of the set value (for example: 0.13) on the first intermediate information. The process of linearly transforming the second intermediate information can be: obtain the initial values ​​of the three color channels, and perform a linear transformation on the second intermediate information based on the initial values. The process of setting the exponent of the second intermediate information after the linear transformation can be: first subtract the second intermediate information from 1, then multiply the calculation result by the initial values ​​of the three color channels and the set value (for example: 1.5), and finally perform an exponential operation of the set value (for example: 4) on the accumulated multiplication result. Among them, the initial values ​​of the three color channels can be set according to needs, and are not limited here. Specifically, after the normalized directed distance information and the grayscale information of the set noise image are merged, the initial special effect image can be obtained. Figure 2e is a schematic diagram of the initial special effects diagram in this embodiment, such as Figure 2e As shown, 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 edge line of the portrait with an "electric light effect".

[0064] S130, fusing the initial special effects image with the original image to obtain a target special effects image.

[0065] The fusion of the initial special effect image and the original image can be understood as fusing the pixel values ​​of the initial special effect image and the pixel values ​​of the original image object to obtain the target special effect image.

[0066] 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 pattern processing on the original image based on a set color map; fusing the original image and the original image processed with the color filter pattern based on a 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 a target object mask map to obtain a target special effects image.

[0067] The set color map may be a monochrome map of the set color, that is, the color values ​​of the pixels in the map are the same. The process of performing a blendscreen on the original image based on the set color map may be: 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 result and the second result from 1 to obtain a color value after the blendscreen process.

[0068] 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 according to 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 according to the first fusion coefficient to obtain the first intermediate special effects image.

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

[0070] Optionally, the first intermediate special effect image and the initial special effect image are merged in a manner of: 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. Figure 3b Schematic diagram of the second intermediate special effect diagram in this embodiment.

[0071] 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 according to 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 according to the second fusion coefficient to obtain the target special effects image.

[0072] Among them, the second fusion coefficient may include the fusion coefficients corresponding to the original image and the second intermediate special effect map respectively. In this embodiment, the grayscale value of the pixel point in the target object mask map is a normalized value, that is, a value between 0-1. Assuming that the grayscale value of the target object mask map 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 map is 1-a2. Then the process of fusing the second intermediate special effect map and the original image according to the second fusion coefficient can be: using the second fusion coefficient as the weighting coefficient of the color value of the original image, using the grayscale value of the target object mask map as the weighting coefficient of the color value of the original image, and using the difference between 1 and the grayscale value of the target object mask map as the weighting coefficient of the color value of the second intermediate special effect map, so as to perform weighted summation of the color value of the original image and the color value of the second intermediate special effect map to obtain the target image. In this embodiment, the second intermediate special effect map and the original image are fused based on the target object mask map, so that the portrait can be highlighted. Exemplarily, Figure 3c is an example diagram of the target special effect diagram in this embodiment, such as Figure 3c As shown, an image with an "electric light surround" effect is generated at the edge of the portrait.

[0073] The technical solution of the embodiment of the present disclosure determines the directed distance information corresponding to the original image; generates an initial special effect image according to 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 embodiment of the present disclosure generates a special effect image based on the directed distance information of the original image and a set noise map, and can generate an image with a set special effect, which can not only improve the speed of generating the special effect image, but also improve the display effect of the special effect image, making the effect of the special effect image richer.

[0074] Figure 4 A schematic diagram of a structure of a special effect image generation device provided by an embodiment of the present disclosure is shown in FIG2 , and the device includes:

[0075] A directed distance information determination module 410 is used 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;

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

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

[0078] Optionally, the directed distance information determining module 410 is further configured to:

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

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

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

[0082] Optionally, it also includes: an expansion processing module, used for:

[0083] Performing image dilation processing on the target object mask image to obtain an expanded mask image;

[0084] The target object mask image is fuzzy processed to obtain a fuzzy mask image, including:

[0085] The dilated mask image is blurred to obtain a blurred mask image.

[0086] Optionally, the directed distance information determining module 410 is further configured to:

[0087] Downsampling the target object mask image to obtain a downsampled mask image;

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

[0089] Optionally, the directed distance information determining module 410 is further configured to:

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

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

[0092] Optionally, the directed distance information determining module 410 is further configured to:

[0093] Acquiring boundary information of the original image;

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

[0095] Optionally, the initial special effect image generating module 420 is further used for:

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

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

[0098] Optionally, the initial special effect image generating module 420 is further used for:

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

[0100] Performing a set index calculation on the first intermediate information to obtain second intermediate information;

[0101] 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;

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

[0103] Optionally, the target special effect image acquisition module 430 is further used for:

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

[0105] 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;

[0106] Merging the first intermediate special effects image with the initial special effects image to obtain a second intermediate special effects image;

[0107] 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.

[0108] Optionally, the target special effect image acquisition module 430 is further used for:

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

[0110] 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.

[0111] Optionally, the target special effect image acquisition module 430 is further used for:

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

[0113] 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.

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

[0115] It is worth noting that the various units and modules included in the above-mentioned device are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the embodiments of the present disclosure.

[0116] Figure 5 This is a schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure. Figure 5 , which shows an electronic device (eg, Figure 5 The terminal device in the embodiment of the present disclosure may include but is not limited to mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0117] like Figure 5 As shown, 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. In the RAM 503, various programs and data required for the operation of the electronic device 500 are also stored. The processing device 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An edit / output (I / O) interface 505 is also connected to the bus 504.

[0118] Typically, the following devices may be connected to the I / O interface 505: an input device 506 including, for example, a touch screen, a touch pad, 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 Figure 5 The electronic device 500 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.

[0119] 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 contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 509, or installed from a storage device 508, or installed from a ROM 502. When the computer program is executed by the processing device 501, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.

[0120] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.

[0121] The electronic device provided in the embodiment of the present disclosure and the method for generating the special effect image provided in the above embodiment belong to the same inventive concept. The technical details not fully described in this embodiment can be referred to the above embodiment, and this embodiment has the same beneficial effects as the above embodiment.

[0122] The embodiments of the present disclosure provide a computer storage medium on which a computer program is stored. When the program is executed by a processor, the method for generating a special effect graph provided in the above embodiments is implemented.

[0123] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit 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 but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0124] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.

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

[0126] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, 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 according to 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, but not limited to, 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 separate software package, partially on the user's computer and partially on a remote computer, or entirely on a 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 flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square 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 square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a 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 the present disclosure may be implemented by software or hardware. The name of a unit does not limit the unit itself in some cases. For example, the first acquisition unit may also 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, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.

[0132] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (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 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;

[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] Furthermore, 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] Furthermore, after obtaining the target object mask image, the method further includes:

[0142] Performing image dilation 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, including:

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

[0145] Further, the target object mask image is fuzzy processed to obtain a fuzzy mask image, including:

[0146] Downsampling 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] Further, 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 set on the grayscale value to obtain directed distance information.

[0151] Furthermore, 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 the pixel coordinates.

[0154] Further, generating an initial special effect map according to the directed distance information and the set noise map 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] Furthermore, the normalized directed distance information and the grayscale information of the set noise image are fused to obtain an initial special effect image, including:

[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 index 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] Furthermore, the initial special effect image and the original image are fused to obtain a target special effect image, including:

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

[0164] 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;

[0165] Merging 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] Furthermore, 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:

[0168] Determine 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] Further, 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, including:

[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] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.

[0174] 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. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. 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 mode.

[0175] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.

Claims

1. A method for generating a special effect image, characterized in that: include: 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 image according to the directed distance information and a set noise image; wherein the set noise image is a grayscale image with the same size as the original image; 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, characterized in that 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, characterized in that After obtaining the target object mask map, it also includes: 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, characterized in that: 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, characterized in that: 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, characterized in that 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, characterized in that 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, characterized in that 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, characterized in that: 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, characterized in that 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, characterized in that 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, characterized in that: include: A directed distance information determination module, used 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 image generation module, used to generate an initial special effect image according to the directed distance information and a set noise image; wherein the set noise image is a grayscale image with the same size as the original image; The target special effect image acquisition module is used to fuse the initial special effect image with the original image to obtain a target special effect image.

13. An electronic device, characterized in that: The electronic device comprises: 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.