Image processing method, apparatus and electronic device

By segmenting the hair in a person's image into multiple strands and processing it based on facial key points and hair strand outlines, the system automatically creates flowing hair, solving the problem that ordinary people find it difficult to achieve flowing hair in static images, thus enhancing the vividness and interest of the images.

CN116309967BActive Publication Date: 2026-11-24BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202310215665.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-28
Publication Date
2026-11-24
Estimated Expiration
2043-02-28

AI Technical Summary

Technical Problem

In existing technologies, it is difficult for ordinary people to achieve the effect of flowing hair in static portrait images. It usually requires professional tools and manual operation, which makes image processing complex and unintuitive.

Method used

By segmenting the hair in a person's image into multiple strands, and utilizing facial key points and hair strand outlines, the system automatically processes the hair to create a flowing motion, generating a dynamic image.

Benefits of technology

Without requiring manual operation, a dynamic flowing effect of hair in static images was achieved, enhancing the vividness and interest of the images and improving the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116309967B_ABST
    Figure CN116309967B_ABST
Patent Text Reader

Abstract

This disclosure provides an image processing method, apparatus, and electronic device. One specific embodiment of the method includes: acquiring an image to be processed, comprising a face and hair; determining a target region corresponding to the hair and facial key points in the image to be processed; determining multiple hair strand contours based on the target region; and performing hair-flowing processing on the image to be processed based on the target region, the facial key points, and the multiple hair strand contours. This embodiment enables the hair in a person's image to achieve a flowing effect, and can obtain a realistic dynamic image based on a static image.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the technical field of computer, and particularly relates to a method and device for image processing and electronic equipment. BACKGROUND

[0002] With the continuous development of digital image technology, people can take digital portrait images through digital camera equipment, and can also draw cartoon portrait images. At present, in order to make the portrait image more lively, a scheme is needed to make the hair of a person in a static portrait image move, so as to obtain a dynamic image with moving hair. SUMMARY

[0003] The present disclosure provides a method and device for image processing and electronic equipment.

[0004] According to a first aspect, a method for image processing is provided, and the method comprises:

[0005] obtaining a to-be-processed image, wherein the to-be-processed image comprises a face and hair;

[0006] determining a target region corresponding to the hair and a face key point in the to-be-processed image;

[0007] determining a plurality of hair strand contours based on the target region;

[0008] performing a hair moving processing on the to-be-processed image based on the target region, the face key point and the plurality of hair strand contours.

[0009] According to a second aspect, a device for image processing is provided, and the device comprises:

[0010] an obtaining module, configured to obtain a to-be-processed image, wherein the to-be-processed image comprises a face and hair;

[0011] a first determining module, configured to determine a target region corresponding to the hair and a face key point in the to-be-processed image;

[0012] a second determining module, configured to determine a plurality of hair strand contours based on the target region;

[0013] a processing module, configured to perform a hair moving processing on the to-be-processed image based on the target region, the face key point and the plurality of hair strand contours.

[0014] According to a third aspect, a computer readable storage medium is provided, wherein the storage medium stores a computer program, and the computer program is executed by a processor to implement the method according to any one of the first aspect.

[0015] According to a fourth aspect, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the method described in any one of the first aspects.

[0016] The technical solutions provided by the embodiments of this disclosure may include the following beneficial effects:

[0017] This disclosure provides an image processing method and apparatus that segments the hair in a person's image into multiple hair bundles, and then applies a hair-flowing effect to the image based on facial key points, hair regions, and the outlines of the multiple hair bundles, thereby generating a dynamic image of flowing hair from a static person's image. Because this embodiment segments the person's hair into multiple hair bundles and applies the hair-flowing effect based on facial key points, hair regions, and the outlines of the multiple hair bundles, the hair in the resulting animated image or video flows according to the hair bundles. This achieves the effect of flowing hair in a static person's image without manual intervention, making the display of the person's image richer and more vivid, improving the flexibility and fun of image applications, and enhancing the user experience.

[0018] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0019] To more clearly illustrate the technical solutions of the embodiments in this specification, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0020] Figure 1 This disclosure is a schematic diagram illustrating an image processing scenario according to an exemplary embodiment;

[0021] Figure 2A This is a flowchart illustrating an image processing method according to an exemplary embodiment of the present disclosure;

[0022] Figure 2B This is a schematic diagram illustrating an image processing method according to an exemplary embodiment of the present disclosure;

[0023] Figure 3A This is a flowchart illustrating another image processing method according to an exemplary embodiment of the present disclosure;

[0024] Figure 3B This is a schematic diagram illustrating another image processing method according to an exemplary embodiment of the present disclosure;

[0025] Figure 4 This is a block diagram illustrating an image processing apparatus according to an exemplary embodiment of the present disclosure;

[0026] Figure 5 This is a schematic block diagram of an electronic device provided in some embodiments of this disclosure;

[0027] Figure 6 This is a schematic block diagram of another electronic device provided in some embodiments of this disclosure;

[0028] Figure 7 This is a schematic diagram of a storage medium provided in some embodiments of this disclosure. Detailed Implementation

[0029] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this specification, and not all embodiments. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this specification.

[0030] In the following description, when referring to the accompanying drawings, the same numbers in different drawings denote the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.

[0031] The terminology used in this disclosure is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The singular forms “a,” “the,” and “the” as used herein are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any and all possible combinations of one or more of the associated listed items.

[0032] It should be understood that although the terms first, second, third, etc., may be used in this disclosure to describe various information, such information should not be limited to these terms. These terms are used only to distinguish information of the same type from one another. For example, without departing from the scope of this disclosure, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to determination."

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

[0034] For example, upon receiving a user's active request, a prompt message is sent to the user to explicitly inform them that the requested operation will require the acquisition and use of the user's personal information. This allows the user to independently choose, based on the prompt message, whether to provide personal information to the software or hardware such as electronic devices, applications, servers, or storage media performing the operations of this disclosed technical solution.

[0035] As an optional but not limited implementation, in response to a user's active request, sending a prompt message to the user can be done via a pop-up window, where the prompt message can be presented in text format. Furthermore, the pop-up window can also include a selection control allowing the user to choose "agree" or "disagree" to provide personal information to the electronic device.

[0036] It is understood that the above notification and user authorization process are merely illustrative and do not constitute a limitation on the implementation of this disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of this disclosure.

[0037] With the continuous development of digital imaging technology, people can capture digital portrait images and create cartoon portraits using digital camera equipment. To make portrait images more vivid, the hair in a static portrait image can be made to move, thus creating a dynamic image with flowing hair. In related technologies, professionals typically need to use specialized image processing tools to manually process static portrait images and perform repeated adjustments to obtain a satisfactory dynamic portrait image, which is difficult for ordinary non-professionals to achieve.

[0038] This disclosure provides an image processing method that segments the hair in a person's image into multiple hair bundles, and then applies a hair-flowing effect based on facial key points, hair regions, and the outlines of the multiple hair bundles, thereby obtaining a dynamic image of flowing hair from a static person's image. Because this embodiment segments the person's hair into multiple hair bundles and applies the hair-flowing effect based on facial key points, hair regions, and the outlines of the multiple hair bundles, the hair in the animated image or video after the flow-flowing effect is made to flow according to the hair bundles. This achieves the effect of flowing hair in a static person's image without manual operation, making the display effect of the person's image richer and more vivid, improving the flexibility and fun of image applications, and enhancing the user experience.

[0039] SeeFigure 1 This is a schematic diagram illustrating an image processing scene according to an exemplary embodiment. Reference is made below. Figure 1 The present invention will be illustrated with a complete and specific application example. This application example describes a specific image processing process.

[0040] like Figure 1 As shown, the image to be processed, A, can be a static image including a face and hair. It needs to be processed to create a flowing hair effect, resulting in a dynamic image or video. Specifically, firstly, the hair in image A can be identified to determine the target region corresponding to the hair, and a hair mask image B can be obtained based on this target region. For example, a pre-trained hair recognition model can be used to identify the hair in image A, assigning a value of 0 to the pixels in the target region corresponding to the hair and a value of 1 to the pixels in other regions, thus obtaining the hair mask image B.

[0041] Then, hair strand segmentation is performed based on the hair mask image B. For example, the hair mask image B can be input into the target model, and the target model can be used to perform initial segmentation of the target region to obtain multiple initial segmentation regions. Based on each initial segmentation region, multiple hair strand regions are determined, such that the maximum width of each hair strand region is less than or equal to a preset value, resulting in a hair segmentation image G. Contour optimization processing is then performed on the multiple hair strand regions in the hair segmentation image G to obtain a hair strand mask image C. The hair strand mask image C includes multiple hair strand regions after hair segmentation and optimization processing.

[0042] Next, the hair strand mask image C can be meshed to generate multiple mesh layers for rendering. For example, a first mesh layer corresponding to the hair strands can be generated based on the hair strand mask image C. A second mesh layer corresponding to the entire target region can also be generated based on the target region. Specifically, each hair strand region can be traversed, and for any given hair strand region, multiple points can be randomly selected, and a mesh for that hair strand region can be generated using a preset algorithm (e.g., triangulation algorithm). The first mesh layer consists of the meshes corresponding to each of the multiple hair strand regions. Simultaneously, multiple points can be randomly selected from the target region, and a mesh for the target region can be generated using a preset algorithm, serving as the second mesh layer.

[0043] On the other hand, facial landmarks in the image to be processed (A) can be identified to determine their location. Specifically, a pre-trained facial landmark detection model can be used to detect the location of facial landmarks in the image to be processed (A).

[0044] Next, anchor points for constraining hair movement can be extracted based on the hair strand mask image C and the positional information of the aforementioned facial key points. Then, based on the image to be processed A, the aforementioned anchor points, and the aforementioned multi-layer mesh, rendering processing is performed to obtain multi-frame images for displaying animated images or playing videos, which can achieve the effect of hair movement. Specifically, the trajectory information of the overall hair movement and the movement of the hair strands can be determined based on the aforementioned anchor points. And based on the pixel values ​​of each pixel in the image to be processed A, the aforementioned multi-layer mesh, and the aforementioned trajectory information, the pixel values ​​of each pixel in each frame image are determined, thereby obtaining multi-frame images.

[0045] The present disclosure will now be described in detail with reference to specific embodiments.

[0046] Figure 2A This is a flowchart illustrating an image processing method according to an exemplary embodiment. The implementer of this method can be any device, platform, server, or device cluster with computing and processing capabilities. The method includes the following steps:

[0047] like Figure 2A As shown, in step 201, an image to be processed, including a face and hair, is acquired, and in step 202, the target region corresponding to the hair and the key points of the face in the image to be processed are determined.

[0048] In this embodiment, the image to be processed can be an image including a face and hair in RGB color mode. This image can be a real photograph of a person or a drawing of a cartoon character. Specifically, on one hand, the target region corresponding to the hair in the image to be processed can be determined. The target region corresponding to the hair can be the area covered by the hair of a person in the image, and the location information of the target region in the image to be processed can be determined using a pre-trained model. This model can be trained based on a large number of sample images including human hair. Optionally, after determining the location information of the target region in the image to be processed, a mask image of the hair can be further obtained based on the location information of the target region. For example, the pixels of the target region in the image to be processed can be assigned a value of 0, and the pixels of other regions can be assigned a value of 1, thereby obtaining a mask image of the hair. This mask image of the hair can be used in processes such as determining the hair strand outline.

[0049] On the other hand, facial key points in the image to be processed can be determined. These facial key points can be points in key regions of the face, such as multiple points on areas including but not limited to eyebrows, eyes, nose, and mouth. A preset facial key point detection algorithm or a pre-trained facial key point detection model can be used to identify the facial key points in the image to be processed. This embodiment does not limit the specific method for determining facial key points.

[0050] In step 203, multiple hair strand contours are determined based on the target region.

[0051] In this embodiment, the hair in the image to be processed can be segmented into multiple hair bundles, and the contour information of each hair bundle can be obtained. In one implementation, the target region can be segmented into multiple hair bundle regions, and the contours corresponding to each of the multiple hair bundle regions can be directly obtained as the multiple hair bundle contours. Specifically, a pre-trained target model can be used to perform initial segmentation of the hair bundles in the target region, obtaining multiple initial segmentation regions. Then, multiple hair bundle regions are determined based on the initial segmentation regions, such that the maximum width of each hair bundle region is less than or equal to a preset value.

[0052] For example, the image to be processed and information about the target region within the image can be input into the target model, or a mask image of the hair obtained based on the location information of the target region can be input into the target model. The target model then performs initial segmentation of the hair bundles in the target region, obtaining multiple initial segmented regions. Then, each initial segmented region can be traversed. For any given initial segmented region, if its maximum width is greater than a preset value, it can be further subdivided to obtain multiple hair bundle regions with a maximum width less than or equal to the preset value. If the maximum width of the initial segmented region is less than or equal to the preset value, it can be considered as a single hair bundle region without further subdivision. It is understood that any reasonable method can be used to subdivide the initial segmented regions with a maximum width greater than the preset value; this embodiment does not limit the specific method of subdividing the initial segmented regions.

[0053] It should be noted that the maximum width of the initial segmented region can be any value that represents the widest or narrowest part of the initial segmented region. For example, the maximum distance between two contour points with the same ordinate on the contour of the initial segmented region can be used as the maximum width of the initial segmented region. It is understood that the maximum width of the initial segmented region can also be defined as any other maximum value that represents the widest or narrowest part of the initial segmented region, and this embodiment does not limit the specific definition of the maximum width.

[0054] In another implementation, after dividing the target region into multiple hair bundle regions, contour optimization processing can be further performed on these multiple hair bundle regions to obtain the optimized hair bundle contour for each hair bundle region. Specifically, the initial contour of each hair bundle region can be obtained, and the initial contour can be optimized to obtain the hair bundle contour corresponding to each hair bundle region (see [link to detailed processing steps]). Figure 3A Example (Example).

[0055] like Figure 2BAs shown, image 211 is a mask image of a person's hair. Image 211 can be input into a target model for hair segmentation to obtain image 212. Image 212 is then optimized to obtain image 213. Specifically, a width threshold can be pre-set for the hair strand width. After obtaining image 212, it can be checked whether the maximum width of each initially segmented region is greater than the aforementioned width threshold. If the maximum width of any initial segmented region is greater than the aforementioned width threshold, the initial segmented region can be further subdivided into multiple hair strand regions, such that the maximum width of the subdivided hair strand regions is less than the aforementioned width threshold. After subdividing the initial segmented region, each hair strand region can be further optimized to obtain the hair strand contour corresponding to each hair strand region.

[0056] In step 204, hair movement processing is performed on the image to be processed based on the target region, facial key points, and multiple hair strand contours.

[0057] In this embodiment, anchor points can be determined based on facial key points and multiple hair strand contours. Mesh processing is performed based on multiple hair strand contours and target areas. Then, based on the results of the above anchor points and the above mesh processing, multi-frame images for displaying the hair flowing effect are rendered. The hair flowing effect can be displayed by playing these multi-frame images.

[0058] The anchor points can include anchor points for individual hair strands and anchor points for the entire hair. Anchor points for any individual hair strand can be used to constrain the movement of that strand, and anchor points for the entire hair can be used to constrain the movement of the hair as a whole. The anchor points for individual hair strands further include hair strand fixing anchor points for securing the hair strand and hair strand control anchor points for controlling the movement of the hair strand. The anchor points for the entire hair further include hair strand fixing anchor points for securing the entire hair and hair strand control anchor points for controlling the movement of the entire hair.

[0059] Specifically, firstly, based on facial key points, the forehead outline can be determined, which can serve as the boundary line for fixing the overall hair. Multiple points can be selected from this forehead outline according to preset selection rules, such as selecting multiple points at equal intervals. Then, the points among these multiple points that are covered by the target area are selected as the hair fixing anchor points.

[0060] Furthermore, each hair bundle contour is traversed, and for any given hair bundle contour, its centerline is determined. For example, the line connecting the midpoints of all two contour points with the same ordinate on the hair bundle contour can be used as the centerline. Multiple points can be selected from the centerline of the hair bundle contour, for example, at equal intervals, as hair bundle control anchor points. Optionally, multiple hair bundle control anchor points can be arbitrarily selected as hair control anchor points. It is understood that the centerline of the hair bundle contour can also be determined in any other reasonable way, and this embodiment does not limit the specific method of determining the centerline of the hair bundle contour. In addition, in one implementation, the apex point with the largest ordinate on the hair bundle contour can be selected as the hair bundle fixing anchor point corresponding to the hair bundle contour. In another implementation, the hair bundle fixing anchor point corresponding to the hair bundle contour can also be selected from the hair fixing anchor points.

[0061] Next, meshing can be performed based on multiple hair strand contours and the target region. Specifically, for example, a triangulation algorithm can be used to mesh multiple hair strand contours and the target region separately to obtain a mesh layer composed of multiple triangles. In another implementation, multiple hair strand contours can be meshed separately to obtain a first mesh layer composed of multiple triangles, and the target region can be meshed to obtain a second mesh layer composed of multiple triangles.

[0062] Then, the trajectory points corresponding to each anchor point can be determined. For hair-fixed anchor points and hair bundle-fixed anchor points, their corresponding trajectory points are fixed points. For hair-control anchor points and hair bundle-control anchor points, the trajectory information corresponding to each anchor point can be calculated using a preset algorithm according to the required floating effect. Based on the trajectory information corresponding to each anchor point, the position points of each anchor point in each frame of the image to be played are determined. Subsequently, based on preset constraints (such as constraints that can indicate the distance relationship between the anchor point and other points in the grid area) and the position points of each anchor point in each frame of the image to be played, the first and second network layers (i.e., the hair bundle region and target region corresponding to the network layers after deformation due to floating) in each frame of the image to be played are calculated.

[0063] Finally, based on the pixel values ​​of each pixel in the image to be processed and the first and second network layers after deformation due to movement in each frame of the image to be played, the pixel values ​​of each pixel in the image to be played can be determined, and then rendering processing can be performed to obtain multiple frames of images to be played. These multiple frames of images to be played can form an animated GIF or video. If these multiple frames of images to be played are displayed, the effect of a person's hair moving can be shown.

[0064] This disclosure provides an image processing method that segments the hair in a person's image into multiple hair bundles, and then applies a hair-flowing effect to the image based on facial key points, hair regions, and the outlines of the multiple hair bundles, thereby obtaining a dynamic image of flowing hair from a static person's image. Because this embodiment segments the person's hair into multiple hair bundles, the hair in the animated image or video after the flow processing moves according to the hair bundles. This achieves a flowing hair effect in a static person's image without manual operation, making the display effect of the person's image richer and more vivid, improving the flexibility and fun of image applications, and enhancing the user experience.

[0065] Figure 3A This is a flowchart illustrating another image processing method according to an exemplary embodiment, which describes the process of optimizing a hair strand region, including the following steps:

[0066] like Figure 3A As shown, in step 301, the target area is divided into multiple hair bundle regions, and the initial contour of each hair bundle region is obtained. In step 302, the initial contour is processed to obtain the hair bundle contour corresponding to each hair bundle region.

[0067] In this embodiment, the target area can first be divided into multiple hair bundle regions, and the initial contour of each hair bundle region can be obtained, that is, the position information corresponding to the edge of each hair bundle region can be determined. Then, the initial contour is optimized to obtain the hair bundle contour corresponding to each hair bundle region. Specifically, for any hair bundle region, the initial contour of the hair bundle region can first be divided into a first curve and a second curve. For example, as shown... Figure 3B As shown, region 311 is a hair strand region. The coordinate system of region 311 can be determined, and the corresponding top point 312 and bottom point 313 of region 311 can be determined based on the coordinate system. Specifically, the top point 312 of region 311 can be the point with the largest ordinate on the contour of region 311, and the bottom point 313 of region 311 can be the point with the smallest ordinate on the contour of region 311. Then, using the top point 312 and the bottom point 313, region 311 is divided into a first curve 314 and a second curve 315.

[0068] Next, multiple first sampling points are uniformly selected from the first curve, including the top and bottom points corresponding to the hair bundle region. A polynomial fitting is performed on these multiple first sampling points in the coordinate system to obtain a fitted third curve, which is the optimized version of the first curve. Similarly, multiple second sampling points are uniformly selected from the second curve, also including the top and bottom points corresponding to the hair bundle region. A polynomial fitting is performed on these multiple second sampling points in the coordinate system to obtain a fitted fourth curve, which is the optimized version of the second curve. The third and fourth curves are connected through the top and bottom points corresponding to the hair bundle region. The contour formed by the third and fourth curves is defined as the hair bundle contour corresponding to the hair bundle region.

[0069] Because this embodiment optimizes the outline of each hair strand area, making the hair strand outline smoother, the tip sharper, and the division of the hair strand outline more reasonable, the processing effect obtained after the hair strand area is processed is better and more realistic, improving the quality of the hair flowing effect, further enriching the display effect of the character image, and helping to improve the user experience.

[0070] It should be noted that although the operations of the methods of this disclosure embodiment are described in a specific order in the above embodiments, this does not require or imply that these operations must be performed in that specific order, or that all the operations shown must be performed to achieve the desired result. On the contrary, the steps depicted in the flowcharts may be executed in a different order. Additionally or alternatively, certain steps may be omitted, multiple steps may be combined into one step, and / or one step may be broken down into multiple steps.

[0071] Corresponding to the foregoing embodiments of the image processing method, this disclosure also provides embodiments of the image processing apparatus.

[0072] like Figure 4 As shown, Figure 4 This disclosure is a block diagram of an image processing apparatus according to an exemplary embodiment. The apparatus may include: an acquisition module 401, a first determination module 402, a second determination module 403, and a processing module 404.

[0073] The acquisition module 401 is used to acquire the image to be processed, which includes a face and hair.

[0074] The first determining module 402 is used to determine the target region corresponding to the hair and the facial key points in the image to be processed.

[0075] The second determining module 403 is used to determine multiple hair bundle contours based on the target region.

[0076] The processing module 404 is used to perform hair movement processing on the image to be processed based on the target region, facial key points and multiple hair strand contours.

[0077] In some embodiments, the second determining module 403 is configured to: divide the target region into multiple hair bundle regions, obtain the initial contour of each hair bundle region, process the initial contour, and obtain the hair bundle contour corresponding to each hair bundle region.

[0078] In other embodiments, the second determining module 403 can process the initial contour of any hair bundle region in the following manner to obtain the hair bundle contour corresponding to the hair bundle region: divide the initial contour of the hair bundle region into a first curve and a second curve, perform curve fitting processing on the first curve and the second curve respectively to obtain a third curve and a fourth curve, and determine the contour formed by the third curve and the fourth curve as the hair bundle contour corresponding to the hair bundle region.

[0079] In other embodiments, the second determining module 403 may divide the initial contour of the hair bundle region into a first curve and a second curve by determining the top point and bottom point of the hair bundle region, wherein the top point is the highest point on the initial contour of the hair bundle region and the bottom point is the lowest point on the initial contour of the hair bundle region, and the initial contour of the hair bundle region is divided into a first curve and a second curve based on the top point and the bottom point.

[0080] In other embodiments, the processing module 404 is configured to: determine anchor points for constraining hair movement based on facial key points and multiple hair strand outlines, and render multiple frames of images for displaying the hair movement effect based on the anchor points.

[0081] In other embodiments, the processing module 404 can obtain a multi-frame image for displaying the hair-swaying effect by rendering based on the above anchor points in the following manner: determining the swaying trajectory information corresponding to the above anchor points, and rendering based on the swaying trajectory information to obtain a multi-frame image for displaying the hair-swaying effect.

[0082] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to in the description of the method embodiments. The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of the embodiments of this disclosure according to actual needs. Those skilled in the art can understand and implement this without creative effort.

[0083] Figure 5 This is a schematic block diagram of an electronic device provided for some embodiments of this disclosure. For example... Figure 5 As shown, the electronic device 910 includes a processor 911 and a memory 912, and can be used to implement a client or server. The memory 912 stores computer-executable instructions (e.g., one or more computer program modules) non-transitoryly. The processor 911 executes the computer-executable instructions, which, when run by the processor 911, can perform one or more steps of the image processing method described above, thereby implementing the image processing method described above. The memory 912 and the processor 911 can be interconnected via a bus system and / or other forms of connection mechanisms (not shown).

[0084] For example, processor 911 can be a central processing unit (CPU), a graphics processing unit (GPU), or other form of processing unit with data processing and / or program execution capabilities. For example, the central processing unit (CPU) can be an x86 or ARM architecture. Processor 911 can be a general-purpose processor or a special-purpose processor, and can control other components in electronic device 910 to perform desired functions.

[0085] For example, memory 912 may include any combination of one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and / or cache memory. Non-volatile memory may include, for example, read-only memory (ROM), hard disk, erasable programmable read-only memory (EPROM), portable compact disc read-only memory (CD-ROM), USB memory, flash memory, etc. One or more computer program modules may be stored on the computer-readable storage medium, and processor 911 may run one or more computer program modules to implement various functions of electronic device 910. Various application programs and various data, as well as various data used and / or generated by the application programs, may also be stored in the computer-readable storage medium.

[0086] It should be noted that, in the embodiments of this disclosure, the specific functions and technical effects of the electronic device 910 can be referred to the description of the image processing method above, and will not be repeated here.

[0087] Figure 6This is a schematic block diagram of another electronic device provided in some embodiments of the present disclosure. The electronic device 920 is, for example, suitable for implementing the image processing method provided in the embodiments of the present disclosure. The electronic device 920 can be a terminal device, etc., and can be used to implement a client or server. The electronic device 920 can 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), wearable electronic devices, etc., as well as fixed terminals such as digital TVs, desktop computers, smart home devices, etc. It should be noted that... Figure 6 The illustrated electronic device 920 is merely an example and does not impose any limitation on the functionality and scope of use of the embodiments of this disclosure.

[0088] like Figure 6 As shown, the electronic device 920 may include a processing unit (e.g., a central processing unit, a graphics processor, etc.) 921, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 922 or a program loaded from a storage device 928 into a random access memory (RAM) 923. The RAM 923 also stores various programs and data required for the operation of the electronic device 920. The processing unit 921, ROM 922, and RAM 923 are interconnected via a bus 924. An input / output (I / O) interface 925 is also connected to the bus 924.

[0089] Typically, the following devices can be connected to I / O interface 925: input devices 926 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 927 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 928 including, for example, magnetic tapes, hard disks, etc.; and communication devices 929. Communication device 929 allows electronic device 920 to communicate wirelessly or wiredly with other electronic devices to exchange data. Although Figure 6 An electronic device 920 with various devices is shown, but it should be understood that it is not required to implement or have all of the devices shown, and the electronic device 920 may alternatively implement or have more or fewer devices.

[0090] For example, according to embodiments of this disclosure, the image processing method described above can be implemented as a computer software program. For instance, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program including program code for performing the image processing method described above. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 929, or installed from a storage device 928, or installed from a ROM 922. When the computer program is executed by the processing device 921, the functions defined in the image processing method provided by embodiments of this disclosure can be implemented.

[0091] Figure 7 This is a schematic diagram of a storage medium provided for some embodiments of this disclosure. For example, such as... Figure 7 As shown, the storage medium 930 can be a non-transitory computer-readable storage medium for storing non-transitory computer-executable instructions 931. When the non-transitory computer-executable instructions 931 are executed by a processor, the image processing method described in the embodiments of this disclosure can be implemented. For example, when the non-transitory computer-executable instructions 931 are executed by a processor, one or more steps in the image processing method described above can be performed.

[0092] For example, the storage medium 930 can be used in the aforementioned electronic device, such as the storage medium 930 may include the memory in the electronic device.

[0093] For example, the storage medium may include a memory card for a smartphone, a storage component for a tablet computer, a hard disk for a personal computer, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), portable compact disc read-only memory (CD-ROM), flash memory, or any combination of the above storage media, or other suitable storage media.

[0094] For example, the description of storage medium 930 can be found in the description of memory in the embodiments of the electronic device, and will not be repeated here. The specific functions and technical effects of storage medium 930 can be found in the description of the image processing method above, and will not be repeated here.

[0095] It should be noted that, in the context of this disclosure, a computer-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 computer-readable medium 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 that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, capable of transmitting, propagating, or transmitting 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 may be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.

[0096] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the claims.

[0097] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.

Claims

1. An image processing method, the method comprising: Acquire an image to be processed, which includes a face and hair; Determine the target region corresponding to the hair and facial key points in the image to be processed; The target area is divided into multiple hair bundle regions, such that the maximum width of any hair bundle region is less than or equal to a preset value. Obtain the initial contour of the hair bundle region; Determine the top point and bottom point of the hair bundle region; wherein, the top point is the highest point on the initial contour of the hair bundle region, and the bottom point is the lowest point on the initial contour of the hair bundle region; Based on the apex point and the bottom point, the initial contour of the hair bundle region is divided into a first curve and a second curve; Curve fitting is performed on the first curve and the second curve respectively to obtain the third curve and the fourth curve; The contour formed by the third curve and the fourth curve is defined as the hair bundle contour corresponding to the hair bundle region. Based on the target region, the facial key points, and the multiple hair strand outlines, the image to be processed is subjected to hair movement processing.

2. The method according to claim 1, wherein, The step of performing hair movement processing on the image to be processed based on the target region, the facial key points, and the multiple hair strand contours includes: Based on the facial key points and the multiple hair strand outlines, anchor points are determined to constrain hair movement. Based on the anchor points, multiple frames of images are rendered to display the effect of flowing hair.

3. The method according to claim 2, wherein, The multi-frame images rendered based on the anchor points to display the hair-flowing effect include: Determine the drift trajectory information corresponding to the anchor point; The multi-frame images are obtained by rendering based on the drift trajectory information.

4. An image processing apparatus, the apparatus comprising: The acquisition module is used to acquire the image to be processed, which includes a face and hair; The first determining module is used to determine the target region corresponding to the hair and the key points of the face in the image to be processed; The second determining module is used to divide the target region into multiple hair bundle regions, such that the maximum width of any hair bundle region is less than or equal to a preset value, obtain the initial contour of the hair bundle region, and determine the top point and bottom point of the hair bundle region; wherein, the top point is the highest point on the initial contour of the hair bundle region, and the bottom point is the lowest point on the initial contour of the hair bundle region; based on the top point and the bottom point, the initial contour of the hair bundle region is divided into a first curve and a second curve; curve fitting processing is performed on the first curve and the second curve respectively to obtain a third curve and a fourth curve; the contour formed by the third curve and the fourth curve is determined as the hair bundle contour corresponding to the hair bundle region; The processing module is used to perform hair movement processing on the image to be processed based on the target region, the facial key points, and the multiple hair strand contours.

5. A computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to perform the method of any one of claims 1-3.

6. An electronic device comprising a memory and a processor, wherein the memory stores executable code, and the processor, when executing the executable code, implements the method of any one of claims 1-3.

Citation Information

Patent Citations

  • Visual special effect processing method and device, storage medium and terminal

    CN110298327A

  • Portrait hairline flowing special effect implementation method

    CN111986212A

  • Portrait hair flow special effect processing method and device, medium and electronic equipment

    CN114219877A