A method, device, electronic device and computer-readable storage medium for generating a deformable image
By setting multiple parameters of deformation type and range of action, flexible deformation processing of images is achieved, solving the problem that deformation effects cannot be edited in the prior art, and improving the flexibility and personalization of image deformation.
Patent Information
- Application Number
- CN201810838408.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2018-07-27
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2040-04-24
AI Technical Summary
The face image deformation function in the prior art can only adopt preset deformation effects, and cannot flexibly edit the deformation effects.
A deformation image generation method is provided, by receiving type setting commands and range setting commands, setting deformation type and range of action, calling corresponding deformation algorithms to process the image, and generating deformation images. This method includes setting multiple parameters such as deformation type parameters, degree parameters, shape of the range of action, center point position, length and rotation angle, etc., allowing users to flexibly define and edit deformation effects.
Improves the flexibility of image deformation, allowing users to customize the deformation effect as needed and generate more personalized deformation images.
Smart Images

Figure CN109146770B_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. Background Art
[0002] With the development of computer technology, the application scope of smart terminals has been widely expanded. 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] Currently, when taking photos with smart terminals, you can not only use the built-in camera software at the factory to achieve traditional photo effects, but you can also download applications (Application, abbreviated as: APP) from the network to achieve photo effects with additional functions, such as APPs that can achieve dark light detection, beauty camera, super pixel and other functions.
[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 view of this, an embodiment of the present disclosure provides a method for generating a deformable image, which is used to define and edit the deformation effect of an image and generate a deformable image.
[0006] In a first aspect, an embodiment of the present disclosure provides a method for generating a deformed image, comprising: setting the type of deformation in response to a received type setting command; setting the range of deformation in response to a received range setting command; and processing an image captured by an image sensor according to the setting results of the above setting commands to generate a deformed image.
[0007] Optionally, setting the deformation type includes: setting deformation type parameters and deformation degree parameters.
[0008] Optionally, setting the scope of the deformation includes: setting a shape of the scope, wherein the shape is described by multiple parameters; the multiple parameters include at least a shape type parameter, a center point position parameter, and a length parameter.
[0009] Optionally, processing the image captured by the image sensor according to the setting result of the above-mentioned setting command to generate a deformed image includes: calling a deformation algorithm corresponding to the set deformation, performing deformation processing on pixel points of the image within the effective range, and obtaining a deformed image.
[0010] Optionally, after setting the deformation action range, the method further includes: displaying a standard image on a display device, and displaying the action range on the standard image.
[0011] Optionally, after displaying the action range on the standard image, the method further includes: processing the standard image according to the setting result of the above setting command to generate a deformed image of the standard image.
[0012] Optionally, the image captured by the image sensor is processed according to the setting results of the above-mentioned setting command to generate a deformed image, including: obtaining feature points of the standard image, fixing the position of the action range in the standard image through the feature points; identifying a first image corresponding to the standard image from the image captured by the image sensor; mapping the fixed position in the standard image to the first image; and deforming the first image to generate a deformed image.
[0013] Optionally, the scope of action includes a center point position parameter indicating the position of the scope of action; the position P of the center point of the scope of action is described by three feature points A, B, C and two linear difference coefficients λ1 and λ2, specifically: P is located in a triangle formed by A, B, and C, D is the intersection of the extended line connecting point A to point P and line segment BC, where Wherein BD, BC, AP and AD represent the lengths of the line segments respectively.
[0014] Optionally, the range of action includes a length parameter representing the axial length of the range of action; the length parameter R of the range of action is described by two characteristic points E and F and a length coefficient S, specifically: R=EF×S, wherein EF is the distance between points E and F, and the length coefficient S is calculated by EF and R.
[0015] Optionally, the scope includes an angle parameter representing the rotation angle of the scope; the angle parameter angle of the scope is described by two feature points G and H, specifically: using the vector , as the reference direction of the scope of action.
[0016] Optionally, before generating the deformed image, the method further includes: in response to receiving a deformation amplitude setting command, setting the deformation amplitude in the X-axis direction and the Y-axis direction of the deformation action range.
[0017] In a second aspect, an embodiment of the present disclosure provides a deformation image generating device, comprising: a deformation type setting module, used to set the type of deformation in response to a received type setting command; a range setting module, used to set the scope of deformation in response to a received range setting command; and a deformation execution module, used to process the image captured by the image sensor according to the setting result of the above setting command to generate a deformation image.
[0018] Optionally, the deformation type setting module is used to set deformation type parameters and deformation degree parameters.
[0019] Optionally, the range setting module is used to set the shape of the scope of action, wherein the shape is described by multiple parameters; the multiple parameters include at least a shape type parameter, a center point position parameter, and a length parameter.
[0020] Optionally, the deformation execution module is used to call a deformation algorithm corresponding to the set deformation, perform deformation processing on pixel points of the image within the scope of action, and obtain a deformed image.
[0021] Optionally, the deformation image generating device further includes: a display module, configured to display the action range on a standard image.
[0022] Optionally, the deformation execution module is used to obtain feature points of a standard image and fix the position of the action range in the standard image through the feature points; identify a first image corresponding to the standard image from the image acquired by the image sensor; map the fixed position in the standard image to the first image; and perform deformation processing on the first image to generate a deformed image.
[0023] Optionally, the position P of the center point of the action range is described by three feature points A, B, C and two linear difference coefficients λ1 and λ2, specifically: P is located in the triangle formed by A, B, and C, D is the intersection of the extended line connecting point A to point P and line segment BC, where Wherein BD, BC, AP and AD represent the lengths of the line segments respectively.
[0024] Optionally, the length parameter R of the range of action is described by two feature points E and F and a length coefficient S, specifically: R=EF×S, wherein EF is the distance between points E and F, and the length coefficient S is calculated by EF and R.
[0025] Optionally, the scope of action also includes an angle parameter representing the rotation angle of the scope of action; the angle parameter angle of the scope of action is described by two feature points G and H, specifically: using the vector , as the reference direction of the scope of action.
[0026] Optionally, the deformation image generating device further includes: an amplitude setting module, which is used to set the deformation amplitude in the X-axis direction and the Y-axis direction of the deformation action range in response to receiving the deformation amplitude setting command.
[0027] In a third aspect, an embodiment of the present disclosure provides an electronic device, including:
[0028] at least one processor; and,
[0029] a memory communicatively connected to the at least one processor; wherein,
[0030] The memory stores instructions that can be executed 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 deformable image generation methods described in the first aspect.
[0031] 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 deformable image generation methods described in the first aspect.
[0032] The embodiments of the present disclosure provide a method, device, electronic device and computer-readable storage medium for generating a deformable image. The method for generating a deformable image includes: setting the type of deformation in response to a received type setting command; setting the range of deformation in response to a received range setting command; and processing the image collected by the image sensor according to the setting result of the above setting command to generate a deformable image. The embodiments of the present disclosure solve the technical problem that only preset effects can be used to deform images in the prior art by adopting this technical solution, thereby improving the flexibility of generating deformable images.
[0033] 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
[0034] 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.
[0035] Figure 1 This is a flowchart of Example 1 of the method for generating a deformable image provided in an embodiment of the present disclosure.
[0036] Figure 2a This is a flow chart of Embodiment 2 of the method for generating a deformable image provided in the embodiment of the present disclosure.
[0037] Figure 2bA schematic diagram of a standard image in Embodiment 2 of the method for generating a deformable image provided by an embodiment of the present disclosure;
[0038] Figure 2c A schematic diagram of a deformed image of a standard image in Embodiment 2 of the deformable image generation method provided in an embodiment of the present disclosure;
[0039] Figure 3 A schematic diagram of the position of the center point of the action range in the deformable image generation method provided in an embodiment of the present disclosure.
[0040] Figure 4 This is a flow chart of Embodiment 2 of the method for generating a deformable image provided in the embodiment of the present disclosure.
[0041] Figure 5 A schematic diagram of the structure of a first embodiment of a deformable image generating device provided in an embodiment of the present disclosure.
[0042] Figure 6 A schematic diagram of the structure of a second embodiment of a deformable image generating device provided in an embodiment of the present disclosure.
[0043] Figure 7 The present invention is a schematic diagram of the structure of a third embodiment of a deformable image generating device provided in an embodiment of the present disclosure.
[0044] Figure 8 It is a schematic diagram of the structure of an electronic device provided according to an embodiment of the present disclosure.
[0045] Fig. 9 A schematic diagram of the structure of a computer-readable storage medium provided according to an embodiment of the present disclosure.
[0046] Fig.10 It is a structural schematic diagram of a deformable image generating terminal provided according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0047] 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.
[0048] 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.
[0049] 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.
[0050] 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.
[0051] Figure 1 This is a flowchart of the first embodiment of the deformable image generation method provided by the embodiment of the present disclosure. The deformable image generation method provided by this embodiment can be executed by a deformable image generation device. The deformable image generation device can be implemented as software, or as a combination of software and hardware. The deformable image generation 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 1 As shown, the method comprises the following steps:
[0052] S101, in response to a received type setting command, setting a deformation type;
[0053] At the terminal device, the user can set the deformation through the human-machine interface. At this time, for the terminal device, it receives the type setting command input by the user and sets the type of deformation; the deformation type setting command may include a deformation type parameter, and the deformation type parameter specifies the type of deformation, and the deformation type may include enlargement, reduction, translation, rotation, drag, etc. The deformation type setting command may also include two parameters, namely, a deformation type parameter and a deformation degree parameter, wherein the deformation type parameter is the same as the aforementioned deformation type parameter, and the deformation degree parameter specifies the degree of deformation, and the degree of deformation may be, for example, the multiple of enlargement and reduction, the translation distance, the rotation angle, the drag distance, etc. When the deformation type is translation, the deformation degree parameter includes the position of the target point and the amplitude of translation from the center point to the target point, and the amplitude may be a negative number, indicating a translation in the opposite direction; the deformation degree parameter may also include a translation attenuation coefficient, and the larger the translation attenuation coefficient, the smaller the attenuation of the translation amplitude in the direction away from the center point. The deformation type also includes a special deformation type: flexible enlargement / reduction, which can freely adjust the degree of image deformation of the image position at different distances from the center point within the deformation area.
[0054] S102, in response to the received range setting command, setting the range of action of the deformation;
[0055] At the terminal device, the user can set the scope of the deformation through the human-computer interface. At this time, for the terminal device, it receives the range setting command input by the user and sets the scope of the deformation. Generally speaking, the scope includes the shape of the scope, such as circle, ellipse, rectangle, etc., as well as the size and position of the scope, such as the radius of a circle and the position of the center of the circle; the length of the major and minor axes of the ellipse, the rotation angle and the center position of the ellipse; the side length, rotation angle and the center position of the rectangle; the setting command includes multiple scope parameters to describe the shape, and the multiple scope parameters include shape type parameters, position coordinate parameters of the center point of the shape and length parameters of the shape in the axial direction of the screen. For some shapes such as ellipses and rectangles, the shape parameters can also include rotation angle parameters, which define the rotation angle of the shape relative to the axial direction of the screen; the length parameter of the shape in the axial direction of the screen includes the length of the scope in the X-axis direction of the screen and / or the length in the Y-axis direction of the screen.
[0056] In one embodiment, the multiple parameters may also include parameters max and min, where max determines the outer boundary and min determines the inner boundary, the inner boundary and the outer boundary form an annular range within the scope of action, and the image is deformed only within the annular range; where max>min, and 0≤max≤1, 0≤min≤1, generally, max and min respectively represent the length parameter ratio of the outer boundary and the inner boundary to the scope of action, for example, when max=1, it means that the outer boundary of the annular range coincides with the boundary of the scope of action. It can be understood that the annular can be a circular ring, an elliptical ring, a rectangular ring, etc.
[0057] In one embodiment, the multiple parameters also include signX and signY. Specifically, when signX=-1, it means that only half of the range of action where the negative half axis of the X axis is located needs to be deformed; when signX=1, it means that only half of the range of action where the positive half axis of the X axis is located needs to be deformed; when signX=0, it means that no deformation range is selected in the X-axis direction; when signY=-1, it means that only half of the range of action where the negative half axis of the Y axis is located needs to be deformed; when signY=1, it means that only half of the range of action where the positive half axis of the Y axis is located needs to be deformed; when signY=0, it means that no deformation range is selected in the Y-axis direction. The above two parameters can be combined to form multiple ranges of action. For example, when signX=1 and signY=1, it means that the image in the range of action of the first quadrant of the range of action needs to be deformed, and so on. No further details will be given.
[0058] S103: Process the image collected by the image sensor according to the setting result of the above setting command to generate a deformed image.
[0059] Different deformation types call different deformation processing methods. When the deformation range and deformation type are determined, the corresponding deformation processing method is called to perform deformation processing on the image within the deformation range. The image is a real-time image collected by an image sensor or an image obtained by an image sensor. The image includes a picture or a video, and finally a deformed image is generated. In a specific implementation, different deformation algorithms are pre-set for different deformations. The deformation algorithm is configured by inputting parameters in the command received in steps S101 and S102, and the pixel points of the image within the deformation range are deformed to obtain the final deformed image.
[0060] The core idea of this embodiment is to control the deformation by setting two parameters: deformation type and deformation range. Through the above deformation image generation method, the deformation result can be controlled more flexibly.
[0061] Figure 2aThis is a flow chart of Embodiment 2 of the method for generating a deformable image provided by the present disclosure, as shown in FIG. Figure 2a As shown, the following steps may be included:
[0062] S201, in response to a received type setting command, setting a deformation type;
[0063] S202, in response to the received range setting command, setting the range of action of the deformation;
[0064] S203, displaying a standard image on a display device, and displaying the action range on the standard image;
[0065] S204: Process the image collected by the image sensor according to the setting result of the above setting command to generate a deformed image.
[0066] like Figure 2b and 2c As shown, in this embodiment, in order to facilitate the user to observe and adjust the deformation range, after step S202, step S203 is added: display a standard image on the display device, and display the range on the standard image. In one embodiment, the standard image is a face image, and the range is an elliptical area. The user can set the major and minor axes of the ellipse and the rotation angle. The elliptical area will be displayed at a default position on the face image. At this time, the user can change the position of the range by dragging the center point of the ellipse, such as dragging from the nose area to the eye area, and the eye image will be deformed accordingly, such as Figure 2c The scope and deformation effect shown in
[0067] Displaying the scope of action on the standard image also facilitates the user to view the expected effect of the deformation and adjust the parameters of each deformation according to the effect. In one embodiment, the relative position of the scope of action is determined by feature points, such as Figure 2bThe facial feature points shown in . 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 human 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 facial contour mainly includes eyebrows, eyes, nose, mouth and cheeks, and sometimes pupils and nostrils. Generally speaking, to achieve a relatively complete description of the facial 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 pupil, nostril or more detailed facial features are required, the number of key points can be increased. Extracting facial key points on an image is equivalent to finding the corresponding position coordinates of each facial contour key point in the face image, that is, key point positioning. 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 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 methods of feature extraction: (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 point. 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.
[0068] Since there needs to be a mapping relationship between the deformation on the standard image and the deformation of the 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. The 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 range 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. In another embodiment, when generating a deformed image, first obtain the feature points of the standard image in step S203, and determine the position of the action range in the standard image through the feature points; identify the first image corresponding to the standard image from the image collected by the image sensor; map the position determined in the standard image to the first image; perform deformation processing on the first image to generate a deformed image. In this deformation method, the relative position of the deformation range in the target image is determined. No matter how the target image moves, the deformation range is always located at the relative position, so as to achieve the purpose of tracking deformation. In a typical application, the standard image is a standard facial image that serves as a reference. The standard image has 106 feature points after triangulation. When setting the scope of action, the relative position of the deformation range and the feature points is used to determine the relative position of the scope of action in the facial image. The same triangulation is performed on the facial image captured by the camera. Afterwards, 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.
[0069] For the tracking deformation method in the above embodiment, the standard image and the captured image use the same set of feature points, and the feature points have the same number. For example, feature point No. 6 in the standard image and feature point No. 6 on the image captured by the image sensor have the same position on the standard image and the same position on the captured image. Since the center point of the action range is generally always located inside a certain triangle, the position of the center point of the action range can be determined by using three feature points, such as Figure 3 As shown in the figure, points A, B, and C are feature points in the image, P is the center point of the action range, and point D is the intersection of the extension line of line segment AP and line segment BC. The coordinates of point A are (X a ,Y a ), the coordinates of point B are (X b ,Y b ), the coordinates of point C are (X c ,Y c ), the coordinates of point D are (X d ,Y d ), the coordinates of point P are (X p ,Yp ), then we can get two linear difference coefficients Where BD, BC, AP and AD represent the lengths of the line segments respectively.
[0070]
[0071] In the standard image, the coordinates of A, B, C, and P are all known values, so BD, BC, AP, and AD can be used to calculate λ1 and λ2; when deforming the image captured by the image sensor, it is necessary to first determine the scope of the deformation. At this time, the feature points A1, B1, and C1 with the same number as A, B, and C can be used. The coordinates of A1, B1, and C1 are known values in the coordinate system of the image sensor. At this time, the coordinates of A1, B1, and C1 and the linear difference coefficients λ1 and λ2 can be used to calculate the coordinates of point P1 corresponding to point P in the coordinate system of the image sensor. It should be noted that if A, B, and C have the same number, A, B, and C have a common point. At this time, point P is located at point A, and there is no need to calculate the values of λ1 and λ2; when B and C have the same number, B, C, and D have a common point. At this time, the triangle degenerates into a line segment, and the position of P is determined by λ2, and there is no need to calculate λ1; when A and B have a common point or A and C have a common point, the order of A, B, and C can be exchanged to convert to the case of BC. This scheme uses linear difference coefficients to record the relative position between the deformation center point and the three feature points, thereby calculating the position of point P mapped to the coordinate system of the image sensor. The above method is only an example. In fact, any method that uses feature points to record the position of the deformation center point can be introduced into the present disclosure. When the deformation type is translation or dragging, the above scheme can also be used to describe the position of the target point of translation and dragging. The above method is used to describe the position of the target point of translation and dragging in the standard image. When mapped to the image captured by the image sensor, the position of the target point in the actual image can be determined. When the deformation type is translation, two translation modes can also be preset. For example, when the number of point A is less than 0, the target point is located at the farthest end of the positive direction of the X-axis of the range of action; when the number of point A is greater than or equal to 0 and the number of point B is less than 0, the target point is located at the farthest end of the positive direction of the Y-axis of the range of action.
[0072] In addition to the position of the center, it is also necessary to record the length R of the range of action, which can be described by two feature points E and F and the length coefficient S. Specifically: R = EF × S. In the standard image, R is a known value, and EF is the length of the line segment between feature points E and F, from which the length coefficient can be calculated. In the coordinate system of the image sensor, the coordinates of the feature points E1 and F1 corresponding to E and F are known values, so the length R1 of the action range in the coordinate system of the image sensor can be calculated by the following formula: E1F1×S, for some shapes, the range of action has multiple lengths, such as an ellipse has a major axis and a minor axis, and a rectangle has a length and a width. At this time, multiple length coefficients S can be calculated for each length to record the relative length of each length.
[0073] The user can set whether the scope of action rotates with the rotation of the target image. If it does not rotate, it is only necessary to keep the x-radius direction of the scope parallel to the screen width (horizontal) direction, and the y-radius direction must also be parallel to the screen height (vertical) direction. When the scope of action needs to rotate with the rotation of the target image, it is necessary to determine the angle of the scope of action, which indicates how much the scope of action needs to rotate to remain relatively still with the target image. The angle can be a vector consisting of two feature points G and H. The direction is determined by, for example, the X-axis of the scope of action and The angle needs to be kept at a fixed value. When the target image captured by the image sensor rotates, the range of action needs to be Keep the angle fixed and rotate accordingly.
[0074] The recording of various parameters of the above-mentioned scope of action is based on the feature points as references, and the relative values are calculated, and the actual parameters of the scope of action are calculated in the coordinate system of the image sensor. The present disclosure does not limit the method of calculating the relative values. As long as the relative values of various parameters of the scope of action can be recorded, they can be used in the present disclosure.
[0075] Figure 4 This is a flow chart of a third embodiment of a method for generating a deformable image provided by the present disclosure. In this embodiment, based on the first embodiment, a deformation amplitude setting step is further added. Figure 4 As shown, the following steps may be included:
[0076] S401, in response to the received type setting command, setting the type of deformation;
[0077] S402, in response to the received range setting command, setting the range of action of the deformation;
[0078] S403, in response to receiving the deformation amplitude setting command, setting the deformation amplitude in the X-axis direction and the Y-axis direction of the deformation action range;
[0079] S404: Process the image collected by the image sensor according to the setting result of the above setting command to generate a deformed image.
[0080] In this embodiment, a deformation amplitude setting command is also included, which sets the deformation amplitude of the scope in the X-axis direction and the deformation amplitude in the Y-axis direction. This parameter can be set for deformations of the types of magnification, reduction, rotation, etc. Taking magnification as an example, the user can set the image to be magnified 3 times in the X-axis direction and 2 times in the Y-axis direction. The magnification of the area between the X-axis and the Y-axis can be gradually processed; the deformation amplitude can be a negative number, which indicates the reverse deformation of this type of deformation. For example, for a deformation of the magnification type, if the deformation amplitude is a negative number, it is equivalent to a reduction deformation. In this way, more diverse deformation processing effects can be obtained.
[0081] Figure 5 This is a structural diagram of Embodiment 1 of the deformable image generating device provided by the present disclosure, as shown in FIG. Figure 5 As shown, the device includes: a deformation type setting module 51, a range setting module 52, and a deformation execution module 53.
[0082] A deformation type setting module 51, configured to set the deformation type in response to a received type setting command;
[0083] A range setting module 52, configured to set a range of action of the deformation in response to a received range setting command;
[0084] The deformation execution module 53 is used to process the image collected by the image sensor according to the setting result of the above setting command to generate a deformed image.
[0085] Figure 5 The device shown can perform Figure 1 For the method of the embodiment shown in the figure, the part not described in detail in this embodiment can be referred to Figure 1 The implementation process and technical effects of this technical solution refer to Figure 1 The description in the illustrated embodiment will not be repeated here.
[0086] Figure 6 The structure diagram of the second embodiment of the deformable image generating device provided by the present disclosure is as follows:
[0087] Figure 6 As shown, in Figure 5 Based on the illustrated embodiment, the device further includes: a display module 61 .
[0088] A deformation type setting module 51, configured to set the deformation type in response to a received type setting command;
[0089] A range setting module 52, configured to set a range of action of the deformation in response to a received range setting command;
[0090] A display module 61, used for displaying a standard image on a display device, and displaying the action range on the standard image;
[0091] The deformation execution module 53 is used to process the image collected by the image sensor according to the setting result of the above setting command to generate a deformed image.
[0092] Figure 6 The device shown can execute the method of the embodiment shown in Figure 2. For the parts not described in detail in this embodiment, please refer to the relevant description of the embodiment shown in Figure 2. The execution process and technical effects of this technical solution refer to the description of the embodiment shown in Figure 2, which will not be repeated here.
[0093] Figure 7 This is a schematic diagram of the structure of Embodiment 3 of the deformable image generation device provided by the present disclosure.
[0094] Figure 7 As shown, in Figure 5 Based on the embodiment, the device further includes: an amplitude setting module 71.
[0095] A deformation type setting module 51, configured to set the deformation type in response to a received type setting command;
[0096] A range setting module 52, configured to set a range of action of the deformation in response to a received range setting command;
[0097] Amplitude setting module 71, used to set the deformation amplitude in the X-axis direction and the Y-axis direction of the deformation action range;
[0098] The deformation execution module 53 is used to process the image collected by the image sensor according to the setting result of the above setting command to generate a deformed image.
[0099] Figure 7 The device shown can perform Figure 3 For the method of the embodiment shown in the figure, the part not described in detail in this embodiment can be referred to Figure 3 The implementation process and technical effects of this technical solution refer to Figure 3 The description in the illustrated embodiment will not be repeated here.
[0100] Figure 8 is a hardware block diagram of an electronic device according to an embodiment of the present disclosure. Figure 8 As shown, the electronic device 80 according to an embodiment of the present disclosure includes a memory 81 and a processor 82 .
[0101] The memory 81 is used to store non-temporary computer-readable instructions. Specifically, the memory 81 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.
[0102] The processor 82 may be a central processing unit (CPU) or other forms of processing units having data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 80 to perform desired functions. In one embodiment of the present disclosure, the processor 82 is used to run the computer-readable instructions stored in the memory 81, so that the electronic device 80 performs all or part of the steps of the deformable image generation method of each embodiment of the present disclosure.
[0103] 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.
[0104] For detailed description of this embodiment, reference may be made to the corresponding descriptions in the aforementioned embodiments, which will not be repeated here.
[0105] Fig. 9 is a schematic diagram illustrating a computer-readable storage medium according to an embodiment of the present disclosure. Fig. 9 As shown, a computer-readable storage medium 90 according to an embodiment of the present disclosure stores non-transitory computer-readable instructions 91. When the non-transitory computer-readable instructions 91 are executed by a processor, all or part of the steps of the deformable image generation method of each embodiment of the present disclosure are executed.
[0106] The above-mentioned computer-readable storage medium 90 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).
[0107] For detailed description of this embodiment, reference may be made to the corresponding descriptions in the aforementioned embodiments, which will not be repeated here.
[0108] Fig.10 Schematic diagram of the hardware structure of a terminal device according to an embodiment of the present disclosure. Fig.10As shown, the deformable image generating terminal 100 includes the above-mentioned deformable image generating device embodiment.
[0109] 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.
[0110] As an equivalent alternative implementation, the terminal may also include other components. Fig.10 As shown, the deformable image generating terminal 100 may include a power supply unit 101, a wireless communication unit 102, an A / V (audio / video) input unit 103, a user input unit 104, a sensing unit 105, an interface unit 106, a controller 107, an output unit 108 and a storage unit 109, etc. Fig.10 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.
[0111] Among them, the wireless communication unit 102 allows radio communication between the terminal 100 and the wireless communication system or network. The A / V input unit 103 is used to receive audio or video signals. The user input unit 104 can generate key input data according to the command input by the user to control various operations of the terminal device. The sensing unit 105 detects the current state of the terminal 100, the position of the terminal 100, the presence or absence of the user's touch input to the terminal 100, the orientation of the terminal 100, the acceleration or deceleration movement and direction of the terminal 100, etc., and generates a command or signal for controlling the operation of the terminal 100. The interface unit 106 is used as an interface through which at least one external device can be connected to the terminal 100. The output unit 108 is configured to provide output signals in a visual, audio and / or tactile manner. The storage unit 109 can store software programs for processing and control operations performed by the controller 107, etc., or can temporarily store data that has been output or is to be output. The storage unit 109 may include at least one type of storage medium. Moreover, the terminal 100 can cooperate with a network storage device that performs the storage function of the storage unit 109 through a network connection. The controller 107 generally controls the overall operation of the terminal device. In addition, the controller 107 may include a multimedia module for reproducing or playing back multimedia data. The controller 107 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 101 receives external power or internal power under the control of the controller 107 and provides the appropriate power required to operate each element and component.
[0112] Various embodiments of the deformable image generation method 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 deformable image generation method 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 deformable image generation method proposed in the present disclosure can be implemented in the controller 107. For software implementation, various embodiments of the deformable image generation method 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 109 and executed by the controller 107.
[0113] For detailed description of this embodiment, reference may be made to the corresponding descriptions in the aforementioned embodiments, which will not be repeated here.
[0114] 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.
[0115] 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.
[0116] 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.
[0117] 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.
[0118] 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.
[0119] 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.
[0120] 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 a deformable image, characterized in that: include: In response to the received type setting command, setting the type of deformation; In response to the received range setting command, setting the range of action of the deformation; Processing the image captured by the image sensor according to the setting result of the above setting command to generate a deformed image; The scope of deformation setting includes: Set the shape of the scope, where the shape is described by multiple parameters; The multiple parameters include at least a shape type parameter, a center point position parameter and a length parameter; After setting the deformation range, it also includes: Displaying a standard image on a display device, and displaying the action range on the standard image; processing the standard image according to the setting result of the setting command to generate a deformed image of the standard image; The scope of action includes a center point position parameter representing the position of the scope of action; The center point position of the action range is described by 3 characteristic points and 2 linear difference coefficients; The center point of the effective range is located in the triangle formed by the three feature points.
2. The method for generating a deformable image as claimed in claim 1, characterized in that: The deformation setting types include: Set the type and degree of deformation.
3. The method for generating a deformable image according to claim 1, wherein: The step of processing the image collected by the image sensor according to the setting result of the setting command to generate the deformed image includes: The deformation algorithm corresponding to the set deformation is called to perform deformation processing on the pixel points in the image within the scope of action to obtain a deformed image.
4. The method for generating a deformable image according to claim 1, wherein: The image collected by the image sensor is processed according to the setting result of the above setting command to generate a deformed image, including: Acquire feature points of a standard image, and fix the position of the action range in the standard image by using the feature points; Identifying a first image corresponding to a standard image from images acquired by an image sensor; Mapping a fixed position in the standard image into the first image; Perform deformation processing on the first image to generate a deformed image.
5. The method for generating a deformable image according to claim 1, wherein: The scope of action includes a center point position parameter representing the position of the scope of action; The center point position P of the action range is described by three feature points A, B, C and two linear difference coefficients λ1 and λ2, specifically: P is located in the triangle formed by A, B, and C. D is the intersection of the extended line from point A to point P and the line segment BC. Wherein BD, BC, AP and AD represent the lengths of the line segments respectively.
6. The method for generating a deformable image according to claim 1, wherein: The action range includes a length parameter representing the axial length of the action range; The length parameter R of the range of action is described by two characteristic points E and F and a length coefficient S, specifically: R=EF×S Among them, EF is the distance between points E and F, and the length coefficient S is calculated by EF and R.
7. The method for generating a deformable image according to claim 1, wherein: The action range includes an angle parameter representing a rotation angle of the action range; The angle parameter angle of the scope of action is described by two feature points G and H, specifically: Using Vectors , as the reference direction of the scope of action.
8. The method for generating a deformable image according to claim 1, wherein: Before generating the deformed image, it also includes: In response to receiving the deformation amplitude setting command, the deformation amplitudes in the X-axis direction and the Y-axis direction of the deformation action range are set.
9. A deformable image generating device, characterized in that: include: A deformation type setting module, used to set the deformation type in response to a received type setting command; A range setting module, used to set the range of deformation in response to a received range setting command; A deformation execution module, used for processing the image collected by the image sensor according to the setting result of the above setting command to generate a deformed image; Range setting module, specifically used for: Set the shape of the scope, where the shape is described by multiple parameters; The multiple parameters include at least a shape type parameter, a center point position parameter and a length parameter; The device further comprises: A standard image display module is used to display a standard image on a display device, and display the scope of action on the standard image; process the standard image according to the setting result of the above setting command to generate a deformed image of the standard image; The scope of action includes a center point position parameter representing the position of the scope of action; The center point position of the action range is described by 3 characteristic points and 2 linear difference coefficients; The center point of the effective range is located in the triangle formed by the three feature points.
10. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed 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 the deformable image generation method described in any one of claims 1-8.
11. 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 the deformable image generation method described in any one of claims 1-8.
