An image special effect processing method, device, equipment and medium

By acquiring the set of edge points of the target object in the image and processing the rotation matrix, generating and rotating the drawn shape and performing texture mapping, the problem of low efficiency and poor effect of adding special effects in the existing technology is solved, thus improving the image display effect.

CN114445269BActive Publication Date: 2025-11-04BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210121537.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-09
Publication Date
2025-11-04
Estimated Expiration
2042-02-09

AI Technical Summary

Technical Problem

In existing technologies, adding effects by having users manually select existing stickers and paste them into any area of ​​an image is inefficient and produces poor display results, failing to meet user needs.

Method used

Obtain the set of edge points of the target object in the image to be processed, determine the position of the drawing center point based on the edge point parameter information, generate a drawing shape on the image, rotate the drawing shape using a rotation matrix, perform texture mapping processing on the source image and the rotated drawing shape, and generate the target image.

Benefits of technology

It enables the generation of drawing shapes on the outline area of ​​the target object, avoiding overlap between the drawing shapes and the target object, and improving the image display effect in image effects scenes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114445269B_ABST
    Figure CN114445269B_ABST
Patent Text Reader

Abstract

Embodiments of the present disclosure relate to an image special effect processing method, device, equipment and medium, wherein the method comprises: obtaining an edge point set of a target object in a to-be-processed image, determining a drawing center point position based on edge point parameter information in the edge point set, generating a drawing shape corresponding to the drawing center point position on the to-be-processed image, obtaining a rotation matrix corresponding to the drawing shape, and performing texture mapping processing on the drawing shape after rotation and a material picture to generate a target image. By adopting the above technical solution, a drawing shape is generated on the contour area of the target object in the processing process of the image special effect. Since the drawing center point position of the drawing shape is determined based on the edge point set of the target object, the display effect of the picture material surrounding the target object is achieved, and the drawing shape is rotated to avoid the overlapping of the drawing shape and the target object, thereby further improving the image display effect in the image special effect scene.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the technical field of image processing, and particularly relates to an image special effect processing method and device, equipment and medium. BACKGROUND

[0002] With the rapid development of Internet technology and intelligent terminals, adding various special effects to images has become a common image processing method.

[0003] In the related art, for adding special effect materials, a user independently selects an existing sticker to paste in any area of an image. However, this method is relatively low in efficiency and the display effect cannot meet the user's demand. SUMMARY

[0004] In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides an image special effect processing method, device, equipment and medium.

[0005] The present disclosure provides an image special effect processing method, which comprises the following steps:

[0006] obtaining an edge point set of a target object in a to-be-processed image;

[0007] determining a drawing center point position based on edge point parameter information in the edge point set;

[0008] generating a drawing shape corresponding to the drawing center point position on the to-be-processed image;

[0009] obtaining a rotation matrix corresponding to the drawing shape, and rotating the drawing shape based on the rotation matrix;

[0010] performing texture mapping processing on the material picture and the rotated drawing shape to generate a target image.

[0011] The present disclosure also provides an image special effect processing device, which comprises:

[0012] an edge point set obtaining module configured to obtain an edge point set of a target object in a to-be-processed image;

[0013] a drawing position determining module configured to determine a drawing center point position based on edge point parameter information in the edge point set;

[0014] a drawing shape generating module configured to generate a drawing shape corresponding to the drawing center point position on the to-be-processed image;

[0015] a matrix obtaining module configured to obtain a rotation matrix corresponding to the drawing shape;

[0016] A rotation module is used to rotate the drawn shape based on the rotation matrix;

[0017] The processing and generation module is used to perform texture mapping processing on the source image and the rotated drawn shape to generate the target image.

[0018] This disclosure also provides an electronic device, the electronic device comprising: a processor; a memory for storing executable instructions of the processor; the processor being configured to read the executable instructions from the memory and execute the instructions to implement the image effects processing method provided in this disclosure.

[0019] This disclosure also provides a computer-readable storage medium storing a computer program for performing the image effects processing method provided in this disclosure.

[0020] Compared with the prior art, the technical solution provided in this disclosure has the following advantages: The image effect processing solution provided in this disclosure obtains the set of edge points of the target object in the image to be processed, determines the position of the drawing center point based on the edge point parameter information in the edge point set, generates a drawing shape corresponding to the position of the drawing center point on the image to be processed, obtains the rotation matrix corresponding to the drawing shape, rotates the drawing shape based on the rotation matrix, and performs texture mapping processing on the material image and the rotated drawing shape to generate the target image. Using the above technical solution, a drawing shape is generated on the contour area of ​​the target object during the image effect processing. Since the position of the drawing center point of the drawing shape is determined with the set of edge points of the target object, the display effect of the image material surrounding the target object is achieved. Furthermore, the rotation of the drawing shape avoids the situation where the drawing shape overlaps with the target object, further improving the image display effect in image effect scenarios. Attached Figure Description

[0021] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote 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.

[0022] Figure 1 A flowchart illustrating an image special effects processing method provided in this embodiment of the disclosure;

[0023] Figure 2 A schematic flowchart illustrating another image effects processing method provided in this embodiment of the disclosure;

[0024] Figure 3a A schematic diagram of an image to be processed provided in an embodiment of this disclosure;

[0025] Figure 3b A schematic diagram of the outline of a target object provided in an embodiment of this disclosure;

[0026] Figure 4a A schematic diagram illustrating the location of the center point provided in an embodiment of this disclosure;

[0027] Figure 4b A schematic diagram of a shape drawing provided for an embodiment of this disclosure;

[0028] Figure 5a This is a schematic diagram illustrating another shape to be drawn according to an embodiment of this disclosure;

[0029] Figure 5b This is another schematic diagram of drawing a shape provided by an embodiment of the present disclosure;

[0030] Figure 6a A schematic diagram of a material image provided for an embodiment of this disclosure;

[0031] Figure 6b A schematic diagram of a target image provided in an embodiment of this disclosure;

[0032] Figure 6c A schematic diagram of another target image provided in an embodiment of this disclosure.

[0033] Figure 7 This is a schematic diagram of the structure of an image special effects processing device provided in an embodiment of the present disclosure;

[0034] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation

[0035] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.

[0036] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.

[0037] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based 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". Definitions of other terms will be given in the description below.

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

[0039] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".

[0040] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.

[0041] Figure 1 This is a flowchart illustrating an image effects processing method provided in an embodiment of this disclosure. The method can be executed by an image effects processing device, which can be implemented using software and / or hardware, and is generally integrated into an electronic device. Figure 1 As shown, the method includes:

[0042] Step 101: Obtain the set of edge points of the target object in the image to be processed.

[0043] The target object can be a face, animal, or object, and the image to be processed can be any image related to the target object. This embodiment does not limit the source of the image to be processed. For example, the image to be processed can be a selfie of a user's face, or any image frame from a video taken by the user that includes the target object. The edge point set refers to the set of pixels corresponding to the outline of the target object. For example, if the target object is a face, the edge point set refers to the set of pixels of the face outline; similarly, if the target object is a kitten, the edge point set refers to the set of pixels of the kitten outline.

[0044] In some implementations, obtaining the set of edge points of a target object in the image to be processed includes: inputting the image to be processed into a target object segmentation model to obtain a target object region; recognizing the target object region according to an edge contour recognition mode to obtain a target object contour; and extracting at least a portion of the pixels of the target object contour to represent it in the form of a point vector to obtain the set of edge points.

[0045] In other embodiments, obtaining the edge point set of the target object in the image to be processed includes: extracting the region of the target object (e.g., a face) in the image to be processed as the target object region by using a target object detection algorithm (e.g., a face detection algorithm); sampling along the target object region to generate multiple squares that surround the entire target object region; drawing a local contour curve in each square; fusing multiple local contour curves into a global contour curve as the target object contour by using a global fusion algorithm; and extracting at least some pixels of the target object contour to represent them in the form of point vectors to obtain the edge point set.

[0046] The above two methods for obtaining the set of edge points of the target object in the image to be processed are merely examples. This disclosure does not impose any specific restrictions on the methods for obtaining the set of edge points of the target object in the image to be processed.

[0047] Specifically, after acquiring the image to be processed, target object acquisition processing can be performed based on the image to obtain the target object region, and contour extraction processing can be performed based on the target object region to obtain the edge point set.

[0048] Step 102: Determine the location of the drawing center point based on the edge point parameter information in the edge point set.

[0049] Here, edge point parameter information refers to parameters including the number of edge points and their positions, while the drawing center point position refers to the position of the center point of the drawn shape, such as the center point of a rectangle or a square. In this embodiment of the disclosure, the drawing center point position refers to using the position of one or more edge points determined from the set of edge points as the center point of the subsequently drawn shape.

[0050] In this embodiment of the disclosure, after obtaining the set of edge points, the position of the drawing center point can be determined based on the edge point parameter information in the set of edge points, and the number of drawing center point positions can be multiple.

[0051] In some implementations, the drawing center point position is determined based on a preset number of drawings, the number of edge points, and the position information of the edge points.

[0052] In other implementations, edge points are determined from the set of edge points according to a preset edge point interval as the drawing center point position. For example, the preset edge point interval is 50, and the 1st edge point, the 51st edge point, the 101st edge point, etc. are used as the drawing center point positions.

[0053] The above two methods for determining the drawing center point position based on the edge point parameter information in the edge point set are only examples. This disclosure does not impose any specific restrictions on the methods for determining the drawing center point position based on the edge point parameter information in the edge point set.

[0054] Step 103: Generate a drawing shape on the image to be processed that corresponds to the position of the drawing center point.

[0055] The shape can be any shape, and the settings can be selected according to the application scenario, such as one or more combinations of rectangles, squares, hearts, and pentagrams.

[0056] In some embodiments, each line edge corresponding to the shape to be drawn is determined based on a preset side length value, the target center point position of the target line edge in each line edge is obtained, the target center point position is matched with the drawing center point position, and the shape to be drawn is generated on the image to be processed.

[0057] In other implementations, the center point of the drawing is used as the center point of the drawing shape area, and the drawing shape is generated on the image to be processed according to a preset side length value.

[0058] The above two methods for generating drawing shapes corresponding to the drawing center point position on the image to be processed are merely examples. This disclosure does not impose any specific restrictions on the methods for generating drawing shapes corresponding to the drawing center point position on the image to be processed.

[0059] Specifically, after obtaining the drawing center point position, a drawing shape corresponding to that position can be generated. Since the drawing center point can be located anywhere on the drawing shape, to further improve the display effect, for example, the drawing center point can be set at the center of the bottom edge of the drawing shape (which is a rectangle), thus minimizing the overlap between the drawing shape and the target object area and affecting the display effect. Because there can be multiple drawing center points and multiple drawing shapes, the multiple drawing shapes generated on the image to be processed can be the same or different.

[0060] Step 104: Obtain the rotation matrix corresponding to the drawn shape, and rotate the drawn shape based on the rotation matrix.

[0061] Among them, the rotation matrix refers to the matrix used to rotate the drawn shape, that is, the matrix that can change the direction of the drawn shape but not the size of the drawn shape.

[0062] In some implementations, adjacent position points of the drawing center point are obtained, and the rotation angle between the drawing center point and the adjacent position points is calculated based on the coordinate information of the drawing center point and the coordinate information of the adjacent position points. The sine and cosine values ​​of the rotation angle are then calculated to construct the rotation matrix of the drawn shape.

[0063] In this embodiment of the disclosure, after obtaining the rotation matrix corresponding to the drawn shape, the drawn shape is rotated based on the rotation matrix. In a specific embodiment, the rotation center point position is obtained by calculating the rotation matrix based on the drawn shape and the drawing center point position of the drawn shape, and the drawing center point position of the drawn shape is rotated to the rotation center point position in a preset direction.

[0064] Specifically, after obtaining the rotation matrix corresponding to the drawn shape, the drawn shape can be rotated, thereby changing the position of the drawn shape in the image to be processed, so that the drawn shape does not overlap with the target object area, thus optimizing the display effect of the drawn shape.

[0065] Step 105: Perform texture mapping processing on the source image and the rotated drawing shape to generate the target image.

[0066] The source images can be one or a combination of text images, animal images, and plant images.

[0067] In some embodiments, the source image includes a text image. The texture coordinates of the source image and the texture coordinates of the rotated drawing shape are directly mapped one-to-one, and then the sampled fragments of the source image are interpolated into the drawing shape to generate the target image.

[0068] In other implementations, the source images include multiple text images or multiple animal images, etc. The segmentation coordinates of the source images are calculated based on the shape number of the drawn shape, the number of drawn source images, and the texture coordinates of the source images. The texture coordinates of the source images are then segmented based on the segmentation coordinates to obtain multiple source sub-images. The source sub-images are then texture-mapped with the drawn shape to generate the target image.

[0069] The two methods described above for performing texture mapping processing between source images and rotated drawn shapes to generate target images are merely examples. This disclosure does not impose any specific restrictions on the methods for performing texture mapping processing between source images and rotated drawn shapes to generate target images.

[0070] Specifically, after rotating the drawn shape, the area corresponding to the drawn shape is grayscale. Further texture mapping processing is needed between the source image and the rotated drawn shape to fill the content of the source image into the drawn shape and generate the target image.

[0071] The image effects processing scheme provided in this disclosure involves obtaining a set of edge points of the target object in the image to be processed, determining the position of the drawing center point based on the edge point parameter information in the edge point set, generating a drawing shape corresponding to the drawing center point position on the image to be processed, obtaining a rotation matrix corresponding to the drawing shape, rotating the drawing shape based on the rotation matrix, and performing texture mapping processing on the source image and the rotated drawing shape to generate the target image. Using the above technical solution, a drawing shape is generated on the contour area of ​​the target object during the image effects processing. Since the position of the drawing center point of the drawing shape is determined with the set of edge points of the target object, the image source material achieves a display effect of surrounding the target object. Furthermore, rotating the drawing shape avoids overlap between the drawing shape and the target object, further improving the image display effect in image effects scenarios.

[0072] In some embodiments, obtaining the edge point set of a target object in the image to be processed includes: inputting the image to be processed into a target object segmentation model to obtain a target object region; recognizing the target object region according to an edge contour recognition mode to obtain a target object contour; and extracting at least a portion of the pixels of the target object contour to represent it in the form of a point vector to obtain the edge point set.

[0073] In this embodiment of the disclosure, different target objects correspond to different target object segmentation models, such as human image segmentation models. The target object segmentation model is pre-trained and generated based on multiple target object samples and neural networks. Inputting the image to be processed into the target object segmentation model can achieve image segmentation of the image to be processed and obtain the target object region and the background region.

[0074] In this embodiment of the disclosure, the target object region refers to the region that includes the target object. For example, when the target object is a human portrait, the pixel region corresponding to the human portrait is the target object region; or, when the target object is a kitten, the pixel region corresponding to the kitten is the target object region. The target object outline refers to the lines that represent the shape of the target object. For example, when the target object is a human portrait, the lines representing the shape of the human portrait are the human portrait outline; or, when the target object is a kitten, the lines representing the shape of the kitten are the kitten outline.

[0075] Specifically, after acquiring the target object region, the target object region is identified according to the edge contour recognition mode to obtain the target object contour. At least a portion of the pixels of the target object contour are extracted and represented as point vectors to obtain an edge point set. The edge point set includes parameters such as the number and position of the edge points. The edge contour recognition mode can be understood as identifying the outermost contour of the target object region to obtain the target object contour. The "at least a portion of the pixels of the target object contour" can be understood as either a portion of the pixels corresponding to the target object contour or all of the pixels, depending on the application scenario.

[0076] In the above solution, by identifying the target object region and then combining it with edge extraction, the set of edge points of the target object can be accurately obtained, which improves the accuracy of the display effect of subsequent material wrapping around the target object and meets the user's needs.

[0077] In some embodiments, determining the drawing center point position based on edge point parameter information in the edge point set includes: obtaining the number of edge points and the position of the edge points in the edge point set; determining the number of edge point intervals between drawing center points based on a preset drawing quantity and the number of edge points; taking the position corresponding to the first edge point in the edge point set as the first drawing center point position; calculating the second drawing center point position based on the first drawing center point position and the number of edge point intervals; if the second drawing center point position is in the edge point set, continuing to calculate based on the second drawing center point position and the number of edge point intervals until the Nth drawing center point position is not in the edge point set; and taking the positions from the first drawing center point position to the (N-1)th drawing center point position as the drawing center point position; where N is a positive integer greater than 2, and if the second drawing center point position is not in the edge point set, the first drawing center point position is taken as the drawing center point position.

[0078] The preset number of draws refers to the number of pre-set draw shapes. The fewer the draws, the greater the distance between the draw shapes. The more draws, the sparser the draw shapes displayed on the image to be processed. The smaller the distance between the draw shapes, the denser the draw shapes displayed on the image to be processed. The specific number of draws can be set according to the application scenario or display preferences.

[0079] In this embodiment of the disclosure, the edge point interval number refers to the number of edge points between two drawing center point positions, the edge point number refers to the number of edge points contained in the edge point set, and the edge point position refers to the coordinate information of each edge point (such as the horizontal and vertical coordinate information with the upper left corner of the image to be processed as the origin). After setting the drawing quantity, the edge point interval number between the drawing center points is determined based on the preset drawing quantity and the edge point number. For example, if the preset drawing quantity is 10 and the edge point number is 500, dividing 500 by 10 gives an edge point interval number of 50 edge points.

[0080] In this embodiment of the disclosure, after determining the number of edge point intervals, the position corresponding to the first edge point in the edge point set can be used as the position of the first drawing center point. Then, the position of the second drawing center point is calculated based on the position of the first drawing center point and the number of edge point intervals. The position of the second drawing center point is in the edge point set. The calculation continues based on the position of the second drawing center point and the number of edge point intervals until the calculated position of the Nth drawing center point is not in the edge point set. The positions of the first drawing center point to the (N-1)th drawing center point are used as the drawing center point positions.

[0081] It should be noted that if the second drawing center point is not in the set of edge points, the first drawing center point will be used as the drawing center point, meaning the preset number of drawings is 1, and only one drawing shape will be generated.

[0082] In the above scheme, the distance interval between the center points of each drawing can be adjusted based on the preset number of drawings, thereby adjusting the distance between the drawn shapes. This allows the spacing between materials to be adjusted by changing the number of drawings, making the display of materials in the image more flexible and further improving the image display effect.

[0083] In some embodiments, each line edge corresponding to the shape to be drawn is determined based on a preset side length value, the target center point position of the target line edge in each line edge is obtained, the target center point position is matched with the drawing center point position, and the shape to be drawn is generated on the image to be processed.

[0084] The preset side length values ​​refer to the lengths of each side of the shape to be drawn in advance. For example, if the shape is a rectangle, the side length value refers to the length of the rectangle's side; if the shape is a rectangle, the side length value refers to the length of the rectangle's length and width.

[0085] In this embodiment of the disclosure, the edges of each line corresponding to different drawing shapes are different, so the target line edges from each line edge are also different. For example, if the drawing shape is a rectangle, after obtaining the four edges of the rectangle, the bottom edge of the rectangle is taken as the target line edge, and the center point of the target line edge is taken as the target center point position, so that the target center point position corresponds to the drawing center point position, and the drawing shape is generated on the image to be processed.

[0086] In the above scheme, by aligning the target center point of the target line edge in the drawn shape with the drawing center point, the overlapping of the drawn shape and the target object area can be avoided as much as possible, thus minimizing the impact on the display effect.

[0087] In some embodiments, adjacent position points to the drawing center point are obtained according to a preset step size. Based on the coordinate information of the drawing center point and the coordinate information of the adjacent position points, the horizontal gradient value and the vertical gradient value are obtained. Based on the horizontal gradient value and the vertical gradient value, the sine value and the cosine value are calculated. Based on the sine value and the cosine value, the rotation matrix of the drawn shape is constructed.

[0088] The preset step size refers to the number of edge points that are pre-set at the distance from the center point of the drawing. It can be understood that different step sizes determine different adjacent points, thus the angle of rotation of the drawn shape is different, and the final display effect is also different.

[0089] In this embodiment of the disclosure, for example, if the center point is drawn as the first edge point and the preset step size is 20, then the twentieth edge point is taken as the adjacent position point. After obtaining the adjacent position points of each center point, calculations are performed based on the coordinate information of the center point and the coordinate information of the adjacent position points. The difference between the horizontal coordinates of the two positions is calculated as the horizontal gradient value, and the difference between the vertical coordinates of the two positions is calculated as the vertical gradient value. Based on the horizontal and vertical gradient values ​​and the principle of right triangles, the sine and cosine values ​​are calculated, and the signs of the sine and cosine values ​​are determined according to the rotation direction to construct a two-dimensional rotation matrix.

[0090] In some embodiments, rotating the drawn shape based on a rotation matrix includes: calculating the rotation center point position based on the rotation matrix of the drawn shape and the position of the drawing center point of the drawn shape, and rotating the drawing center point position of the drawn shape to the rotation center point position in a preset direction.

[0091] In this embodiment of the disclosure, after obtaining the rotation matrix corresponding to the drawn shape, the drawn shape can be rotated. Specifically, the position coordinates corresponding to the drawing center point are multiplied by the rotation matrix to obtain the rotation center point position, and the drawing center point position of the drawn shape is rotated to the rotation center point position in a preset direction to achieve the rotation of the drawn shape. The preset direction can be clockwise or counterclockwise, and the specific setting depends on the application scenario.

[0092] In the above solution, by rotating the drawn shape, the position of the drawn shape changes in the image to be processed, so that the drawn shape does not overlap with the target object area, thus optimizing the display effect of the drawn shape.

[0093] In some embodiments, the segmentation coordinates of the material image are calculated based on the shape number of the drawn shape, the number of drawn materials, and the texture coordinates of the material image. The texture coordinates of the material image are then segmented based on the segmentation coordinates to obtain multiple material sub-images. The material sub-images are then texture-mapped with the drawn shape to generate the target image.

[0094] The shape number of the drawn shape is used to distinguish different drawn shapes. For example, if 12 drawn shapes are generated in the image to be processed, the first drawn shape or a randomly selected drawn shape is used as rectangle number 1, and rectangle numbers 2-12 are determined in a clockwise or counterclockwise direction. The specific settings are selected according to the application scenario.

[0095] The number of drawing materials refers to the number of texts or animals included in the drawn image, and the texture coordinates of the material image refer to the texture coordinates of the entire material image. In a specific embodiment, the shape number is modulo the number of drawing materials and then summed with the horizontal coordinate value in the texture coordinates of the material image to obtain the current horizontal coordinate value. The current horizontal coordinate value is divided by the number of drawing materials to obtain the horizontal coordinate value of the segmentation coordinates. The vertical coordinate value in the texture coordinates of the material image is used as the vertical coordinate value of the segmentation coordinates. The segmentation coordinates are determined based on the horizontal and vertical coordinate values ​​of the segmentation coordinates.

[0096] Furthermore, after obtaining the segmentation coordinates of the source image, the texture coordinates of the source image are segmented based on the segmentation coordinates to obtain multiple source sub-images. The source sub-images are then texture-mapped with the drawn shape to generate the target image.

[0097] In the above solution, the material images are segmented according to the shape sequence number of the drawing shape based on the number of drawing materials, and then mapped to the drawing shape, which further ensures the display effect and improves the user experience.

[0098] In some embodiments, based on the drawing center point position of the drawn shape and a preset moving speed, the current center point position corresponding to the drawn shape at the target time point is calculated, and at the target time point, the drawing center point position corresponding to the drawn shape is moved to the current center point position corresponding to the drawn shape.

[0099] The preset movement speed can be selected and set according to the application scenario. The movement speed determines how many positions and distances the drawn shape moves per second. The target time point can be understood as which second away from the current time. The result of multiplying the target time point by the movement speed is the movement distance corresponding to the drawing center point position of the drawn shape. The current center point position is obtained by adding the drawing center point position and the movement distance. At the target time point, the drawing center point position corresponding to the drawn shape is moved to the current center point position corresponding to the drawn shape.

[0100] In the above solution, the speed of the drawn shape movement can be controlled based on a preset movement speed, thereby realizing the speed at which the material moves around the target object, further improving the diversity of material display around the target object, enhancing the image display effect, and meeting user needs.

[0101] Figure 2 This is a flowchart illustrating another image effects processing method provided in this embodiment of the present disclosure. This embodiment further optimizes the above-described image effects processing method based on the previous embodiment. For example... Figure 2 As shown, the method includes:

[0102] Step 201: Input the image to be processed into the target object segmentation model to obtain the target object region. Identify the target object region according to the edge contour recognition mode to obtain the target object contour. Extract at least some pixels of the target object contour and represent them in the form of point vectors to obtain the edge point set.

[0103] For example, Figure 3a This is a schematic diagram of an image to be processed according to an embodiment of the present disclosure. The image shows a human portrait as the target object. The image to be processed includes a target object region 11 and a background region 12, and the target object region and the background region are distinguished by a grayscale image.

[0104] For example, continue with Figure 3a Taking the target object region as an example, the target object region is identified according to the edge contour recognition mode, and the obtained target object contour is as follows: Figure 3b The outermost contour of the target object region shown is target object contour 111. After obtaining the target object contour, each pixel of the target object contour is extracted and represented as a point vector to obtain the edge point set.

[0105] Step 202: Obtain the number and position of edge points in the edge point set. Determine the number of edge point intervals between drawing center points based on the preset number of drawing points and the number of edge points. Take the position corresponding to the first edge point in the edge point set as the position of the first drawing center point. Calculate the position of the second drawing center point based on the position of the first drawing center point and the number of edge point intervals.

[0106] Step 203: If the second drawing center point is in the edge point set, continue to calculate based on the second drawing center point position and the edge point interval until the Nth drawing center point position is not in the edge point set. Take the first drawing center point position to the (N-1)th drawing center point position as the drawing center point position; where N is a positive integer greater than 2.

[0107] Step 204: If the second drawing center point is not in the edge point set, use the first drawing center point as the drawing center point.

[0108] In this embodiment of the disclosure, after determining the number of edge point intervals, the position corresponding to the first edge point in the edge point set can be used as the position of the first drawing center point, for example... Figure 4a The first center point is located at position A0. Then, based on the first center point position A0 and the number of edge point intervals, the second center point position A1 is calculated. If the second center point position A1 is in the edge point set, the calculation continues based on the second center point position and the number of edge point intervals until the calculated Nth center point position AN is no longer in the edge point set. The positions from the first center point position A0 to the (N-1)th center point position AN-1 are then used as the center point positions. Figure 4a A0 to A12 are used as the center points for drawing.

[0109] It should be noted that if the second drawing center point is not in the set of edge points, the first drawing center point will be used as the drawing center point, meaning the preset number of drawings is 1, and only one drawing shape will be generated.

[0110] Step 205: Determine the line edges corresponding to the shape to be drawn based on the preset side length values, obtain the target center point position of the target line edge in each line edge, match the target center point position with the drawing center point position, and generate the shape to be drawn on the image to be processed.

[0111] For example, continue with Figure 4a Taking the drawing center point positions A0 to A12 as an example, the generated drawing shape is a rectangle. The bottom side of the rectangle is used as the target line edge, thereby obtaining, for example, the center point position of the bottom side of the rectangle is respectively mapped to the drawing center point positions A0 to A12, and the drawing shape is generated on the image to be processed as follows. Figure 4b As shown.

[0112] Step 206: Obtain adjacent position points to the drawing center point according to the preset step size; obtain the horizontal gradient value and vertical gradient value based on the coordinate information of the drawing center point and the coordinate information of the adjacent position points; calculate the sine and cosine values ​​based on the horizontal gradient value and the vertical gradient value; and construct the rotation matrix of the drawn shape based on the sine and cosine values.

[0113] For example, Figure 5a Another schematic diagram of a drawn shape provided by an embodiment of this disclosure, such as Figure 5a The shape shown is drawn, where M is the center point of the shape. An adjacent point N is selected (e.g., the position corresponding to an edge point 50 positions forward from M in the edge point set). The gradient information is obtained by calculating the coordinate difference between the center point M and the adjacent point N. Figure 5aThe arrows shown represent the gradients in the x and y directions, i.e., the horizontal gradient value and the vertical gradient value. Based on the horizontal and vertical gradient values, the sine and cosine values ​​are calculated, and the rotation matrix for drawing the shape is constructed based on the sine and cosine values.

[0114] Step 207: Calculate the rotation center point position based on the rotation matrix of the drawn shape and the position of the drawing center point of the drawn shape, and rotate the drawing center point position of the drawn shape to the rotation center point position according to the preset direction.

[0115] For example, continue with Figure 4b For example, the rotation matrix of the drawn shape and the position of the drawing center point of the shape are calculated to obtain the position of the rotation center point, for example... Figure 5b As shown in B1-B12, the drawing center point positions A1-A12 of the drawn shape are rotated to the rotation center point positions B1-B12 in a preset direction, thus realizing the rotation of the drawn shape.

[0116] Step 208: Calculate the segmentation coordinates of the material image based on the shape number of the drawn shape, the number of drawn materials, and the texture coordinates of the material image. Perform segmentation processing on the texture coordinates of the material image based on the segmentation coordinates to obtain multiple material sub-images. Perform texture mapping processing on the material sub-images and the drawn shape to generate the target image.

[0117] For example, Figure 6a This is a schematic diagram of a material image provided in an embodiment of the present disclosure, such as... Figure 6a As shown, the texture coordinates corresponding to the source image are (0, 0), (0, 1), (1, 0), and (1, 1). Continuing with... Figure 5b Taking the drawing shape as an example, the texture coordinates corresponding to each drawing shape are (0,0), (0,1), (1,0) and (1,1). The material image includes three "ABC" characters, thus determining that the number of materials is 3. Therefore, it is necessary to calculate the segmentation coordinates of the material image based on the shape number of the drawing shape, the number of drawing materials, and the texture coordinates of the material image.

[0118] Specifically, the shape number is modulo the number of drawn materials and then summed with the horizontal coordinate value in the texture coordinates of the material image to obtain the current horizontal coordinate value. The current horizontal coordinate value is divided by the number of drawn materials to obtain the horizontal coordinate value of the segmentation coordinate. The vertical coordinate value in the texture coordinate of the material image is used as the vertical coordinate value of the segmentation coordinate. The segmentation coordinate is determined based on the horizontal and vertical coordinate values ​​of the segmentation coordinate.

[0119] For example, the texture coordinates corresponding to the source image are (0, 0), (0, 1), (1, 0), and (1, 1), and the texture coordinates corresponding to each drawn shape are (0, 0), (0, 1), (1, 0), and (1, 1). Therefore, the vertical coordinates of the source image and the drawn shapes remain unchanged, and the vertical coordinate values ​​can be directly used as the vertical coordinate values ​​of the segmentation coordinates. The horizontal coordinate value in the texture coordinates of the source image is 1. Figure 5b The shape numbers for the drawn shapes are 0-11. For example, for the 0th shape, the remainder of the number of drawn materials is taken as 3, resulting in 0. The 0 and 1 are added together to get the current horizontal coordinate value of 1. The current horizontal coordinate value of 1 is then divided by the number of drawn materials of 3 to get the horizontal coordinate value of the segmented coordinate as 1 / 3. The calculation continues for the 1st shape to get the horizontal coordinate value as 2 / 3, the 2nd shape to get the horizontal coordinate value as 1, and so on.

[0120] Furthermore, based on segmented coordinate pairs Figure 6a The source image is segmented to obtain three sub-images: "A", "B", and "C". The texture coordinates of the three sub-images are (0, 0), (0, 1), (1 / 3, 0) and (1 / 3, 1), (1 / 3, 0), (1 / 3, 1), (2 / 3, 0) and (2 / 3, 1) and (2 / 3, 0), (2 / 3, 1), (1, 0), and (1, 1). The texture coordinates of the three sub-images are then mapped sequentially to the texture coordinates of the corresponding drawn shapes to obtain the target image, as shown below. Figure 6b As shown.

[0121] Step 209: Based on the drawing center point position of the drawn shape and the preset moving speed, calculate the current center point position corresponding to the drawn shape at the target time point, and at the target time point, move the drawing center point position corresponding to the drawn shape to the current center point position corresponding to the drawn shape.

[0122] For example, continue with Figure 6b For example, based on a preset movement speed, the drawn shape moves, and at the nth second, the updated display effect after the drawn shape moves is as follows: Figure 6c As shown, in addition, the display effect can be adjusted by setting the number of shapes drawn and the side length of the shapes drawn, so as to further meet the personalized needs of different users.

[0123] The image effects processing scheme of this disclosure involves inputting the image to be processed into a target object segmentation model to obtain the target object region. The target object region is then searched according to the outermost contour retrieval mode to obtain the target object contour. Each pixel of the target object contour is extracted and represented as a point vector to obtain an edge point set. The number of edge points and the position of each edge point in the edge point set are obtained. Based on a preset number of drawing points and the number of edge points, the number of edge point intervals between drawing center points is determined. The position corresponding to the first edge point in the edge point set is taken as the first drawing center point position. The position of the second drawing center point is calculated based on the first drawing center point position and the number of edge point intervals. If the second drawing center point position is in the edge point set, the calculation continues based on the second drawing center point position and the number of edge point intervals until the Nth drawing center point position is not in the edge point set. The positions from the first drawing center point position to the (N-1)th drawing center point position are then taken as the drawing center point positions. If the second drawing center point position is not in the edge point set, the first drawing center point position is taken as the drawing center point position. Based on a preset side length value, the edges of each line corresponding to the drawing shape are determined, and the target line edges among each line edge are obtained. The target center point position is mapped to the drawing center point position, and a drawing shape is generated on the image to be processed. Adjacent points to the drawing center point position are obtained according to a preset step size. Based on the coordinates of the drawing center point position and the adjacent points, horizontal and vertical gradient values ​​are obtained. Sine and cosine values ​​are calculated based on the horizontal and vertical gradient values. A rotation matrix for the drawing shape is constructed based on the sine and cosine values. The rotation center point position is calculated based on the rotation matrix and the drawing center point position of the drawing shape. The drawing center point position of the drawing shape is then calculated according to a preset step size. Assuming the direction is rotated to the rotation center point, the segmentation coordinates of the material image are calculated based on the shape number of the drawn shape, the number of drawn materials, and the texture coordinates of the material image. The texture coordinates of the material image are then segmented based on the segmentation coordinates to obtain multiple material sub-images. The material sub-images are then texture-mapped with the drawn shape to generate the target image. Additionally, based on the drawing center point position of the drawn shape and the preset movement speed, the current center point position of the drawn shape at the target time point is calculated. At the target time point, the drawing center point position of the drawn shape is moved to the current center point position of the drawn shape.Therefore, by identifying the target object region and combining it with edge extraction, the set of edge points of the target object can be accurately obtained, improving the accuracy of the display effect of subsequent material surrounding the target object. Based on the preset number of drawings, the distance interval between the center points of each drawing can be adjusted, thereby adjusting the distance between the drawn shapes. This allows the spacing between materials to be adjusted by changing the number of drawings, making the display of materials in the image more flexible and further improving the image display effect. By aligning the target center point position of the target line edge in the drawn shape with the drawing center point position, the overlap between the drawn shape and the target object region is avoided as much as possible, thus minimizing the impact on the display effect. By rotating the drawn shape, the position of the drawn shape changes in the image to be processed, preventing the drawn shape from overlapping with the target object region and optimizing the display effect of the drawn shape. Based on the number of drawn materials, the material image is segmented according to the shape sequence number of the drawn shape and then mapped to the drawn shape, further ensuring the display effect and improving the user experience. Furthermore, the speed of the drawn shape movement can be controlled based on the preset movement speed, thereby realizing the speed at which the material moves around the target object, further increasing the diversity of material display around the target object, improving the image display effect, and meeting user needs.

[0124] Figure 7 This is a schematic diagram of an image effects processing device provided in an embodiment of the present disclosure. The device can be implemented by software and / or hardware and is generally integrated into an electronic device. Figure 7 As shown, the device includes:

[0125] The acquisition module 301 is used to acquire the set of edge points of the target object in the image to be processed.

[0126] The drawing position determination module 302 is used to determine the drawing center point position based on the edge point parameter information in the edge point set.

[0127] The shape generation module 303 is used to generate a drawing shape on the image to be processed that corresponds to the position of the drawing center point.

[0128] The matrix acquisition module 304 is used to acquire the rotation matrix corresponding to the drawn shape.

[0129] The rotation module 305 is used to rotate the drawn shape based on the rotation matrix.

[0130] The processing and generation module 306 is used to perform texture mapping processing on the source image and the rotated drawing shape to generate the target image.

[0131] Optionally, the acquisition set module 301 is specifically used for:

[0132] The image to be processed is input into the target object segmentation model to obtain the target object region;

[0133] The target object region is identified according to the edge contour recognition mode to obtain the target object contour;

[0134] At least a portion of the pixels of the target object's outline are extracted and represented as point vectors to obtain the edge point set.

[0135] Optionally, the module 302 for determining the drawing position is specifically used for:

[0136] Obtain the number of edge points and the positions of the edge points in the edge point set;

[0137] The number of edge point intervals between the drawing center points is determined based on the preset number of drawings and the number of edge points.

[0138] The position corresponding to the first edge point in the set of edge points is taken as the position of the first drawing center point, and the position of the second drawing center point is calculated based on the position of the first drawing center point and the number of edge point intervals.

[0139] If the second drawing center point is located in the edge point set, the calculation continues based on the second drawing center point location and the edge point interval number until the Nth drawing center point location is not in the edge point set. The first drawing center point location to the (N-1)th drawing center point location is then taken as the drawing center point location; where N is a positive integer greater than 2.

[0140] If the second drawing center point is not in the set of edge points, the first drawing center point is used as the drawing center point.

[0141] Optionally, the shape generation module 303 is used for:

[0142] The edges of each line corresponding to the drawn shape are determined based on preset edge length values;

[0143] Obtain the target center point position of the target line edge in each of the aforementioned line edges;

[0144] The target center point position is matched with the drawing center point position, and the drawing shape is generated on the image to be processed.

[0145] Optionally, the matrix acquisition module 304 is used for:

[0146] Obtain adjacent position points to the drawing center point according to a preset step size;

[0147] The horizontal gradient value and the vertical gradient value are obtained based on the coordinate information of the center point and the coordinate information of the adjacent points.

[0148] The sine and cosine values ​​are calculated based on the horizontal and vertical gradient values.

[0149] The rotation matrix of the drawn shape is constructed based on the sine and cosine values.

[0150] Optionally, the rotation module 305 is used for:

[0151] The position of the rotation center point is calculated based on the rotation matrix of the drawn shape and the position of the drawing center point of the drawn shape.

[0152] The center point of the drawn shape is rotated to the center point of rotation in a preset direction.

[0153] Optionally, the processing and generation module 306 includes:

[0154] The calculation unit is used to calculate the segmentation coordinates of the material image based on the shape number of the drawn shape, the number of drawn materials, and the texture coordinates of the material image;

[0155] The segmentation generation unit is used to segment the texture coordinates of the source image based on the segmentation coordinates to obtain multiple source sub-images, and to perform texture mapping processing on the source sub-images and the drawn shape to generate the target image.

[0156] Optionally, the computing unit is specifically used for:

[0157] The shape number is modulo the number of drawn materials, and then summed with the horizontal coordinate value in the texture coordinates of the material image to obtain the current horizontal coordinate value.

[0158] Divide the current horizontal coordinate value by the number of drawing materials to obtain the horizontal coordinate value of the segmentation coordinate;

[0159] The vertical coordinate value in the texture coordinates of the source image is used as the vertical coordinate value of the segmentation coordinates;

[0160] The segmentation coordinates are determined based on the horizontal coordinate value and the vertical coordinate value of the segmentation coordinates.

[0161] Optionally, the device further includes:

[0162] The calculation module is used to calculate the current center point position of the drawn shape at the target time point based on the center point position of the drawn shape and the preset moving speed.

[0163] The moving module is used to move the drawing center point position corresponding to the drawing shape to the current center point position corresponding to the drawing shape at the target time point.

[0164] The image effects processing apparatus provided in this disclosure can execute the image effects processing method provided in any embodiment of this disclosure, and has the corresponding functional modules and beneficial effects for executing the method.

[0165] This disclosure also provides a computer program product, including a computer program / instructions, which, when executed by a processor, implement the image effects processing method provided in any embodiment of this disclosure.

[0166] Figure 8 This is a schematic diagram of an electronic device provided in an embodiment of the present disclosure. See below for details. Figure 8 The diagram illustrates a structural schematic suitable for implementing the electronic device 400 in the embodiments of this disclosure. The electronic device 400 in the embodiments of this disclosure may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 8 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.

[0167] like Figure 8 As shown, electronic device 400 may include a processing device (e.g., a central processing unit, a graphics processor, etc.) 401, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 402 or a program loaded from storage device 408 into random access memory (RAM) 403. RAM 403 also stores various programs and data required for the operation of electronic device 400. Processing device 401, ROM 402, and RAM 403 are interconnected via bus 404. Input / output (I / O) interface 405 is also connected to bus 404.

[0168] Typically, the following devices can be connected to I / O interface 405: input devices 406 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 407 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 408 including, for example, magnetic tapes, hard disks, etc.; and communication devices 409. Communication device 409 allows electronic device 400 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 8An electronic device 400 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.

[0169] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 409, or installed from a storage device 408, or installed from a ROM 402. When the computer program is executed by the processing device 401, it performs the functions defined in the image effects processing method of embodiments of this disclosure.

[0170] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.

[0171] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.

[0172] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.

[0173] The aforementioned computer-readable medium carries one or more programs that, when executed by the electronic device, cause the electronic device to: receive a user's information display trigger operation during video playback; acquire at least two target information items associated with the video; display a first target information item among the at least two target information items in an information display area on the video playback page, wherein the size of the information display area is smaller than the size of the playback page; and receive a user's first switching trigger operation to switch the first target information item displayed in the information display area to a second target information item among the at least two target information items.

[0174] Computer program code for performing the operations of this disclosure can 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, and C++, as well as conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone 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 remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0175] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0176] The units described in the embodiments of this disclosure can be implemented in software or hardware. The names of the units are not, in some cases, intended to limit the specific unit.

[0177] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.

[0178] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0179] According to one or more embodiments of this disclosure, this disclosure provides an image special effects processing method, including:

[0180] Obtain the set of edge points of the target object in the image to be processed;

[0181] The position of the drawing center point is determined based on the edge point parameter information in the edge point set;

[0182] A drawing shape corresponding to the drawing center point position is generated on the image to be processed;

[0183] Obtain the rotation matrix corresponding to the drawn shape, and rotate the drawn shape based on the rotation matrix;

[0184] The source image is texture-mapped to the rotated drawing shape to generate the target image.

[0185] According to one or more embodiments of this disclosure, in the image special effects processing method provided by this disclosure, obtaining the set of edge points of the target object in the image to be processed includes:

[0186] The image to be processed is input into the target object segmentation model to obtain the target object region;

[0187] The target object region is identified according to the edge contour recognition mode to obtain the target object contour;

[0188] At least a portion of the pixels of the target object's outline are extracted and represented as point vectors to obtain the edge point set.

[0189] According to one or more embodiments of this disclosure, in the image effects processing method provided by this disclosure, determining the drawing center point position based on the edge point parameter information in the edge point set includes:

[0190] Obtain the number of edge points and the positions of the edge points in the edge point set;

[0191] The number of edge point intervals between the drawing center points is determined based on the preset number of drawings and the number of edge points.

[0192] The position corresponding to the first edge point in the set of edge points is taken as the position of the first drawing center point, and the position of the second drawing center point is calculated based on the position of the first drawing center point and the number of edge point intervals.

[0193] If the second drawing center point is located in the edge point set, the calculation continues based on the second drawing center point location and the edge point interval number until the Nth drawing center point location is not in the edge point set. The first drawing center point location to the (N-1)th drawing center point location is then taken as the drawing center point location; where N is a positive integer greater than 2.

[0194] If the second drawing center point is not in the set of edge points, the first drawing center point is used as the drawing center point.

[0195] According to one or more embodiments of this disclosure, in the image effects processing method provided by this disclosure, the step of generating a drawing shape on the image to be processed corresponding to the drawing center point position includes:

[0196] The edges of each line corresponding to the drawn shape are determined based on preset edge length values;

[0197] Obtain the target center point position of the target line edge in each of the aforementioned line edges;

[0198] The target center point position is matched with the drawing center point position, and the drawing shape is generated on the image to be processed.

[0199] According to one or more embodiments of this disclosure, in the image effects processing method provided by this disclosure, obtaining the rotation matrix corresponding to the drawn shape includes:

[0200] Obtain adjacent position points to the drawing center point according to a preset step size;

[0201] The horizontal gradient value and the vertical gradient value are obtained based on the coordinate information of the center point and the coordinate information of the adjacent points.

[0202] The sine and cosine values ​​are calculated based on the horizontal and vertical gradient values.

[0203] The rotation matrix of the drawn shape is constructed based on the sine and cosine values.

[0204] According to one or more embodiments of this disclosure, in the image effects processing method provided by this disclosure, rotating the drawn shape based on the rotation matrix includes:

[0205] The position of the rotation center point is calculated based on the rotation matrix of the drawn shape and the position of the drawing center point of the drawn shape.

[0206] The center point of the drawn shape is rotated to the center point of rotation in a preset direction.

[0207] According to one or more embodiments of this disclosure, in the image effects processing method provided by this disclosure, the step of performing texture mapping processing on the source image and the rotated drawn shape to generate a target image includes:

[0208] The segmentation coordinates of the material image are calculated based on the shape number of the drawn shape, the number of drawn materials, and the texture coordinates of the material image.

[0209] The texture coordinates of the source image are segmented based on the segmentation coordinates to obtain multiple source sub-images. The source sub-images are then texture-mapped with the drawn shape to generate the target image.

[0210] According to one or more embodiments of this disclosure, in the image effects processing method provided by this disclosure, the step of calculating the segmentation coordinates of the material image based on the shape index of the drawn shape, the number of drawn materials, and the texture coordinates of the material image includes:

[0211] The shape number is modulo the number of drawn materials, and then summed with the horizontal coordinate value in the texture coordinates of the material image to obtain the current horizontal coordinate value.

[0212] Divide the current horizontal coordinate value by the number of drawing materials to obtain the horizontal coordinate value of the segmentation coordinate;

[0213] The vertical coordinate value in the texture coordinates of the source image is used as the vertical coordinate value of the segmentation coordinates;

[0214] The segmentation coordinates are determined based on the horizontal coordinate value and the vertical coordinate value of the segmentation coordinates.

[0215] According to one or more embodiments of this disclosure, the image effects processing method provided in this disclosure further includes:

[0216] Based on the position of the center point of the drawn shape and the preset moving speed, calculate the current center point position of the drawn shape at the target time point;

[0217] At the target time point, the position of the drawing center point corresponding to the drawing shape is moved to the current center point position corresponding to the drawing shape.

[0218] According to one or more embodiments of this disclosure, this disclosure provides an image special effects processing apparatus, including:

[0219] The set acquisition module is used to acquire the set of edge points of the target object in the image to be processed;

[0220] The drawing position determination module is used to determine the drawing center point position based on the edge point parameter information in the edge point set;

[0221] A shape generation module is used to generate a shape on the image to be processed that corresponds to the position of the drawing center point.

[0222] A matrix acquisition module is used to acquire the rotation matrix corresponding to the drawn shape;

[0223] A rotation module is used to rotate the drawn shape based on the rotation matrix;

[0224] The processing and generation module is used to perform texture mapping processing on the source image and the rotated drawn shape to generate the target image.

[0225] According to one or more embodiments of this disclosure, in the image effects processing apparatus provided by this disclosure, the acquisition set module is specifically used for:

[0226] The image to be processed is input into the target object segmentation model to obtain the target object region;

[0227] The target object region is identified according to the edge contour recognition mode to obtain the target object contour;

[0228] At least a portion of the pixels of the target object's outline are extracted and represented as point vectors to obtain the edge point set.

[0229] According to one or more embodiments of this disclosure, in the image effects processing apparatus provided by this disclosure, the module for determining the drawing position is specifically used for:

[0230] Obtain the number of edge points and the positions of the edge points in the edge point set;

[0231] The number of edge point intervals between the drawing center points is determined based on the preset number of drawings and the number of edge points.

[0232] The position corresponding to the first edge point in the set of edge points is taken as the position of the first drawing center point, and the position of the second drawing center point is calculated based on the position of the first drawing center point and the number of edge point intervals.

[0233] If the second drawing center point is located in the edge point set, the calculation continues based on the second drawing center point location and the edge point interval number until the Nth drawing center point location is not in the edge point set. The first drawing center point location to the (N-1)th drawing center point location is then taken as the drawing center point location; where N is a positive integer greater than 2.

[0234] If the second drawing center point is not in the set of edge points, the first drawing center point is used as the drawing center point.

[0235] According to one or more embodiments of this disclosure, in the image effects processing apparatus provided by this disclosure, the shape generation module is used for:

[0236] The edges of each line corresponding to the drawn shape are determined based on preset edge length values;

[0237] Obtain the target center point position of the target line edge in each of the aforementioned line edges;

[0238] The target center point position is matched with the drawing center point position, and the drawing shape is generated on the image to be processed.

[0239] According to one or more embodiments of this disclosure, in the image effects processing apparatus provided by this disclosure, the matrix acquisition module is used for:

[0240] Obtain adjacent position points to the drawing center point according to a preset step size;

[0241] The horizontal gradient value and the vertical gradient value are obtained based on the coordinate information of the center point and the coordinate information of the adjacent points.

[0242] The sine and cosine values ​​are calculated based on the horizontal and vertical gradient values.

[0243] The rotation matrix of the drawn shape is constructed based on the sine and cosine values.

[0244] According to one or more embodiments of this disclosure, in the image effects processing apparatus provided by this disclosure, the rotation module is used for:

[0245] The position of the rotation center point is calculated based on the rotation matrix of the drawn shape and the position of the drawing center point of the drawn shape.

[0246] The center point of the drawn shape is rotated to the center point of rotation in a preset direction.

[0247] According to one or more embodiments of this disclosure, in the image special effects processing apparatus provided by this disclosure, the processing generation module includes:

[0248] The calculation unit is used to calculate the segmentation coordinates of the material image based on the shape number of the drawn shape, the number of drawn materials, and the texture coordinates of the material image;

[0249] The segmentation generation unit is used to segment the texture coordinates of the source image based on the segmentation coordinates to obtain multiple source sub-images, and to perform texture mapping processing on the source sub-images and the drawn shape to generate the target image.

[0250] According to one or more embodiments of this disclosure, in the image effects processing apparatus provided by this disclosure, the computing unit is specifically used for:

[0251] The shape number is modulo the number of drawn materials, and then summed with the horizontal coordinate value in the texture coordinates of the material image to obtain the current horizontal coordinate value.

[0252] Divide the current horizontal coordinate value by the number of drawing materials to obtain the horizontal coordinate value of the segmentation coordinate;

[0253] The vertical coordinate value in the texture coordinates of the source image is used as the vertical coordinate value of the segmentation coordinates;

[0254] The segmentation coordinates are determined based on the horizontal coordinate value and the vertical coordinate value of the segmentation coordinates.

[0255] According to one or more embodiments of this disclosure, the image effects processing apparatus provided in this disclosure further includes:

[0256] The calculation module is used to calculate the current center point position of the drawn shape at the target time point based on the center point position of the drawn shape and the preset moving speed.

[0257] The moving module is used to move the drawing center point position corresponding to the drawing shape to the current center point position corresponding to the drawing shape at the target time point.

[0258] According to one or more embodiments of this disclosure, this disclosure provides an electronic device, including:

[0259] processor;

[0260] Memory used to store the processor's executable instructions;

[0261] The processor is configured to read the executable instructions from the memory and execute the instructions to implement any of the image effects processing methods provided in this disclosure.

[0262] According to one or more embodiments of the present disclosure, the present disclosure provides a computer-readable storage medium storing a computer program for performing an image effects processing method as described in any of the present disclosure.

[0263] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.

[0264] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.

[0265] Although the subject matter has been described using language specific to structural features and / or methodological logic, 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. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.

Claims

1. An image special effects processing method, characterized in that, include: Obtain the set of edge points of the target object in the image to be processed; The drawing center point position is determined based on the edge point parameter information in the edge point set; wherein, determining the drawing center point position based on the edge point parameter information in the edge point set includes: obtaining the number of edge points and the positions of the edge points in the edge point set; determining the number of edge point intervals between drawing center points based on a preset drawing quantity and the number of edge points; taking the position corresponding to the first edge point in the edge point set as the first drawing center point position, calculating the second drawing center point position based on the first drawing center point position and the number of edge point intervals; if the second drawing center point position is in the edge point set, continuing to calculate based on the second drawing center point position and the number of edge point intervals until the Nth drawing center point position is not in the edge point set, and taking the position from the first drawing center point position to the (N-1)th drawing center point position as the drawing center point position; wherein, N is a positive integer greater than 2; if the second drawing center point position is not in the edge point set, taking the first drawing center point position as the drawing center point position; A drawing shape corresponding to the drawing center point position is generated on the image to be processed; Obtain the rotation matrix corresponding to the drawn shape, and rotate the drawn shape based on the rotation matrix; The source image is texture-mapped to the rotated drawing shape to generate the target image.

2. The image special effects processing method according to claim 1, characterized in that, The step of obtaining the set of edge points of the target object in the image to be processed includes: The image to be processed is input into the target object segmentation model to obtain the target object region; The target object region is identified according to the edge contour recognition mode to obtain the target object contour; At least a portion of the pixels of the target object's outline are extracted and represented as point vectors to obtain the edge point set.

3. The image special effects processing method according to claim 1, characterized in that, The step of generating a drawing shape on the image to be processed corresponding to the drawing center point position includes: The edges of each line corresponding to the drawn shape are determined based on preset edge length values; Obtain the target center point position of the target line edge in each of the aforementioned line edges; The target center point position is matched with the drawing center point position, and the drawing shape is generated on the image to be processed.

4. The image special effects processing method according to claim 1, characterized in that, The step of obtaining the rotation matrix corresponding to the drawn shape includes: Obtain adjacent position points to the drawing center point according to a preset step size; The horizontal gradient value and the vertical gradient value are obtained based on the coordinate information of the center point and the coordinate information of the adjacent points. The sine and cosine values ​​are calculated based on the horizontal and vertical gradient values. The rotation matrix of the drawn shape is constructed based on the sine and cosine values.

5. The image special effects processing method according to claim 1, characterized in that, The rotation of the drawn shape based on the rotation matrix includes: The position of the rotation center point is calculated based on the rotation matrix of the drawn shape and the position of the drawing center point of the drawn shape. The center point of the drawn shape is rotated to the center point of rotation in a preset direction.

6. The image special effects processing method according to claim 1, characterized in that, The step of performing texture mapping processing on the source image and the rotated drawn shape to generate the target image includes: The segmentation coordinates of the material image are calculated based on the shape number of the drawn shape, the number of drawn materials, and the texture coordinates of the material image. The texture coordinates of the source image are segmented based on the segmentation coordinates to obtain multiple source sub-images. The source sub-images are then texture-mapped with the drawn shape to generate the target image.

7. The image special effects processing method according to claim 6, characterized in that, The calculation of the segmentation coordinates of the material image based on the shape index of the drawn shape, the number of drawn materials, and the texture coordinates of the material image includes: The shape number is modulo the number of drawn materials, and then summed with the horizontal coordinate value in the texture coordinates of the material image to obtain the current horizontal coordinate value. Divide the current horizontal coordinate value by the number of drawing materials to obtain the horizontal coordinate value of the segmentation coordinate; The vertical coordinate value in the texture coordinates of the source image is used as the vertical coordinate value of the segmentation coordinates; The segmentation coordinates are determined based on the horizontal coordinate value and the vertical coordinate value of the segmentation coordinates.

8. The image special effects processing method according to claim 1, characterized in that, Also includes: Based on the position of the center point of the drawn shape and the preset moving speed, calculate the current center point position of the drawn shape at the target time point; At the target time point, the position of the drawing center point corresponding to the drawing shape is moved to the current center point position corresponding to the drawing shape.

9. An image special effects processing device, characterized in that, include: The set acquisition module is used to acquire the set of edge points of the target object in the image to be processed; A drawing position determination module is used to determine the drawing center point position based on edge point parameter information in the edge point set. The determination of the drawing center point position based on the edge point parameter information in the edge point set includes: obtaining the number of edge points and the positions of the edge points in the edge point set; determining the number of edge point intervals between drawing center points based on a preset drawing quantity and the number of edge points; using the position corresponding to the first edge point in the edge point set as the first drawing center point position; calculating the second drawing center point position based on the first drawing center point position and the number of edge point intervals; if the second drawing center point position is in the edge point set, continuing to calculate based on the second drawing center point position and the number of edge point intervals until the Nth drawing center point position is not in the edge point set, then using the position from the first drawing center point position to the (N-1)th drawing center point position as the drawing center point position; where N is a positive integer greater than 2; if the second drawing center point position is not in the edge point set, the first drawing center point position is used as the drawing center point position. A shape generation module is used to generate a shape on the image to be processed that corresponds to the position of the drawing center point. A matrix acquisition module is used to acquire the rotation matrix corresponding to the drawn shape; A rotation module is used to rotate the drawn shape based on the rotation matrix; The processing and generation module is used to perform texture mapping processing on the source image and the rotated drawn shape to generate the target image.

10. An electronic device, characterized in that, The electronic device includes: processor; Memory used to store the processor's executable instructions; The processor is configured to read the executable instructions from the memory and execute the instructions to implement the image effects processing method according to any one of claims 1-8.

11. A computer-readable storage medium, characterized in that, The storage medium stores a computer program for executing the image effects processing method according to any one of claims 1-8.

Citation Information

Patent Citations

  • Method and device for drawing user interface by using OpenGL and mobile terminal

    CN106873930A

  • Watermarking scheme based on constructed winding pictures

    CN109493269A