WO2020156058A1 - 基于终端的图像拖拽变形实现方法和装置 - Google Patents
基于终端的图像拖拽变形实现方法和装置 Download PDFInfo
- Publication number
- WO2020156058A1 WO2020156058A1 PCT/CN2020/070738 CN2020070738W WO2020156058A1 WO 2020156058 A1 WO2020156058 A1 WO 2020156058A1 CN 2020070738 W CN2020070738 W CN 2020070738W WO 2020156058 A1 WO2020156058 A1 WO 2020156058A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- point
- drag
- image
- deformed
- terminal
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Ceased
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/01—Input arrangements or combined input and output arrangements for interaction between user and computer
- G06F3/048—Interaction techniques based on graphical user interfaces [GUI]
- G06F3/0484—Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range
- G06F3/04845—Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range for image manipulation, e.g. dragging, rotation, expansion or change of colour
Definitions
- the present disclosure relates to the field of image processing technology, and in particular to a method, device, electronic device, and computer-readable storage medium for implementing terminal-based image drag and drop deformation.
- image deformation is a common method in image processing, which refers to changing one image into another according to certain rules or methods. It can be used for entertainment, face deformation, etc. For example, for a given face image, it can produce complex expression changes such as happiness, anger, sadness, and happiness.
- an embodiment of the present disclosure provides a terminal-based image drag transformation implementation method, which includes: determining a drag point in an image to be transformed displayed on the terminal screen; The image to be deformed is dragged and deformed; the deformed image is displayed on the terminal screen.
- determining the drag point in the image to be deformed displayed on the terminal screen includes:
- the selected to-be-selected drag point is used as the drag point.
- the dragging and deforming the image to be deformed according to the trigger operation of the dragging point includes:
- the receiving a trigger operation on the drag point includes:
- a second trigger operation on the drag point is received, and the end position of the drag point is determined according to the second trigger operation on the drag point.
- the method further includes:
- the drag point is in the first form after the first trigger operation, and the first form is displayed on the terminal screen; and/or,
- the drag point is in the second form after the second triggering operation, and the second form is displayed on the terminal screen.
- the determining the position of the drag point according to the trigger operation includes:
- the position of the drag point mapped to the image to be deformed is determined.
- the determining the position of the drag point mapped to the image to be deformed according to the position mapping relationship between the source key point on the template image and the target key point on the image to be deformed includes:
- the location of the drag point mapped to the image to be deformed is determined according to the transformation matrix and the translation vector.
- the determining the transformation matrix and translation vector of the drag point according to the position of the drag point on the template image, the position of the source key point, and the position of the target key point includes:
- the transformation matrix and translation vector of the drag point are determined according to the weight, the position of the source key point, and the position of the target key point.
- the dragging and deforming the image to be deformed according to the starting point position and the ending point position includes:
- the determining the target position of the grid point according to the original position of the grid point, the starting point position and the ending point position includes:
- the target position is determined according to the transformation matrix and the translation vector.
- the determining the transformation matrix and translation vector of the grid point according to the original position of the grid point, the starting point position and the ending point position includes:
- the transformation matrix and translation vector of the grid point are determined according to the weight, the start position and the end position.
- the determining the transformation matrix and translation vector of the grid point according to the weight, the starting point position and the ending point position includes:
- the transformation matrix and translation vector of the grid point are determined according to the optimized weight, the starting point position and the ending point position.
- the image to be deformed is a video face image.
- embodiments of the present disclosure provide a terminal-based image drag-and-drop implementation device, including: a drag-point determination module for determining a drag-point in an image to be deformed displayed on the terminal screen; a drag-and-deform module , Used to drag and deform the image according to the trigger operation of the drag point; an image display module, used to display the deformed image on the terminal screen.
- the drag point determination module includes:
- a drag point display unit configured to display at least one candidate drag point contained in the image on the terminal screen
- the drag point selection unit is configured to use the selected drag point to be selected as the drag point according to the selection operation generated on the terminal screen.
- the drag deformation module includes:
- a receiving unit configured to receive a trigger operation on the drag point
- a drag point determining unit configured to determine a position of the drag point according to the trigger operation, the position including a starting point position and an ending point position;
- the drag deformation unit is configured to drag and deform the image to be deformed according to the start point position and the end point position.
- the receiving unit is specifically configured to: receive a first trigger operation on the drag point, determine the start position of the drag point according to the first trigger operation on the drag point;
- the second trigger operation of the drag point determines the end position of the drag point according to the second trigger operation of the drag point.
- the image display module is specifically configured to: the drag point is in the first form after the first triggering operation, and display the first form on the terminal screen; and/or, the The drag point is in the second form after the second trigger operation, and the second form is displayed on the terminal screen.
- the drag point determination unit includes:
- a drag point determination subunit configured to determine a template image corresponding to the image according to the first trigger operation of the drag point, and determine the drag point on the template image
- the drag point position determination subunit is used to determine the position where the drag point is mapped to the image to be deformed according to the position mapping relationship between the source key point on the template image and the target key point on the image to be deformed .
- the drag point position determination subunit is specifically configured to determine the drag point according to the position of the drag point on the template image, the position of the source key point, and the position of the target key point.
- the transformation matrix and translation vector of the drag point; and the location of the drag point mapped to the image to be deformed is determined according to the transformation matrix and translation vector.
- the drag point position determining subunit is specifically configured to determine the drag point and the source key point according to the position of the drag point on the template image and the position of the source key point
- the weight of the drag point; the transformation matrix and translation vector of the drag point are determined according to the weight, the position of the source key point, and the position of the target key point.
- the drag deformation unit includes:
- a grid processing subunit for performing grid processing on the image to be deformed to obtain at least one grid point
- the target position determining subunit is configured to determine the target position of the grid point according to the original position of the grid point, the start position and the end position;
- the drag deformation sub-unit is used to drag and deform the image to be deformed according to the target position, and display the deformed image.
- target position determining subunit is specifically configured to: determine the transformation matrix and translation vector of the grid point according to the original position of the grid point, the start position and the end position; The matrix and the translation vector determine the target position.
- target position determining subunit is specifically configured to: determine the weight of the grid point and the starting point of the drag point according to the original position of the grid point and the starting point position; according to the weight, The start position and the end position determine the transformation matrix and translation vector of the grid point.
- target position determining subunit is specifically configured to: perform optimization processing on the weight; and determine the transformation matrix and translation vector of the grid point according to the optimized weight, the starting point position, and the ending point position.
- the image to be deformed is a video face image.
- embodiments of the present disclosure provide an electronic device, including: at least one processor; and,
- the device can execute any of the terminal-based image drag-and-drop implementation methods described in the foregoing first aspect.
- embodiments of the present disclosure provide 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 cause a computer to execute the aforementioned first aspect Any of the terminal-based methods for implementing image drag-and-drop deformation.
- the present disclosure discloses a method, a device, an electronic device and a computer-readable storage medium for implementing image drag and drop deformation based on a terminal.
- the method for implementing terminal-based image drag deformation includes: determining a drag point in the image to be deformed displayed on the terminal screen; dragging and deforming the image according to the trigger operation of the drag point; displaying the deformed image on the terminal on the screen.
- a drag point is determined in the image to be deformed displayed on the terminal screen, the image is dragged and deformed according to the trigger operation of the drag point, and the deformed image is displayed on the terminal screen.
- the image distortion cannot be freely controlled by the user, the distortion effect that the user wants cannot be achieved, and the controllability is poor.
- FIG. 1a is a flowchart of a method for implementing a terminal-based image drag deformation provided by an embodiment of the disclosure
- FIG. 1b is a flowchart of a method for implementing a terminal-based image dragging deformation according to another embodiment of the present disclosure
- FIG. 1c is a schematic diagram of the implementation of a drag point to be selected in the method for implementing a terminal-based image drag deformation provided by an embodiment of the disclosure
- FIG. 1d is a flowchart of a method for implementing a terminal-based image drag and deformation according to another embodiment of the present disclosure
- FIG. 1e is a flowchart of a method for implementing a terminal-based image dragging deformation provided by another embodiment of the present disclosure
- FIG. 2a is a schematic structural diagram of a terminal-based image drag-and-drop implementation device provided by an embodiment of the disclosure
- Figure 2b is a schematic structural diagram of a terminal-based image drag-and-drop implementation device provided by an embodiment of the disclosure
- 2c is a schematic structural diagram of a terminal-based image drag-and-drop implementation device provided by another embodiment of the present disclosure
- Fig. 3 is a schematic structural diagram of an electronic device provided according to an embodiment of the present disclosure.
- Figure 1a is a flowchart of a method for implementing terminal-based image drag deformation provided by an embodiment of the present disclosure.
- the method for implementing terminal-based image drag deformation provided in this embodiment can be implemented by a terminal-based image drag deformation implementation device Execution, the terminal-based image drag-and-drop implementation device can be implemented as software, or as a combination of software and hardware, the terminal-based image drag-and-drop implementation device can be integrated in the terminal-based image drag-and-drop implementation system In a certain device, such as a terminal-based image drag-and-drop implementation server or terminal-based image drag-and-drop implementation in a terminal device. As shown in Figure 1a, the method includes the following steps:
- Step S1 determining the drag point in the image to be deformed displayed on the terminal screen
- the terminal may be a mobile terminal (for example, a smart phone, an iphone, a tablet computer) or a fixed terminal (for example, a desktop computer)
- a mobile terminal for example, a smart phone, an iphone, a tablet computer
- a fixed terminal for example, a desktop computer
- the image to be deformed may be a video face image.
- a face image can be collected as the image to be deformed through the camera function of the terminal device.
- Step S2 Determine the drag point in the image to be deformed displayed on the terminal screen
- the trigger operation includes, but is not limited to, a single-click operation, a double-click operation, and a drag operation.
- Step S3 Display the deformed image on the terminal screen.
- a drag point is determined in the image to be deformed displayed on the terminal screen, the image is dragged and deformed according to the trigger operation of the drag point, and the deformed image is displayed on the terminal screen, which solves the prior art
- the image distortion cannot be freely controlled by the user, cannot achieve the distortion effect that the user wants, and the technical problem of poor controllability.
- step S1 includes:
- Step S11 Display at least one drag point to be selected included in the image to be deformed on the terminal screen
- the white dots are candidate drag points included in the image to be deformed.
- Step S12 According to the selection operation generated on the terminal screen, the selected to-be-selected drag point is used as the drag point.
- step S2 includes:
- Step S21 Receive a trigger operation on the drag point
- Step S22 Determine the position of the drag point according to the trigger operation, where the position includes a starting point and an ending point;
- Step S23 drag and deform the image to be deformed according to the start position and the end position.
- the drag point corresponding to the pixel point of the image to be deformed is moved from the starting point position to the ending point position, so as to realize the image deformation.
- step S21 includes:
- Step S211 Receive a first trigger operation on the drag point, and determine the starting point of the drag point according to the first trigger operation on the drag point;
- Step S212 Receive a second trigger operation on the drag point, and determine the end position of the drag point according to the second trigger operation on the drag point.
- the first trigger operation precedes the second trigger operation in time sequence.
- step S22 includes:
- Step S221 Determine a template image corresponding to the image to be deformed according to the trigger operation, and determine the drag point on the template image;
- the drag point includes a drag start point and a drag end point.
- this step includes: obtaining a template image corresponding to the drag start point according to the first trigger operation, and according to the second trigger operation Get the template image corresponding to the drag end point.
- Step S222 According to the position mapping relationship between the source key point on the template image and the target key point on the image to be deformed, determine the position where the drag point is mapped to the image to be deformed.
- the template image is an image preset to be associated with the image to be deformed, such as a frontal image of a human face. Any pixel on the template image can be selected as the drag point.
- the source key points are pixels on the template image, and specifically may be all pixels on the template image, or a selected preset number of pixels.
- the target key point is a key point on the image to be deformed, and specifically may be all pixels on the template image, or a selected preset number of pixels.
- the number of the source key points and the target key points are the same, and they are pixels with the same characteristics contained in both images.
- the key point can be customized by the user or obtained through machine algorithm learning.
- the number of specific pixels can be customized, for example, 106. When the pixels are the selected preset number of pixels, the calculation amount can be effectively reduced.
- step S222 includes:
- the location of the drag point mapped to the image to be deformed is determined according to the transformation matrix and the translation vector.
- the step of determining the transformation matrix and translation vector of the drag point according to the position of the drag point, the position of the source key point, and the position of the target key point includes:
- the transformation matrix and translation vector of the drag point are determined according to the weight, the position of the source key point, and the position of the target key point.
- the weight is calculated; where
- the following formula can be used to optimize the weight, and the optimized weight is used to locate the position of the drag point: Among them, ⁇ is the optimized weight coefficient, and ⁇ is the optimized weight offset.
- step S23 includes:
- Step S231 Perform gridding processing on the image to be deformed to obtain at least one grid point
- Step S232 Determine the target position of the grid point according to the original position of the grid point, the start position and the end position;
- Step S233 Drag and deform the image to be deformed according to the target position, and display the deformed image.
- step S232 includes:
- the target position is determined according to the transformation matrix and the translation vector.
- the step of determining the transformation matrix and translation vector of the grid point according to the original position of the grid point, the start position and the end position includes:
- the transformation matrix and translation vector of the grid point are determined according to the weight, the start position and the end position.
- the step of determining the transformation matrix and translation vector of the grid point according to the weight, the starting point position and the ending point position includes:
- the transformation matrix and translation vector of the grid point are determined according to the optimized weight, the starting point position and the ending point position.
- the weight is calculated; where
- the weight is optimized, where ⁇ is the optimized weight coefficient, and ⁇ is the optimized weight offset.
- the method further includes:
- the drag point is in the first form after the first trigger operation, and the first form is displayed on the terminal screen; and/or,
- the drag point is in the second form after the second triggering operation, and the second form is displayed on the terminal screen.
- the first form and the second form are different states, and can be represented by different colors or different shapes.
- Figure 2a is a schematic structural diagram of a terminal-based image drag-and-drop implementation device provided by an embodiment of the disclosure.
- the terminal-based image drag-and-drop implementation device can be implemented as software or as a combination of software and hardware.
- the image drag deformation realization device may be integrated in a device in a terminal-based image drag deformation realization system, such as a terminal-based image drag deformation realization server or a terminal-based image drag deformation realization terminal device.
- the device includes: a drag point determination module 21, a drag deformation module 22, and an image display module 23. among them,
- the drag point determination module 21 is used to determine a drag point in the image to be deformed displayed on the terminal screen; the drag deformation module 22 is used to drag and deform the image according to the trigger operation of the drag point; image display The module 23 is used to display the deformed image on the terminal screen.
- the terminal may be a mobile terminal (for example, a smart phone, an iphone, a tablet computer) or a fixed terminal (for example, a desktop computer)
- a mobile terminal for example, a smart phone, an iphone, a tablet computer
- a fixed terminal for example, a desktop computer
- the image to be deformed may be a video face image.
- a face image can be collected as the image to be deformed through the camera function of the terminal device.
- the trigger operation includes, but is not limited to, a single-click operation, a double-click operation, and a drag operation.
- the drag point determination module 21 includes: a drag point display unit 211 and a drag point selection unit 212; wherein,
- the drag point display unit 211 is configured to display at least one drag point to be selected included in the image on the terminal screen;
- the drag point selection unit 212 is configured to use the selected drag point to be selected as the drag point according to the selection operation generated on the terminal screen.
- the drag deformation module 22 includes: a receiving unit 221, a drag point determination unit 222, and a drag deformation unit 223; wherein,
- the receiving unit 221 is configured to receive a trigger operation on the drag point
- the drag point determination unit 222 is configured to determine the position of the drag point according to the trigger operation, where the position includes a starting point and an ending point;
- the drag deformation unit 223 is configured to drag and deform the image to be deformed according to the start position and the end position.
- the receiving unit 221 is specifically configured to: receive a first trigger operation on the drag point, and determine the starting point of the drag point according to the first trigger operation of the drag point Position; receiving a second trigger operation on the drag point, and determine the end position of the drag point according to the second trigger operation on the drag point.
- the image display module 23 is specifically configured to: the drag point is in the first form after the first trigger operation, and display the first form on the terminal screen And/or, the drag point is in the second form after the second triggering operation, and the second form is displayed on the terminal screen.
- the drag point determination unit 222 includes: a drag point determination subunit and a drag point position determination subunit; wherein,
- the drag point determination subunit is configured to determine a template image corresponding to the image according to the first trigger operation of the drag point, and determine the drag point on the template image;
- the drag point position determination subunit is used to determine the position of the drag point mapped to the image to be deformed according to the position mapping relationship between the source key point on the template image and the target key point on the image to be deformed.
- the drag point position determination subunit is specifically configured to determine the drag point according to the position of the drag point on the template image, the position of the source key point, and the position of the target key point.
- the transformation matrix and translation vector of the drag point; and the location of the drag point mapped to the image to be deformed is determined according to the transformation matrix and translation vector.
- the drag point position determining subunit is specifically configured to determine the drag point and the source key point according to the position of the drag point on the template image and the position of the source key point
- the weight of the drag point; the transformation matrix and translation vector of the drag point are determined according to the weight, the position of the source key point, and the position of the target key point.
- the drag deformation unit 223 includes: a grid processing subunit, a target position determination subunit, and a drag deformation subunit; wherein,
- the grid processing subunit is used to perform grid processing on the image to be deformed to obtain at least one grid point;
- the target position determining subunit is used to determine the target position of the grid point according to the original position of the grid point, the start position and the end position;
- the drag deformation sub-unit is used to drag and deform the image to be deformed according to the target position, and display the deformed image.
- target position determining subunit is specifically configured to: determine the transformation matrix and translation vector of the grid point according to the original position of the grid point, the start position and the end position; The matrix and the translation vector determine the target position.
- target position determining subunit is specifically configured to: determine the weight of the grid point and the starting point of the drag point according to the original position of the grid point and the starting point position; according to the weight, The start position and the end position determine the transformation matrix and translation vector of the grid point.
- target position determining subunit is specifically configured to: perform optimization processing on the weight; and determine the transformation matrix and translation vector of the grid point according to the optimized weight, the starting point position, and the ending point position.
- FIG. 3 shows a schematic structural diagram of an electronic device suitable for implementing embodiments of the present disclosure.
- the electronic devices in the embodiments of the present disclosure may include, but are not limited to, mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablets), PMPs (portable multimedia players), vehicle-mounted terminals (such as Mobile terminals such as car navigation terminals) and fixed terminals such as digital TVs, desktop computers, etc.
- the electronic device shown in FIG. 3 is only an example, and should not bring any limitation to the function and scope of use of the embodiments of the present disclosure.
- the electronic device may include a processing device (such as a central processing unit, a graphics processor, etc.) 301, which may be loaded into a random access memory according to a program stored in a read-only memory (ROM) 302 or from a storage device 308 (RAM)
- the program in 303 executes various appropriate actions and processing.
- various programs and data required for the operation of the electronic device are also stored.
- the processing device 301, the ROM 302, and the RAM 303 are connected to each other through a bus 304.
- An input/output (I/O) interface 305 is also connected to the bus 304.
- the following devices can be connected to the I/O interface 305: including input devices 306 such as touch screens, touch pads, keyboards, mice, image sensors, microphones, accelerometers, gyroscopes, etc.; including, for example, liquid crystal displays (LCD), speakers, An output device 307 such as a vibrator; a storage device 308 such as a magnetic tape and a hard disk; and a communication device 309.
- the communication device 309 may allow the electronic device to perform wireless or wired communication with other devices to exchange data.
- FIG. 3 shows an electronic device with various devices, it should be understood that it is not required to implement or have all the devices shown. It may alternatively be implemented or provided with more or fewer devices.
- the process described above with reference to the flowchart can be implemented as a computer software program.
- the embodiments of the present disclosure include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart.
- the computer program may be downloaded and installed from the network through the communication device 309, or installed from the storage device 308, or installed from the ROM 302.
- the processing device 301 the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
- the aforementioned computer-readable medium in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two.
- the computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable Programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above.
- a computer-readable storage medium may be any tangible medium that contains or stores a program, and the program may be used by or in combination with an instruction execution system, apparatus, or device.
- a computer-readable signal medium may include a data signal propagated in a baseband or as a part of a carrier wave, and a computer-readable program code is carried therein. This propagated data signal can take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing.
- the computer-readable signal medium may also be any computer-readable medium other than the computer-readable storage medium.
- the computer-readable signal medium may send, propagate, or transmit the program for use by or in combination with the instruction execution system, apparatus, or device .
- the program code contained on the computer-readable medium can be transmitted by any suitable medium, including but not limited to: wire, optical cable, RF (Radio Frequency), etc., or any suitable combination of the above.
- the above-mentioned computer-readable medium may be included in the above-mentioned electronic device; or it may exist alone without being assembled into the electronic device.
- the above-mentioned computer-readable medium carries one or more programs.
- the electronic device When the above-mentioned one or more programs are executed by the electronic device, the electronic device is caused to determine the position of the drag point in the image to be deformed, and the drag point includes Drag start point and drag end point; drag and deform the image to be deformed according to the position of the drag start point and the position of the drag end point.
- the computer program code used to perform the operations of the present disclosure may be written in one or more programming languages or a combination thereof.
- the above-mentioned programming languages include object-oriented programming languages—such as Java, Smalltalk, C++, and also conventional Procedural programming language-such as "C" language or similar programming language.
- the program code can be executed entirely on the user's computer, partly on the user's computer, executed as an independent software package, partly on the user's computer and partly executed on a remote computer, or entirely executed on the remote computer or server.
- the remote computer can be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (for example, using an Internet service provider to pass Internet connection).
- LAN local area network
- WAN wide area network
- each block in the flowchart or block diagram can represent a module, program segment, or part of code, and the module, program segment, or part of code contains one or more for realizing the specified logic function Executable instructions.
- the functions marked in the block may also occur in a different order from the order marked in the drawings. For example, two blocks shown in succession can actually be executed substantially in parallel, or they can sometimes be executed in the reverse order, depending on the functions involved.
- each block in the block diagram and/or flowchart, and the combination of the blocks in the block diagram and/or flowchart can be implemented by a dedicated hardware-based system that performs the specified functions or operations Or it can be realized by a combination of dedicated hardware and computer instructions.
- the units involved in the embodiments described in the present disclosure can be implemented in software or hardware. Among them, the name of the unit does not constitute a limitation on the unit itself under certain circumstances.
Landscapes
- Engineering & Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Human Computer Interaction (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- User Interface Of Digital Computer (AREA)
- Processing Or Creating Images (AREA)
Abstract
一种基于终端的图像拖拽变形实现方法、装置、电子设备和计算机可读存储介质。其中该基于终端的图像拖拽变形实现方法包括:在终端屏幕上显示的待变形图像中确定拖拽点(S1);根据拖拽点的触发操作对图像进行拖拽变形;将变形后的图像显示在终端屏幕上(S3)。所述方法解决了现有技术中图像形变不能由用户自由控制、不能达到用户想要的形变效果、可控性较差的技术问题。
Description
相关申请的交叉引用
本申请要求于2019年01月31日提交的,申请号为201910100528.9、发明名称为“基于终端的图像拖拽变形实现方法和装置”的中国专利申请的优先权,该申请的全文通过引用结合在本申请中。
本公开涉及图像处理技术领域,尤其涉及一种基于终端的图像拖拽变形实现方法、装置、电子设备及计算机可读存储介质。
随着计算机软件技术的飞速发展,大大丰富了各种互联网终端的功能,例如可以通过终端拍照、录视频等。图像变形作为一种新科技,也将被广泛应用在终端中。
具体的,图像变形是图像处理中的一个常见方法,它是指按一定的规则或方法将一幅图像变为另一幅。它可以用于娱乐、人脸变形等,例如对于一些给定的人脸图像让它产生喜,怒,哀,乐等复杂的表情变化。
而在现有技术中,通常是在终端中给出固定的形变,终端根据该固定的形变通过图像传感器对原图像进行变形,然后显示出来。但是,这种方法无法使用户自由的对图像进行形变,及达到用户想要的形变效果,图像形变的可控性较差。
发明内容
第一方面,本公开实施例提供一种基于终端的图像拖拽变形实现方法,包括:在终端屏幕上显示的待变形图像中确定拖拽点;根据所述拖拽点的触发操作对所述待变形图像进行拖拽变形;将变形后的图像显示在所述终端屏幕上。
进一步的,所述在终端屏幕上显示的待变形图像中确定拖拽点,包括:
在所述终端屏幕上显示所述待变形图像中包含的至少一个待选拖拽点;
根据在所述终端屏幕上产生的选中操作,将选中的待选拖拽点作为所述拖拽 点。
进一步的,所述根据所述拖拽点的触发操作对所述待变形图像进行拖拽变形,包括:
接收对所述拖拽点的触发操作;
根据所述触发操作确定所述拖拽点的位置,所述位置包括起点位置和终点位置;
根据所述起点位置和所述终点位置对所述待变形图像进行拖拽变形。
进一步的,所述接收对所述拖拽点的触发操作,包括:
接收对所述拖拽点的第一触发操作,根据所述拖拽点的第一触发操作确定所述拖拽点的起点位置;
接收对所述拖拽点的第二触发操作,根据所述拖拽点的第二触发操作确定所述拖拽点的终点位置。
进一步的,所述方法还包括:
所述拖拽点在所述第一触发操作后处于第一形态,并在所述终端屏幕上显示所述第一形态;和/或,
所述拖拽点在所述第二触发操作后处于第二形态,并在所述终端屏幕上显示所述第二形态。
进一步的,所述根据所述触发操作确定所述拖拽点的位置,包括:
根据所述拖拽点的第一触发操作确定所述图像对应的模板图像,在所述模板图像上确定所述拖拽点;
根据所述模板图像上的源关键点和待变形图像上的目标关键点的位置映射关系,确定所述拖拽点映射到所述待变形图像上的位置。
进一步的,所述根据所述模板图像上的源关键点和待变形图像上的目标关键点的位置映射关系,确定所述拖拽点映射到所述待变形图像上的位置,包括:
根据所述拖拽点在所述模板图像上的位置、所述源关键点的位置、所述目标关键点的位置确定所述拖拽点的变换矩阵和平移向量;
根据所述变换矩阵和平移向量确定所述拖拽点映射到所述待变形图像上的位置。
进一步的,所述根据所述拖拽点在所述模板图像上的位置、所述源关键点的位置、所述目标关键点的位置确定所述拖拽点的变换矩阵和平移向量,包括:
根据所述拖拽点在所述模板图像上的位置和所述源关键点的位置确定所述拖拽点与所述源关键点的权重;
根据所述权重、所述源关键点的位置、所述目标关键点的位置确定所述拖拽点的变换矩阵和平移向量。
进一步的,所述根据所述起点位置和所述终点位置对所述待变形图像进行拖拽变形,包括:
对所述待变形图像进行网格化处理,得到至少一个网格点;
根据所述网格点的原始位置、所述起点位置和所述终点位置确定所述网格点的目标位置;
根据所述目标位置对所述待变形图像进行拖拽变形,并显示变形后的图像。
进一步的,所述根据所述网格点的原始位置、所述起点位置和所述终点位置确定所述网格点的目标位置,包括:
根据所述网格点的原始位置、所述起点位置和所述终点位置确定所述网格点的变换矩阵和平移向量;
根据所述变换矩阵和所述平移向量确定所述目标位置。
进一步的,所述根据所述网格点的原始位置、所述起点位置和所述终点位置确定所述网格点的变换矩阵和平移向量,包括:
根据所述网格点的原始位置和所述起点位置确定所述网格点与所述拖拽点的起点的权重;
根据所述权重、所述起点位置和所述终点位置确定所述网格点的变换矩阵和平移向量。
进一步的,所述根据所述权重、所述起点位置和所述终点位置确定所述网格点的变换矩阵和平移向量,包括:
对所述权重进行优化处理;
根据优化后的权重、所述起点位置和所述终点位置确定所述网格点的变换矩阵和平移向量。
进一步的,所述待变形图像为视频人脸图像。
第二方面,本公开实施例提供一种基于终端的图像拖拽变形实现装置,包括:拖拽点确定模块,用于在终端屏幕上显示的待变形图像中确定拖拽点;拖拽变形模块,用于根据所述拖拽点的触发操作对所述图像进行拖拽变形;图像显示模块,用于将变形后的图像显示在所述终端屏幕上。
进一步的,所述拖拽点确定模块包括:
拖拽点显示单元,用于在所述终端屏幕上显示所述图像中包含的至少一个待选拖拽点;
拖拽点选择单元,用于根据在所述终端屏幕上产生的选中操作,将选中的待选拖拽点作为所述拖拽点。
进一步的,所述拖拽变形模块包括:
接收单元,用于接收对所述拖拽点的触发操作;
拖拽点确定单元,用于根据所述触发操作确定所述拖拽点的位置,所述位置包括起点位置和终点位置;
拖拽变形单元,用于根据所述起点位置和所述终点位置对所述待变形图像进行拖拽变形。
进一步的,所述接收单元具体用于:接收对所述拖拽点的第一触发操作,根据所述拖拽点的第一触发操作确定所述拖拽点的起点位置;接收对所述拖拽点的第二触发操作,根据所述拖拽点的第二触发操作确定所述拖拽点的终点位置。
进一步的,所述图像显示模块具体用于:所述拖拽点在所述第一触发操作后处于第一形态,并在所述终端屏幕上显示所述第一形态;和/或,所述拖拽点在所述第二触发操作后处于第二形态,并在所述终端屏幕上显示所述第二形态。
进一步的,所述拖拽点确定单元包括:
拖拽点确定子单元,用于根据所述拖拽点的第一触发操作确定所述图像对应的模板图像,在所述模板图像上确定所述拖拽点;
拖拽点位置确定子单元,用于根据所述模板图像上的源关键点和待变形图像上的目标关键点的位置映射关系,确定所述拖拽点映射到所述待变形图像上的位置。
进一步的,所述拖拽点位置确定子单元具体用于:根据所述拖拽点在所述模 板图像上的位置、所述源关键点的位置、所述目标关键点的位置确定所述拖拽点的变换矩阵和平移向量;根据所述变换矩阵和平移向量确定所述拖拽点映射到所述待变形图像上的位置。
进一步的,所述拖拽点位置确定子单元具体用于:根据所述拖拽点在所述模板图像上的位置和所述源关键点的位置确定所述拖拽点与所述源关键点的权重;根据所述权重、所述源关键点的位置、所述目标关键点的位置确定所述拖拽点的变换矩阵和平移向量。
进一步的,所述拖拽变形单元包括:
网格处理子单元,用于对所述待变形图像进行网格化处理,得到至少一个网格点;
目标位置确定子单元,用于根据所述网格点的原始位置、所述起点位置和所述终点位置确定所述网格点的目标位置;
拖拽变形子单元,用于根据所述目标位置对所述待变形图像进行拖拽变形,并显示变形后的图像。
进一步的,所述目标位置确定子单元具体用于:根据所述网格点的原始位置、所述起点位置和所述终点位置确定所述网格点的变换矩阵和平移向量;根据所述变换矩阵和所述平移向量确定所述目标位置。
进一步的,所述目标位置确定子单元具体用于:根据所述网格点的原始位置和所述起点位置确定所述网格点与所述拖拽点的起点的权重;根据所述权重、所述起点位置和所述终点位置确定所述网格点的变换矩阵和平移向量。
进一步的,所述目标位置确定子单元具体用于:对所述权重进行优化处理;根据优化后的权重、所述起点位置和所述终点位置确定所述网格点的变换矩阵和平移向量。
进一步的,所述待变形图像为视频人脸图像。
第三方面,本公开实施例提供一种电子设备,包括:至少一个处理器;以及,
与所述至少一个处理器通信连接的存储器;其中,所述存储器存储有能被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行前述第一方面中的任一所述基于终端的图像拖拽变形实现方法。
第四方面,本公开实施例提供一种非暂态计算机可读存储介质,其特征在于, 该非暂态计算机可读存储介质存储计算机指令,该计算机指令用于使计算机执行前述第一方面中的任一所述基于终端的图像拖拽变形实现方法。
本公开公开了一种基于终端的图像拖拽变形实现方法、装置、电子设备和计算机可读存储介质。其中该基于终端的图像拖拽变形实现方法包括:在终端屏幕上显示的待变形图像中确定拖拽点;根据拖拽点的触发操作对图像进行拖拽变形;将变形后的图像显示在终端屏幕上。本公开实施例通过在终端屏幕上显示的待变形图像中确定拖拽点,根据拖拽点的触发操作对图像进行拖拽变形,并将变形后的图像显示在终端屏幕上,解决了现有技术中图像形变不能由用户自由控制、不能达到用户想要的形变效果、可控性较差的技术问题。
上述说明仅是本公开技术方案的概述,为了能更清楚了解本公开的技术手段,而可依照说明书的内容予以实施,并且为让本公开的上述和其他目的、特征和优点能够更明显易懂,以下特举较佳实施例,并配合附图,详细说明如下。
为了更清楚地说明本公开实施例的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本公开的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其它的附图。
图1a为本公开实施例提供的基于终端的图像拖拽变形实现方法的流程图;
图1b为本公开另一实施例提供的基于终端的图像拖拽变形实现方法的流程图;
图1c为本公开实施例提供的基于终端的图像拖拽变形实现方法中的待选拖拽点实现示意图;
图1d为本公开另一实施例提供的基于终端的图像拖拽变形实现方法的流程图;
图1e为本公开另一实施例提供的基于终端的图像拖拽变形实现方法的流程图;
图2a为本公开实施例提供的基于终端的图像拖拽变形实现装置的结构示意图;
图2b为本公开实施例提供的基于终端的图像拖拽变形实现装置的结构示意 图
图2c为本公开另一实施例提供的基于终端的图像拖拽变形实现装置的结构示意图;
图3为根据本公开实施例提供的电子设备的结构示意图。
以下通过特定的具体实例说明本公开的实施方式,本领域技术人员可由本说明书所揭露的内容轻易地了解本公开的其他优点与功效。显然,所描述的实施例仅仅是本公开一部分实施例,而不是全部的实施例。本公开还可以通过另外不同的具体实施方式加以实施或应用,本说明书中的各项细节也可以基于不同观点与应用,在没有背离本公开的精神下进行各种修饰或改变。需说明的是,在不冲突的情况下,以下实施例及实施例中的特征可以相互组合。基于本公开中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本公开保护的范围。
需要说明的是,下文描述在所附权利要求书的范围内的实施例的各种方面。应显而易见,本文中所描述的方面可体现于广泛多种形式中,且本文中所描述的任何特定结构及/或功能仅为说明性的。基于本公开,所属领域的技术人员应了解,本文中所描述的一个方面可与任何其它方面独立地实施,且可以各种方式组合这些方面中的两者或两者以上。举例来说,可使用本文中所阐述的任何数目个方面来实施设备及/或实践方法。另外,可使用除了本文中所阐述的方面中的一或多者之外的其它结构及/或功能性实施此设备及/或实践此方法。
还需要说明的是,以下实施例中所提供的图示仅以示意方式说明本公开的基本构想,图式中仅显示与本公开中有关的组件而非按照实际实施时的组件数目、形状及尺寸绘制,其实际实施时各组件的型态、数量及比例可为一种随意的改变,且其组件布局型态也可能更为复杂。
另外,在以下描述中,提供具体细节是为了便于透彻理解实例。然而,所属领域的技术人员将理解,可在没有这些特定细节的情况下实践所述方面。
图1a为本公开实施例提供的基于终端的图像拖拽变形实现方法的流程图,本实施例提供的该基于终端的图像拖拽变形实现方法可以由一基于终端的图像拖拽变形实现装置来执行,该基于终端的图像拖拽变形实现装置可以实现为软件,或者实现为软件和硬件的组合,该基于终端的图像拖拽变形实现装置可以集成设 置在基于终端的图像拖拽变形实现系统中的某设备中,比如基于终端的图像拖拽变形实现服务器或者基于终端的图像拖拽变形实现终端设备中。如图1a所示,该方法包括如下步骤:
步骤S1,在终端屏幕上显示的待变形图像中确定拖拽点;
其中,所述终端可以为移动终端(例如,智能手机、iphone、平板电脑)或固定终端(例如,台式电脑)
其中,所述待变形图像可以为视频人脸图像。例如,可通过终端设备的摄像功能采集人脸图像作为所述待变形图像。
步骤S2:在终端屏幕上显示的待变形图像中确定拖拽点;
其中,触发操作包括但不限于单击操作、双击操作、拖拽操作等。
步骤S3:将变形后的图像显示在所述终端屏幕上。
本实施例通过在终端屏幕上显示的待变形图像中确定拖拽点,根据拖拽点的触发操作对图像进行拖拽变形,并将变形后的图像显示在终端屏幕上,解决了现有技术中图像形变不能由用户自由控制、不能达到用户想要的形变效果、可控性较差的技术问题。
在一个可选的实施例中,如图1b所示,步骤S1包括:
步骤S11:在所述终端屏幕上显示所述待变形图像中包含的至少一个待选拖拽点;
具体的,以所述待变形图像为人脸图像为例,如图1c所示,其中所述白点为待变形图像中包含的待选拖拽点。
步骤S12:根据在所述终端屏幕上产生的选中操作,将选中的待选拖拽点作为所述拖拽点。
在一个可选的实施例中,如图1d所示,步骤S2包括:
步骤S21:接收对所述拖拽点的触发操作;
步骤S22:根据所述触发操作确定所述拖拽点的位置,所述位置包括起点位置和终点位置;
步骤S23:根据所述起点位置和所述终点位置对所述待变形图像进行拖拽变形。
具体的,在确定了所述起点位置和所述终点位置之后,将所述拖拽点对应在待变形图像的像素点从所述起点位置移动至所述终点位置,从而实现图像的变形。
在一个可选的实施例中,如图1e所示,步骤S21包括:
步骤S211:接收对所述拖拽点的第一触发操作,根据所述拖拽点的第一触发操作确定所述拖拽点的起点位置;
步骤S212:接收对所述拖拽点的第二触发操作,根据所述拖拽点的第二触发操作确定所述拖拽点的终点位置。
其中,在时序上第一触发操作先于第二触发操作。
在一个可选的实施例中,步骤S22包括:
步骤S221:根据所述触发操作确定所述待变形图像对应的模板图像,在所述模板图像上确定所述拖拽点;
具体的,所述拖拽点包括拖拽起点和拖拽终点,基于上述图1e所示的实施例,本步骤包括:根据第一触发操作获取拖拽起点对应的模板图像,根据第二触发操作获取拖拽终点对应的模板图像。
步骤S222:根据所述模板图像上的源关键点和待变形图像上的目标关键点的位置映射关系,确定所述拖拽点映射到所述待变形图像上的位置。
在该实施例中,所述模板图像为预先设定与所述待变形图像相关联的图像,例如人脸正面图像。可选择所述模板图像上的任意像素点作为所述拖拽点。
所述源关键点为模板图像上的像素点,具体可以为所述模板图像上的所有像素点,或者选取的预设个数像素点。所述目标关键点为所述待变形图像上的关键点,具体可以为所述模板图像上的所有像素点,或者选取的预设个数像素点。且所述源关键点和所述目标关键点的个数相同,且为两幅图像中均包含的相同特征的像素点。该关键点可由用户自定义设置,或者通过机器算法学习得到,具体像素点的个数可自定义设置,例如为106个。当像素点为选取的预设个数像素点时,可以有效减少计算量。
由于模板图像上的像素点与待变形图像上的像素点存在一定的位置关系,所以通过所述源关键点与所述目标关键点的位置映射关系,可以确定所述拖拽点映射到所述待变形图像上的位置。
进一步的,步骤S222包括:
根据所述拖拽点的位置、所述源关键点的位置、所述目标关键点的位置确定所述拖拽点的变换矩阵和平移向量;
根据所述变换矩阵和平移向量确定所述拖拽点映射到所述待变形图像上的位置。
进一步的,步骤根据所述拖拽点的位置、所述源关键点的位置、所述目标关键点的位置确定所述拖拽点的变换矩阵和平移向量,包括:
根据所述拖拽点的位置和所述源关键点的位置确定所述拖拽点与所述源关键点的权重;
根据所述权重、所述源关键点的位置、所述目标关键点的位置确定所述拖拽点的变换矩阵和平移向量。
进一步的,可以根据公式
计算得到所述权重;其中,|·|表示绝对值,w
ij为第j个拖拽点与第i个源关键点的权重,p
i为第i个源关键点的坐标,v
j为第j个拖拽点的坐标,α为权重衰减系数。或者,为了实现图像变形更为平滑,可以采用以下公式对权重进行优化,使用优化后的权重定位所述拖拽点的位置:
其中,γ为优化权重系数,β为优化权重偏移量。
进一步的,可以根据目标函数
求解得到所述变换矩阵和平移向量;其中,argmin为求最大值函数,Σ·为求和,M
j为第j个拖拽点的变换矩阵,T
j为第j个拖拽点的平移向量,q
i为第i个目标关键点的坐标。
进一步的,可以根据公式f
α(v
j)=v
jM
j+T
j计算得到所述拖拽点映射到所述待变形图像上的坐标,其中,f
α(v
j)为第j个拖拽点映射到所述待变形图像上的坐标。
在一个可选的实施例中,步骤S23包括:
步骤S231:对所述待变形图像进行网格化处理,得到至少一个网格点;
步骤S232:根据所述网格点的原始位置、所述起点位置和所述终点位置确定所述网格点的目标位置;
步骤S233:根据所述目标位置对所述待变形图像进行拖拽变形,并显示变形后的图像。
进一步的,步骤S232包括:
根据所述网格点的原始位置、所述起点位置和所述终点位置确定所述网格点的变换矩阵和平移向量;
根据所述变换矩阵和所述平移向量确定所述目标位置。
进一步的,步骤所述根据所述网格点的原始位置、所述起点位置和所述终点位置确定所述网格点的变换矩阵和平移向量,包括:
根据所述网格点的原始位置和所述起点位置确定所述网格点与所述拖拽点的起点的权重;
根据所述权重、所述起点位置和所述终点位置确定所述网格点的变换矩阵和平移向量。
进一步的,步骤所述根据所述权重、所述起点位置和所述终点位置确定所述网格点的变换矩阵和平移向量,包括:
对所述权重进行优化处理;
根据优化后的权重、所述起点位置和所述终点位置确定所述网格点的变换矩阵和平移向量。
进一步的,可以根据目标函数
和约束条件M
j
TM
j=λ
2I求解得到所述变换矩阵和平移向量;其中,arg min为求最大值函数,Σ·为求和,M
j为第j个网格点的变换矩阵,T
j为第j个网格点的平移向量,q
i为第i个拖拽终点的坐标,T为矩阵转置,λ为数值,I为单位矩阵。
进一步的,可以根据公式f
α(v
j)=v
jM
j+T
j计算得到所述网格点的目标位置坐标,其中,f
α(v
j)为第j个网格点的目标位置坐标。
在一个可选的实施例中,所述方法还包括:
所述拖拽点在所述第一触发操作后处于第一形态,并在所述终端屏幕上显示所述第一形态;和/或,
所述拖拽点在所述第二触发操作后处于第二形态,并在所述终端屏幕上显示所述第二形态。
其中,第一形态和第二形态为不同的状态,可以采用不同的颜色、或不同的形状进行表示。
图2a为本公开实施例提供的基于终端的图像拖拽变形实现装置的结构示意图,该基于终端的图像拖拽变形实现装置可以实现为软件,或者实现为软件和硬件的组合,该基于终端的图像拖拽变形实现装置可以集成设置在基于终端的图像拖拽变形实现系统中的某设备中,比如基于终端的图像拖拽变形实现服务器或者基于终端的图像拖拽变形实现终端设备中。如图2a所示,该装置包括:拖拽点确定模块21、拖拽变形模块22和图像显示模块23。其中,
拖拽点确定模块21用于在终端屏幕上显示的待变形图像中确定拖拽点;拖拽变形模块22用于根据所述拖拽点的触发操作对所述图像进行拖拽变形;图像显示模块23用于将变形后的图像显示在所述终端屏幕上。
其中,所述终端可以为移动终端(例如,智能手机、iphone、平板电脑)或固定终端(例如,台式电脑)
其中,所述待变形图像可以为视频人脸图像。例如,可通过终端设备的摄像功能采集人脸图像作为所述待变形图像。
其中,触发操作包括但不限于单击操作、双击操作、拖拽操作等。
在一个可选的实施例中,如图2b所示,所述拖拽点确定模块21包括:拖拽点显示单元211和拖拽点选择单元212;其中,
拖拽点显示单元211用于在所述终端屏幕上显示所述图像中包含的至少一个待选拖拽点;
拖拽点选择单元212用于根据在所述终端屏幕上产生的选中操作,将选中的待选拖拽点作为所述拖拽点。
在一个可选的实施例中,如图2c所示,所述拖拽变形模块22包括:接收单元221、拖拽点确定单元222和拖拽变形单元223;其中,
接收单元221用于接收对所述拖拽点的触发操作;
拖拽点确定单元222用于根据所述触发操作确定所述拖拽点的位置,所述位置包括起点位置和终点位置;
拖拽变形单元223用于根据所述起点位置和所述终点位置对所述待变形图像进行拖拽变形。
在一个可选的实施例中,所述接收单元221具体用于:接收对所述拖拽点的第一触发操作,根据所述拖拽点的第一触发操作确定所述拖拽点的起点位置;接收对所述拖拽点的第二触发操作,根据所述拖拽点的第二触发操作确定所述拖拽点的终点位置。
在一个可选的实施例中,所述图像显示模块23具体用于:所述拖拽点在所述第一触发操作后处于第一形态,并在所述终端屏幕上显示所述第一形态;和/或,所述拖拽点在所述第二触发操作后处于第二形态,并在所述终端屏幕上显示所述第二形态。
在一个可选的实施例中,所述拖拽点确定单元222包括:拖拽点确定子单元和拖拽点位置确定子单元;其中,
拖拽点确定子单元用于根据所述拖拽点的第一触发操作确定所述图像对应的模板图像,在所述模板图像上确定所述拖拽点;
拖拽点位置确定子单元用于根据所述模板图像上的源关键点和待变形图像上的目标关键点的位置映射关系,确定所述拖拽点映射到所述待变形图像上的位置。
进一步的,所述拖拽点位置确定子单元具体用于:根据所述拖拽点在所述模板图像上的位置、所述源关键点的位置、所述目标关键点的位置确定所述拖拽点的变换矩阵和平移向量;根据所述变换矩阵和平移向量确定所述拖拽点映射到所述待变形图像上的位置。
进一步的,所述拖拽点位置确定子单元具体用于:根据所述拖拽点在所述模板图像上的位置和所述源关键点的位置确定所述拖拽点与所述源关键点的权重;根据所述权重、所述源关键点的位置、所述目标关键点的位置确定所述拖拽点的变换矩阵和平移向量。
进一步的,所述拖拽变形单元223包括:网格处理子单元、目标位置确定子单元和拖拽变形子单元;其中,
网格处理子单元用于对所述待变形图像进行网格化处理,得到至少一个网格点;
目标位置确定子单元用于根据所述网格点的原始位置、所述起点位置和所述终点位置确定所述网格点的目标位置;
拖拽变形子单元用于根据所述目标位置对所述待变形图像进行拖拽变形,并显示变形后的图像。
进一步的,所述目标位置确定子单元具体用于:根据所述网格点的原始位置、所述起点位置和所述终点位置确定所述网格点的变换矩阵和平移向量;根据所述变换矩阵和所述平移向量确定所述目标位置。
进一步的,所述目标位置确定子单元具体用于:根据所述网格点的原始位置和所述起点位置确定所述网格点与所述拖拽点的起点的权重;根据所述权重、所述起点位置和所述终点位置确定所述网格点的变换矩阵和平移向量。
进一步的,所述目标位置确定子单元具体用于:对所述权重进行优化处理;根据优化后的权重、所述起点位置和所述终点位置确定所述网格点的变换矩阵和平移向量。
有关基于终端的图像拖拽变形实现装置实施例的工作原理、实现的技术效果等详细说明可以参考前述基于终端的图像拖拽变形实现方法实施例中的相关说明,在此不再赘述。
下面参考图3,其示出了适于用来实现本公开实施例的电子设备的结构示意图。本公开实施例中的电子设备可以包括但不限于诸如移动电话、笔记本电脑、数字广播接收器、PDA(个人数字助理)、PAD(平板电脑)、PMP(便携式多媒体播放器)、车载终端(例如车载导航终端)等等的移动终端以及诸如数字TV、台式计算机等等的固定终端。图3示出的电子设备仅仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。
如图3所示,电子设备可以包括处理装置(例如中央处理器、图形处理器等)301,其可以根据存储在只读存储器(ROM)302中的程序或者从存储装置308加载到随机访问存储器(RAM)303中的程序而执行各种适当的动作和处理。在RAM303中,还存储有电子设备操作所需的各种程序和数据。处理装置301、ROM 302以及RAM 303通过总线304彼此相连。输入/输出(I/O)接口305也连接至总线304。
通常,以下装置可以连接至I/O接口305:包括例如触摸屏、触摸板、键盘、鼠标、图像传感器、麦克风、加速度计、陀螺仪等的输入装置306;包括例如液晶显示器(LCD)、扬声器、振动器等的输出装置307;包括例如磁带、硬盘等的存储装置308;以及通信装置309。通信装置309可以允许电子设备与其他设备进行无线或有线通信以交换数据。虽然图3示出了具有各种装置的电子设备,但是应理解的是,并不要求实施或具备所有示出的装置。可以替代地实施或具备更多或更少的装置。
特别地,根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信装置309从网络上被下载和安装,或者从存储装置308被安装,或者从ROM 302被安装。在该计算机程序被处理装置301执行时,执行本公开实施例的方法中限定的上述功能。
需要说明的是,本公开上述的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本公开中,计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读信号介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:电线、光缆、RF(射频)等等,或者上述的任意合适的组合。
上述计算机可读介质可以是上述电子设备中所包含的;也可以是单独存在,而未装配入该电子设备中。
上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该电子设备执行时,使得该电子设备:确定拖拽点在待变形图像中的位置,所述拖拽点包括拖拽起点和拖拽终点;根据所述拖拽起点的位置和所述拖拽终点的位置对所述待变形图像进行拖拽变形。
可以以一种或多种程序设计语言或其组合来编写用于执行本公开的操作的计算机程序代码,上述程序设计语言包括面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。
附图中的流程图和框图,图示了按照本公开各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。
描述于本公开实施例中所涉及到的单元可以通过软件的方式实现,也可以通过硬件的方式来实现。其中,单元的名称在某种情况下并不构成对该单元本身的限定。
以上描述仅为本公开的较佳实施例以及对所运用技术原理的说明。本领域技术人员应当理解,本公开中所涉及的公开范围,并不限于上述技术特征的特定组合而成的技术方案,同时也应涵盖在不脱离上述公开构思的情况下,由上述技术特征或其等同特征进行任意组合而形成的其它技术方案。例如上述特征与本公开中公开的(但不限于)具有类似功能的技术特征进行互相替换而形成的技术方案。
Claims (16)
- 一种基于终端的图像拖拽变形实现方法,其特征在于,包括:在终端屏幕上显示的待变形图像中确定拖拽点;根据所述拖拽点的触发操作对所述待变形图像进行拖拽变形;将变形后的图像显示在所述终端屏幕上。
- 根据权利要求1所述的图像拖拽变形实现方法,其特征在于,所述在终端屏幕上显示的待变形图像中确定拖拽点,包括:在所述终端屏幕上显示所述待变形图像中包含的至少一个待选拖拽点;根据在所述终端屏幕上产生的选中操作,将选中的待选拖拽点作为所述拖拽点。
- 根据权利要求1所述的图像拖拽变形实现方法,其特征在于,所述根据所述拖拽点的触发操作对所述待变形图像进行拖拽变形,包括:接收对所述拖拽点的触发操作;根据所述触发操作确定所述拖拽点的位置,所述位置包括起点位置和终点位置;根据所述起点位置和所述终点位置对所述待变形图像进行拖拽变形。
- 根据权利要求3所述的图像拖拽变形实现方法,其特征在于,所述接收对所述拖拽点的触发操作,包括:接收对所述拖拽点的第一触发操作,根据所述拖拽点的第一触发操作确定所述拖拽点的起点位置;接收对所述拖拽点的第二触发操作,根据所述拖拽点的第二触发操作确定所述拖拽点的终点位置。
- 根据权利要求4所述的图像拖拽变形实现方法,其特征在于,所述方法还包括:所述拖拽点在所述第一触发操作后处于第一形态,并在所述终端屏幕上显示所述第一形态;和/或,所述拖拽点在所述第二触发操作后处于第二形态,并在所述终端屏幕上显示 所述第二形态。
- 根据权利要求4所述的图像拖拽变形实现方法,其特征在于,所述根据所述触发操作确定所述拖拽点的位置,包括:根据所述拖拽点的第一触发操作确定所述图像对应的模板图像,在所述模板图像上确定所述拖拽点;根据所述模板图像上的源关键点和待变形图像上的目标关键点的位置映射关系,确定所述拖拽点映射到所述待变形图像上的位置。
- 如权利要求6所述的图像拖拽变形实现方法,其特征在于,所述根据所述模板图像上的源关键点和待变形图像上的目标关键点的位置映射关系,确定所述拖拽点映射到所述待变形图像上的位置,包括:根据所述拖拽点在所述模板图像上的位置、所述源关键点的位置、所述目标关键点的位置确定所述拖拽点的变换矩阵和平移向量;根据所述变换矩阵和平移向量确定所述拖拽点映射到所述待变形图像上的位置。
- 如权利要求7所述的图像拖拽变形实现方法,其特征在于,所述根据所述拖拽点在所述模板图像上的位置、所述源关键点的位置、所述目标关键点的位置确定所述拖拽点的变换矩阵和平移向量,包括:根据所述拖拽点在所述模板图像上的位置和所述源关键点的位置确定所述拖拽点与所述源关键点的权重;根据所述权重、所述源关键点的位置、所述目标关键点的位置确定所述拖拽点的变换矩阵和平移向量。
- 根据权利要求3所述的基于终端的图像拖拽变形实现方法,其特征在于,所述根据所述起点位置和所述终点位置对所述待变形图像进行拖拽变形,包括:对所述待变形图像进行网格化处理,得到至少一个网格点;根据所述网格点的原始位置、所述起点位置和所述终点位置确定所述网格点的目标位置;根据所述目标位置对所述待变形图像进行拖拽变形,并显示变形后的图像。
- 如权利要求9所述的基于终端的图像拖拽变形实现方法,其特征在于,所述根据所述网格点的原始位置、所述起点位置和所述终点位置确定所述网格点 的目标位置,包括:根据所述网格点的原始位置、所述起点位置和所述终点位置确定所述网格点的变换矩阵和平移向量;根据所述变换矩阵和所述平移向量确定所述目标位置。
- 如权利要求10所述的基于终端的图像拖拽变形实现方法,其特征在于,所述根据所述网格点的原始位置、所述起点位置和所述终点位置确定所述网格点的变换矩阵和平移向量,包括:根据所述网格点的原始位置和所述起点位置确定所述网格点与所述拖拽点的起点的权重;根据所述权重、所述起点位置和所述终点位置确定所述网格点的变换矩阵和平移向量。
- 如权利要求11所述的基于终端的图像拖拽变形实现方法,其特征在于,所述根据所述权重、所述起点位置和所述终点位置确定所述网格点的变换矩阵和平移向量,包括:对所述权重进行优化处理;根据优化后的权重、所述起点位置和所述终点位置确定所述网格点的变换矩阵和平移向量。
- 如权利要求1-12任一项所述的基于终端的图像拖拽变形实现方法,其特征在于,所述待变形图像为视频人脸图像。
- 一种基于终端的图像拖拽变形实现装置,其特征在于,包括:拖拽点确定模块,用于在终端屏幕上显示的待变形图像中确定拖拽点;拖拽变形模块,用于根据所述拖拽点的触发操作对所述待变形图像进行拖拽变形;图像显示模块,用于将变形后的图像显示在所述终端屏幕上。
- 一种电子设备,包括:存储器,用于存储非暂时性计算机可读指令;以及处理器,用于运行所述计算机可读指令,使得所述处理器执行时实现根据权利要求1-13中任意一项所述的基于终端的图像拖拽变形实现方法。
- 一种计算机可读存储介质,用于存储非暂时性计算机可读指令,当所述非暂时性计算机可读指令由计算机执行时,使得所述计算机执行权利要求1-13中任意一项所述的基于终端的图像拖拽变形实现方法。
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201910100528.9 | 2019-01-31 | ||
| CN201910100528.9A CN110069191B (zh) | 2019-01-31 | 2019-01-31 | 基于终端的图像拖拽变形实现方法和装置 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2020156058A1 true WO2020156058A1 (zh) | 2020-08-06 |
Family
ID=67366116
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2020/070738 Ceased WO2020156058A1 (zh) | 2019-01-31 | 2020-01-07 | 基于终端的图像拖拽变形实现方法和装置 |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN110069191B (zh) |
| WO (1) | WO2020156058A1 (zh) |
Families Citing this family (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN110069191B (zh) * | 2019-01-31 | 2021-03-30 | 北京字节跳动网络技术有限公司 | 基于终端的图像拖拽变形实现方法和装置 |
| CN110837332A (zh) | 2019-11-13 | 2020-02-25 | 北京字节跳动网络技术有限公司 | 面部图像变形方法、装置、电子设备和计算机可读介质 |
| CN111199512B (zh) * | 2019-12-24 | 2023-08-15 | 远光软件股份有限公司 | Svg矢量图形的调整方法、装置、存储介质及终端 |
| CN113986105B (zh) * | 2020-07-27 | 2024-05-31 | 北京达佳互联信息技术有限公司 | 人脸图像的变形方法、装置、电子设备及存储介质 |
| CN112258653A (zh) * | 2020-10-28 | 2021-01-22 | 北京字跳网络技术有限公司 | 弹性对象的渲染方法、装置、设备及存储介质 |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20080192049A1 (en) * | 2007-02-13 | 2008-08-14 | Thomas Schiwietz | Image deformation using physical models |
| CN105184735A (zh) * | 2014-06-19 | 2015-12-23 | 腾讯科技(深圳)有限公司 | 一种人像变形方法及装置 |
| CN109003224A (zh) * | 2018-07-27 | 2018-12-14 | 北京微播视界科技有限公司 | 基于人脸的形变图像生成方法和装置 |
| CN110069191A (zh) * | 2019-01-31 | 2019-07-30 | 北京字节跳动网络技术有限公司 | 基于终端的图像拖拽变形实现方法和装置 |
Family Cites Families (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| KR100787977B1 (ko) * | 2006-03-30 | 2007-12-24 | 삼성전자주식회사 | 이동 단말기에서 사용자 데이터 크기 조절 장치 및 방법 |
| CN104077798B (zh) * | 2014-07-01 | 2017-05-03 | 中国科学技术大学 | 一种可形变物体的高真实感动画合成方法 |
| JP2016207197A (ja) * | 2015-04-15 | 2016-12-08 | 株式会社ウェブサービス・ディベロップメント | 情報処理装置、情報処理方法及び情報処理プログラム |
-
2019
- 2019-01-31 CN CN201910100528.9A patent/CN110069191B/zh active Active
-
2020
- 2020-01-07 WO PCT/CN2020/070738 patent/WO2020156058A1/zh not_active Ceased
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20080192049A1 (en) * | 2007-02-13 | 2008-08-14 | Thomas Schiwietz | Image deformation using physical models |
| CN105184735A (zh) * | 2014-06-19 | 2015-12-23 | 腾讯科技(深圳)有限公司 | 一种人像变形方法及装置 |
| CN109003224A (zh) * | 2018-07-27 | 2018-12-14 | 北京微播视界科技有限公司 | 基于人脸的形变图像生成方法和装置 |
| CN110069191A (zh) * | 2019-01-31 | 2019-07-30 | 北京字节跳动网络技术有限公司 | 基于终端的图像拖拽变形实现方法和装置 |
Non-Patent Citations (1)
| Title |
|---|
| DU XIAORONG , PING SHUWEN ,ZHANG YONG : "Graphics and Image Local Deformation Based on Moving Least Squares Method", JOURNAL OF SYSTEM SIMULATION, vol. 27, no. 4, 30 April 2015 (2015-04-30), pages 816 - 823, XP009522483, ISSN: 1004-731X * |
Also Published As
| Publication number | Publication date |
|---|---|
| CN110069191A (zh) | 2019-07-30 |
| CN110069191B (zh) | 2021-03-30 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| WO2020156058A1 (zh) | 基于终端的图像拖拽变形实现方法和装置 | |
| JP7181375B2 (ja) | 目標対象の動作認識方法、装置及び電子機器 | |
| TWI522894B (zh) | 用於電子元件中的方法、電腦程式產品以及非暫時性電腦可讀記錄媒體 | |
| WO2020186935A1 (zh) | 虚拟对象的显示方法、装置、电子设备和计算机可读存储介质 | |
| WO2020228406A1 (zh) | 图像风格化生成方法、装置及电子设备 | |
| WO2021139408A1 (zh) | 显示特效的方法、装置、存储介质及电子设备 | |
| WO2021179882A1 (zh) | 图像的绘制方法、装置、可读介质和电子设备 | |
| CN112258622B (zh) | 图像处理方法、装置、可读介质及电子设备 | |
| CN111641797A (zh) | 视频通话界面显示控制方法、装置、存储介质及设备 | |
| EP4113446B1 (en) | Sticker processing method and apparatus | |
| US12019669B2 (en) | Method, apparatus, device, readable storage medium and product for media content processing | |
| CN104423804A (zh) | 用于显示内容的方法和电子设备 | |
| WO2022022689A1 (zh) | 交互方法、装置和电子设备 | |
| WO2021244651A1 (zh) | 信息显示方法、装置、终端及存储介质 | |
| CN118627483B (zh) | 表格数据处理方法、装置、设备及存储介质 | |
| WO2023169287A1 (zh) | 美妆特效的生成方法、装置、设备、存储介质和程序产品 | |
| CN110069195B (zh) | 图像拖拽变形方法和装置 | |
| CN111159593A (zh) | 流程图的生成方法、装置、存储介质和电子设备 | |
| CN108492349B (zh) | 书写笔画的处理方法、装置、设备和存储介质 | |
| JP7007168B2 (ja) | プログラム、情報処理方法、及び情報処理装置 | |
| WO2021244650A1 (zh) | 控制方法、装置、终端及存储介质 | |
| WO2024051639A1 (zh) | 图像处理方法、装置、设备及存储介质和产品 | |
| CN111596836A (zh) | 一种分屏显示方法及电子设备 | |
| CN110070479B (zh) | 图像变形拖拽点定位方法和装置 | |
| WO2025067334A1 (zh) | 特效添加方法、装置、电子设备以及存储介质 |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 20747651 Country of ref document: EP Kind code of ref document: A1 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 32PN | Ep: public notification in the ep bulletin as address of the adressee cannot be established |
Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 01.12.2021) |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 20747651 Country of ref document: EP Kind code of ref document: A1 |



