CN112489157B - Photo frame drawing method, device and storage medium - Google Patents

Photo frame drawing method, device and storage medium Download PDF

Info

Publication number
CN112489157B
CN112489157B CN202011510168.9A CN202011510168A CN112489157B CN 112489157 B CN112489157 B CN 112489157B CN 202011510168 A CN202011510168 A CN 202011510168A CN 112489157 B CN112489157 B CN 112489157B
Authority
CN
China
Prior art keywords
photo frame
image
transformation
image transformation
coordinates
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
CN202011510168.9A
Other languages
Chinese (zh)
Other versions
CN112489157A (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.)
Guangzhou Shiyuan Electronics Thecnology Co Ltd
Guangzhou Shirui Electronics Co Ltd
Original Assignee
Guangzhou Shiyuan Electronics Thecnology Co Ltd
Guangzhou Shirui Electronics Co 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 Guangzhou Shiyuan Electronics Thecnology Co Ltd, Guangzhou Shirui Electronics Co Ltd filed Critical Guangzhou Shiyuan Electronics Thecnology Co Ltd
Priority to CN202011510168.9A priority Critical patent/CN112489157B/en
Publication of CN112489157A publication Critical patent/CN112489157A/en
Application granted granted Critical
Publication of CN112489157B publication Critical patent/CN112489157B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/60Rotation of whole images or parts thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2210/00Indexing scheme for image generation or computer graphics
    • G06T2210/12Bounding box

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Editing Of Facsimile Originals (AREA)
  • Image Processing (AREA)
  • Processing Or Creating Images (AREA)
  • Studio Devices (AREA)

Abstract

The embodiment of the application provides a photo frame drawing method, photo frame drawing equipment and a storage medium, and belongs to the technical field of image processing. The method comprises the following steps: acquiring a rotation angle of image transformation, determining second key point position information of an outer frame of the image-transformed photo frame according to the rotation angle, first key point position information of the outer frame of the image-transformed photo frame and the width of the photo frame before image transformation, determining a transformation matrix of the photo frame according to third key point position information and second key point position information of the outer frame of the image-transformed photo frame, and drawing the image-transformed photo frame according to the transformation matrix of the photo frame and the shape of the image-transformed photo frame. Therefore, the picture frame and the graphics on the picture frame can be changed along with the change of the image, and the original width proportion of the picture frame is maintained.

Description

Photo frame drawing method, device and storage medium
Technical Field
The embodiment of the application relates to the technical field of image processing, in particular to a photo frame drawing method, photo frame drawing equipment and a storage medium.
Background
With the continuous development of network technology, storage, processing, use and the like of images are increasingly frequent, and the application of drawing photo frames for images is also common. Currently, when drawing a photo frame, a photo frame with a certain width and a certain shape, such as a rectangular photo frame and a heart-shaped photo frame, is drawn on an outer frame of an image, and a certain graph can be drawn on the photo frame.
Image transformations refer to the evolution of one graphic into another, common image transformations being translation, scaling, rotation, flipping, miscut, etc. When the image is transformed, the photo frame is also transformed along with the transformation of the image, so that how to transform the photo frame along with the transformation of the image, and meanwhile, the original width proportion of the photo frame is maintained, is a problem to be solved.
Disclosure of Invention
The embodiment of the application provides a photo frame drawing method, photo frame drawing equipment and a storage medium, which are used for solving the problem of how to realize the transformation of a photo frame along with the transformation of an image.
In a first aspect, an embodiment of the present application provides a method for drawing a photo frame, including:
acquiring a rotation angle of image transformation;
determining second key point position information of the outer frame of the image-transformed photo frame according to the rotation angle, the first key point position information of the outer frame of the image-transformed photo frame and the width of the photo frame before image transformation;
determining a transformation matrix of the photo frame according to the third key point position information of the outer frame of the photo frame before the image transformation and the second key point position information;
and drawing the photo frame after the image transformation according to the transformation matrix of the photo frame and the shape of the photo frame before the image transformation.
In one possible implementation form of the present invention,
the position information is coordinates, and the first key point position information is: coordinates of four vertexes of a rectangle corresponding to an outer frame of the image after the image transformation;
the second key point position information is: coordinates of four vertexes of a rectangle corresponding to an outer frame of the photo frame after the image transformation;
the determining the second key point position information of the outer frame of the image transformed photo frame according to the rotation angle, the first key point position information of the outer frame of the image transformed photo frame and the width of the image transformed photo frame comprises the following steps:
and calculating coordinates of four vertexes of the rectangle corresponding to the outer frame of the image-transformed photo frame according to coordinates of four vertexes of the rectangle corresponding to the outer frame of the image-transformed photo frame, the width of the photo frame before image transformation and the rotation angle.
In a possible implementation manner, the third keypoint location information is: coordinates of four vertexes of a rectangle corresponding to an outer frame of the photo frame before image transformation;
the determining a transformation matrix of the photo frame according to the third key point position information of the outer frame of the photo frame before the image transformation and the second key point position information comprises the following steps:
And determining a transformation matrix of the photo frame according to coordinates of four vertexes of a rectangle corresponding to an outer frame of the photo frame before image transformation and coordinates of four vertexes of a rectangle corresponding to an outer frame of the photo frame after image transformation, wherein the transformation matrix of the photo frame comprises at least one of translation information, rotation information, scaling information, overturning information and beveling information.
In a possible implementation manner, the drawing the picture frame after the image transformation according to the transformation matrix of the picture frame and the shape of the picture frame before the image transformation includes:
determining the coordinates of each point on the photo frame after the image transformation according to the transformation matrix of the photo frame and the coordinates of each point on the photo frame before the image transformation;
and drawing the photo frame after image transformation according to the coordinates of each point on the photo frame after image transformation.
In a possible implementation manner, the photo frame includes at least one graphic thereon, and the method further includes:
determining fourth key point position information of circumscribed rectangles of the graphics after image transformation according to the rotation angle, the first key point position information and the length and width of the circumscribed rectangles for each of the at least one graphics;
Determining a transformation matrix of the graph according to fifth key point position information and fourth key point position information of the circumscribed rectangle of the graph before the image transformation;
and drawing the graph after the image transformation according to the transformation matrix of the graph and the shape of the graph.
In a possible implementation manner, the position information is coordinates, and the first key point position information is: coordinates of four vertexes of a rectangle corresponding to an outer frame of the image after the image transformation;
the fourth key point position information is: coordinates of four vertexes of the circumscribed rectangle of the graph after the image transformation;
the fifth key point position information is: coordinates of four vertexes of the circumscribed rectangle of the graph before the image transformation;
the determining the fourth key point position information of the circumscribed rectangle of the graph after the image transformation according to the rotation angle, the first key point position information and the length and the width of the circumscribed rectangle comprises the following steps:
and calculating the coordinates of the four vertexes of the circumscribed rectangle of the graph after the image transformation according to the rotation angle, the coordinates of the four vertexes of the rectangle corresponding to the outer frame of the image after the image transformation and the length and the width of the circumscribed rectangle.
In a possible implementation manner, the determining the transformation matrix of the graph according to the fifth key point position information and the fourth key point position information of the circumscribed rectangle of the graph before the image transformation includes:
and calculating a transformation matrix of the graph according to the coordinates of four vertexes of the circumscribed rectangle of the graph before the image transformation and the coordinates of four vertexes of the circumscribed rectangle of the graph after the image transformation, wherein the transformation matrix of the graph comprises at least one of translation information, rotation information, scaling information, overturning information and beveling information.
In a possible implementation manner, the drawing the image transformed graph according to the transformation matrix of the graph and the shape of the graph includes:
determining the coordinates of each point on the graph after the image transformation according to the transformation matrix of the graph and the coordinates of each point on the graph before the image transformation;
and drawing the graph after image transformation according to the coordinates of each point on the graph after image transformation.
In a second aspect, an embodiment of the present application provides a photo frame drawing apparatus, including:
the acquisition module is used for acquiring the rotation angle of the image transformation;
The first determining module is used for determining second key point position information of the outer frame of the image transformed photo frame according to the rotation angle, the first key point position information of the outer frame of the image transformed photo frame and the width of the photo frame before image transformation;
the second determining module is used for determining a transformation matrix of the photo frame according to the third key point position information of the outer frame of the photo frame before the image transformation and the second key point position information;
and the drawing module is used for drawing the photo frame after the image transformation according to the transformation matrix of the photo frame and the shape of the photo frame before the image transformation.
In one possible implementation form of the present invention,
the position information is coordinates, and the first key point position information is: coordinates of four vertexes of a rectangle corresponding to an outer frame of the image after the image transformation;
the second key point position information is: coordinates of four vertexes of a rectangle corresponding to an outer frame of the photo frame after the image transformation;
the first determining module is used for: and calculating coordinates of four vertexes of the rectangle corresponding to the outer frame of the image-transformed photo frame according to coordinates of four vertexes of the rectangle corresponding to the outer frame of the image-transformed photo frame, the width of the photo frame before image transformation and the rotation angle.
In a possible implementation manner, the third keypoint location information is: coordinates of four vertexes of a rectangle corresponding to an outer frame of the photo frame before image transformation; the second determining module is configured to:
and determining a transformation matrix of the photo frame according to coordinates of four vertexes of a rectangle corresponding to an outer frame of the photo frame before image transformation and coordinates of four vertexes of a rectangle corresponding to an outer frame of the photo frame after image transformation, wherein the transformation matrix of the photo frame comprises at least one of translation information, rotation information, scaling information, overturning information and beveling information.
In a possible implementation manner, the drawing module is used for:
determining the coordinates of each point on the photo frame after the image transformation according to the transformation matrix of the photo frame and the coordinates of each point on the photo frame before the image transformation;
and drawing the photo frame after image transformation according to the coordinates of each point on the photo frame after image transformation.
In a possible implementation manner, the photo frame includes at least one graphic thereon, and the first determining module is further configured to:
determining fourth key point position information of circumscribed rectangles of the graphics after image transformation according to the rotation angle, the first key point position information and the length and width of the circumscribed rectangles for each of the at least one graphics;
The second determining module is further configured to: determining a transformation matrix of the graph according to fifth key point position information and fourth key point position information of the circumscribed rectangle of the graph before the image transformation;
the drawing module is further configured to: and drawing the graph after the image transformation according to the transformation matrix of the graph and the shape of the graph.
In a possible embodiment, the location information is coordinates,
the first key point position information is: coordinates of four vertexes of a rectangle corresponding to an outer frame of the image after the image transformation;
the fourth key point position information is: coordinates of four vertexes of the circumscribed rectangle of the graph after the image transformation;
the fifth key point position information is: coordinates of four vertexes of the circumscribed rectangle of the graph before the image transformation;
the first determining module is specifically configured to:
and calculating the coordinates of the four vertexes of the circumscribed rectangle of the graph after the image transformation according to the rotation angle, the coordinates of the four vertexes of the rectangle corresponding to the outer frame of the image after the image transformation and the length and the width of the circumscribed rectangle.
In a possible implementation manner, the second determining module is specifically configured to: and calculating a transformation matrix of the graph according to the coordinates of four vertexes of the circumscribed rectangle of the graph before the image transformation and the coordinates of four vertexes of the circumscribed rectangle of the graph after the image transformation, wherein the transformation matrix of the graph comprises at least one of translation information, rotation information, scaling information, overturning information and beveling information.
In a possible implementation manner, the drawing module is specifically configured to:
determining the coordinates of each point on the graph after the image transformation according to the transformation matrix of the graph and the coordinates of each point on the graph before the image transformation;
and drawing the graph after image transformation according to the coordinates of each point on the graph after image transformation.
In a third aspect, an embodiment of the present application provides a computer readable storage medium, where a computer program is stored, where the computer program is executed by a processor to implement the method for drawing a photo frame according to the first aspect or any one of possible implementation manners of the first aspect.
In a fourth aspect, embodiments of the present application provide an electronic device, including:
a processor; and
a memory for storing executable instructions of the processor;
wherein the processor is configured to perform the method of drawing a picture frame according to the first aspect or any of the possible implementations of the first aspect via execution of the executable instructions.
In a fifth aspect, embodiments of the present application provide a computer program product, which includes a computer program, where the computer program when executed by a processor implements the method for drawing a photo frame according to the first aspect or any of the possible embodiments of the first aspect.
According to the photo frame drawing method, the photo frame drawing equipment and the storage medium, the rotation angle of image transformation is obtained firstly, the rotation angle can be any one of translation, scaling, rotation, overturning and miscut or the rotation angle of the images before and after transformation after combination, then the second key point position information of the outer frame of the photo frame after image transformation is determined according to the rotation angle, the first key point position information of the outer frame of the image after image transformation and the width of the photo frame before image transformation, then the transformation matrix of the photo frame is determined according to the third key point position information and the second key point position information of the outer frame of the photo frame before image transformation, and finally the photo frame after image transformation is drawn according to the transformation matrix of the photo frame and the shape of the photo frame before image transformation. Because the transformation matrix of the photo frame is determined according to the key point position information of the outer frame of the photo frame before image transformation and the key point position information of the outer frame of the photo frame after image transformation, the photo frame after image transformation is drawn according to the transformation matrix of the photo frame and the shape of the photo frame before image transformation, thereby realizing that the photo frame can be transformed along with the transformation of the image and the original width proportion of the photo frame is maintained, no matter what kind of image transformation is, the photo frame can be redrawn according to the transformed image.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, a brief description will be given below of the drawings that are needed in the embodiments or the prior art descriptions, and it is obvious that the drawings in the following description are some embodiments of the present application, and that other drawings can be obtained according to these drawings without inventive effort to a person skilled in the art.
FIG. 1 is a schematic illustration of an original image being horizontally miscut to obtain a transformed image;
FIG. 2 is a schematic illustration of an original image after being vertically miscut to obtain a transformed image;
fig. 3 is an exemplary diagram of an application scenario provided in an embodiment of the present application;
fig. 4 is an exemplary diagram of an application scenario provided in an embodiment of the present application;
FIG. 5 is a flowchart of a method for drawing a photo frame according to an embodiment of the present disclosure;
fig. 6 is a schematic diagram of a process of calculating a coordinate of a vertex of a rectangle corresponding to an outer frame of an image-transformed photo frame in the photo frame drawing method provided in the embodiment of the application;
fig. 7 is a schematic diagram of calculating coordinates of two vertices of a rectangle corresponding to an outer frame of a photo frame after image transformation in the photo frame drawing method provided in the embodiment of the present application;
FIG. 8 is a flowchart of a method for drawing a photo frame according to an embodiment of the present disclosure;
fig. 9 is a schematic diagram of a circumscribed rectangle when a graphic on a photo frame is heart-shaped in the photo frame drawing method provided in the embodiment of the present application;
fig. 10 is a schematic structural diagram of a photo frame drawing device according to an embodiment of the present disclosure;
fig. 11 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
For the purposes of making the objects, technical solutions and advantages of the embodiments of the present application more clear, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments, but not all embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the embodiments of the present application, are within the scope of the embodiments of the present application.
The terms first and second and the like in the description of embodiments of the present application, in the claims and in the above-described figures, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that embodiments of the present application described herein may be capable of implementation in sequences other than those illustrated or described herein, for example. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
First, some terms in the embodiments of the present application are explained below to facilitate understanding by those skilled in the art.
1. Image transformation including basic transformation including translation, scaling, rotation, flipping, and miscut, and affine transformation and perspective transformation realized by combining the basic transformation.
2. Miscut, also known as beveling, shearing or dislocation transformation, includes horizontal miscut and vertical miscut, as shown in fig. 1 and 2, fig. 1 is a schematic diagram of an original image after being subjected to horizontal miscut to obtain a transformed image, and fig. 2 is a schematic diagram of an original image after being subjected to vertical miscut to obtain a transformed image.
Currently, in some applications, for displaying an image, it is involved to draw a photo frame for the image, and after the image is subjected to image transformation, the original photo frame needs to be transformed along with the image transformation, while the original width proportion of the photo frame is maintained, so that the photo frame needs to be drawn again for the transformed image. The photo frame has different shapes, such as a rectangular photo frame, a parallelogram photo frame, a heart-shaped photo frame and the like, and can also draw specific graphics, and after image transformation, the graphics on the photo frame and the photo frame are transformed along with the image transformation.
For translation and scaling in image transformation, redrawing a photo frame along with the transformation of an image is easy to realize, for example, if only translation is performed, a photo frame with equal width is drawn according to the position of a frame of the translated image, if scaling is performed, a photo frame with equal proportion is drawn according to the scaling of the image, but if image transformation comprises any one or combination of translation, scaling, rotation, overturning and miscut, how to realize transformation of the photo frame along with the transformation of the image while maintaining the original width proportion of the photo frame is a problem to be solved by the embodiment of the application.
The embodiment of the application provides a photo frame drawing method, equipment and a storage medium, wherein the rotation angle of image transformation is obtained firstly, the rotation angle can be any one of translation, scaling, rotation, overturning and miscut or the rotation angle of images before and after transformation after combination, then according to the rotation angle, first key point position information of an outer frame of an image after image transformation and the width of the photo frame before image transformation, second key point position information of the outer frame of the photo frame after image transformation is determined, then according to third key point position information and second key point position information of the outer frame of the photo frame before image transformation, a transformation matrix of the photo frame is determined, and finally according to the transformation matrix of the photo frame and the shape of the photo frame before image transformation, the photo frame after image transformation is drawn. Because the transformation matrix of the photo frame is determined according to the key point position information of the outer frame of the photo frame before image transformation and the key point position information of the outer frame of the photo frame after image transformation, the photo frame after image transformation is drawn according to the transformation matrix of the photo frame and the shape of the photo frame before image transformation, thereby realizing that the photo frame can be transformed along with the transformation of the image and the original width proportion of the photo frame is maintained, no matter what kind of image transformation is, the photo frame can be redrawn according to the transformed image.
Next, an application scenario according to an embodiment of the present application will be described by way of example.
Fig. 3 is an exemplary diagram of an application scenario provided in the embodiment of the present application, in which a rectangular photo frame is used as an example, as shown in fig. 3, an original image is a rectangular portion shown in gray, the original photo frame is a rectangular frame outside the image, the photo frame has a fixed width, and three other diagrams in fig. 3 are respectively a schematic diagram of the original image and the original photo frame after transformation 1, transformation 2 and transformation 3, transformation 1 is rotation, transformation 2 is rotation and miscut, transformation 3 is scaling, miscut and rotation, and fig. 3 is only an example and other image transformations. According to the picture frame drawing method, the picture frame can be drawn again according to the transformed image, the picture frame can be transformed along with the transformation of the image, and meanwhile the original width proportion of the picture frame is maintained.
Fig. 4 is an example diagram of an application scenario provided in the embodiment of the present application, in which a rectangular photo frame is more common, in this embodiment, the rectangular photo frame is further provided with graphics, as shown in fig. 4, the positions of four vertices of the rectangular photo frame are all provided with graphics, an original image is an image shown in the photo frame, the original photo frame is a rectangular frame outside the image, the photo frame has a fixed width, the positions of four vertices of the rectangular photo frame are further provided with graphics, two other diagrams in fig. 4 are schematic diagrams after the original image and the original photo frame are transformed 1 and 2, transform 1 is rotation, scaling and miscut, transform 2 is rotation, scaling and miscut, and fig. 4 is merely an example, and other image transforms are provided. According to the picture frame drawing method, the picture frames can be drawn again according to the transformed image converted from the image, the picture frames and the graphics on the picture frames can be transformed along with the transformation of the image, and meanwhile the original width proportion of the picture frames is maintained.
The detailed description of the specific implementation process of the photo frame drawing method, the photo frame drawing device and the storage medium provided by the embodiment of the application is provided below by means of specific embodiments.
Fig. 5 is a flowchart of a picture frame drawing method provided in an embodiment of the present application, where the picture frame drawing method may be performed by a picture frame drawing apparatus, and the picture frame drawing apparatus may be implemented by software and/or hardware. The photo frame drawing means may be an electronic device or a chip or a circuit of an electronic device. As shown in fig. 5, the method of the present embodiment may include:
s101, acquiring a rotation angle of image transformation.
Specifically, in the present embodiment, the image transformation includes a basic transformation including translation, scaling, rotation, flipping, and miscut, and an affine transformation and perspective transformation realized by combining the basic transformation. It is understood that, in addition to the translation and/or scaling corresponding to a rotation angle of 0, any one or combination of rotation, flipping, and miscut transforms corresponding to a rotation angle of greater than 0, and at least one of rotation, flipping, and miscut transforms corresponding to a combination of translation or scaling transforms corresponding to a rotation angle of greater than 0.
As an implementation manner, the rotation angle of the image transformation may be obtained by a vector method, since the image before transformation and the image after transformation are known, coordinates (x 1, y 1) and (x 2, y 2) of two points on the image before transformation may be taken, the two points form a first vector, coordinates (x 1', y 1') and (x 2', y 2') of two points corresponding to the same position on the image after transformation are taken, the two points form a second vector, and the included angle between the first vector and the second vector is calculated to be the rotation angle of the image transformation.
How to calculate the angle between the first vector and the second vector can be calculated by an arctangent function, for example, a value between-pi and pi is returned by an atan2 method, and the offset angle corresponding to the point (X, y) is represented by a counterclockwise angle, and the radian is taken as a unit, and the positive X axis and the connection line between the point (X, y) and the origin are calculated. For two intersecting vectors, the intersection point is the origin point, and after the corresponding angles are calculated by an atan2 method, the included angle of the two vectors can be obtained by subtraction.
As another embodiment, the rotation angle of the image transformation may be obtained by first obtaining a transformation matrix of the image, where the transformation matrix of the image includes information of the image transformation, such as translation distance, scaling, rotation angle, and the like, and then obtaining the rotation angle of the image transformation according to the transformation matrix of the image.
S102, determining second key point position information of the outer frame of the image-transformed photo frame according to the rotation angle, the first key point position information of the outer frame of the image-transformed photo frame and the width of the photo frame before image transformation.
Specifically, the first keypoint location information of the outer frame of the image after image transformation may be acquired before or after S101, or acquired while the rotation angle is acquired, and the width of the photo frame before image transformation may be known, or may be acquired before or after S101, or acquired while the rotation angle is acquired.
In one embodiment, the position information may be coordinates, the key points of the outer frame of the photo frame may be four vertices of a rectangle corresponding to the outer frame of the photo frame, if the outer frame of the photo frame is rectangular, the key points of the outer frame of the photo frame are four vertices of the rectangle, if the outer frame of the photo frame is circular, oval or heart-shaped, the rectangle corresponding to the outer frame of the photo frame is an circumscribed rectangle of the outer frame of the photo frame, and correspondingly, the key points of the outer frame of the photo frame are four vertices of the circumscribed rectangle. If the outer frame of the photo frame is a parallelogram, the rectangle corresponding to the outer frame of the photo frame is a rectangle formed by taking the bottom and the height of the parallelogram as the length and the width of the rectangle respectively.
As an implementation manner, the first key point location information may be: the coordinates of four vertices of a rectangle corresponding to the outer frame of the image after the image transformation, and the second key point position information may be: coordinates of four vertexes of a rectangle corresponding to an outer frame of the photo frame after image transformation. Accordingly, S102 may be: and calculating coordinates of four vertexes of the rectangle corresponding to the outer frame of the picture frame after the image transformation according to coordinates of four vertexes of the rectangle corresponding to the outer frame of the picture after the image transformation, the width and the rotation angle of the picture frame before the image transformation.
In this embodiment, four vertices of a rectangle corresponding to an outer frame of a photo frame are used as key points of the outer frame of the photo frame, and four vertices of a rectangle corresponding to the outer frame of an image are used as key points of the outer frame of the image, so that the calculation is convenient, and the accuracy of the calculation of the transformation matrix of the photo frame can be ensured.
Taking a rectangular photo frame as an example, when calculating coordinates of four vertices of a rectangle corresponding to an outer frame of an image after image transformation, a width and a rotation angle of the photo frame before image transformation, each vertex may BE calculated respectively, taking one vertex as an example, fig. 6 is a schematic process diagram of calculating coordinates of one vertex of a rectangle corresponding to an outer frame of the photo frame after image transformation in the photo frame drawing method provided by the embodiment of the application, as shown in fig. 6, point C is one vertex of four vertices of an outer frame of the image after image transformation, the coordinates of point C may BE obtained, the length of CE is the width of the photo frame before image transformation, the included angle between CE and CB is the rotation angle, the distance of the width of the photo frame before image transformation is extended in the opposite direction according to the direction of the side where the point C is located, CE and BE are obtained, the length of CB is calculated according to the included angle between CE and BE, the coordinates of point B are obtained, and the coordinates of point D and point D35 are obtained according to the same method, and the coordinates of point D and point D35 are obtained. According to the same method as shown in fig. 6, coordinates of four vertices of a rectangle corresponding to the outer frame of the image-converted photo frame can be obtained. Fig. 7 is a schematic diagram of calculating coordinates of two vertices of a rectangle corresponding to an outer frame of a photo frame after image transformation in the photo frame drawing method provided in the embodiment of the present application, as shown in fig. 7, point a and point a 'are respectively two vertices of a rectangle corresponding to an outer frame of a photo frame after image transformation, and a process for calculating coordinates of point a' is the same as a process for calculating coordinates of point a.
In another embodiment, as shown in fig. 7, after the length of the CB is calculated to obtain the coordinates of the point B, the CB line extends a fixed distance (i.e., the calculated length of the CB) to the point B, the C ' B ' extends the same distance to the point B ', the point a and the point a ' are obtained by extending the same distance through the B B ', and so on, the coordinates of four vertices may be calculated, and optionally, the amount of calculation may be reduced by using the symmetrical characteristic.
S103, determining a transformation matrix of the photo frame according to the third key point position information and the second key point position information of the outer frame of the photo frame before image transformation.
Specifically, in one implementation, the third keypoint location information is: coordinates of four vertices of a rectangle corresponding to an outer frame of a photo frame before image transformation.
S103 may specifically be: and determining a transformation matrix of the photo frame according to coordinates of four vertexes of a rectangle corresponding to the outer frame of the photo frame before image transformation and coordinates of four vertexes of a rectangle corresponding to the outer frame of the photo frame after image transformation, wherein the transformation matrix of the photo frame comprises at least one of translation information, rotation information, scaling information, overturning information and beveling information.
The transformation matrix is determined according to the coordinates of the four-point vertices before and after transformation, and a calculation mode of the transformation matrix can be adopted, which is not described in detail here.
S104, drawing the photo frame after image transformation according to the transformation matrix of the photo frame and the shape of the photo frame before image transformation.
Specifically, after the transformation matrix of the photo frame is obtained in S103, the photo frame after the image transformation can be drawn according to the transformation matrix of the photo frame and the shape of the photo frame before the image transformation.
As an implementation manner, S104 may specifically be:
s1041, determining the coordinates of each point on the photo frame after image transformation according to the transformation matrix of the photo frame and the coordinates of each point on the photo frame before image transformation.
S1042, drawing the photo frame after image transformation according to the coordinates of each point on the photo frame after image transformation. Specifically, each point on the photo frame after the image transformation is connected, and the photo frame after the image transformation can be obtained.
According to the photo frame drawing method provided by the embodiment, the rotation angle of image transformation is obtained firstly, the rotation angle can be any one of translation, scaling, rotation, overturning and miscut or the rotation angle of the images before and after transformation, then the second key point position information of the outer frame of the photo frame after image transformation is determined according to the rotation angle, the first key point position information of the outer frame of the image after image transformation and the width of the photo frame before image transformation, then the transformation matrix of the photo frame is determined according to the third key point position information and the second key point position information of the outer frame of the photo frame before image transformation, and finally the photo frame after image transformation is drawn according to the transformation matrix of the photo frame and the shape of the photo frame before image transformation. Because the transformation matrix of the photo frame is determined according to the key point position information of the outer frame of the photo frame before image transformation and the key point position information of the outer frame of the photo frame after image transformation, the photo frame after image transformation is drawn according to the transformation matrix of the photo frame and the shape of the photo frame before image transformation, thereby realizing that the photo frame can be transformed along with the transformation of the image and the original width proportion of the photo frame is maintained, no matter what kind of image transformation is, the photo frame can be redrawn according to the transformed image.
Fig. 8 is a flowchart of a picture frame drawing method provided in an embodiment of the present application, where the picture frame drawing method may be performed by a picture frame drawing apparatus, and the picture frame drawing apparatus may be implemented by software and/or hardware. The photo frame drawing means may be an electronic device or a chip or a circuit of an electronic device. The difference between the embodiment of the present embodiment and the embodiment of the method shown in fig. 5 is that, in the case that the photo frame can be transformed along with the transformation of the image and at least one graphic is further provided on the photo frame, the method of the present embodiment can be implemented such that the photo frame and the graphic on the photo frame can be transformed along with the transformation of the image, as shown in fig. 8, the method of the present embodiment may include:
s201, acquiring a rotation angle of image transformation.
S202, determining second key point position information of the outer frame of the image-transformed photo frame according to the rotation angle, the first key point position information of the outer frame of the image-transformed photo frame and the width of the photo frame before image transformation.
S203, determining a transformation matrix of the photo frame according to the third key point position information and the second key point position information of the outer frame of the photo frame before image transformation.
Specifically, for a specific determination manner of the transformation matrix of the photo frame, reference may be made to the description in the embodiment shown in fig. 5, which is not repeated herein.
S204, determining fourth key point position information of the circumscribed rectangle of the graph after image transformation according to the rotation angle, the first key point position information and the length and the width of the circumscribed rectangle for each graph in the at least one graph.
As an implementation manner, the location information is coordinates, and the first key point location information may be: coordinates of four vertexes of a rectangle corresponding to an outer frame of the image after the image transformation. The fourth keypoint location information may be: coordinates of four vertexes of a circumscribed rectangle of the image-converted pattern. The fifth key point position information is: the image transforms the coordinates of the four vertices of the circumscribed rectangle of the pre-image.
Accordingly, S204 may be: and calculating the coordinates of the four vertexes of the circumscribed rectangle of the image after image transformation according to the rotation angle, the coordinates of the four vertexes of the rectangle corresponding to the outer frame of the image after image transformation and the length and width of the circumscribed rectangle.
Fig. 9 is a schematic diagram of a circumscribed rectangle when the pattern on the photo frame is heart-shaped in the photo frame drawing method provided in the embodiment of the present application, as shown in fig. 9, if the pattern on the photo frame is heart-shaped, the circumscribed rectangle of the heart-shaped pattern is shown as a dashed frame in fig. 9. The circumscribed rectangle of the heart-shaped graph has a length and a width, and the transformation matrix of the graph can be calculated through the coordinates of four vertexes of the circumscribed rectangle of the heart-shaped graph before image transformation and the coordinates of four vertexes of the circumscribed rectangle of the heart-shaped graph after image transformation. The calculation mode of the transformation matrix of the graph is similar to that of the transformation matrix of the photo frame, and because the coordinates of the four vertexes of the circumscribed rectangle of the heart-shaped graph before the image transformation can be directly obtained, the coordinates of the four vertexes of the circumscribed rectangle of the heart-shaped graph after the image transformation need to be determined.
It should be noted that, when the graph is close to which vertex of the four vertices of the rectangle corresponding to the outer frame of the image after the image transformation, the coordinates of the vertex are used in the calculation, that is, the coordinates of the four vertices of the rectangle corresponding to the outer frame of the image after the image transformation are calculated according to the rotation angle, the coordinates of the vertex with the smallest distance to the graph in the four vertices of the rectangle corresponding to the outer frame of the image after the image transformation, and the length and width of the circumscribed rectangle, the calculation mode can be similar to the calculation mode of the transformation matrix of the photo frame, and the coordinates of the four vertices of the rectangle corresponding to the outer frame of the photo frame after the image transformation are calculated, which is not repeated here.
In the embodiment, four vertexes of the circumscribed rectangle of the graph are used as key points of the circumscribed rectangle of the graph, so that the calculation is convenient, and the accuracy of the calculation of the graph transformation matrix can be ensured.
S205, determining a transformation matrix of the graph according to the fifth key point position information and the fourth key point position information of the circumscribed rectangle of the graph before image transformation.
Accordingly, in an embodiment, S205 may specifically be a calculation method of calculating a transformation matrix of the graph according to coordinates of four vertices of a circumscribed rectangle of the graph before the image transformation and coordinates of four vertices of a circumscribed rectangle of the graph after the image transformation, where the calculation method may be a calculation method of the transformation matrix, and the transformation matrix of the graph includes at least one of translation information, rotation information, scaling information, flipping information, and beveling information.
It should be noted that, the transformation matrix of the photo frame is determined through S202-S203, the transformation matrix of the graphics is determined through S204-S205, and if the photo frame is provided with at least one graphic, the determination of the transformation matrix of the photo frame and the partial order of the transformation matrix of the graphics may also be performed simultaneously. The transformation matrix of the photo frame is different from the transformation matrix of the graphics, and for each graphic set on the photo frame, the transformation matrix of each graphic is determined through S204-S205, respectively.
S206, drawing the photo frame after image transformation according to the transformation matrix of the photo frame and the shape of the photo frame before image transformation.
S207, drawing the graph after image transformation according to the transformation matrix of the graph and the shape of the graph.
Specifically, S207 may be: and determining the coordinates of each point on the graph after the image transformation according to the transformation matrix of the graph and the coordinates of each point on the graph before the image transformation, and drawing the graph after the image transformation according to the coordinates of each point on the graph after the image transformation.
According to the photo frame drawing method provided by the embodiment, the rotation angle of image transformation is firstly obtained, then the transformation matrix of the photo frame is determined according to the rotation angle, the first key point position information of the outer frame of the image after image transformation, the width of the photo frame before image transformation and the third key point position information of the outer frame of the photo frame before image transformation, then the transformation matrix of the graph is determined according to the rotation angle, the first key point position information, the length and the width of the circumscribed rectangle and the fifth key point position information of the circumscribed rectangle of the graph before image transformation for each graph, finally the photo frame after image transformation is drawn according to the transformation matrix of the photo frame and the shape of the graph, and the graph after image transformation is drawn according to the transformation matrix of the graph and the shape of the graph. Because the transformation matrix of the photo frame is determined according to the key point position information of the outer frame of the photo frame before image transformation and the key point position information of the outer frame of the photo frame after image transformation, the photo frame after image transformation is drawn according to the transformation matrix of the photo frame and the shape of the photo frame before image transformation, thereby realizing that the photo frame can be transformed along with the transformation of the image and the original width proportion of the photo frame is maintained, no matter what kind of image transformation is, the photo frame can be redrawn according to the transformed image. The transformation matrix of the graph is determined according to the position information of the key points of the circumscribed rectangle of the graph before the image transformation and the position information of the key points of the circumscribed rectangle of the graph after the image transformation, and the graph after the image transformation is drawn according to the transformation matrix of the graph and the shape of the graph, so that no matter what kind of image transformation is realized, the graph on the photo frame can be redrawn according to the transformed image of the image, and the graph on the photo frame can be transformed along with the transformation of the image.
Taking a photo frame as a quadrilateral ABCD as an example, the quadrilateral ABCD may be any one of a rectangle, a parallelogram or a diamond, and shows a program code example for implementing the photo frame drawing method provided in the present application, where in the following implementation formula, the photo frame may be implemented to be transformed along with the transformation of an image:
implementation code for calculating the actual extended distance:
the following are device embodiments of the present application, which may be used to perform the method embodiments described above. For details not disclosed in the device embodiments of the present application, reference may be made to the method embodiments described above in the present application.
Fig. 10 is a schematic structural diagram of a photo frame drawing device according to an embodiment of the present application. The photo frame drawing device may be implemented in software and/or hardware. As shown in fig. 10, the photo frame drawing apparatus of the present embodiment may include: an acquisition module 11, a first determination module 12, a second determination module 13 and a rendering module 14, wherein,
the acquisition module 11 is used for acquiring the rotation angle of the image transformation.
The first determining module 12 is configured to determine second keypoint location information of an outer frame of the image-transformed photo frame according to the rotation angle, first keypoint location information of the outer frame of the image-transformed image, and a width of the photo frame before the image transformation.
The second determining module 13 is configured to determine a transformation matrix of the photo frame according to the third key point position information of the outer frame of the photo frame before the image transformation and the second key point position information.
The drawing module 14 is configured to draw the picture frame after the image transformation according to the transformation matrix of the picture frame and the shape of the picture frame before the image transformation.
In some embodiments, the location information is coordinates and the first keypoint location information is: coordinates of four vertexes of a rectangle corresponding to an outer frame of the image after the image transformation;
the second key point position information is: coordinates of four vertexes of a rectangle corresponding to an outer frame of the photo frame after the image transformation;
the first determining module 12 is configured to: and calculating coordinates of four vertexes of the rectangle corresponding to the outer frame of the image-transformed photo frame according to coordinates of four vertexes of the rectangle corresponding to the outer frame of the image-transformed photo frame, the width of the photo frame before image transformation and the rotation angle.
In some embodiments, the third keypoint location information is: coordinates of four vertexes of a rectangle corresponding to an outer frame of the photo frame before image transformation; the second determining module 13 is configured to:
And determining a transformation matrix of the photo frame according to coordinates of four vertexes of a rectangle corresponding to an outer frame of the photo frame before image transformation and coordinates of four vertexes of a rectangle corresponding to an outer frame of the photo frame after image transformation, wherein the transformation matrix of the photo frame comprises at least one of translation information, rotation information, scaling information, overturning information and beveling information.
In some embodiments, the rendering module 14 is configured to:
determining the coordinates of each point on the photo frame after the image transformation according to the transformation matrix of the photo frame and the coordinates of each point on the photo frame before the image transformation;
and drawing the photo frame after image transformation according to the coordinates of each point on the photo frame after image transformation.
In some embodiments, the photo frame includes at least one graphic thereon, and the first determining module 12 is further configured to:
determining fourth key point position information of circumscribed rectangles of the graphics after image transformation according to the rotation angle, the first key point position information and the length and width of the circumscribed rectangles for each of the at least one graphics;
the second determining module 13 is further configured to: determining a transformation matrix of the graph according to fifth key point position information and fourth key point position information of the circumscribed rectangle of the graph before the image transformation;
The rendering module 14 is further configured to: and drawing the graph after the image transformation according to the transformation matrix of the graph and the shape of the graph.
In some embodiments, the location information is coordinates and the first keypoint location information is: coordinates of four vertexes of a rectangle corresponding to an outer frame of the image after the image transformation, and the fourth key point position information is: coordinates of four vertexes of the circumscribed rectangle of the graph after the image transformation, and the fifth key point position information is: the image transforms the coordinates of the four vertices of the circumscribed rectangle of the graphic.
The first determining module 12 is specifically configured to: and calculating the coordinates of the four vertexes of the circumscribed rectangle of the graph after the image transformation according to the rotation angle, the coordinates of the four vertexes of the rectangle corresponding to the outer frame of the image after the image transformation and the length and the width of the circumscribed rectangle.
In a possible embodiment, the second determining module 13 is specifically configured to: and calculating a transformation matrix of the graph according to the coordinates of four vertexes of the circumscribed rectangle of the graph before the image transformation and the coordinates of four vertexes of the circumscribed rectangle of the graph after the image transformation, wherein the transformation matrix of the graph comprises at least one of translation information, rotation information, scaling information, overturning information and beveling information.
In a possible implementation manner, the drawing module 14 is specifically configured to: and determining the coordinates of each point on the graph after the image transformation according to the transformation matrix of the graph and the coordinates of each point on the graph before the image transformation, and drawing the graph after the image transformation according to the coordinates of each point on the graph after the image transformation.
The device of the present embodiment may be used to implement the technical solution of the method embodiment shown in fig. 5 or fig. 8, and its implementation principle and technical effects are similar, and are not described herein again.
In this embodiment of the present application, the function modules of the photo frame drawing apparatus may be divided according to the above method example, for example, each function module may be divided corresponding to each function, or two or more functions may be integrated into one processing module. The integrated modules may be implemented in hardware or in software functional modules. It should be noted that, in the embodiments of the present application, the division of the modules is schematic, which is merely a logic function division, and other division manners may be implemented in actual implementation.
Fig. 11 is a schematic structural diagram of an electronic device according to an embodiment of the present application. As shown in fig. 11, the electronic device 50 includes: a processor 51, and a memory 52, a communication module 53 and a display 54 connected to the processor 51.
The processor 51 may include one or more processing units, such as: the processor 51 may be a central processing unit (Central Processing Unit, CPU for short), a digital signal processor (Digital Signal Processor, DSP for short), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC for short), or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with the present application may be embodied directly in a hardware processor for execution, or in a combination of hardware and software modules in a processor for execution.
Memory 52 may be used to store program instructions. The memory 52 may include a stored program area and a stored data area. The storage program area may store an application program (such as a sound playing function, etc.) required for at least one function of the operating system, and the like. The storage data area may store data created during use of the electronic device 50 (e.g., audio data, etc.), and so on. In addition, the memory 52 may include a high-speed random access memory, and may also include a nonvolatile memory such as at least one magnetic disk storage device, a flash memory device, a universal flash memory (universal flash storage, abbreviated UFS), and the like. The processor 51 performs various functional applications of the electronic device 50 and data processing by executing program instructions stored in the memory 52.
The communication module 53 may provide a solution for wireless communication including 2G/3G/4G/5G, etc. applied on the electronic device 50. The communication module 53 may receive electromagnetic waves from an antenna, filter, amplify, and the like the received electromagnetic waves, and transmit the electromagnetic waves to a modem processor for demodulation. The communication module 53 may amplify the signal modulated by the modem processor, and convert the signal into electromagnetic waves through the antenna to radiate the electromagnetic waves. In some embodiments, at least some of the functional modules of the communication module 53 may be provided in the processor 51. In some embodiments, at least some of the functional modules of the communication module 53 may be provided in the same device as at least some of the modules of the processor 51.
The display screen 54 is used to display pictures, such as images, videos, and the like. The display screen 54 includes a display panel. The display panel may employ a liquid crystal display (Liquid Crystal Display, LCD) or an Organic Light-Emitting Diode (OLED), an Active-Matrix Organic Light Emitting Diode or an Active-matrix Organic Light-Emitting Diode (AMOLED), a flexible Light-Emitting Diode (Flex-Emitting Diode), a mini, micro led, micro-OLED, a quantum dot Light-Emitting Diode (Quantum Dot Light Emitting Diodes, QLED), or the like. The display panel may receive a touch operation input by a user through a finger or an input device. Wherein the input device includes, but is not limited to: a stylus, an infrared pen, and/or a capacitive pen, etc.
Optionally, the electronic device 50 further includes: a camera 55, etc.
The camera 55 can take an image or video. For example, the camera 55 may capture video under the control of the processor 51 and store the video to the memory 52.
It should be noted that, the number of the memories 52 and the processors 51 is not limited in the embodiment of the present application, and may be one or more, and fig. 11 illustrates one example; the memory 52 and the processor 51 may be connected by a wired or wireless connection in a variety of ways, such as a bus connection. In practice, the electronic device 50 may be a computer, a mobile phone, a tablet, a PDA, an interactive tablet, or the like.
The bus may be an industry standard architecture (Industry Standard Architecture, ISA) bus, an external device interconnect (Peripheral Component, PCI) bus, or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, among others. The buses may be divided into address buses, data buses, control buses, etc. For ease of illustration, the buses in the drawings of the present application are not limited to only one bus or one type of bus.
The electronic device of the present embodiment may be used to execute the photo frame drawing method in the foregoing embodiment, and its implementation principle and technical effects are similar, and will not be described herein.
The embodiment of the application also provides a computer readable storage medium, which comprises a computer program for implementing the photo frame drawing method in the above embodiment.
The present application also provides a computer program product, including a computer program, which when executed by a processor implements the picture frame drawing method in the above embodiments.
Those of ordinary skill in the art will appreciate that: all or part of the steps for implementing the method embodiments described above may be performed by hardware associated with program instructions. The foregoing program may be stored in a computer readable storage medium. The program, when executed, performs steps including the method embodiments described above; and the aforementioned storage medium includes: various media that can store program code, such as ROM, RAM, magnetic or optical disks.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solutions of the embodiments of the present application, and are not limited thereto; although embodiments of the present application have been described in detail with reference to the foregoing embodiments, it will be appreciated by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some or all of the technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application.

Claims (11)

1. A picture frame drawing method, comprising:
acquiring a rotation angle of image transformation;
determining second key point position information of the outer frame of the image transformed photo frame according to the rotation angle, the first key point position information of the outer frame of the image transformed photo frame and the width of the photo frame before the image transformation;
determining a transformation matrix of the photo frame according to the third key point position information of the outer frame of the photo frame before the image transformation and the second key point position information;
and drawing the photo frame after the image transformation according to the transformation matrix of the photo frame and the shape of the photo frame before the image transformation.
2. The method of claim 1, wherein the location information is coordinates and the first keypoint location information is: coordinates of four vertexes of a rectangle corresponding to an outer frame of the image after the image transformation;
the second key point position information is: coordinates of four vertexes of a rectangle corresponding to an outer frame of the photo frame after the image transformation;
the determining the second key point position information of the outer frame of the image transformed photo frame according to the rotation angle, the first key point position information of the outer frame of the image transformed photo frame and the width of the photo frame before the image transformation comprises the following steps:
And calculating coordinates of four vertexes of a rectangle corresponding to the outer frame of the image after image transformation according to coordinates of four vertexes of the rectangle corresponding to the outer frame of the image after image transformation, the width of the photo frame before image transformation and the rotation angle.
3. The method of claim 2, wherein the third keypoint location information is: coordinates of four vertexes of a rectangle corresponding to an outer frame of the photo frame before image transformation;
the determining a transformation matrix of the photo frame according to the third key point position information of the outer frame of the photo frame before the image transformation and the second key point position information comprises the following steps:
and determining a transformation matrix of the photo frame according to coordinates of four vertexes of a rectangle corresponding to an outer frame of the photo frame before image transformation and coordinates of four vertexes of a rectangle corresponding to an outer frame of the photo frame after image transformation, wherein the transformation matrix of the photo frame comprises at least one of translation information, rotation information, scaling information, overturning information and beveling information.
4. A method according to any one of claims 1-3, wherein said rendering said image transformed photo frame from said transformation matrix of said photo frame and from said shape of said image transformed photo frame comprises:
Determining the coordinates of each point on the photo frame after the image transformation according to the transformation matrix of the photo frame and the coordinates of each point on the photo frame before the image transformation;
and drawing the photo frame after image transformation according to the coordinates of each point on the photo frame after image transformation.
5. The method of claim 1, wherein the frame includes at least one graphic thereon, the method further comprising:
determining fourth key point position information of circumscribed rectangles of the graphics after image transformation according to the rotation angle, the first key point position information and the length and width of the circumscribed rectangles for each of the at least one graphics;
determining a transformation matrix of the graph according to fifth key point position information and fourth key point position information of the circumscribed rectangle of the graph before the image transformation;
and drawing the graph after the image transformation according to the transformation matrix of the graph and the shape of the graph.
6. The method of claim 5, wherein the location information is coordinates,
the first key point position information is: coordinates of four vertexes of a rectangle corresponding to an outer frame of the image after the image transformation;
The fourth key point position information is: coordinates of four vertexes of the circumscribed rectangle of the graph after the image transformation;
the fifth key point position information is: coordinates of four vertexes of the circumscribed rectangle of the graph before the image transformation;
the determining the fourth key point position information of the circumscribed rectangle of the graph after the image transformation according to the rotation angle, the first key point position information and the length and the width of the circumscribed rectangle comprises the following steps:
and calculating the coordinates of the four vertexes of the circumscribed rectangle of the graph after the image transformation according to the rotation angle, the coordinates of the four vertexes of the rectangle corresponding to the outer frame of the image after the image transformation and the length and the width of the circumscribed rectangle.
7. The method of claim 6, wherein the determining the transformation matrix of the graph based on fifth keypoint location information and the fourth keypoint location information of the circumscribed rectangle of the graph before the image transformation comprises:
and calculating a transformation matrix of the graph according to the coordinates of four vertexes of the circumscribed rectangle of the graph before the image transformation and the coordinates of four vertexes of the circumscribed rectangle of the graph after the image transformation, wherein the transformation matrix of the graph comprises at least one of translation information, rotation information, scaling information, overturning information and beveling information.
8. The method according to any one of claims 5-7, wherein the rendering the image transformed graph from the transformation matrix of the graph and the shape of the graph comprises:
determining the coordinates of each point on the graph after the image transformation according to the transformation matrix of the graph and the coordinates of each point on the graph before the image transformation;
and drawing the graph after image transformation according to the coordinates of each point on the graph after image transformation.
9. A photo frame drawing apparatus, comprising:
the acquisition module is used for acquiring the rotation angle of the image transformation;
the first determining module is used for determining second key point position information of the outer frame of the image transformed photo frame according to the rotation angle, the first key point position information of the outer frame of the image transformed photo frame and the width of the photo frame before image transformation;
the second determining module is used for determining a transformation matrix of the photo frame according to the third key point position information of the outer frame of the photo frame before the image transformation and the second key point position information;
and the drawing module is used for drawing the photo frame after the image transformation according to the transformation matrix of the photo frame and the shape of the photo frame before the image transformation.
10. An electronic device, comprising:
a processor; and
a memory for storing executable instructions of the processor;
wherein the processor is configured to perform the picture frame drawing method of any one of claims 1-8 via execution of the executable instructions.
11. A computer readable storage medium having stored thereon a computer program, which when executed by a processor implements the picture frame drawing method according to any one of claims 1-8.
CN202011510168.9A 2020-12-18 2020-12-18 Photo frame drawing method, device and storage medium Active CN112489157B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011510168.9A CN112489157B (en) 2020-12-18 2020-12-18 Photo frame drawing method, device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011510168.9A CN112489157B (en) 2020-12-18 2020-12-18 Photo frame drawing method, device and storage medium

Publications (2)

Publication Number Publication Date
CN112489157A CN112489157A (en) 2021-03-12
CN112489157B true CN112489157B (en) 2024-03-19

Family

ID=74914914

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011510168.9A Active CN112489157B (en) 2020-12-18 2020-12-18 Photo frame drawing method, device and storage medium

Country Status (1)

Country Link
CN (1) CN112489157B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1291820A2 (en) * 2001-09-07 2003-03-12 Robert Bosch Gmbh Method and apparatus for transforming object pictures
CN101149838A (en) * 2007-11-09 2008-03-26 北大方正集团有限公司 Layout image frame generation method and device
CN107122774A (en) * 2017-03-28 2017-09-01 武汉斗鱼网络科技有限公司 A kind of adaptive chart pasting method moved with key point in image and system
CN107230239A (en) * 2017-05-11 2017-10-03 广州视源电子科技股份有限公司 Graph drawing method, device and equipment
CN110070479A (en) * 2019-01-31 2019-07-30 北京字节跳动网络技术有限公司 Anamorphose pulls independent positioning method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1291820A2 (en) * 2001-09-07 2003-03-12 Robert Bosch Gmbh Method and apparatus for transforming object pictures
CN101149838A (en) * 2007-11-09 2008-03-26 北大方正集团有限公司 Layout image frame generation method and device
CN107122774A (en) * 2017-03-28 2017-09-01 武汉斗鱼网络科技有限公司 A kind of adaptive chart pasting method moved with key point in image and system
CN107230239A (en) * 2017-05-11 2017-10-03 广州视源电子科技股份有限公司 Graph drawing method, device and equipment
CN110070479A (en) * 2019-01-31 2019-07-30 北京字节跳动网络技术有限公司 Anamorphose pulls independent positioning method and device

Also Published As

Publication number Publication date
CN112489157A (en) 2021-03-12

Similar Documents

Publication Publication Date Title
JP5538435B2 (en) Image feature extraction method and system
US9443348B2 (en) Image processing apparatus, image processing method, and program
US20210035346A1 (en) Multi-Plane Model Animation Interaction Method, Apparatus And Device For Augmented Reality, And Storage Medium
US9330466B2 (en) Methods and apparatus for 3D camera positioning using a 2D vanishing point grid
CN110781823B (en) Screen recording detection method and device, readable medium and electronic equipment
EP3163423A1 (en) Method and device for setting background of ui control and terminal
US10176552B2 (en) Non-transitory computer-readable storage medium, image display method, and image processing system for associating the same object in different images
CN116310036A (en) Scene rendering method, device, equipment, computer readable storage medium and product
CN113126862A (en) Screen capture method and device, electronic equipment and readable storage medium
US20160155250A1 (en) Map obtaining method
US10861138B2 (en) Image processing device, image processing method, and program
WO2022095318A1 (en) Character detection method and apparatus, electronic device, storage medium, and program
CN111833399A (en) Target detection method based on fisheye image and related equipment
CN112489157B (en) Photo frame drawing method, device and storage medium
CN117522963A (en) Corner positioning method and device of checkerboard, storage medium and electronic equipment
CN115129278A (en) Image display control method, system, readable storage medium and electronic device
CN112927163A (en) Image data enhancement method and device, electronic equipment and storage medium
CN112132764A (en) Face shape processing method, face shape processing device, user terminal and computer-readable storage medium
CN112181332A (en) Display method of any resolution ratio picture of LED cloud spliced wall and LED cloud spliced wall
CN113553128A (en) Picture corner generation method and device, electronic equipment and storage medium
CN113610864B (en) Image processing method, device, electronic equipment and computer readable storage medium
CN111625237B (en) Character vision deformation method, system and medium
CN101706721B (en) Face detection method simulating radar scanning
CN112150351A (en) Image processing method, image processing device, electronic equipment and computer readable storage medium
CN110827411B (en) Method, device, equipment and storage medium for displaying augmented reality model of self-adaptive environment

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