CN110443751B - Image deformation method, device and equipment based on drawing lines and storage medium - Google Patents

Image deformation method, device and equipment based on drawing lines and storage medium Download PDF

Info

Publication number
CN110443751B
CN110443751B CN201910619943.5A CN201910619943A CN110443751B CN 110443751 B CN110443751 B CN 110443751B CN 201910619943 A CN201910619943 A CN 201910619943A CN 110443751 B CN110443751 B CN 110443751B
Authority
CN
China
Prior art keywords
line
displacement
image
grid
mapping
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.)
Active
Application number
CN201910619943.5A
Other languages
Chinese (zh)
Other versions
CN110443751A (en
Inventor
邓立邦
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Zhimeiyuntu Tech Corp ltd
Original Assignee
Guangdong Zhimeiyuntu Tech Corp ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Guangdong Zhimeiyuntu Tech Corp ltd filed Critical Guangdong Zhimeiyuntu Tech Corp ltd
Priority to CN201910619943.5A priority Critical patent/CN110443751B/en
Publication of CN110443751A publication Critical patent/CN110443751A/en
Application granted granted Critical
Publication of CN110443751B publication Critical patent/CN110443751B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/04Context-preserving transformations, e.g. by using an importance map
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Image Processing (AREA)

Abstract

The invention discloses an image deformation method, device, equipment and storage medium based on drawing lines, wherein the method comprises the following steps: receiving an image to be processed and a line drawn by a user, and then storing the image to be processed and the line in a first grid and a second grid which have the same size respectively; determining the scaling direction of the lines according to the vertical and horizontal scale parameters of the lines, and then scaling the lines in an equal proportion until the lines are overlapped with the second grid in the scaling direction to obtain scaled lines; extracting the central point of the zoomed line and making a reference line along the zooming direction through the central point; taking the pixel points on the zoomed lines as line pixel points, and calculating the displacement required when each line pixel point moves to the reference line along the corresponding displacement line one by one to obtain the displacement of each line pixel point; and moving all pixel points on each mapping ray in the image to be processed according to the corresponding mapping displacement to obtain a deformed image. Image distortion errors can be reduced by implementing embodiments of the present invention.

Description

Image deformation method, device and equipment based on drawing lines and storage medium
Technical Field
The present invention relates to the field of image processing technologies, and in particular, to an image deformation method and apparatus based on drawing lines, a terminal device, and a computer-readable storage medium.
Background
With the continuous development of image processing technology, image deformation achieves a plurality of excellent results, and has been widely applied, such as: facial animation, free deformation of images, and the like. At present, the image deformation technology is generally implemented by an interpolation algorithm, such as: IDW algorithm and RBF algorithm, and interpolation algorithm has the problems that distortion of individual points is large and the problem of large image deformation error is easy to cause depending on the numerical type adopted in the calculation process.
Disclosure of Invention
The embodiment of the invention provides an image deformation method based on drawing lines, which can reduce image deformation errors.
An embodiment of the present invention provides an image deformation method based on drawing lines, including: receiving an image to be processed and a line drawn by a user, then storing the image to be processed in a first grid, and storing the line in a second grid, wherein the first grid and the second grid have the same size;
determining the scaling direction of the line according to the vertical and horizontal scale parameters of the line, and then scaling the line in an equal proportion until the line is overlapped with the second grid in the scaling direction to obtain a scaled line; wherein the zoom direction comprises a landscape or portrait direction;
extracting the central point of the zoomed line, and making a reference line along the zooming direction through the central point;
taking the pixel points on the zoomed lines as line pixel points, and calculating the displacement required when each line pixel point moves to the reference line along the corresponding displacement line one by one to obtain the displacement of each line pixel point; each line pixel point is on a corresponding displacement line, and the displacement line is perpendicular to the datum line;
moving all pixel points on each mapping ray in the image to be processed according to the corresponding mapping displacement to obtain a deformed image; wherein the position of each mapping line on the first grid is the same as the position of the corresponding displacement line on the second grid; and each mapping displacement is the displacement of the line pixel point in the displacement line corresponding to each mapping ray.
Further, the determining the scaling direction of the line according to the aspect ratio parameter of the line specifically includes:
if the longitudinal parameter of the line is larger than the transverse parameter, setting the zooming direction as the longitudinal direction;
if the longitudinal parameter of the line is smaller than the transverse parameter, setting the zooming direction as the transverse direction;
and if the longitudinal parameter of the line is equal to the transverse parameter, randomly selecting one direction as the zooming direction.
Further, the extracting the center point of the scaled line specifically includes:
and selecting the zoomed line as a rectangular frame, and taking the cross point of the diagonal line of the rectangular frame as the midpoint of the zoomed line.
Further, before storing the image to be processed in the first grid, determining whether the size of the image to be processed is consistent with the size of the first grid;
and if not, scaling the size of the image to be processed so as to enable the size of the image to be processed to be the same as that of the first grid.
On the basis of the above method item embodiments, the present invention correspondingly provides apparatus item embodiments;
the invention provides an image deformation device based on drawing lines, which is characterized by comprising a data receiving and storing receiving module, a line scaling module, a line central point extracting module, a displacement calculating module and an image deformation processing module, wherein the data receiving and storing receiving module is used for receiving and storing the data;
the data receiving and storing receiving module is used for receiving an image to be processed and a line drawn by a user, then storing the image to be processed in a first grid, and storing the line in a second grid, wherein the first grid and the second grid have the same size;
the line scaling module is used for determining the scaling direction of the line according to the vertical and horizontal scale parameters of the line, and then scaling the line in an equal proportion until the line is overlapped with the second grid in the scaling direction to obtain a scaled line; wherein the zoom direction comprises a landscape or portrait direction;
the line center extraction module is used for extracting the center point of the zoomed line and making a reference line along the zooming direction through the center point;
the displacement calculation module is used for taking the pixels on the zoomed lines as line pixels, calculating displacement required when each line pixel moves to the reference line along the corresponding displacement line one by one, and obtaining the displacement of the line pixels; each line pixel point is on a corresponding displacement line, and the displacement line is perpendicular to the datum line;
the image deformation processing module is used for moving all pixel points on each mapping ray in the image to be processed according to the corresponding mapping displacement to obtain a deformed image; wherein the position of each mapping line on the first grid is the same as the position of the corresponding displacement line on the second grid; and each mapping displacement is the displacement of the line pixel point in the displacement line corresponding to each mapping ray.
On the basis of the above embodiment of the method, the present invention provides another embodiment;
another embodiment of the present invention provides a drawing line-based image warping apparatus, which includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, and when the processor executes the computer program, the processor implements the drawing line-based image warping method according to any one of the above method items of the present invention.
On the basis of the above embodiment of the method item, another embodiment is provided:
another embodiment of the present invention provides a storage medium, where the storage medium includes a stored computer program, and when the computer program runs, the storage medium controls an apparatus to execute the method for deforming an image based on drawn lines according to any one of the above-mentioned method embodiments of the present invention.
The embodiment of the invention has the following beneficial effects:
the embodiment of the invention provides an image deformation method, device, equipment and storage medium based on drawing lines, wherein when an image to be processed is subjected to deformation processing, the image to be processed and lines drawn by a user are received, then the image to be processed and the lines are respectively stored in grids with the same size, then one direction is selected as a scaling direction according to the vertical and horizontal proportion of the drawn lines, and the lines are scaled in an equal proportion until the lines are overlapped with the grids in the scaling direction; extracting the central point of the zoomed line, making a reference line through the central point of the zoomed line, calculating each pixel point on the zoomed line after making the reference line, and moving to the displacement required by the reference line to obtain the displacement of each line pixel point; when each pixel point moves to the datum line, the pixel point moves along the direction vertical to the datum line, and the fact that a line pixel point moves along a corresponding displacement line when moving can be understood as that the displacement line is vertical to the datum line; finally, all pixel points on each mapping line in the image to be processed are moved according to the corresponding mapping displacement amount, and finally, a deformed image is obtained; the image to be processed can be regarded as being composed of a mapping line, each mapping line comprises a plurality of pixel points of the image to be processed, each mapping line corresponds to a mapping displacement amount, and when the image to be processed is subjected to deformation processing, the pixel points of the image to be processed on each mapping line are moved according to the corresponding mapping displacement amounts. Each mapping line corresponds to a displacement line, and the mapping displacement amount corresponding to each mapping line is the displacement amount of the line pixel point of the corresponding displacement line and the line pixel point. According to the method, when the image to be processed is subjected to deformation processing, a line drawn by a user is introduced, the accuracy of the displacement required by deformation processing of each pixel point of the image to be processed is determined according to the line, and the problem of large relative position error caused by interpolation calculation is solved, so that the deformation error is reduced. Meanwhile, the image is combined with the drawing of the user, so that the interactivity of the user is improved.
Drawings
Fig. 1 is a schematic flowchart of an image deformation method based on drawing lines according to an embodiment of the present invention.
FIG. 2 is a schematic diagram of a zoom of a line provided according to an embodiment of the present invention;
fig. 3 is a diagram illustrating a determination method of a line center point and a reference line according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of an image morphing apparatus based on drawing lines according to an embodiment of the present invention.
Fig. 5 is an undeformed image to be processed according to the present invention.
FIG. 6 is a line drawn by a user in accordance with the present invention.
Fig. 7 is a deformed image processed by the method for deforming an image based on drawing lines according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without inventive step based on the embodiments of the present invention, are within the scope of protection of the present invention.
As shown in fig. 1, which is a schematic flow chart of an image deformation method based on drawing lines according to an embodiment of the present invention, including:
step S101, receiving an image to be processed and a line drawn by a user, storing the image to be processed in a first grid, and storing the line in a second grid, wherein the first grid and the second grid have the same size.
S102, determining the scaling direction of the line according to the longitudinal and transverse scale parameters of the line, and then scaling the line in an equal proportion until the line is overlapped with the second grid in the scaling direction to obtain a scaled line; wherein the zoom direction comprises a landscape or portrait orientation.
Step S103, extracting the central point of the zoomed line, and making a reference line along the zooming direction through the central point.
Step S104, taking the pixel points on the zoomed lines as line pixel points, calculating displacement required when each line pixel point moves to the reference line along the corresponding displacement line one by one, and obtaining the displacement of each line pixel point; and each line pixel point is on a corresponding displacement line, and the displacement line is perpendicular to the datum line.
S105, moving all pixel points on each mapping line in the image to be processed according to the corresponding mapping displacement to obtain a deformed image; wherein the position of each mapping line on the first grid is the same as the position of the corresponding displacement line on the second grid; and each mapping displacement is the displacement of the line pixel point in the displacement line corresponding to each mapping ray.
Step S101, firstly, receiving an image which is uploaded by a user on a terminal device and needs to be subjected to deformation processing, the image to be processed and a line which is drawn by the user in a drawing area at will; then storing the image and the lines to be processed in grids with the same size, namely the first grid and the second grid;
the size of the optional mesh may be consistent with the size of the drawing area;
in addition, in a preferred embodiment, before storing the image to be processed in the first grid, the method further includes determining whether the size of the image to be processed is consistent with the size of the first grid;
and if not, scaling the size of the image to be processed so as to enable the size of the image to be processed to be the same as that of the first grid.
It should be noted that the terminal device herein may be a hardware device such as a mobile phone or a touch screen, and a drawing area for a user to draw lines is provided on the terminal device, and the terminal device is internally packaged with the image deformation method based on the drawing lines provided by the embodiment of the present invention.
For step S102, in a preferred embodiment, the aspect ratio parameter of the line may be obtained by calling an existing image processing tool, such as Photoshop, and then the scaling direction of the line is determined according to the aspect ratio parameter of the line.
In a preferred embodiment the details are as follows:
if the longitudinal parameter of the line is larger than the transverse parameter, setting the zooming direction as the longitudinal direction;
if the longitudinal parameter of the line is smaller than the transverse parameter, setting the zooming direction as the transverse direction;
and if the longitudinal parameter of the line is equal to the transverse parameter, randomly selecting one direction as the zooming direction.
For example: the aspect ratio parameter of a line is 2:5, and the direction (i.e., the lateral direction, also called the horizontal direction) in which the ratio parameter is 5 is selected as the scaling direction of the line.
After the scaling direction is determined, scaling the line in equal proportion until the line is overlapped with the grid where the line is located, namely the second grid, in the scaling direction to obtain the scaled line. The longitudinal scaling needs to reduce or enlarge the lines to the maximum height of the storage grid; lateral scaling entails scaling or enlarging the lines to the maximum width of their storage grid. As shown in fig. 2, (a) in fig. 2 is a line drawn by the user, and (b) is a scaled line obtained by scaling the line laterally, as can be seen from fig. 2, the line does not coincide with the grid in the lateral direction, i.e. the horizontal direction, at the beginning, and the line coincides with the grid in the lateral direction after scaling.
As shown in fig. 3: for step S103, in a preferred embodiment, the extracting the center point of the zoomed line specifically includes:
and selecting the zoomed line as a rectangular frame, and taking the cross point of the diagonal line of the rectangular frame as the midpoint of the zoomed line.
Step S104, calculating the displacement of the pixels on the zoomed line, namely the pixels on the line, moving to the reference line along the direction vertical to the reference line; in this case, the displacement required when each line pixel point moves to the reference line along a line perpendicular to the reference line is calculated, the line is the above-defined displacement line, and each line pixel point corresponds to one displacement line.
It should be noted that the shift line does not need to be drawn in the actual processing process, and if the size of one pixel is taken as the size of each grid in the first grid and the second grid. The above-mentioned displacement lines can be understood as one of the rows or one of the columns of the grid in the grid
Specifically, the method comprises the following steps: for a scaled line that is scaled horizontally, its base line is also horizontal (horizontal), so the displaced line at this point is vertical (vertical) representing a column in the second grid; then, after calculating the displacement required when a line pixel point moves to the reference line along the corresponding displacement line, obtaining the displacement, which can be used as the displacement of all pixel points on a corresponding column in the grid where the line pixel point is located.
For a scaled line that is scaled vertically, its baseline is also vertical (vertical) and the displaced line is horizontal (horizontal) representing a row in the second grid; at this time, after calculating the displacement required when a line pixel point moves to the reference line along the corresponding displacement line, the displacement is obtained and can be used as the displacement of all pixel points on a corresponding line in the grid where the line pixel point is located.
In step S105, it should be noted that the mapping line mentioned herein is not required to be drawn in the actual processing, and it can be understood that when the size of one pixel point is taken as the size of each grid in the second grid, a row or a column in the second grid is the mapping line mentioned herein;
since the sizes and specifications of the first grid and the second grid are consistent, the shift lines (each row or each column) in the first grid can map the corresponding mapping lines (each row or each column in the second grid) in the second grid; thus, the mapping displacement amount corresponding to each mapping ray is a displacement amount that each line or each column of pixel points of the image to be processed needs to be moved in the deformation process, and the mapping displacement amount corresponds to the line pixel point displacement amount of each line pixel point calculated in step S104.
Specifically, for example, a line pixel point a is in the 2 nd row and 3 rd column of the first grid; if the reference line of the line drawn by the user is horizontal, the displacement line corresponding to the line pixel point a at this time can be understood as a straight line formed by the 3 rd column of the first grid, and the displacement amount of the line pixel point a at this time can be regarded as the displacement amount of all pixel points in the 3 rd column of the first grid; the mapping line mapped to the second grid corresponding to the displacement line of the first grid can be understood as a straight line formed by the 3 rd column in the second grid, and the mapping displacement amount corresponding to the mapping line is the pixel point displacement amount of the line pixel point A.
If the reference line of the line drawn by the user is longitudinal, the displacement line corresponding to the line pixel point a at this time can be understood as a straight line formed by the 2 nd line of the first grid, and the displacement amount of the line pixel point a at this time can be regarded as the displacement amount of all pixel points of the 2 nd line in the first grid; the mapping line mapped to the second grid corresponding to the displacement line of the first grid can be understood as a straight line formed by the 2 nd line in the second grid, and the mapping displacement amount corresponding to the mapping line is the pixel point displacement amount of the line pixel point A.
By the method, all pixel points on each mapping line in the image to be processed and the corresponding mapping displacement can be obtained, and the image after deformation is obtained by moving according to the corresponding mapping displacement. The specific effect exhibition can be seen in fig. 5, 6 and 7.
In a preferred embodiment, after the deformed image is obtained, the deformed image is displayed on the terminal.
On the basis of the above-described method item embodiments, an apparatus item embodiment is provided:
an embodiment of the present invention provides an image deformation apparatus based on drawing lines, which includes a data receiving and storing receiving module 401, a line scaling module 402, a line center point extracting module 403, a displacement calculating module 404, and an image deformation processing module 405;
the data receiving and storing receiving module 401 is configured to receive an image to be processed and a line drawn by a user, store the image to be processed in a first grid, and store the line in a second grid, where the first grid and the second grid have the same size;
the line scaling module 402 is configured to determine a scaling direction of the line according to the vertical-to-horizontal ratio parameter of the line, and then scale the line in an equal proportion until the line is overlapped with the second grid in the scaling direction, so as to obtain a scaled line; wherein the zoom direction comprises a landscape or portrait direction;
the line center extraction module 403 is configured to extract a center point of the zoomed line, and make a reference line along the zooming direction through the center point;
the displacement calculating module 404 is configured to use the pixel points on the zoomed line as line pixel points, and calculate displacement required when each line pixel point moves to the reference line along a corresponding displacement line one by one, so as to obtain a line pixel point displacement; each line pixel point is on a corresponding displacement line, and the displacement line is perpendicular to the datum line;
the image deformation processing module 405 is configured to move all pixel points on each mapping line in the image to be processed according to the corresponding mapping displacement to obtain a deformed image; wherein the position of each mapping line on the first grid is the same as the position of the corresponding displacement line on the second grid; and each mapping displacement is the displacement of the line pixel point in the displacement line corresponding to each mapping ray.
It is understood that the above-mentioned embodiments of the apparatus correspond to the embodiments of the method of the present invention, and the method for deforming an image based on drawing lines provided by any one of the above-mentioned embodiments of the method of the present invention can be implemented.
It should be noted that the above-described device embodiments are merely illustrative, wherein the units/modules illustrated as separate components may or may not be physically separate, and the components displayed as the units/modules may or may not be physical units/modules, may be located in one place, or may also be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. In addition, in the drawings of the embodiment of the apparatus provided by the present invention, the connection relationship between the modules indicates that there is a communication connection between them, and may be specifically implemented as one or more communication buses or signal lines. One of ordinary skill in the art can understand and implement it without inventive effort. The schematic diagram is merely an example of the painted line-based image deformation apparatus, and does not constitute a limitation of the painted line-based image deformation apparatus, and may include more or less components than those shown, or combine some components, or different components,
on the basis of the above-described method embodiment, a further embodiment is provided:
an embodiment of the present invention provides a drawing line-based image warping device, which includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, and when the processor executes the computer program, the processor implements the drawing line-based image warping method provided by any one of the above-mentioned method embodiments of the present invention.
The apparatus may include, but is not limited to, a processor, a memory. Those skilled in the art will appreciate that input output devices, network access devices, buses, etc., for example, may also be included.
The Processor may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like that is the control center for the device and that connects the various parts of the overall device using various interfaces and lines.
The memory may be used to store the computer programs and/or modules, and the processor may implement the various functions of the device by executing or executing the computer programs and/or modules stored in the memory and invoking data stored in the memory. The memory may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the cellular phone, and the like. In addition, the memory may include high speed random access memory, and may also include non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), at least one magnetic disk storage device, a Flash memory device, or other volatile solid state storage device.
On the basis of the above-described method embodiment, a further embodiment is provided:
an embodiment of the present invention provides a storage medium, where the storage medium includes a stored computer program, where the computer program, when running, controls an apparatus on which the storage medium is located to execute the method for deforming an image based on drawing lines according to any one of the above-mentioned method embodiments of the present invention
The storage medium is a computer readable storage medium, wherein, the drawing line-based image deformation method, device/equipment integrated module/unit can be stored in a computer readable storage medium if it is implemented in the form of software functional unit and sold or used as a stand-alone product. Based on such understanding, all or part of the flow of the method according to the embodiments of the present invention may also be implemented by a computer program, which may be stored in a computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method embodiments described above may be implemented. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like.
The embodiment of the invention has the following beneficial effects:
the user only needs to upload an image and draw a line at will on the terminal, the system determines the zooming direction based on the vertical and horizontal proportion parameters of the drawn line and zooms the zoomed line to the maximum height or the maximum width of the storage grid, the center point of the rectangular frame of the zoomed line is used as the reference line which is the same as the line zooming, and the original displacement of each pixel point of the uploaded image is moved based on the moving displacement of each pixel point of the zoomed line to the affiliated reference line, thereby realizing the image deformation effect based on the drawn line. Compared with the prior image deformation technology, the method combines the image and the drawing, has novel and interesting image deformation mode, and improves the user interactivity; the moving displacement from each pixel point of the zoomed line to the affiliated datum line and the original displacement of each pixel point of the uploaded image are used for forming a mapping relation, the position relation accuracy is high, and the problem that the relative position error is large due to interpolation calculation, so that the deformation error is reduced is solved; the method has the advantages of simple realization principle, less calculation amount and improvement of image deformation efficiency.
While the foregoing is directed to the preferred embodiment of the present invention, it will be understood by those skilled in the art that various changes and modifications may be made without departing from the spirit and scope of the invention.

Claims (7)

1. An image deformation method based on drawing lines is characterized by comprising the following steps:
receiving an image to be processed and a line drawn by a user, then storing the image to be processed in a first grid, and storing the line in a second grid, wherein the first grid and the second grid have the same size;
determining the scaling direction of the line according to the longitudinal and transverse scaling parameters of the line, and then scaling the line in an equal proportion until the line is overlapped with the second grid in the scaling direction to obtain the scaled line; wherein the zoom direction comprises a landscape or portrait direction;
extracting the central point of the zoomed line, and making a reference line along the zooming direction through the central point;
taking the pixel points on the zoomed lines as line pixel points, and calculating the displacement required when each line pixel point moves to the reference line along the corresponding displacement line one by one to obtain the displacement of each line pixel point; each line pixel point is on a corresponding displacement line, and the displacement line is perpendicular to the datum line;
moving all pixel points on each mapping line in the image to be processed according to the corresponding mapping displacement to obtain a deformed image; wherein the position of each mapping line on the first grid is the same as the position of the corresponding displacement line on the second grid; and each mapping displacement is the displacement of the line pixel point in the displacement line corresponding to each mapping ray.
2. The method for image deformation based on drawing lines according to claim 1, wherein the determining the scaling direction of the lines according to the aspect ratio parameters of the lines is specifically:
if the longitudinal parameter of the line is larger than the transverse parameter, setting the zooming direction as the longitudinal direction;
if the longitudinal parameter of the line is smaller than the transverse parameter, setting the zooming direction as the transverse direction;
and if the longitudinal parameter of the line is equal to the transverse parameter, randomly selecting one direction as the zooming direction.
3. The method for image deformation based on drawing lines as claimed in claim 1, wherein the extracting the center point of the zoomed line is specifically:
and selecting the zoomed line as a rectangular frame, and taking the intersection point of the diagonal lines of the rectangular frame as the midpoint of the zoomed line.
4. The method for image deformation based on drawing lines as claimed in claim 1, further comprising, before the storing the image to be processed in the first grid:
judging whether the size of the image to be processed is consistent with that of the first grid or not;
and if not, scaling the size of the image to be processed so as to enable the size of the image to be processed to be the same as that of the first grid.
5. An image deformation device based on drawing lines is characterized by comprising a data receiving and storing receiving module, a line scaling module, a line central point extracting module, a displacement calculating module and an image deformation processing module;
the data receiving and storing receiving module is used for receiving an image to be processed and a line drawn by a user, then storing the image to be processed in a first grid, and storing the line in a second grid, wherein the first grid and the second grid have the same size;
the line scaling module is used for determining the scaling direction of the line according to the vertical and horizontal scale parameters of the line, and then scaling the line in an equal proportion until the line is overlapped with the second grid in the scaling direction to obtain a scaled line; wherein the zoom direction comprises a landscape or portrait direction;
the line central point extracting module is used for extracting the central point of the zoomed line and making a reference line along the zooming direction through the central point;
the displacement calculation module is used for taking the pixels on the zoomed lines as line pixels, calculating displacement required when each line pixel moves to the reference line along the corresponding displacement line one by one, and obtaining the displacement of the line pixels; each line pixel point is on a corresponding displacement line, and the displacement line is perpendicular to the datum line;
the image deformation processing module is used for moving all pixel points on each mapping line in the image to be processed according to the corresponding mapping displacement amount to obtain a deformed image; wherein the position of each mapping line on the first grid is the same as the position of the corresponding displacement line on the second grid; and each mapping displacement is the displacement of the line pixel point in the displacement line corresponding to each mapping ray.
6. A drawn line-based image morphing apparatus comprising a processor, a memory and a computer program stored in the memory and configured to be executed by the processor, the processor when executing the computer program implementing a drawn line-based image morphing method according to any one of claims 1 to 4.
7. A storage medium comprising a stored computer program, wherein the storage medium is controlled by a device to execute the method according to any one of claims 1 to 4 when the computer program is run.
CN201910619943.5A 2019-07-10 2019-07-10 Image deformation method, device and equipment based on drawing lines and storage medium Active CN110443751B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910619943.5A CN110443751B (en) 2019-07-10 2019-07-10 Image deformation method, device and equipment based on drawing lines and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910619943.5A CN110443751B (en) 2019-07-10 2019-07-10 Image deformation method, device and equipment based on drawing lines and storage medium

Publications (2)

Publication Number Publication Date
CN110443751A CN110443751A (en) 2019-11-12
CN110443751B true CN110443751B (en) 2022-09-23

Family

ID=68430085

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910619943.5A Active CN110443751B (en) 2019-07-10 2019-07-10 Image deformation method, device and equipment based on drawing lines and storage medium

Country Status (1)

Country Link
CN (1) CN110443751B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112102374B (en) * 2020-11-23 2021-03-12 北京蜜莱坞网络科技有限公司 Image processing method, image processing apparatus, electronic device, and medium
CN112634124B (en) * 2020-12-10 2024-04-12 深兰工业智能创新研究院(宁波)有限公司 Image warping method, image warping device, electronic apparatus, and storage medium
CN114861247B (en) * 2022-07-06 2022-12-30 广东时谛智能科技有限公司 Method, device, equipment and storage medium for generating shoe body model based on simple design

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001249656A (en) * 2001-01-09 2001-09-14 Hitachi Ltd Character and graphic deformation processing device
US6512521B1 (en) * 1997-07-02 2003-01-28 Kazunari Era Method of displaying two dimensional picture image data, and constructing animation picture therefrom
CN101147172A (en) * 2005-04-01 2008-03-19 国立大学法人东京大学 Image processing system and program
CN101478686A (en) * 2008-01-04 2009-07-08 中强光电股份有限公司 Image correction table establishing method and image processing method
CN101650824A (en) * 2009-09-23 2010-02-17 清华大学 Content erotic image zooming method based on conformal energy
CN104574266A (en) * 2013-12-19 2015-04-29 陈鹏飞 Image deformation technology based on contour line

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2002025587A2 (en) * 2000-09-19 2002-03-28 Technion Research And Development Foundation Ltd. Method and apparatus for shape deformation and placement
US8994736B2 (en) * 2011-09-23 2015-03-31 Adobe Systems Incorporated Methods and apparatus for freeform deformation of 3-D models

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6512521B1 (en) * 1997-07-02 2003-01-28 Kazunari Era Method of displaying two dimensional picture image data, and constructing animation picture therefrom
JP2001249656A (en) * 2001-01-09 2001-09-14 Hitachi Ltd Character and graphic deformation processing device
CN101147172A (en) * 2005-04-01 2008-03-19 国立大学法人东京大学 Image processing system and program
CN101478686A (en) * 2008-01-04 2009-07-08 中强光电股份有限公司 Image correction table establishing method and image processing method
CN101650824A (en) * 2009-09-23 2010-02-17 清华大学 Content erotic image zooming method based on conformal energy
CN104574266A (en) * 2013-12-19 2015-04-29 陈鹏飞 Image deformation technology based on contour line

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于自适应网格变形的图像编辑算法;金勇 等;《软件学报》;20120515;全文 *

Also Published As

Publication number Publication date
CN110443751A (en) 2019-11-12

Similar Documents

Publication Publication Date Title
CN110443751B (en) Image deformation method, device and equipment based on drawing lines and storage medium
CN109840881B (en) 3D special effect image generation method, device and equipment
US11997397B2 (en) Method, apparatus, and device for processing images, and storage medium
CN108040210B (en) Local distortion correction method, mobile terminal and related medium product
CN110533594B (en) Model training method, image reconstruction method, storage medium and related device
US10614551B2 (en) Image interpolation methods and related image interpolation devices thereof
CN108537729B (en) Image stepless zooming method, computer device and computer readable storage medium
CN110866862B (en) Data processing method and device based on buffer, storage medium and electronic equipment
CN106780336B (en) Image reduction method and device
CN112508783B (en) Image processing method based on direction interpolation, computer device and computer readable storage medium
CN103702032A (en) Image processing method, device and terminal equipment
CN111724304A (en) Image scaling method and device, terminal equipment and storage medium
CN108509241B (en) Full-screen display method and device for image and mobile terminal
CN112270642A (en) Method, system and device for constructing external rectangular frame of obstacle point cloud
CN109522532B (en) Method and device for calculating selection range of line drawing frame
WO2024002064A1 (en) Method and apparatus for constructing three-dimensional model, and electronic device and storage medium
CN112819701B (en) Image denoising method and system and electronic equipment
US8902474B2 (en) Image processing apparatus, control method of the same, and program
CN109683798B (en) Text determination method, terminal and computer readable storage medium
CN107977923B (en) Image processing method, image processing device, electronic equipment and computer readable storage medium
WO2011121563A1 (en) Detecting saliency in an image
CN110874814A (en) Image processing method, image processing device and terminal equipment
CN110706351B (en) Triangular mesh model generation method and device
CN114972558A (en) Handwriting drawing method, device, medium and interactive panel
CN111709419A (en) Method, system and equipment for positioning banknote serial number and readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant