Special effects image generation method, device, equipment and storage medium
Through edge detection and graphic panel screening technology, special effect materials are added to the image, which solves the problem of insufficient content of the special effect pictures and improves the image display effect.
Patent Information
- Application Number
- CN202211035718.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-26
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2042-08-26
AI Technical Summary
In the existing image processing technology, the generated special effects pictures are not rich enough, making it difficult to improve the display effect of the image.
By creating multiple initial graphic panels, edge detection of the original image, filter out the target graphic panels, and draw the setting material on these graphic panels, and finally fuse the initial special effects map with the original image to generate the target special effects map.
Add special effects materials to the image to enrich image content and improve the image display effect.
Smart Images

Figure CN115358958B_ABST
Abstract
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] In recent years, image processing applications (Application, APP) have developed rapidly and entered the lives of users, gradually enriching their spare time. Users can record their lives in the form of videos, photos, etc., and can reprocess images through special effects technology provided on image processing APPs, so that images can be expressed in a richer form. In related technologies, the generated special effects images are not rich enough in content. Summary of the invention
[0003] The embodiments of the present disclosure provide a method, device, equipment and storage medium for generating special effect images, which can add special effect materials to the edges of objects contained in an image, enrich the content of the image, and improve the display effect of the image.
[0004] In a first aspect, an embodiment of the present disclosure provides a method for generating a special effect graph, comprising:
[0005] Create multiple initial graphic patches;
[0006] Performing edge detection on the original image to obtain an edge detection result; wherein the edge detection result is characterized by an edge detection result;
[0007] Screening the multiple initial graphic patches based on the edge detection result to obtain a target graphic patch;
[0008] Drawing the set material into the target graphic patch to obtain an initial special effect picture;
[0009] The initial special effects image is fused with the original image to obtain a target special effects image.
[0010] In a second aspect, the embodiment of the present disclosure further provides a special effect image generating device, including:
[0011] A graphics patch creation module, used for creating a plurality of initial graphics patches;
[0012] An edge detection module is used to perform edge detection on the original image to obtain an edge detection result; wherein the edge detection result is characterized by an edge detection result;
[0013] A target graphic patch acquisition module, configured to screen the plurality of initial graphic patches based on the edge detection result to obtain a target graphic patch;
[0014] A setting material drawing module is used to draw the setting material in the target graphic patch to obtain an initial special effect picture;
[0015] 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.
[0016] In a third aspect, an embodiment of the present disclosure further provides an electronic device, the electronic device comprising:
[0017] one or more processors;
[0018] a storage device for storing one or more programs,
[0019] When the one or more programs are executed by the one or more processors, the one or more processors implement the special effect graph generating method as described in the embodiment of the present disclosure.
[0020] 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 special effect graph generation method as described in the embodiment of the present disclosure.
[0021] The disclosed embodiments disclose a method, device, equipment and storage medium for generating special effects images, which create multiple initial graphic patches; perform edge detection on the original image to obtain edge detection results; wherein the edge detection results are characterized by edge detection results; based on the edge detection results, multiple initial graphic patches are screened to obtain target graphic patches; set materials are drawn into the target graphic patches to obtain an initial special effects image; the initial special effects image is merged with the original image to obtain a target special effects image. The special effects image generation method provided by the disclosed embodiments draws the set materials into the graphic patches screened based on the edge detection results, and special effects materials can be added to the edges of objects contained in the image, thereby enriching the content of the image and improving the display effect of the image. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] 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.
[0023] Figure 1 It is a schematic diagram of a flow chart of a special effect image generation method provided by an embodiment of the present disclosure;
[0024] Figure 2a is an example diagram of multiple initial graphic patches created according to an embodiment of the present disclosure;
[0025] Figure 2bis a schematic diagram of an initial graphic patch created according to an embodiment of the present disclosure;
[0026] Figure 3a is an example diagram of an original image provided by an embodiment of the present disclosure;
[0027] Figure 3b is a schematic diagram of an edge detection graph provided by an embodiment of the present disclosure;
[0028] Figure 3c is an example diagram of a screened target graphic face provided by an embodiment of the present disclosure;
[0029] Figure 4a is an example diagram of a color noise diagram provided by an embodiment of the present disclosure;
[0030] Figure 4b is an example diagram of a target special effect diagram provided by an embodiment of the present disclosure;
[0031] Figure 5 It is a structural schematic diagram of a special effect image generating device provided by an embodiment of the present disclosure;
[0032] Figure 6 It is a structural schematic diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0033] 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.
[0034] 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.
[0035] 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.
[0036] 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.
[0037] 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".
[0038] 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.
[0039] 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.
[0040] 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.
[0041] 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.
[0042] 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.
[0043] 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.
[0044] Figure 1A flow chart of a special effect graph generation method provided in an embodiment of the present disclosure is provided. The embodiment of the present disclosure is applicable to the situation of generating special effect graphs. The method can be executed by a special effect graph 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.
[0045] like Figure 1 As shown, the method includes:
[0046] S110, creating a plurality of initial graphic patches.
[0047] Among them, the graphic patch can be understood as a patch in graphics. The graphic patch can be used to draw an image. The graphic patch is composed of multiple pixels. The pixel values are filled into the corresponding pixels to realize the drawing of the image. The positions and sizes of multiple initial graphic patches in the layer can be different. The initial graphic patches can overlap in some areas or not overlap. In this embodiment, the initial graphic patch can be a rectangular graphic patch composed of two triangle primitives.
[0048] Specifically, the method of creating multiple initial graphic patches may be: creating an empty layer based on the original image, dividing the empty layer into grids to obtain multiple sub-grids; and creating multiple initial graphic patches based on the multiple sub-grids.
[0049] The size of the empty layer can be the same as the size of the original image, that is, an empty layer with the same size as the original image is created. The method of creating multiple initial graphic patches based on multiple sub-grids can be: creating a graphic patch in each sub-grid, or randomly selecting several sub-grids from multiple sub-grids as candidate sub-grids, and creating a graphic patch in several candidate sub-grids. The size of the graphic patch created in the grid can be the same as the size of the sub-grid, or smaller than the size of the sub-grid. For example, the layer can be divided into M*N sub-grids. Exemplary, Figure 2a An example diagram of multiple initial graphic patches created in this embodiment is shown in FIG. Figure 2a As shown in the figure, the black area is the initial graphic patch created, such as Figure 2a As shown, some sub-grids are randomly selected from the divided multiple sub-grids, and initial graphic patches are created in the selected sub-grids. In this embodiment, multiple initial graphic patches are created based on the divided multiple sub-grids, which can improve the efficiency of creating graphic patches.
[0050] Optionally, a method of creating multiple initial graphic patches based on multiple sub-grids may be: selecting a set number of sub-grids from the multiple sub-grids as candidate sub-grids; creating graphic patches in the candidate sub-grids; and performing at least one of the following operations on the created graphic patches to obtain multiple initial graphic patches: translation, rotation, and scaling.
[0051] The set number may be set by a user or determined according to a set ratio. Assuming the set ratio is a%, and the total number of subgrids is n, the set number is n*a%. Specifically, the process of selecting a set number of subgrids from a plurality of subgrids may be: randomly selecting a set number of subgrids from a plurality of subgrids as candidate subgrids.
[0052] Specifically, the method of creating a graphic patch in a candidate sub-mesh may be: obtaining vertex information of the candidate sub-mesh; and creating a graphic patch based on the vertex information.
[0053] The vertex information may be the coordinate information of the four vertices of the candidate sub-mesh. In this embodiment, the four vertices of the candidate sub-mesh are obtained and used as the vertices of the graphic patch to create the graphic patch. Creating the graphic patch based on the vertex information of the sub-mesh can improve the speed of creating the graphic patch.
[0054] In this embodiment, performing at least one of translation, rotation and scaling on the created graphic patches can be understood as: the translation amount, rotation amount and scaling amount of each created graphic patch can be different. This makes the sizes and postures of the initial graphic patches different, or the initial graphic patches overlap. For example, Figure 2b is a schematic diagram of the initial graphic patch created in this embodiment, such as Figure 2b As described above, the size, posture and position of the created initial graphic patches are different. In this embodiment, at least one of translation, rotation and scaling is performed on the created graphic patches, which can improve the diversity of the special effect images.
[0055] S120, performing edge detection on the original image to obtain an edge detection result.
[0056] The edge detection result can be represented by an edge point set or an edge detection map. The edge point set contains the position information of each edge point in the original image. The pixel value of the edge point in the edge detection map can be represented by a first set value, and the pixel value of other pixels can be represented by a second set value. The first set value can be 1, which is displayed as white in the image, and the second set value can be 0, which is displayed as black in the image.
[0057] In this embodiment, the Sobel edge detection algorithm can be used to perform edge detection on the original image to obtain an edge detection result. Figure 3ais an example of an original image. Figure 3b is a schematic diagram of the edge detection graph. Figure 3a As shown, the object in the figure is a part of the arm, such as Figure 3b This is the edge detection result of part of the hand.
[0058] S130, screening multiple initial graphic patches based on the edge detection result to obtain target graphic patches.
[0059] The screening of the multiple initial graphic patches based on the edge detection result can be understood as screening out the initial graphic patches at the edge to obtain the target graphic patches.
[0060] Specifically, the target graphic patch may be obtained by screening multiple initial graphic patches based on the edge detection result by respectively determining the center points of the multiple initial graphic patches and determining the initial graphic patch whose center point falls within the edge detection result as the target graphic patch.
[0061] In this embodiment, the initial graphic patch may be a rectangular graphic patch composed of two triangular primitives. The method for determining the center point of the initial graphic patch may be to determine the center point of the rectangle corresponding to the initial graphic patch. The center point falling into the edge detection result can be understood as: the center point of the initial graphic patch coincides with an edge point in the edge detection result, that is, the position coordinates of the center point of the initial graphic patch are the same as the position coordinates of an edge point in the edge detection result. In this embodiment, the initial graphic patch whose center point falls into the edge detection result is determined as the target graphic patch, and the target patch can be quickly determined.
[0062] Specifically, multiple initial graphic patches are screened based on edge detection results to obtain target graphic patches by: obtaining pixel points contained in the initial graphic patches as graphic patch pixels; and determining the initial graphic patches whose graphic patch pixels fall into the edge detection results as target graphic patches.
[0063] The method of obtaining the pixel points included in the initial graphic patch may be: determining the coordinate information of the pixel points included in the initial graphic patch based on the vertex coordinates of the initial graphic patch. Determining the initial graphic patch whose pixel points fall into the edge detection result as the target graphic patch may be understood as: if one or more pixel points of the initial graphic patch fall into the edge detection result, the initial graphic patch is determined as the target graphic patch.
[0064] In this embodiment, the process of determining whether a graphic patch pixel point falls into the edge detection result may be: traversing the graphic patch pixel points of the initial graphic patch, determining whether the position coordinates of the traversed graphic patch pixel points are the same as the position coordinates of an edge point in the edge detection result, if they are the same, then the traversed graphic patch pixel points fall into the edge detection result, and continue to traverse the next graphic patch pixel points. In this embodiment, the initial graphic patch whose graphic patch pixel points fall into the edge detection result is determined as the target graphic patch, which can improve the accuracy of determining the target graphic patch.
[0065] Optionally, the method of determining an initial graphic patch whose pixel points fall into the edge detection result as a target graphic patch may be: obtaining the number of facial pixel points that fall into the edge detection result; and determining an initial graphic patch whose number exceeds a first set threshold as a target graphic patch.
[0066] Among them, the first set threshold value can be a value set by the user. In this embodiment, the graphic patch pixels of the initial graphic patch are traversed, and it is determined whether the position coordinates of the traversed graphic patch pixels are the same as the position coordinates of an edge point in the edge detection result. If they are the same, the traversed graphic patch pixels fall into the edge detection result, and the next graphic patch pixel points are traversed until the traversal of the pixels included in the current initial graphic patch is completed. The number of facial pixel points that fall into the edge detection result is counted, and the initial graphic patch whose number exceeds the first set threshold is determined as the target graphic patch. In this embodiment, the initial graphic patch whose number of facial pixel points that fall into the edge detection result exceeds the first set threshold is determined as the target graphic patch, which can improve the accuracy and reliability of the determined target graphic patch.
[0067] Optionally, an initial graphic patch whose pixel points fall into the edge detection result is determined as a target graphic patch by: obtaining the ratio of facial pixel points that fall into the edge detection result to the total graphic patch pixel points; and determining the initial graphic patch whose ratio exceeds a second set threshold as the target graphic patch.
[0068] Among them, the second set threshold can be set by the user. In this embodiment, the graphic surface pixel points of the initial graphic surface are traversed, and it is determined whether the position coordinates of the traversed graphic surface pixel points are the same as the position coordinates of an edge point in the edge detection result. If they are the same, the traversed graphic surface pixel points fall into the edge detection result, and the next graphic surface pixel points are traversed until the traversal of the pixel points included in the current initial graphic surface is completed. The number of facial pixel points that fall into the edge detection result is counted, and the ratio between the number of facial pixel points that fall into the edge detection result and the total number of pixel points included in the initial graphic surface is calculated, and the initial graphic surface whose ratio exceeds the second set threshold is determined as the target graphic surface. In this embodiment, the initial graphic surface whose ratio of facial pixel points that fall into the edge detection result to the total number of graphic surface pixel points exceeds the second set threshold is determined as the target graphic surface, which can improve the accuracy and reliability of the determined target graphic surface.
[0069] For example, Figure 3c is an example of the target graphic patch selected in this embodiment, such as Figure 3c As shown, the black box in the figure is the filtered target graphic patch.
[0070] S140, drawing the set material in the target graphic patch to obtain an initial special effect image.
[0071] The setting material may be a pre-designed material image, for example, a "star" image, a "heart" image, etc. The setting material may be one or more. In this embodiment, the process of drawing the setting material in the target graphic patch may be: sampling pixel values from the setting material according to vertex information of the target graphic patch, rendering each pixel point in the target graphic patch based on the sampled pixel values, and generating an initial special effect image.
[0072] Optionally, the setting material is drawn in the target graphic patch, and the method for obtaining the initial special effect image can be: obtaining at least one setting material; establishing a correspondence between at least one setting material and the target graphic patch; based on the correspondence, drawing at least one setting material in the corresponding target graphic patch to obtain the initial special effect image.
[0073] Among them, the correspondence between the setting material and the target graphic patch can be: one-to-one, one-to-many or many-to-many. In this embodiment, if the setting material is one, the setting material is sequentially drawn into the target graphic patch, that is, the correspondence between the setting material and the target graphic patch is one-to-many. If there are multiple setting materials, and the number of types of setting materials is less than the number of target graphic patches, the multiple setting materials are randomly matched with the target graphic patches, and each setting material is sequentially drawn into the corresponding target graphic patch based on the matching result, that is, the correspondence between the setting material and the target graphic patch is one-to-many. If the number of types of setting materials is greater than or equal to the number of target graphic patches, a one-to-one correspondence between the multiple setting materials and the target graphic patches is established, and the setting material is drawn into the corresponding target graphic patch based on the corresponding relationship. In this embodiment, drawing the at least one setting material into the corresponding target graphic patch based on the corresponding relationship can improve the diversity of special effect images.
[0074] Optionally, the setting material is drawn in the target graphic patch, and the method for obtaining the initial special effect image can be: determining the size information of the target graphic patch; obtaining the corresponding setting material according to the size information; drawing the setting material in the corresponding target graphic patch to obtain the initial special effect image.
[0075] The size information of the target graphic patch may be the number of pixels contained in the target graphic patch, or the area occupied by the target graphic patch. In this embodiment, a correspondence between the size information of the graphic patch and the category of the set material is established in advance. After obtaining the size information of the target graphic patch, the set material corresponding to the size information is determined according to the correspondence between the size information of the graphic patch and the category of the set material, and then the set material is drawn in the corresponding target graphic patch to obtain the initial special effect map. In this embodiment, obtaining the corresponding set material based on the size information can not only accurately determine the material corresponding to each target graphic patch, but also improve the diversity of the special effect map.
[0076] Optionally, the setting material is drawn in the target graphic patch, and the method for obtaining the initial special effects image can be: obtaining the center point of the target graphic patch; obtaining the pixel value of the pixel point corresponding to the center point in the original image; obtaining the corresponding setting material according to the pixel value; drawing the setting material in the corresponding target graphic patch to obtain the initial special effects image.
[0077] In this embodiment, a correspondence between a pixel value range and a set material category is pre-established, and then the range of the pixel value of the pixel point corresponding to the center point in the original image is determined, and the set material corresponding to the pixel value is determined based on the correspondence between the pixel value range and the set material category, and the set material is drawn on the corresponding target graphic patch. In this embodiment, the set material is determined based on the pixel value of the pixel point corresponding to the center point of the target graphic patch in the original image, which can not only accurately determine the material corresponding to each target graphic patch, but also improve the diversity of special effect images.
[0078] Optionally, the set material is drawn in the target graphic patch, and the method for obtaining the initial special effects image can be: obtaining the position information of the target graphic patch; sampling color information from the set color noise map according to the position information; and drawing the set material in the target graphic patch based on the color information to obtain the initial special effects image.
[0079] The position information of the target graphic patch can be represented by the coordinates of the center point of the target graphic patch. In this embodiment, color information is sampled from the set color noise map according to the position information of the target graphic patch, and the sampled color information is used as the color information of the set material drawn in the target graphic patch, so that the set material is drawn in the target graphic patch based on the color information. Figure 4a is an example of a color noise map, such as Figure 4b In this embodiment, the color information of the set material is sampled from the set color noise map, so that the target graphic patches at different positions display materials of different colors, thereby enriching the display content of the special effect map.
[0080] Optionally, the method of drawing the set material in the target graphic patch based on the color information to obtain the initial special effects image can be: performing set color mapping processing on the color information to obtain the target color information; drawing the set material in the target graphic patch according to the target color information to obtain the initial special effects image.
[0081] The process of setting color mapping for color information may be: obtaining a pre-established color mapping relationship, and obtaining target color information corresponding to the sampled color information according to the mapping relationship. In this implementation, setting color mapping for color information can enrich the display content of the special effect image.
[0082] S150, fusing the initial special effect image with the original image to obtain a target special effect image.
[0083] In this embodiment, the initial special effect image is fused with the original image to obtain the target special effect image by: fusing the initial special effect image with the original image in a color filter mode to obtain the target special effect image.
[0084] The principle of the color filter mode may be: any color fused with white produces white, and any color fused with black remains unchanged. In this embodiment, the initial special effect image is fused with the original image in the color filter mode to improve the fusion accuracy. For example, Figure 4b is an example diagram of the target special effect diagram of this embodiment, such as Figure 4b As shown, a "star" effect is generated at the edge of the arm in the figure.
[0085] The technical solution of the disclosed embodiment is to create multiple initial graphic patches; perform edge detection on the original image to obtain edge detection results; wherein the edge detection results are characterized by edge detection results; filter multiple initial graphic patches based on the edge detection results to obtain target graphic patches; draw the set material in the target graphic patches to obtain an initial special effect map; merge the initial special effect map with the original image to obtain a target special effect map. The special effect map generation method provided by the disclosed embodiment draws the set material in the graphic patches filtered out based on the edge detection results, and can add special effect materials to the edges of objects contained in the image, enrich the content of the image, and improve the display effect of the image.
[0086] Figure 5 A schematic diagram of the structure of a special effect image generating device provided by an embodiment of the present disclosure is shown in FIG. Figure 5 As shown, the device comprises:
[0087] A graphics patch creation module 510, used to create a plurality of initial graphics patches;
[0088] The edge detection module 520 is used to perform edge detection on the original image to obtain an edge detection result; wherein the edge detection result is represented by an edge detection result;
[0089] A target graphic patch acquisition module 530 is used to screen multiple initial graphic patches based on the edge detection result to obtain a target graphic patch;
[0090] A setting material drawing module 540 is used to draw the setting material in the target graphic patch to obtain an initial special effect image;
[0091] The target special effect image acquisition module 550 is used to fuse the initial special effect image with the original image to obtain the target special effect image.
[0092] Optionally, the graphics patch creation module 510 is further used to:
[0093] Divide the layer into grids to obtain multiple sub-grids;
[0094] Create multiple initial shape patches based on multiple submeshes.
[0095] Optionally, the graphics patch creation module 510 is further used to:
[0096] Selecting a set number of sub-grids from the plurality of sub-grids as candidate sub-grids;
[0097] Creating graphic patches in the candidate sub-meshes;
[0098] The created graphic patches are subjected to at least one of the following operations to obtain a plurality of initial graphic patches: translation, rotation, and scaling.
[0099] Optionally, the graphics patch creation module 510 is further used to:
[0100] Get vertex information of candidate sub-meshes;
[0101] Create graphics patches based on vertex information.
[0102] Optionally, the target graphic patch acquisition module 530 is further used to:
[0103] Determine the center points of multiple initial graphic patches respectively;
[0104] The initial graphic patch whose center point falls into the edge detection result is determined as the target graphic patch.
[0105] Optionally, the target graphic patch acquisition module 530 is further used to:
[0106] Obtain the pixel points contained in the initial graphic patch as the pixel points of the graphic patch;
[0107] The initial graphic patch whose pixel points fall into the edge detection result is determined as the target graphic patch.
[0108] Optionally, the target graphic patch acquisition module 530 is further used to:
[0109] Get the number of facial pixels that fall into the edge detection result;
[0110] The initial graphic patches whose number exceeds a first set threshold are determined as target graphic patches.
[0111] Optionally, the target graphic patch acquisition module 530 is further used to:
[0112] Obtain the ratio of facial pixels that fall into the edge detection result to the total number of graphic face pixels;
[0113] The initial graphic patch whose ratio exceeds the second set threshold is determined as the target graphic patch.
[0114] Optionally, set the material drawing module 540:
[0115] Obtain at least one setting material;
[0116] Establishing a correspondence between at least one setting material and a target graphic face;
[0117] Based on the corresponding relationship, at least one setting material is drawn in the corresponding target graphic patch to obtain an initial special effect image.
[0118] Optionally, set the material drawing module 540:
[0119] Determine the size information of the target graphic patch;
[0120] Obtain corresponding setting materials according to size information;
[0121] Draw the set material into the corresponding target graphic patch to obtain the initial special effect picture.
[0122] Optionally, set the material drawing module 540:
[0123] Get the center point of the target graphic patch;
[0124] Get the pixel value of the pixel point corresponding to the center point in the original image;
[0125] Get the corresponding setting material according to the pixel value;
[0126] Draw the set material into the corresponding target graphic patch to obtain the initial special effect picture.
[0127] Optionally, set the material drawing module 540:
[0128] Get the location information of the target graphic patch;
[0129] Sample color information from a set color noise map according to position information;
[0130] Based on the color information, the set material is drawn into the target graphic patch to obtain the initial special effect image.
[0131] Optionally, set the material drawing module 540:
[0132] Performing color mapping processing on the color information to obtain target color information;
[0133] The set material is drawn into the target graphic patch according to the target color information to obtain the initial special effect image.
[0134] Optionally, the target special effect image acquisition module 550 is further used for:
[0135] The initial special effects image is fused with the original image in a color filter mode to obtain the target special effects image.
[0136] The special effect image generation device provided in the embodiments of the present disclosure can execute the special effect image generation method provided in any embodiment of the present disclosure, and has the functional modules and beneficial effects corresponding to the execution method.
[0137] 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.
[0138] Figure 6 This is a schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure. Figure 6 , which shows an electronic device (eg, Figure 6 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 6 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.
[0139] like Figure 6 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.
[0140] 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 6The 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.
[0141] 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.
[0142] 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.
[0143] The electronic device provided in the embodiment of the present disclosure and the special effect image generation method 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.
[0144] 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 special effect images provided in the above embodiments is implemented.
[0145] 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.
[0146] 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.
[0147] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0148] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device:
[0149] The above-mentioned computer-readable medium carries one or more programs. When the above-mentioned one or more programs are executed by the electronic device, the electronic device: creates multiple initial graphic patches; performs edge detection on the original image to obtain edge detection results; screens the multiple initial graphic patches based on the edge detection results to obtain target graphic patches; draws the set material into the target graphic patches to obtain an initial special effect image; and merges the initial special effect image with the original image to obtain a target special effect image.
[0150] 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).
[0151] 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.
[0152] 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".
[0153] 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.
[0154] 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.
[0155] According to one or more embodiments of the present disclosure, a method for generating a special effect graph is provided, comprising:
[0156] Create multiple initial graphic patches;
[0157] Perform edge detection on the original image to obtain edge detection results;
[0158] Screening the multiple initial graphic patches based on the edge detection result to obtain a target graphic patch;
[0159] Drawing the set material into the target graphic patch to obtain an initial special effect picture;
[0160] The initial special effects image is fused with the original image to obtain a target special effects image.
[0161] Furthermore, a plurality of initial graphic patches are created, including:
[0162] Divide the layer into grids to obtain multiple sub-grids;
[0163] A plurality of initial graphic patches are created based on the plurality of sub-meshes.
[0164] Further, creating a plurality of initial graphic patches based on the plurality of sub-grids includes:
[0165] Selecting a set number of sub-grids from the plurality of sub-grids as candidate sub-grids;
[0166] Creating a graphics patch in the candidate sub-mesh;
[0167] The created graphic patches are subjected to at least one of the following operations to obtain a plurality of initial graphic patches: translation, rotation, and scaling.
[0168] Furthermore, creating a graphic patch in the candidate sub-grid includes:
[0169] Obtaining vertex information of the candidate sub-mesh;
[0170] A graphics patch is created based on the vertex information.
[0171] Further, the plurality of initial graphic patches are screened based on the edge detection result to obtain a target graphic patch, including:
[0172] Determine the center points of the multiple initial graphic patches respectively;
[0173] The initial graphic patch whose center point falls within the edge detection result is determined as the target graphic patch.
[0174] Further, the plurality of initial graphic patches are screened based on the edge detection result to obtain a target graphic patch, including:
[0175] Obtaining pixel points included in the initial graphic patch as graphic patch pixel points;
[0176] An initial graphic patch whose pixel points fall into the edge detection result is determined as a target graphic patch.
[0177] Further, determining the initial graphic patch whose pixel points fall into the edge detection result as the target graphic patch includes:
[0178] Obtaining the number of facial pixels falling within the edge detection result;
[0179] The initial graphic patches whose number exceeds a first set threshold are determined as target graphic patches.
[0180] Further, determining the initial graphic patch whose pixel points fall into the edge detection result as the target graphic patch includes:
[0181] Obtaining the ratio of facial pixels falling into the edge detection result to the total number of graphic face pixels;
[0182] The initial graphic patch whose ratio exceeds the second set threshold is determined as the target graphic patch.
[0183] Furthermore, the setting material is drawn into the target graphic patch to obtain an initial special effect picture, including:
[0184] Obtain at least one setting material;
[0185] Establishing a correspondence between the at least one setting material and the target graphic patch;
[0186] Based on the corresponding relationship, the at least one setting material is drawn in the corresponding target graphic patch to obtain an initial special effect image.
[0187] Furthermore, the setting material is drawn into the target graphic patch to obtain an initial special effect picture, including:
[0188] Determine the size information of the target graphic patch;
[0189] Acquire corresponding setting materials according to the size information;
[0190] The setting material is drawn in the corresponding target graphic patch to obtain an initial special effect picture.
[0191] Furthermore, the setting material is drawn into the target graphic patch to obtain an initial special effect picture, including:
[0192] Get the center point of the target graphic patch;
[0193] Obtaining pixel values of pixels corresponding to the center point in the original image;
[0194] Acquire corresponding setting material according to the pixel value;
[0195] The setting material is drawn in the corresponding target graphic patch to obtain an initial special effect picture.
[0196] Furthermore, the setting material is drawn into the target graphic patch to obtain an initial special effect picture, including:
[0197] Obtaining the position information of the target graphic patch;
[0198] Sampling color information from a set color noise map according to the position information;
[0199] The setting material is drawn in the target graphic patch based on the color information to obtain an initial special effect image.
[0200] Furthermore, drawing the setting material in the target graphic patch based on the color information to obtain an initial special effect graph includes:
[0201] Performing a color mapping process on the color information to obtain target color information;
[0202] The setting material is drawn in the target graphic patch according to the target color information to obtain an initial special effect image.
[0203] Furthermore, the initial special effect image is fused with the original image to obtain a target special effect image, including:
[0204] The initial special effect image is fused with the original image in a color filter mode to obtain a target special effect image.
[0205] 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.
[0206] 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.
[0207] 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: Create multiple initial graphic patches; Perform edge detection on the original image to obtain edge detection results; Screening the multiple initial graphic patches based on the edge detection result to obtain a target graphic patch; Drawing the set material into the target graphic patch to obtain an initial special effect picture; Fusing the initial special effects image with the original image to obtain a target special effects image; The step of screening the plurality of initial graphic patches based on the edge detection result to obtain a target graphic patch includes: An initial graphic patch whose center point falls within the edge detection result is determined as a target graphic patch, and / or an initial graphic patch whose pixel points fall within the edge detection result is determined as a target graphic patch; the graphic patch pixel points are the pixel points contained in the initial graphic patch.
2. The method according to claim 1, characterized in that Create several initial shape patches, including: Create an empty layer based on the original image; Divide the empty layer into grids to obtain multiple sub-grids; A plurality of initial graphic patches are created based on the plurality of sub-meshes.
3. The method according to claim 2, characterized in that Creating a plurality of initial graphic patches based on the plurality of sub-meshes includes: Selecting a set number of sub-grids from the plurality of sub-grids as candidate sub-grids; Creating a graphics patch in the candidate sub-mesh; The created graphic patches are subjected to at least one of the following operations to obtain a plurality of initial graphic patches: translation, rotation, and scaling.
4. The method according to claim 3, characterized in that Creating a graphics patch in the candidate sub-mesh includes: Obtaining vertex information of the candidate sub-mesh; A graphics patch is created based on the vertex information.
5. The method according to claim 1, characterized in that: Before determining the initial graphic patch whose center point falls into the edge detection result as the target graphic patch, the method further includes: The center points of the multiple initial graphic patches are determined respectively.
6. The method according to claim 1, characterized in that Before determining the initial graphic patch whose pixel points fall into the edge detection result as the target graphic patch, the method further includes: The pixel points included in the initial graphic patch are obtained as the pixel points of the graphic patch.
7. The method according to claim 6, characterized in that Determining an initial graphic patch whose pixel points fall into the edge detection result as a target graphic patch includes: Obtaining the number of facial pixels falling within the edge detection result; The initial graphic patches whose number exceeds a first set threshold are determined as target graphic patches.
8. The method according to claim 6, characterized in that Determining an initial graphic patch whose pixel points fall into the edge detection result as a target graphic patch includes: Obtaining the ratio of facial pixels falling into the edge detection result to the total number of graphic face pixels; The initial graphic patch whose ratio exceeds the second set threshold is determined as the target graphic patch.
9. The method according to claim 1, characterized in that: Drawing the set material into the target graphic patch to obtain an initial special effect map includes: Obtain at least one setting material; Establishing a correspondence between the at least one setting material and the target graphic patch; Based on the corresponding relationship, the at least one setting material is drawn in the corresponding target graphic patch to obtain an initial special effect image.
10. The method according to claim 1, characterized in that Drawing the set material into the target graphic patch to obtain an initial special effect map includes: Determine the size information of the target graphic patch; Acquire corresponding setting materials according to the size information; The setting material is drawn in the corresponding target graphic patch to obtain an initial special effect picture.
11. The method according to claim 1, characterized in that: Drawing the set material into the target graphic patch to obtain an initial special effect map includes: Get the center point of the target graphic patch; Obtaining pixel values of pixels corresponding to the center point in the original image; Acquire corresponding setting material according to the pixel value; The setting material is drawn in the corresponding target graphic patch to obtain an initial special effect picture.
12. The method according to claim 1, characterized in that Drawing the set material into the target graphic patch to obtain an initial special effect map includes: Obtaining the position information of the target graphic patch; Sampling color information from a set color noise map according to the position information; The setting material is drawn in the target graphic patch based on the color information to obtain an initial special effect image.
13. The method according to claim 12, characterized in that Drawing the setting material in the target graphic patch based on the color information to obtain an initial special effect image includes: Performing a color mapping process on the color information to obtain target color information; The setting material is drawn in the target graphic patch according to the target color information to obtain an initial special effect image.
14. The method according to claim 1, characterized in that The initial special effect image is merged with the original image to obtain a target special effect image, including: The initial special effect image is fused with the original image in a color filter mode to obtain a target special effect image.
15. A special effect image generating device, characterized in that: include: A graphics patch creation module, used for creating a plurality of initial graphics patches; An edge detection module is used to perform edge detection on the original image to obtain an edge detection result; wherein the edge detection result is characterized by an edge detection result; A target graphic patch acquisition module, configured to screen the plurality of initial graphic patches based on the edge detection result to obtain a target graphic patch; A setting material drawing module is used to draw the setting material in the target graphic patch to obtain an initial special effect picture; A 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; The target graphics patch acquisition module is also used for: An initial graphic patch whose center point falls within the edge detection result is determined as a target graphic patch, and / or an initial graphic patch whose pixel points fall within the edge detection result is determined as a target graphic patch; the graphic patch pixel points are the pixel points contained in the initial graphic patch.
16. 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 special effect graph generating method as described in any one of claims 1-14.
17. A storage medium comprising computer executable instructions, wherein the computer executable instructions are used to execute the special effect image generation method as described in any one of claims 1 to 14 when executed by a computer processor.
