Method and device for generating deformable image based on human face
By obtaining and dragging the feature points of the face image to generate a deformation image, it solves the problem of preset and inflexible deformation effects in the existing technology, realizes personalized deformation processing of the face image, and improves the user experience.
Patent Information
- Application Number
- CN201810838359.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2018-07-27
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2038-07-27
AI Technical Summary
The face image deformation function in the existing technology can only use preset deformation effects, cannot be flexibly edited, and lacks personalized processing.
By acquiring a standard face image, selecting feature points and dragging them to a new position, a deformed image is generated based on the new position. It supports the synchronous movement of mirrored feature points and the setting of deformation intensity to achieve flexible deformation of the face image.
It improves the flexibility and convenience of generating facial deformation images, allowing users to customize deformation effects as needed to meet personalized needs.
Smart Images

Figure CN109003224B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image processing, and in particular to a method, device, electronic device and computer-readable storage medium for generating a deformable image based on a human face. Background Art
[0002] With the development of computer technology, the application scope of smart terminals has been widely improved. For example, you can listen to music, play games, chat online, take photos, etc. With regard to the photography technology of smart terminals, its photography pixels have reached more than 10 million pixels, with high clarity and photography effects comparable to professional cameras.
[0003] At present, when taking photos with smart terminals, not only can the built-in camera software at the factory be used to achieve the traditional camera effects, but also the application program (Application, referred to as: APP) can be downloaded from the network to achieve the camera effects with additional functions, such as APPs that can realize functions such as dark light detection, beauty camera and super pixel. The beauty function of smart terminals usually includes beauty processing effects such as skin color adjustment, skin smoothing, enlarged eyes and thin face, and can beautify all recognized faces in the image to the same degree. At present, there are also APPs that can realize the function of deforming faces.
[0004] However, the current face image deformation function only includes some preset deformation effects, and the deformation effect can only be directly selected, and the deformation effect cannot be flexibly edited. Summary of the invention
[0005] In a first aspect, an embodiment of the present disclosure provides a method for generating a deformable image based on a face, comprising: obtaining a standard face image, the standard face image including a plurality of feature points, the feature points being located at a default position; selecting at least one feature point among the plurality of feature points; dragging the selected feature point from the default position to a first position; and generating a first deformable image of the standard face image based on the first position.
[0006] Further, the feature point has a mirror feature point, and the selecting at least one feature point from the plurality of feature points includes: selecting at least one feature point from the plurality of feature points, and a mirror feature point of the feature point is selected at the same time.
[0007] Further, dragging the selected feature point from the default position to the first position includes: moving the selected feature point to the first position, and simultaneously moving the mirror feature point of the feature point to the mirror position of the first position.
[0008] Further, generating a first deformed image of the standard facial image according to the first position includes: generating a deformed image of the standard facial image according to the first position and a mirror image position of the first position.
[0009] Furthermore, generating a first deformed image of the standard facial image according to the first position includes: generating a deformation coefficient according to the first position and a default position, and moving pixel points around the selected feature point according to the deformation coefficient to generate a deformed image of the standard facial image.
[0010] Furthermore, before generating the deformed image of the standard face image according to the first position, the method further includes: selecting a deformation intensity, wherein the deformation intensity indicates a degree of deformation.
[0011] Furthermore, after generating the deformed image of the standard face image according to the first position, the method further includes: receiving a command to add deformation, and continuing to drag feature points on the basis of the deformed image to generate a second deformed image.
[0012] Furthermore, before selecting at least one feature point among the plurality of feature points, the method further includes: setting a sequence number of the standard face image.
[0013] Furthermore, after generating a first deformed image of the standard face image according to the first position, the method further includes: identifying a face in an image captured by an image sensor; and generating a deformed image of the face according to the first deformed image.
[0014] Furthermore, after generating the first deformed image of the standard face image according to the first position, it also includes: identifying multiple faces in the image captured by the image sensor; numbering the faces according to the recognition order; and generating a deformed image of the face according to the numbering, the sequence number and the first deformed image.
[0015] In a second aspect, an embodiment of the present disclosure provides a deformable image generating device based on a face, comprising: an acquisition module for acquiring a standard face image, the standard face image comprising a plurality of feature points, the feature points being located at a default position; a feature point selection module for selecting at least one feature point among the plurality of feature points; a feature point dragging module for dragging the selected feature point from the default position to a first position; and a deformation module for generating a first deformed image of the standard face image according to the first position.
[0016] Furthermore, the feature point selection module is used to select at least one feature point from the multiple feature points, and a mirror feature point of the feature point is selected at the same time.
[0017] Furthermore, the feature point dragging module is used to move the selected feature point to a first position, and the mirror feature point of the feature point is simultaneously moved to a mirror position of the first position.
[0018] Furthermore, the deformation module is used to generate a deformed image of the standard facial image according to the first position and the mirror image position of the first position.
[0019] Furthermore, the deformation module is used to generate a deformation coefficient according to the first position and the default position, and to move the pixel points around the selected feature point according to the deformation coefficient to generate a deformed image of the standard face image.
[0020] Furthermore, the device also includes: a deformation strength selection module, which is used to select the strength of the deformation, and the deformation strength represents the degree of deformation.
[0021] Furthermore, the device also includes: a deformation adding module, which is used to receive a command to add deformation, and continue to drag the feature points on the basis of the deformed image to generate a second deformed image.
[0022] Furthermore, the device also includes: a sequence number setting module, which is used to set the sequence number of the standard face image.
[0023] Furthermore, the device also includes: a first face recognition module and a first deformation mapping module, wherein: the first face recognition module is used to recognize the face in the image captured by the image sensor; the first deformation mapping module is used to generate a deformed image of the face based on the first deformed image.
[0024] Furthermore, the device further comprises: a second face recognition module, a numbering module and a second deformation mapping module, wherein: the second face recognition module is used to recognize multiple faces in the image captured by the image sensor; the numbering module is used to number the faces according to the recognition order;
[0025] The second deformation mapping module is used to generate a deformable image of the face according to the serial number, the sequence number and the first deformable image.
[0026] In a third aspect, an embodiment of the present disclosure provides an electronic device, including: at least one processor; and
[0027] A memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute any of the face-based deformable image generation methods described in the first aspect.
[0028] In a fourth aspect, an embodiment of the present disclosure provides a non-transitory computer-readable storage medium, characterized in that the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute any of the face-based deformable image generation methods described in the first aspect.
[0029] The disclosed embodiments provide a method, device, electronic device and computer-readable storage medium for generating a deformable image based on a face. The method comprises: obtaining a standard face image, the standard face image includes a plurality of feature points, and the feature points are located at a default position; selecting at least one feature point among the plurality of feature points; dragging the selected feature point from the default position to a first position; and generating a first deformed image of the standard face image according to the first position. By adopting this technical solution, the disclosed embodiments solve the technical problem in the prior art that only a preset effect can be used to deform an image, thereby improving the flexibility of generating a deformable image.
[0030] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the following preferred embodiments are specifically cited and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0032] Figure 1a A flowchart of a first embodiment of a method for generating a deformable image based on a face provided in an embodiment of the present disclosure;
[0033] Figure 1b A schematic diagram of a standard face image provided by an embodiment of the present disclosure;
[0034] Figure 2 A flowchart of a second embodiment of a method for generating a deformable image based on a face provided in an embodiment of the present disclosure;
[0035] Figure 3 A schematic diagram of the structure of a first embodiment of a device for generating a deformable image based on a face provided by an embodiment of the present disclosure;
[0036] Figure 4 A schematic diagram of the structure of an electronic device provided according to an embodiment of the present disclosure;
[0037] Figure 5 A schematic diagram of the structure of a computer-readable storage medium provided according to an embodiment of the present disclosure;
[0038] Figure 6 The present invention is a schematic diagram of the structure of a terminal for generating a deformable image based on a face according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0039] The following describes the embodiments of the present disclosure through specific examples, and those skilled in the art can easily understand other advantages and effects of the present disclosure from the contents disclosed in this specification. Obviously, the described embodiments are only a part of the embodiments of the present disclosure, rather than all of the embodiments. The present disclosure can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present disclosure. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present disclosure.
[0040] It should be noted that various aspects of the embodiments within the scope of the appended claims are described below. It should be apparent that the aspects described herein may be embodied in a wide variety of forms, and any specific structure and / or function described herein is merely illustrative. Based on the present disclosure, it should be understood by those skilled in the art that an aspect described herein may be implemented independently of any other aspect, and two or more of these aspects may be combined in various ways. For example, any number of aspects described herein may be used to implement the device and / or practice the method. In addition, other structures and / or functionalities other than one or more of the aspects described herein may be used to implement this device and / or practice this method.
[0041] It should also be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present disclosure. The drawings only show components related to the present disclosure rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.
[0042] Additionally, in the following description, specific details are provided to facilitate a thorough understanding of the examples. However, it will be understood by those skilled in the art that the aspects described may be practiced without these specific details.
[0043] Figure 1aThis is a flowchart of the first embodiment of the method for generating a deformable image based on a face provided by the embodiment of the present disclosure. The method for generating a deformable image provided by the embodiment can be executed by a deformable image generating device based on a face. The deformable image generating device can be implemented as software, or as a combination of software and hardware. The deformable image generating device can be integrated in a device in the image processing system, such as an image processing server or an image processing terminal device. Figure 1a As shown, the method comprises the following steps:
[0044] Step S101, obtaining a standard face image, wherein the standard face image includes a plurality of feature points, and the feature points are located at default positions;
[0045] A standard face image is obtained and displayed on a display device. The standard face image is a pre-set face image. Generally speaking, the standard face image is a frontal face image, and the standard face image has pre-set feature points, wherein the number of feature points can be set, and the user can freely set the number of feature points required. The feature points of an image refer to points in the image that have distinct characteristics and can effectively reflect the essential features of the image and can identify the target object in the image. If the target object is a face, then it is necessary to obtain the key points of the face. If the target image is a house, then it is necessary to obtain the key points of the house. Taking the face as an example to illustrate the method of obtaining key points, the face contour mainly includes eyebrows, eyes, nose, mouth and cheeks, and sometimes pupils and nostrils. Generally speaking, to achieve a relatively complete description of the face contour, the number of key points required is about 60. If only the basic structure is described, no detailed description of the details of each part is required, or no description of the cheek is required, the number of key points can be reduced accordingly. If the pupils, nostrils, or more detailed facial features need to be described, the number of key points can be increased. Extracting facial key points from an image is equivalent to finding the corresponding position coordinates of each facial contour key point in the facial image, that is, locating the key points. This process needs to be based on the features corresponding to the key points. After obtaining the image features that can clearly identify the key points, search and compare in the image based on this feature to accurately locate the position of the key points on the image. Since the feature points only occupy a very small area in the image (usually only a few to dozens of pixels in size), the area occupied by the features corresponding to the feature points on the image is usually also very limited and local. There are currently two feature extraction methods: (1) one-dimensional range image feature extraction along the vertical direction of the contour; (2) two-dimensional range image feature extraction of the square neighborhood of the feature points. There are many implementation methods for the above two methods, such as ASM and AAM methods, statistical energy function methods, regression analysis methods, deep learning methods, classifier methods, batch extraction methods, etc. The number of key points, accuracy and speed used by the above various implementation methods are different, and they are suitable for different application scenarios.
[0046] In a typical scenario, a face image includes 106 feature points. Users can simplify the feature points as needed. For example, if 10 feature points are needed to represent the eyes, users can simplify some feature points and use 4 main feature points to represent the eyes. Each feature point has a number and a default position. Figure 1b is an example of a standard face image with feature points. In actual use, the number of feature points can be more or less than that in the example. Feature points can be represented by numbers and positions, such as 1(0,0), which means that the default position of feature point 1 is at the coordinate point (0,0).
[0047] In one embodiment, the user can retain only the feature points of a certain image area, such as retaining only the feature points of the eyes or retaining only the feature points of the nose, so as to perform processing on a certain area.
[0048] Step S102, selecting at least one feature point from the plurality of feature points;
[0049] In this embodiment, one feature point or multiple feature points can be selected. The user can send a selection command through an input device such as a mouse or a keyboard, such as using a mouse to click on the feature point displayed on the display device or using a keyboard to enter the number of the feature point to select the corresponding feature point. When selecting multiple feature points, the selected feature point can be encircled by dragging the selection box generated by the mouse, or multiple feature points can be selected through a check command. The selected state of the feature point can be displayed by color change, such as the default state of the feature point is white. When selected, the feature point turns blue to indicate that the feature point has been selected. When multiple feature points are selected, a selection box can be displayed outside the multiple feature points. The selection box can be the smallest rectangle including the multiple feature points. The above-mentioned method of selecting feature points and displaying the state of feature points is only an example and does not constitute a limitation. In fact, any method suitable for selecting feature points and displaying the state of feature points in the present disclosure can be used in the present disclosure.
[0050] Step S103: moving the selected feature point from the default position to the first position.
[0051] In this embodiment, the user can move the feature point selected in step S102 to the first position through human-computer interaction. Typically, the user can use a mouse to drag the selected feature point to the first position. The first position can be a position inside the face image or a position outside the face image. The user can also use the keyboard to directly input the coordinates of the first position so that the selected feature point is directly moved to the first position. When multiple feature points are selected, the selection box can be dragged with the mouse to move multiple selected feature points at the same time. The above method of moving feature points is only an example and does not constitute a limitation. In fact, any method suitable for moving feature points in the present disclosure can be used in the present disclosure.
[0052] Step S104: generating a first deformed image of the standard face image according to the first position.
[0053] In this embodiment, after the feature points are moved in step S103, the standard face image will be deformed due to the movement of the feature points, forming a deformed standard face image, ie, a first deformed image.
[0054] In one embodiment, one or more feature points are selected and dragged, and the standard face image will be deformed according to the dragging distance and the position after dragging. When dragging the feature point, the feature point associated with the current feature point will also move. Specifically, each feature point has a correlation coefficient with other feature points. The correlation coefficient defines the proportion of other feature points following the movement when the selected feature point moves. The higher the correlation coefficient, the higher the proportion of following the movement, and the lower the correlation coefficient, the lower the proportion of following the movement. For example, if the correlation coefficient of feature point 1 and feature point 2 is 0.5, then when feature point 1 moves 1 cm, feature point 2 moves 0.5 cm. When the correlation coefficient is 0.1, then when feature point 1 moves 1 cm, feature point 2 moves 0.1 cm. The correlation coefficient can be a negative number, which indicates the proportion of the associated feature points moving in opposite directions.
[0055] In one embodiment, the standard face image is triangulated according to feature points, each feature point is a vertex of a triangle in the triangulation diagram, and the feature points located on the same triangle have the highest correlation coefficient. Typically, the correlation coefficient of these feature points can be set to 1, and the feature points located on different triangles are separated by distance, and the correlation coefficient decreases by distance. The distance can be the number of feature points separated, for example, the correlation coefficient of feature points separated by one feature point is set to 0.5, the correlation coefficient of feature points separated by two feature points is set to 0.25, and so on. That is, when a feature point is moved, the relative position of other feature points located on the same triangle and the feature point remains unchanged, and the feature points separated by one feature point are moved by a distance of 0.5, and the feature points separated by two feature points are moved by a distance of 0.25.
[0056] The pixels in the standard face image are moved according to rules similar to the feature points to generate a first deformed image. Specifically, in the standard face image processed according to the above triangulation, if the pixel point is located in the triangle where the selected feature point is located, the pixel point follows the selected feature point at a ratio of 1:1, if the pixel point is located in a triangle separated by one feature point, the pixel point follows the selected feature point at a ratio of 0.5, and if the pixel point is located in a triangle separated by two feature points, the pixel point follows the selected feature point at a ratio of 0.25. The above-mentioned following movement ratio can be set as needed, and the embodiments in the present disclosure are only examples and do not constitute a limitation.
[0057] In one embodiment, a deformation coefficient is generated according to the first position and the default position, and the pixels around the selected feature point are moved according to the deformation coefficient to generate a deformed image of the standard face image. The deformation coefficient includes a deformation direction and a deformation range. Specifically, the direction between the default position and the first position determines the deformation direction, and the distance between the default position and the first position determines the deformation range. The larger the distance, the larger the deformation range, and the smaller the distance between the default position and the first position, the smaller the deformation range. The range can be a circle with the distance as the radius or diameter, or a rectangle with the distance as the side length, etc., or the size of the range can be calculated according to a certain operation rule with the range as a parameter. In short, the size of the range is associated with the distance, and the present disclosure does not limit the association relationship.
[0058] Furthermore, before or after step S102, the following steps may be further included:
[0059] Select at least one fixed feature point.
[0060] In this step, one or more fixed feature points are selected, and the fixed feature points are feature points that will not move with other feature points. In a typical application, multiple fixed feature points are selected to form a fixed area, and the pixels in the fixed area will not move according to the movement of other feature points because no deformation will occur. For example, if all feature points of the eye are selected as fixed feature points, then no matter how other feature points move, the image of the eye area will not be deformed. It should be noted that setting the correlation coefficient of the feature point with other points to 0 can also achieve the same function as the fixed feature point. Providing a method for selecting fixed feature points can more conveniently set the fixed area without setting the correlation coefficient of the feature point with each other feature point.
[0061] Furthermore, before step S104, the following steps may also be included:
[0062] The strength of the deformation is selected, which indicates the degree of deformation.
[0063] The strength of the deformation refers to the degree of deformation caused by moving the same distance. The deformation strength can be set using various human-machine interfaces, such as input boxes, drop-down menus, sliding buttons, etc., and the present disclosure does not limit this. The method includes a preset deformation strength. If the deformation strength is not selected, all deformation images are generated according to the preset strength. After the user selects the deformation strength, the deformation image is generated according to the new deformation strength. The deformation strength can be set in segments. For example, a distance threshold can be set. When the moving distance is less than or equal to the threshold, the deformation image is formed according to the first deformation strength. When the moving distance is greater than the threshold, the image is formed according to the second deformation strength. It can be understood that multiple thresholds can be set to form deformation images in segments according to multiple deformation strengths.
[0064] Furthermore, after step S104, the following steps may also be included:
[0065] A command for adding deformation is received, and the feature points are continued to be moved on the basis of the deformed image to generate a second deformed image.
[0066] The added deformation here can be in two forms. The first form is to continue moving the previously moved feature points on the basis of the original deformation, and form the second part of the deformed image according to the new deformation coefficient. In this way, a combined deformation of two parts can be formed based on the same feature point or the same group of feature points; the other form is to select new feature points, move the new feature points to form a new deformed image, and the new deformed image is also a combined deformation of two parts.
[0067] Furthermore, before step S102, the method further includes:
[0068] Set the sequence number of the standard face image.
[0069] It is understandable that, since there is a situation where deformation effects are generated for multiple standard face images, after obtaining the standard face images, the serial numbers of the standard face images can be set to number different deformation image effects.
[0070] Furthermore, after step S104, the method further includes:
[0071] Identify a human face in an image captured by an image sensor; and generate a deformed image of the human face based on the first deformed image.
[0072] In this step, a facial image recognized from the camera is obtained. The facial image can be a face recognized from a real person, or a face recognized by taking a picture or video including a face using a camera. The present disclosure does not impose any restrictions on this. In short, the facial image is different from a standard facial image.
[0073] Recognizing a face image mainly involves detecting faces in an image. Face detection is a process of searching an image or a set of image sequences using a certain strategy to determine the location and area of all faces. It is also a process of determining whether a face exists in a variety of images or image sequences, and determining the number and spatial distribution of faces. Generally, face detection methods can be divided into four categories: (1) methods based on prior knowledge, which encode faces by forming a rule base of typical faces, and locate faces by the relationship between facial features; (2) feature-invariant methods, which find stable features when the posture, view angle or lighting conditions change, and then use these features to determine faces; (3) template matching methods, which store several standard face patterns to describe the entire face and facial features respectively, and then calculate the relationship between the input image and the stored patterns and use them for detection; (4) appearance-based methods, which are the opposite of template matching methods, learn from the training image set to obtain models, and use these models for detection. Here, an implementation method in the fourth method is used to illustrate the process of face detection: first, features need to be extracted to complete modeling. This embodiment uses Haar features as the key features for judging faces. Haar features are simple rectangular features with fast extraction speed. Generally, the feature template used for calculating Haar features adopts a simple rectangular combination consisting of two or more congruent rectangles, where the feature template contains two types of rectangles, black and white. After that, the AdaBoost algorithm is used to find a part of the features that play a key role from a large number of Haar features, and these features are used to generate an effective classifier. The constructed classifier can detect faces in the image. In this embodiment, the face in the image can be one or more.
[0074] It is understandable that since each face detection algorithm has its own advantages and different adaptability ranges, multiple different detection algorithms can be set, and different algorithms can be automatically switched for different environments. For example, in images with a relatively simple background environment, an algorithm with a lower detection rate but a faster speed can be used; in images with a relatively complex background environment, an algorithm with a higher detection rate but a slower speed can be used; for the same image, multiple algorithms can also be used for multiple detections to improve the detection rate.
[0075] In this step, a face deformation image identical to the standard face image is generated on the face image recognized from the camera according to the selected feature points and the first deformation image generated in step S104.
[0076] Since there needs to be a mapping relationship between the deformation on the standard face image and the deformation of the face image collected by the image sensor, the deformation method can be divided into fixed deformation and tracking deformation according to different mapping methods. In one embodiment, fixed deformation is used. This deformation is relatively simple. It only needs to set the absolute position of the entire deformation range in the image sensor. Its implementation method can be to correspond the display device to the pixel points of the image acquisition window of the image sensor one by one, determine the position of the deformation in the display device, and then perform corresponding deformation processing on the corresponding position of the image collected by the image sensor acquisition window. The advantage of this deformation processing method is that it is simple and easy to operate. The parameters used in this implementation method are all relative to the position of the acquisition window. In another embodiment, when generating a deformed image, first obtain the feature points of the standard face image in step S101, and determine the position of the deformation in the standard face image through the feature points; identify the face image corresponding to the standard face image from the image collected by the image sensor; map the position determined in the standard face image to the face image; perform deformation processing on the face image to generate a deformed image. In this method, the relative position of the deformation in the face image is determined. No matter how the face image moves or changes, the deformation is always located at the relative position, thereby achieving the purpose of tracking the deformation. In a typical application, the standard face image is triangulated to have 106 feature points. The relative position of the deformation in the face image is determined by using the relative position of the deformation and the feature points. The face image captured by the camera is triangulated in the same way. After that, when the face in the camera moves or rotates, the deformation can be fixed at the relative position on the face to achieve the effect of tracking the deformation.
[0077] It can be understood that multiple faces in the image captured by the image sensor are identified; the faces are numbered according to the recognition order; and the deformed image of the face is generated according to the number, the sequence number and the first deformed image. When multiple face images are identified in the image captured by the image sensor, the user can select a face image to be deformed, or select multiple face images for the same or different processing. For example, when generating a deformed image, the standard faces can be numbered, such as ID1 and ID2, and deformed images can be generated for the standard face images of ID1 and ID2 respectively. The deformed images can be the same or different. When multiple face images are recognized from the camera, deformation effects are added to the multiple face images according to the order of recognition. For example, face No. 1 is recognized first, and the deformation effect of the standard face image of ID1 is added to face No. 1. Then, face No. 2 is recognized, and the deformation effect of the standard face image of ID2 is added to face No. 2. If only the standard face image of ID1 is deformed, the deformation of the standard face image of ID1 can be added to both face images No. 1 and No. 2, or only to face No. 1.
[0078] The disclosed embodiments provide a method, device, electronic device and computer-readable storage medium for generating a deformable image based on a face. The method comprises: obtaining a standard face image, the standard face image includes a plurality of feature points, and the feature points are located at a default position; selecting at least one feature point among the plurality of feature points; dragging the selected feature point from the default position to a first position; and generating a first deformed image of the standard face image according to the first position. The disclosed embodiments generate a deformed image of a face image by moving the position of feature points, thereby solving the technical problem in the prior art that a face image can only be deformed by using a preset effect, and improving the flexibility and convenience of generating a deformable face image.
[0079] Figure 2 The flowchart of the second embodiment of the method for generating a deformable image based on a face provided in the embodiment of the present disclosure is as follows: Figure 2 As shown, the following steps may be included:
[0080] S201, obtaining a standard face image, wherein the standard face image includes a plurality of feature points, and the feature points are located at default positions;
[0081] S202, selecting at least one feature point from the plurality of feature points, wherein a mirror feature point of the feature point is selected at the same time;
[0082] S203, moving the selected feature point to a first position, and the mirror image feature point of the feature point is simultaneously moved to the mirror image position of the first position;
[0083] S204: Generate a deformed image of the standard facial image according to the first position and the mirror image position of the first position.
[0084] In actual applications, since the human face is symmetrical, users often make symmetrical deformation effects on both sides of the face. This embodiment corresponds to this situation. Generally, it is necessary to make deformation effects on both sides separately. In this way, the deformation effect is first made repeatedly, which is inefficient. Secondly, the deformation effects made twice may have errors and the effect is not good.
[0085] In this embodiment, except for the feature points on the midline of the face, other feature points include mirror feature points, which are feature points symmetrical to the feature points with the midline of the face as the axis of symmetry. The mirror selection function can be set in advance, so that when a feature point is selected, its mirror feature point is also selected. In specific implementation, the mirror feature point of a feature point can be set in advance, for example, feature point No. 1 and feature point No. 10 are mirror feature points of each other, so that no matter whether feature point No. 1 or feature point No. 10 is selected, feature point No. 10 and feature point No. 1 will be selected at the same time. When the selected feature point is moved, the mirror feature point of the feature point will make a corresponding mirror movement. When the feature point moves to the first position, its mirror feature point is moved to the mirror position of the first position. According to the first position and the mirror position of the first position, a deformed image of the standard face image is generated.
[0086] Figure 3 The structure diagram of the first embodiment of the apparatus for generating a deformable image based on a face according to the embodiment of the present disclosure is as follows: Figure 3 As shown, the device includes: an acquisition module 31, a feature point selection module 32, a feature point movement module 33 and a deformation module 34.
[0087] An acquisition module 31 is used to acquire a standard face image, wherein the standard face image includes a plurality of feature points, and the feature points are located at default positions;
[0088] A feature point selection module 32, configured to select at least one feature point from the plurality of feature points;
[0089] A feature point moving module 33, used to drag the selected feature point from the default position to the first position;
[0090] The deformation module 34 is used to generate a first deformed image of the standard face image according to the first position.
[0091] Furthermore, the device also includes:
[0092] The deformation strength selection module is used to select the deformation strength, where the deformation strength indicates the degree of deformation.
[0093] Furthermore, the device also includes:
[0094] The deformation adding module is used to receive a command to add deformation, and continue to drag the feature points on the basis of the deformed image to generate a second deformed image.
[0095] Furthermore, the device also includes:
[0096] The serial number setting module is used to set the serial number of the standard face image.
[0097] Furthermore, the device further comprises: a first face recognition module and a first deformation mapping module, wherein:
[0098] A first face recognition module, used to recognize a face in an image captured by an image sensor;
[0099] The first deformation mapping module is used to generate a deformable image of the human face according to the first deformable image.
[0100] Furthermore, the device further comprises: a second face recognition module, a numbering module and a second deformation mapping module, wherein:
[0101] A second face recognition module, used to recognize multiple faces in the image captured by the image sensor;
[0102] A numbering module, used for numbering the faces according to the recognition order;
[0103] The second deformation mapping module is used to generate a deformable image of the face according to the serial number, the sequence number and the first deformable image.
[0104] Figure 3 The device shown can execute the method of the embodiment shown in Figure 1. For the parts not described in detail in this embodiment, please refer to the relevant description of the embodiment shown in Figure 1. The execution process and technical effects of this technical solution refer to the description of the embodiment shown in Figure 1, which will not be repeated here.
[0105] In the second embodiment of the apparatus for generating a deformable image based on a human face provided in the embodiment of the present disclosure:
[0106] An acquisition module, used for acquiring a standard face image, wherein the standard face image includes a plurality of feature points, and the feature points are located at default positions;
[0107] A feature point selection module, used to select at least one feature point from the plurality of feature points, wherein a mirror feature point of the feature point is selected at the same time;
[0108] A feature point moving module, used to move the selected feature point to a first position, and a mirror feature point of the feature point is simultaneously moved to a mirror position of the first position;
[0109] A deformation module is used to generate a deformed image of the standard face image according to the first position and the mirror image position of the first position.
[0110] The device in the above-mentioned embodiment 2 can execute Figure 2 For the method of the embodiment shown in the figure, the part not described in detail in this embodiment can be referred to Figure 2 The implementation process and technical effects of this technical solution refer to Figure 2 The description in the illustrated embodiment will not be repeated here.
[0111] Figure 4 is a hardware block diagram of an electronic device according to an embodiment of the present disclosure. Figure 4 As shown, the electronic device 40 according to an embodiment of the present disclosure includes a memory 41 and a processor 42 .
[0112] The memory 41 is used to store non-temporary computer-readable instructions. Specifically, the memory 41 may include 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. The volatile memory may include, for example, a random access memory (RAM) and / or a cache memory (cache), etc. The non-volatile memory may include, for example, a read-only memory (ROM), a hard disk, a flash memory, etc.
[0113] The processor 42 may be a central processing unit (CPU) or other forms of processing units with data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 40 to perform desired functions. In one embodiment of the present disclosure, the processor 42 is used to run the computer-readable instructions stored in the memory 41, so that the electronic device 40 performs all or part of the steps of the method for generating a deformable image based on a human face in the aforementioned embodiments of the present disclosure.
[0114] Those skilled in the art should be able to understand that in order to solve the technical problem of how to obtain a good user experience, the present embodiment may also include well-known structures such as a communication bus and an interface, and these well-known structures should also be included in the protection scope of the present invention.
[0115] For detailed description of this embodiment, reference may be made to the corresponding descriptions in the aforementioned embodiments, which will not be repeated here.
[0116] Figure 5 is a schematic diagram illustrating a computer-readable storage medium according to an embodiment of the present disclosure. Figure 5 As shown, a computer-readable storage medium 50 according to an embodiment of the present disclosure stores non-transitory computer-readable instructions 51. When the non-transitory computer-readable instructions 51 are executed by a processor, all or part of the steps of the method for generating a deformable image based on a human face in the above-mentioned embodiments of the present disclosure are executed.
[0117] The above-mentioned computer-readable storage medium 50 includes, but is not limited to: optical storage media (e.g., CD-ROM and DVD), magneto-optical storage media (e.g., MO), magnetic storage media (e.g., magnetic tape or mobile hard disk), media with built-in rewritable non-volatile memory (e.g., memory card) and media with built-in ROM (e.g., ROM box).
[0118] For detailed description of this embodiment, reference may be made to the corresponding descriptions in the aforementioned embodiments, which will not be repeated here.
[0119] Figure 6 Schematic diagram of the hardware structure of a terminal device according to an embodiment of the present disclosure. Figure 6 As shown, the face-based deformable image generating terminal 60 includes the above-mentioned face-based deformable image generating device embodiment.
[0120] The terminal device can be implemented in various forms. The terminal device in the present disclosure may include but is not limited to mobile terminal devices such as mobile phones, smart phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), navigation devices, vehicle-mounted terminal devices, vehicle-mounted display terminals, vehicle-mounted electronic rearview mirrors, etc., as well as fixed terminal devices such as digital TVs, desktop computers, etc.
[0121] As an equivalent alternative implementation, the terminal may also include other components. Figure 6 As shown, the face-based deformable image generation terminal 60 may include a power supply unit 61, a wireless communication unit 62, an A / V (audio / video) input unit 63, a user input unit 64, a sensing unit 65, an interface unit 66, a controller 67, an output unit 68 and a storage unit 69, etc. Figure 6 A terminal is shown having various components, but it is understood that implementing all of the components shown is not a requirement, and more or fewer components may alternatively be implemented.
[0122] Among them, the wireless communication unit 62 allows radio communication between the terminal 60 and the wireless communication system or network. The A / V input unit 63 is used to receive audio or video signals. The user input unit 64 can generate key input data according to the command input by the user to control various operations of the terminal device. The sensing unit 65 detects the current state of the terminal 60, the position of the terminal 60, the presence or absence of the user's touch input to the terminal 60, the orientation of the terminal 60, the acceleration or deceleration movement and direction of the terminal 60, etc., and generates a command or signal for controlling the operation of the terminal 60. The interface unit 66 is used as an interface through which at least one external device can be connected to the terminal 60. The output unit 68 is configured to provide output signals in a visual, audio and / or tactile manner. The storage unit 69 can store software programs for processing and control operations performed by the controller 67, etc., or can temporarily store data that has been output or is to be output. The storage unit 69 may include at least one type of storage medium. Moreover, the terminal 60 can cooperate with a network storage device that performs the storage function of the storage unit 69 through a network connection. The controller 67 generally controls the overall operation of the terminal device. In addition, the controller 67 may include a multimedia module for reproducing or playing back multimedia data. The controller 67 may perform a pattern recognition process to recognize a handwriting input or a picture drawing input performed on the touch screen as a character or an image. The power supply unit 61 receives external power or internal power under the control of the controller 67 and provides appropriate power required for operating each element and component.
[0123] Various embodiments of the method for generating a deformable image based on a human face proposed in the present disclosure can be implemented using a computer-readable medium such as computer software, hardware, or any combination thereof. For hardware implementation, various embodiments of the method for generating a deformable image based on a human face proposed in the present disclosure can be implemented by using at least one of an application-specific integrated circuit (ASIC), a digital signal processor (DSP), a digital signal processing device (DSPD), a programmable logic device (PLD), a field programmable gate array (FPGA), a processor, a controller, a microcontroller, a microprocessor, and an electronic unit designed to perform the functions described herein. In some cases, various embodiments of the method for generating a deformable image based on a human face proposed in the present disclosure can be implemented in the controller 67. For software implementation, various embodiments of the method for generating a deformable image based on a human face proposed in the present disclosure can be implemented with a separate software module that allows the execution of at least one function or operation. The software code can be implemented by a software application (or program) written in any appropriate programming language, and the software code can be stored in the storage unit 69 and executed by the controller 67.
[0124] For detailed description of this embodiment, reference may be made to the corresponding descriptions in the aforementioned embodiments, which will not be repeated here.
[0125] The basic principles of the present disclosure are described above in conjunction with specific embodiments. However, it should be noted that the advantages, strengths, effects, etc. mentioned in the present disclosure are only examples and not limitations, and it cannot be considered that these advantages, strengths, effects, etc. are required by each embodiment of the present disclosure. In addition, the specific details disclosed above are only for the purpose of illustration and ease of understanding, and are not limitations. The above details do not limit the present disclosure to the necessity of adopting the above specific details to be implemented.
[0126] The block diagrams of the devices, apparatuses, equipment, and systems involved in this disclosure are only illustrative examples and are not intended to require or imply that they must be connected, arranged, and configured in the manner shown in the block diagrams. As will be appreciated by those skilled in the art, these devices, apparatuses, equipment, and systems can be connected, arranged, and configured in any manner. Words such as "including," "comprising," "having," and the like are open words, referring to "including but not limited to," and can be used interchangeably therewith. The words "or" and "and" used herein refer to the words "and / or," and can be used interchangeably therewith, unless the context clearly indicates otherwise. The word "such as" used herein refers to the phrase "such as but not limited to," and can be used interchangeably therewith.
[0127] Additionally, as used herein, "or" used in a list of items beginning with "at least one" indicates a separate list, so that, for example, a list of "at least one of A, B, or C" means A or B or C, or AB or AC or BC, or ABC (i.e., A and B and C). Furthermore, the word "exemplary" does not mean that the example described is preferred or better than other examples.
[0128] It should also be noted that in the system and method of the present disclosure, each component or each step can be decomposed and / or recombined. Such decomposition and / or recombination should be regarded as equivalent solutions of the present disclosure.
[0129] Various changes, substitutions, and modifications of the techniques described herein may be made without departing from the teachings defined by the appended claims. Furthermore, the scope of the claims of the present disclosure is not limited to the specific aspects of the processes, machines, manufactures, compositions of events, means, methods, and actions described above. Currently existing or later to be developed processes, machines, manufactures, compositions of events, means, methods, or actions that perform substantially the same functions or achieve substantially the same results as the corresponding aspects described herein may be utilized. Thus, the appended claims include such processes, machines, manufactures, compositions of events, means, methods, or actions within their scope.
[0130] The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use the present disclosure. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein may be applied to other aspects without departing from the scope of the present disclosure. Therefore, the present disclosure is not intended to be limited to the aspects shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
[0131] The above description has been given for the purpose of illustration and description. In addition, this description is not intended to limit the embodiments of the present disclosure to the forms disclosed herein. Although multiple example aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, changes, additions and sub-combinations thereof.
Claims
1. A method for generating deformable images based on human faces, It is characterized in that include: Acquire a standard face image, wherein the standard face image includes a plurality of feature points, and the feature points are located at default positions; Setting the sequence number of the standard face image; Selecting at least one feature point from the plurality of feature points; Moving the selected feature point from the default position to the first position by human-computer interaction; generating a first deformed image of the standard face image according to the first position; Recognize multiple faces in an image captured by an image sensor; numbering the multiple faces according to the recognition order; A deformable image of a face corresponding to the serial number is generated according to the serial number, the serial number and the first deformable image corresponding to the serial number.
2. The method for generating a deformable image based on a face according to claim 1, It is characterized in that The feature point has a mirror feature point, and the selecting at least one feature point from the plurality of feature points comprises: At least one feature point among the plurality of feature points is selected, and a mirror feature point of the feature point is selected at the same time.
3. The method for generating a deformable image based on a face as claimed in claim 2, It is characterized in that The step of dragging the selected feature point from the default position to the first position includes: The selected feature point is moved to a first position, and the mirror feature point of the feature point is simultaneously moved to a mirror position of the first position.
4. The method for generating a deformable image based on a face as claimed in claim 3, It is characterized in that Generating a first deformed image of the standard face image according to the first position includes: A deformed image of the standard facial image is generated according to the first position and the mirror image position of the first position.
5. The method for generating a deformable image based on a face according to claim 1, It is characterized in that Generating a first deformed image of the standard face image according to the first position includes: A deformation coefficient is generated according to the first position and the default position, and pixel points around the selected feature point are moved according to the deformation coefficient to generate a deformed image of the standard face image.
6. The method for generating a deformable image based on a face according to claim 1, It is characterized in that Before generating the deformed image of the standard face image according to the first position, the method further includes: The strength of the deformation is selected, which indicates the degree of deformation.
7. The method for generating a deformable image based on a face according to claim 1, It is characterized in that After generating the deformed image of the standard face image according to the first position, the method further includes: A command for adding deformation is received, and feature points are continued to be dragged on the basis of the deformed image to generate a second deformed image.
8. The method for generating a deformable image based on a human face according to claim 1, It is characterized in that After generating a first deformed image of the standard face image according to the first position, the method further includes: Identify faces in images captured by image sensors; A deformed image of the human face is generated according to the first deformed image.
9. A deformable image generation device based on human face, It is characterized in that include: An acquisition module, used for acquiring a standard face image, wherein the standard face image includes a plurality of feature points, and the feature points are located at default positions; A sequence number setting module, used to set the sequence number of the standard face image; A feature point selection module, used to select at least one feature point from the plurality of feature points; A feature point moving module, used for dragging the selected feature point from the default position to the first position by human-computer interaction; A deformation module, used for generating a first deformed image of the standard face image according to the first position; A second face recognition module, used to recognize multiple faces in the image captured by the image sensor; A numbering module, used for numbering the faces according to the recognition order; The second deformation mapping module is used to generate a deformable image of the face corresponding to the serial number according to the serial number, the serial number and the first deformable image corresponding to the serial number.
10. An electronic device, include: a memory for storing non-transitory computer-readable instructions; as well as A processor is used to run the computer-readable instructions so that when the processor executes, the method for generating a deformable image based on a human face according to any one of claims 1 to 8 is implemented.
11. A computer-readable storage medium for storing non-transitory computer-readable instructions, which, when executed by a computer, enables the computer to execute the face-based morphable image generation method according to any one of claims 1 to 8.
