CN111383170A - Method and device for adjusting picture key points and terminal - Google Patents

Method and device for adjusting picture key points and terminal Download PDF

Info

Publication number
CN111383170A
CN111383170A CN201811627458.4A CN201811627458A CN111383170A CN 111383170 A CN111383170 A CN 111383170A CN 201811627458 A CN201811627458 A CN 201811627458A CN 111383170 A CN111383170 A CN 111383170A
Authority
CN
China
Prior art keywords
point
moved
key
vector
reference point
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.)
Granted
Application number
CN201811627458.4A
Other languages
Chinese (zh)
Other versions
CN111383170B (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 Baiguoyuan Network Technology Co Ltd
Original Assignee
Guangzhou Baiguoyuan Network Technology 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 Baiguoyuan Network Technology Co Ltd filed Critical Guangzhou Baiguoyuan Network Technology Co Ltd
Priority to CN201811627458.4A priority Critical patent/CN111383170B/en
Publication of CN111383170A publication Critical patent/CN111383170A/en
Application granted granted Critical
Publication of CN111383170B publication Critical patent/CN111383170B/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/20Linear translation of whole images or parts thereof, e.g. panning
    • 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
    • G06T5/00Image enhancement or restoration
    • G06T5/70Denoising; Smoothing
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02TCLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO TRANSPORTATION
    • Y02T10/00Road transport of goods or passengers
    • Y02T10/10Internal combustion engine [ICE] based vehicles
    • Y02T10/40Engine management systems

Landscapes

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

Abstract

The invention provides a method for adjusting picture key points, which comprises the following steps: selecting a plurality of key points to be moved from the key points of the picture; determining a reference point in the adjusting process, and respectively calculating the target position of each adjusted key point to be moved according to the position of the reference point and the current position of each key point to be moved; and respectively moving each key point to be moved to a corresponding target position. The invention also provides a device and a terminal for adjusting the picture key points. The method, the device and the terminal for adjusting the picture key points can adjust the key points to be moved from the current position to the target position in batch by utilizing the rule between the key points to be moved and the reference point, and are high in adjusting efficiency and high in accuracy. According to the technical scheme, the remaining key points to be recognized can be adjusted by adjusting one of the key points to be recognized, so that the adjustment is more visual, and the operation of a user is more facilitated.

Description

Method and device for adjusting picture key points and terminal
Technical Field
The invention relates to the technical field of computer application, in particular to a method, a device and a terminal for adjusting picture key points.
Background
In the current key point recognition scenes, such as face recognition, object recognition and other recognition scenes, some models are often required to be trained. When training the model, the key points of the object (such as a picture) input into the training model need to be pre-labeled. However, these pre-labeled objects often have deviations in key points and cannot be used for recognition or training.
The prior art solutions typically move from key point to key point. The existing scheme has the defects that the number of key points needing to be adjusted on a single picture is large, the adjustment efficiency is low, the problem of inaccurate key points exists after adjustment, and finally the adjustment effect of the key points is poor.
Disclosure of Invention
The invention aims to solve at least one of the technical defects, in particular to the technical defect that the adjustment effect of the key point is poor due to low key point adjustment efficiency and inaccurate key point adjustment.
The application provides a method for adjusting picture key points, which comprises the following steps:
selecting a plurality of key points to be moved from the key points of the picture;
determining a reference point in the adjusting process, and respectively calculating the target position of each adjusted key point to be moved according to the position of the reference point and the current position of each key point to be moved;
and respectively moving each key point to be moved to a corresponding target position.
In one embodiment, the step of determining the reference point in the adjustment process, and calculating the target position of each adjusted to-be-moved keypoint according to the reference point position and the current position of each to-be-moved keypoint includes:
determining a reference point of the smooth adjustment process; the reference points are two adjacent key points of the key points to be moved;
acquiring the position of the reference point and the current position of each key point to be moved;
and smoothing the key points to be moved by using a smoothing model, and calculating the target position of each key point to be moved.
In one embodiment, the smoothing model is described as:
Figure BDA0001928271830000021
a+b+c=1;
wherein ,
Figure BDA0001928271830000022
is a vector of keypoints adjusted to the target position,
Figure BDA0001928271830000023
is the vector of the keypoint to be moved,
Figure BDA0001928271830000024
is a vector of said one of the reference points,
Figure BDA0001928271830000025
is the vector of the other reference point, i is the serial number of the key point to be moved, and a, b, and c are smoothing coefficients.
In one embodiment, the smoothing coefficient a is 0.5, and the smoothing coefficients b and c are 0.25.
In one embodiment, the step of determining the reference point in the adjustment process, and calculating the target position of each adjusted to-be-moved keypoint according to the reference point position and the current position of each to-be-moved keypoint includes:
determining a zooming reference point serving as a zooming center in the zooming adjustment process; the zooming reference point is used for determining the distance of the key point zoomed to the target position;
acquiring a zooming distance, a zooming angle taking a zooming reference point as a center and a current position;
and carrying out scaling treatment on the key points to be moved by using the scaling model, and calculating the target position of each key point to be moved.
In one embodiment, the scaling model is described as:
Δxi=di·cos(r);
Δyi=di·sin(r);
Figure BDA0001928271830000026
wherein ,diFor the zoom distance, r is a zoom angle centered at a zoom reference point, Δ xiIs the transverse distance, Δ yiIs the longitudinal distance between the first and second end of the rail,
Figure BDA0001928271830000027
is the vector of the key point to be moved at the current position,
Figure BDA0001928271830000028
is corresponding to
Figure BDA0001928271830000029
And (3) scaling to the vector of the key point of the target position, wherein i is the key point and the serial number of the key point correspondingly adjusted to the target position.
In one embodiment, the scaling distance diAnd the zoom angle r is obtained by the following model:
Figure BDA0001928271830000031
Figure BDA0001928271830000032
wherein ,diFor the zoom distance, r is the zoom angle centered at the zoom reference point,
Figure BDA0001928271830000033
is the vector between the keypoint and the zoom reference point,
Figure BDA0001928271830000034
is a vector of the current position to the target position of one of the keypoints,
Figure BDA0001928271830000035
is the vector between the current position of one of the keypoints and the zoom reference point,
Figure BDA0001928271830000036
is a vector of the current position of the keypoint,
Figure BDA0001928271830000037
is a vector of the current position of one of the keypoints,
Figure BDA0001928271830000038
is a vector of the target locations of the keypoints,
Figure BDA0001928271830000039
is corresponding to
Figure BDA00019282718300000310
And i is the key point and the serial number of the key point correspondingly adjusted to the target position.
In one embodiment, the step of determining the reference point in the adjustment process, and calculating the target position of each adjusted to-be-moved keypoint according to the reference point position and the current position of each to-be-moved keypoint includes:
determining a reference point of the translation adjustment process; wherein the reference points comprise a translation starting point and a translation end point;
acquiring the current positions of the reference point and each key point to be moved;
and translating the key points to be moved by using the translation model, and calculating the target position of each key point to be moved.
In one embodiment, the translation model is described as:
Figure BDA00019282718300000311
wherein ,
Figure BDA00019282718300000312
is the vector of the keypoint at the current position,
Figure BDA00019282718300000313
is the vector of the keypoint at the target location,
Figure BDA00019282718300000314
and the translation vector is constructed by the translation starting point and the translation end point.
In one embodiment, the step of determining the reference point in the adjustment process, and calculating the target position of each adjusted to-be-moved keypoint according to the reference point position and the current position of each to-be-moved keypoint includes:
determining a rotation reference point indicating a rotation position in a rotation adjustment process and a rotation center point serving as a rotation center; the rotating reference point is used for determining the distance and the angle of the key point rotating to the target position;
acquiring and according to a rotating reference point, a rotating central point and the current position of a key point;
and performing rotation processing on the key points to be moved by using the rotation model, and calculating the target position of each key point to be moved.
In one embodiment, the rotation model is described as:
Figure BDA00019282718300000415
Figure BDA0001928271830000041
Figure BDA0001928271830000042
wherein ,
Figure BDA0001928271830000043
is the vector of the keypoint at the current position,
Figure BDA0001928271830000044
is a vector of the reference point of rotation,
Figure BDA0001928271830000045
theta is a vector from the rotation reference point to the rotation center point, and is a rotation angle with the rotation center point as the center, (x)1,y1) Is a rotating superimposed vector, x1Is the transverse coordinate, y, of the rotated superposition vector1Is the longitudinal coordinate of the rotated superposition vector,
Figure BDA0001928271830000046
is the vector of the keypoint at the target location.
In one embodiment, a reference point is selected as the rotation start point and the rotation end point, the vector of the rotation reference point
Figure BDA0001928271830000047
And the rotation angle θ is obtained by the following model:
Figure BDA0001928271830000048
Figure BDA0001928271830000049
wherein ,
Figure BDA00019282718300000410
is a vector of the reference point of rotation,
Figure BDA00019282718300000411
is the vector of the center point of rotation,
Figure BDA00019282718300000412
for one of which is assigned offThe vector of the key points to the center point of rotation, theta is the angle of rotation,
Figure BDA00019282718300000413
is a vector of the rotation starting point around the rotation center point,
Figure BDA00019282718300000414
is a vector of the rotation end point around the rotation center point.
The present application further provides an adjusting device for key points of pictures, including:
the selection unit is used for selecting a plurality of key points to be moved from the key points of the picture;
the operation unit is used for determining a reference point in the adjustment process, and respectively calculating the target position of each adjusted key point to be moved according to the position of the reference point and the current position of each key point to be moved;
and the moving unit is used for respectively moving each key point to be moved to the corresponding target position.
The present invention also provides a terminal, comprising:
one or more processors;
a memory;
one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to: the method for adjusting the key points of the picture according to any embodiment is executed.
According to the method and the device for adjusting the picture key points and the mobile terminal, the plurality of key points to be moved are selected from the key points of the picture; determining a reference point in the adjusting process, and respectively calculating the target position of each adjusted key point to be moved according to the position of the reference point and the current position of each key point to be moved; the technical scheme of moving each key point to be moved to the corresponding target position respectively can realize the adjustment of the key points to be moved from the current position to the target position in batches by utilizing the rule between the key points to be moved and the reference points, and has high adjustment efficiency and strong accuracy.
In some improved schemes, the remaining key points to be identified can be adjusted by adjusting one of the key points to be identified, so that the adjustment is more intuitive and is more beneficial to user operation.
In some improved schemes, all selected key points to be identified can be adjusted by using the track of the external input equipment, the adjustment is convenient, and the operation of a user is facilitated.
Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention.
Drawings
The foregoing and/or additional aspects and advantages of the present invention will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
FIG. 1 is a flowchart illustrating a method for adjusting key points of a picture according to an embodiment;
FIG. 2 is a flowchart of a method for smooth adjustment of key points of a picture according to an embodiment;
FIG. 3 is a comparison graph of the effect of smooth adjustment of key points of a picture according to an embodiment;
FIG. 4 is a flowchart of a method for adjusting the contraction of a key point of a picture according to one embodiment;
FIG. 5 is a graph comparing the effects of pinch adjustment of key points in a picture according to one embodiment;
FIG. 6 is a flowchart of a method for adjusting zoom-in of key points of a picture according to an embodiment;
FIG. 7 is a comparison graph of the effect of the zoom-in adjustment of key points of a picture according to an embodiment;
FIG. 8 is a flowchart of a method for panning key points of a picture, according to an embodiment;
FIG. 9 is a graph comparing the effects of panning adjustment of key points in a picture according to an embodiment;
FIG. 10 is a flowchart of a method for rotational adjustment of key points of a picture, according to an embodiment;
FIG. 11 is a graph comparing the effect of rotational adjustment of key points of a picture according to an embodiment;
FIG. 12 is a diagram illustrating an apparatus for adjusting key points of a picture according to an embodiment;
fig. 13 is a diagram illustrating a structure of a terminal device for performing an adjustment method of a picture key point according to an embodiment.
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are illustrative only and should not be construed as limiting the invention.
Referring to fig. 1, in order to solve the technical defects of low adjustment efficiency, inaccurate adjustment, and poor adjustment effect of the key points, the present application provides an adjustment method of the key points of the picture, which includes the following steps:
step S11: and selecting a plurality of key points to be moved from the key points of the picture.
In the above process, the key points in the picture may be feature points to be marked or some marked patterns or symbols. In the process of building and training the model, some pictures marked with key points in advance need to be obtained, and when the key points have inaccurate conditions such as deviation, a plurality of key points can be selected from the pictures for processing.
Step S12: and determining a reference point in the adjusting process, and respectively calculating the target position of each key point to be moved after adjustment according to the position of the reference point and the current position of each key point to be moved.
Since the relative position determination in the picture is difficult, a reference point is introduced in the adjustment process. In the adjusting process, the reference point may be a key point to be moved, or may also be a reference point having a relative position relationship or a geometric correspondence with the key point to be moved, such as a circular arc position point or a circle center. And according to the position of the reference point and the current positions of the key points to be moved, calculating to obtain parameters such as corresponding moving distance, angle or moving vector.
Step S13: and respectively moving each key point to be moved to a corresponding target position.
And moving the key point to be moved from the current position to the target position according to the calculated target position.
In the process, due to the fact that the deviation condition of the key points to be moved has a certain rule, other selected key points to be moved can be moved together through the position, the change position or the moving track of the reference point, batch processing is achieved, and adjusting efficiency and accuracy are improved.
Referring to fig. 2 and 3 on the basis of fig. 1, in order to solve the technical defect that smoothness of the to-be-moved key point is small in the deviation situation of the to-be-moved key point, the present application provides an adjusting method of the picture key point, where the step S12 of determining the reference point of the adjusting process, and respectively calculating the target position of each adjusted to-be-moved key point according to the position of the reference point and the current position of each to-be-moved key point includes the steps of:
step A1: determining a reference point of the smooth adjustment process; the reference points are two adjacent key points of the key point to be moved.
In the above process, the key point to be moved for which smoothing needs to be performed is determined, for example, P in fig. 2i-1、Pi、Pi+1. Wherein P isiAt P ofi-1 and Pi+1An intermediate position. At this time, Pi-1 and Pi+1Is a reference point in the course of the smooth adjustment.
Step A2: and acquiring the position of the reference point and the current position of each key point to be moved.
Respectively acquiring the reference points (P)i-1 and Pi+1) And a key point to be moved (P)i-1、Pi、Pi+1) The position of (a). It is noted that the reference point is also the key point to be moved at this time, and in other embodiments, the reference point is not necessarily the key point to be moved, and may be merely used as the reference point for indicating the smoothing process.
Step A3: and smoothing the key points to be moved by using a smoothing model, and calculating the target position of each key point to be moved.
In the above process, the positions of the key point to be moved and the reference point are input into the smooth model, and the key point (P) to be moved is corrected by using the smooth modeli-1、Pi、Pi+1) And smoothing the current position of the key point to be moved, and calculating to obtain the target position of the key point to be moved. Correspondingly, the key point P to be movediIs the key point Qi(ii) a To-be-moved key point Pi-1Is the key point Qi-1(ii) a To-be-moved key point Pi+1Is the key point Qi+1
Furthermore, in some embodiments, the moving from the current position of the key point to be moved to the target position can be realized by a space vector in an algebraic geometric manner.
To better achieve the purpose of smooth movement adjustment, the present embodiment further provides a smoothing model, which is described as:
Figure BDA0001928271830000071
a+b+c=1;
wherein ,
Figure BDA0001928271830000072
is a vector of keypoints adjusted to the target position,
Figure BDA0001928271830000073
is the vector of the keypoint to be moved,
Figure BDA0001928271830000074
is a vector of said one of the reference points,
Figure BDA0001928271830000075
is the vector of the other reference point, i is the serial number of the key point to be moved, and a, b, and c are smoothing coefficients.
In the above process, a cartesian coordinate system is taken as an example, an arbitrary cartesian coordinate system is established on the picture to be processed, and an arbitrary point on the plane where the picture is located, for example, a point O in fig. 2, is selected as a reference point, and a key point (P) to be movedi-1、Pi、Pi+1) Forming corresponding space vectors
Figure BDA0001928271830000081
Obtaining a representative key point to be moved by the smooth operation of the smooth model under the adjustment of the smooth coefficient
Figure BDA0001928271830000082
Vector of corresponding target position, i.e.
Figure BDA0001928271830000083
As the key point to be moved, pass through the key point P to be movedi-1 and Pi+1And the corresponding reference points, and the vectors Q of the corresponding target positions can be respectively obtained by using the smooth modeli-1 and Qi+1
In the smoothing operation, the sum of the smoothing coefficient and the smoothing coefficient of the reference point is 1 for the same point to be subjected to the smoothing processing. The embodiment provides a smoothing coefficient composition with better smoothing effect: the smoothing coefficient a is 0.5, and the smoothing coefficients b and c are 0.25. The target position generated by applying the smoothing coefficient is smooth in overall transition and closer to the actual condition of marking key points. Effect of smooth transition please refer to fig. 3, it is noted that the number and the location of the key points and the reference points to be moved in fig. 2 are for the sake of image and exemplary explanation of the present solution, and the number, the location, etc. states are easy to be observed and understood by those skilled in the art, but the present application is not limited by the number, the location, the auxiliary points for helping understanding, etc. in the figure.
Referring to fig. 4 to 7 on the basis of fig. 1, in order to solve the technical defect of centrifugal shrinkage deviation or expansion deviation of the to-be-moved key points in the deviation situation of the to-be-moved key points, the present application provides a method for adjusting picture key points, where the step S12 of determining the reference point of the adjustment process, and respectively calculating the target position of each adjusted to-be-moved key point according to the position of the reference point and the current position of each to-be-moved key point includes the steps of:
step B1: determining a zooming reference point serving as a zooming center in the zooming adjustment process; and the zooming reference point is used for determining the distance of the key point zoomed to the target position.
Referring to fig. 4, the zoom reference point O in the above process is a reference point serving as a zoom center in the zoom adjustment process, and the zoom reference point can be used to determine the distance and the zoom angle of the keypoint zoomed to the target position. Wherein the zooming operation can be used in case the key point to be moved is too far away or too close to the zooming reference point O.
Step B2: a zoom distance, a zoom angle centered on a zoom reference point, and a current position are obtained.
And acquiring the input zooming distance, the zooming angle taking the zooming reference point as the center and the current position of the key point to be moved. In other embodiments, the zoom distance and the zoom angle centered on the zoom reference point may be determined by a change in a designated point, a trajectory of an external input device such as a mouse, or the like.
Step B3: and carrying out scaling treatment on the key points to be moved by using the scaling model, and calculating the target position of each key point to be moved.
Key points to be moved (e.g., P in FIGS. 4 and 6) are treated using a scaling modeli and P1) And carrying out scaling processing. Fig. 4 shows the shrinking process, and fig. 6 shows the shrinking process. Calculating each key point to be moved (e.g. P in FIGS. 4 and 6)i and P1) Is (e.g. is Q in fig. 4 and 6)i and Q1)。
In order to obtain better zooming effect, the present embodiment provides a zooming model, which is described as:
Δxi=di·cos(r);
Δyi=di·sin(r);
Figure BDA0001928271830000091
wherein ,diFor the zoom distance, r is a zoom angle centered at a zoom reference point, Δ xiIs the transverse distance, Δ yiIs the longitudinal distance between the first and second end of the rail,
Figure BDA0001928271830000092
is the vector of the key point to be moved at the current position,
Figure BDA0001928271830000093
is corresponding to
Figure BDA0001928271830000096
And (3) scaling to the vector of the key point of the target position, wherein i is the key point and the serial number of the key point correspondingly adjusted to the target position.
Taking FIG. 4 as an example, in the shrinking process of FIG. 4, the distance d is scalediThe zoom angle r can be directly input with related parameters, or the zoom distance d can be measured and calculated by the current position of one point of the key points to be moved and the key points moved to the target positioniAnd the angle r is zoomed, and then the distance d is zoomediAnd the zoom angle r is applied to other keypoints to be moved. Is selected as the measurement and calculation zoom distance diAnd the keypoints to be moved by the zoom angle r can be marked as reference points. For example, the key point P to be moved is selected in FIG. 41Current position of and key point Q1For measuring and calculating the zoom distance diAnd a reference point of the zoom angle r, and the other key points to be moved are PiThe key point after moving to the target position is Qi. Since the contraction process is shown in FIG. 4, it is preferable that the contraction process is performed in the same manner as described above
Figure BDA0001928271830000094
Is correspondingly converted into
Figure BDA0001928271830000095
In the above process, a cartesian coordinate system may be established with an arbitrary point as an origin on the graph, and the zoom reference point O is selected. In some embodiments, the key point to be moved may be PiThe scaling reference point O is determined by fitting. Wherein the distance d is scalediAnd the zoom angle r can be obtained by the following model:
Figure BDA0001928271830000101
Figure BDA0001928271830000102
wherein ,diFor the zoom distance, r is the zoom angle centered at the zoom reference point,
Figure BDA0001928271830000103
is the vector between the keypoint and the zoom reference point,
Figure BDA0001928271830000104
is a vector of the current position to the target position of one of the keypoints,
Figure BDA0001928271830000105
is the vector between the current position of one of the keypoints and the zoom reference point,
Figure BDA0001928271830000106
is a vector of the current position of the keypoint,
Figure BDA0001928271830000107
is a vector of the current position of one of the keypoints,
Figure BDA0001928271830000108
is a vector of the target locations of the keypoints,
Figure BDA0001928271830000109
is corresponding to
Figure BDA00019282718300001010
And i is the key point and the serial number of the key point correspondingly adjusted to the target position.
In the above process, the reference point P may be designated1 and Q1Calculating the zoom distance diAnd a zoom angle r. Taking the vector as an example, the vector is,
Figure BDA00019282718300001011
is a key point P to be moved as a reference point1The vector between the current position of (c) and the scaling reference point O,
Figure BDA00019282718300001012
is a key point P to be moved as a reference point1To a key point P to be moved as a reference point1Target position (i.e. Q)1) The vector of (2). Scaling distance diIs P1 and Q1The zoom angle r is P relative to the zoom-out distance between the zoom reference points O1 and Q1The angle between the zoom reference point O is reduced. Referring to fig. 4 and 5, the left diagram is the effect diagram before zooming out, and the right diagram is the effect diagram after zooming out.
Taking FIG. 6 as an example, in the diffusion process of FIG. 6, the distance d is scalediThe zoom angle r can be directly input with related parameters, or the zoom distance d can be measured and calculated by the current position of one point of the key points to be moved and the key points moved to the target positioniAnd the angle r is zoomed, and then the distance d is zoomediAnd the zoom angle r is applied to other keypoints to be moved. Is selected as the measurement and calculation zoom distance diAnd the keypoints to be moved by the zoom angle r can be marked as reference points. For example, the key point P to be moved is selected in FIG. 61Current position of and key point Q1For measuring and calculating the zoom distance diAnd a reference point of the zoom angle r, and the other key points to be moved are PiThe key point after moving to the target position is Qi. Since in FIG. 6 is diffusionProcess for so that
Figure BDA00019282718300001013
Is correspondingly converted into
Figure BDA00019282718300001014
In the above process, a cartesian coordinate system may be established with an arbitrary point as an origin on the graph, and the zoom reference point O is selected. In some embodiments, the key point to be moved may be PiThe scaling reference point O is determined by fitting. Wherein the distance d is scalediAnd the zoom angle r can be obtained by the following model:
Figure BDA0001928271830000111
Figure BDA0001928271830000112
wherein ,diFor the zoom distance, r is the zoom angle centered at the zoom reference point,
Figure BDA0001928271830000113
is the vector between the keypoint and the zoom reference point,
Figure BDA0001928271830000114
is a vector of the current position to the target position of one of the keypoints,
Figure BDA0001928271830000115
is the vector between the current position of one of the keypoints and the zoom reference point,
Figure BDA0001928271830000116
is a vector of the current position of the keypoint,
Figure BDA0001928271830000117
is a vector of the current position of one of the keypoints,
Figure BDA0001928271830000118
is a vector of the target locations of the keypoints,
Figure BDA0001928271830000119
is corresponding to
Figure BDA00019282718300001110
And i is the key point and the serial number of the key point correspondingly adjusted to the target position.
In the above process, the reference point P may be designated1 and Q1Calculating the zoom distance diAnd a zoom angle r. Taking the vector as an example, the vector is,
Figure BDA00019282718300001111
is a key point P to be moved as a reference point1The vector between the current position of (c) and the scaling reference point O,
Figure BDA00019282718300001112
is a key point P to be moved as a reference point1To a key point P to be moved as a reference point1Target position (i.e. Q)1) The vector of (2). Scaling distance diIs P1 and Q1The zoom angle r is P relative to the distance between the zoom reference points O1 and Q1The angle is enlarged relative to the zoom reference point O.
Referring to fig. 8 to 9 on the basis of fig. 1, in order to solve the technical defect that the key point to be moved deviates linearly in the deviation situation of the key point to be moved, the present application provides an adjusting method of a picture key point, where the step S12 of determining a reference point in an adjusting process, and calculating a target position of each adjusted key point to be moved according to a position of the reference point and a current position of each key point to be moved respectively includes the steps of:
step C1: determining a reference point of the translation adjustment process; wherein the reference points include a translation start point and a translation end point.
By clicking, framing or designating a number of points within a certain range as key points to be moved for which a translation process is to be performed, e.g. P1 and Pi. The reference point may be a key point to be moved or may be another selected reference point, such as L1 and L0. wherein ,L0Is the translation starting point, L1Is the translation endpoint. Of course, P can be selected in this embodiment1As a translation start point, Q1Is taken as the translation endpoint.
Step C2: and acquiring the current positions of the reference point and each key point to be moved.
In one embodiment, the reference point (e.g., P) is obtained1 and Q1) And each key point to be moved (e.g., P)i) The current position of the mobile terminal.
Step C3: and translating the key points to be moved by using the translation model, and calculating the target position of each key point to be moved.
Key point P to be moved by using translation modeliCarrying out translation processing to calculate the target position Q of each key point to be movedi
In order to obtain a better translation effect, in this embodiment, a translation model is further provided, and the translation model is described as:
Figure BDA0001928271830000121
wherein ,
Figure BDA0001928271830000122
is the vector of the keypoint at the current position,
Figure BDA0001928271830000123
is the vector of the keypoint at the target location,
Figure BDA0001928271830000124
is the translation starting point L1And translation end point L0Constructed translation vector
Figure BDA0001928271830000125
Vector by keypoint at current position
Figure BDA0001928271830000126
And translation vector
Figure BDA0001928271830000127
Superposing to obtain a key point P to be movediVector at target position
Figure BDA0001928271830000128
Referring to fig. 8 and 9, the left effect diagram in fig. 8 and 9 is an effect diagram before translation, and the left effect diagram in fig. 8 and 9 is an effect diagram after translation. Furthermore, P can also be passed1As translation starting point and Q1Construction of translation vectors as translation endpoints
Figure BDA0001928271830000129
Referring to fig. 10 to 11 on the basis of fig. 1, in order to solve the technical defect that the center of the to-be-moved key point is rotationally deviated in the deviation situation of the to-be-moved key point, the present application provides an adjusting method of the picture key point, where the step S12 of determining the reference point in the adjusting process, and respectively calculating the target position of each adjusted to-be-moved key point according to the position of the reference point and the current position of each to-be-moved key point includes the steps of:
step D1: determining a rotation reference point indicating a rotation position in a rotation adjustment process and a rotation center point serving as a rotation center; and the rotating reference point is used for determining the distance and the angle of the key point rotating to the target position.
In the above process, the rotation center point of the rotation center is the point O, and the rotation reference point indicating the rotation position in the rotation adjustment process may be the point P of the key point to be moved at the current positioniAnd point Q of the target positioni. In addition to this, the rotation reference point indicating the rotational position by the rotation adjustment process may also be a rotation start which is additionally capable of indicating the rotation anglePoint M0And end point of rotation M1. The following steps to rotate the starting point M0And end point of rotation M1Shown for example.
Step D2: and acquiring and obtaining the current positions of the rotating reference point, the rotating central point and the key point.
Obtaining a rotation starting point M of a rotation reference point0Rotational end point M1And a rotation center point O, and a key point P to be movediThe current position of the mobile terminal.
Step D3: and performing rotation processing on the key points to be moved by using the rotation model, and calculating the target position of each key point to be moved.
Using the starting point M of rotation0Rotational end point M1Constructing rotation vectors
Figure BDA0001928271830000131
Using vector of rotation
Figure BDA0001928271830000132
For moving key point PiAnd (5) performing rotation treatment.
In addition, the key point P to be moved can be treated by utilizing a rotation modeliRotating to obtain the target position Q of each key point to be movedi. By P1As the starting point of rotation and Q1Constructing rotation vectors as rotation endpoints
Figure BDA0001928271830000133
Using vector of rotation
Figure BDA0001928271830000134
For moving key point PiAnd (5) performing rotation treatment.
In order to better implement the technical solution of the rotational movement, this embodiment further provides a rotational model, where the rotational model is described as:
Figure BDA0001928271830000135
Figure BDA0001928271830000136
Figure BDA0001928271830000137
wherein ,
Figure BDA0001928271830000138
is the vector of the keypoint at the current position,
Figure BDA0001928271830000139
is a vector of the reference point of rotation,
Figure BDA00019282718300001310
theta is a vector from the rotation reference point to the rotation center point, and is a rotation angle with the rotation center point as the center, (x)1,y1) Is a rotating superimposed vector, x1Is the transverse coordinate, y, of the rotated superposition vector1Is the longitudinal coordinate of the rotated superposition vector,
Figure BDA00019282718300001311
is the vector of the keypoint at the target location. Vectors of keypoints at current positions
Figure BDA00019282718300001312
I.e. the key point P to be movediCurrent position of (c), overlay rotational overlay vector (x)1,y1) Obtaining the vector of the key point at the target position
Figure BDA00019282718300001313
I.e. the key point Q to be movediThe current position of the mobile terminal.
Wherein a reference point is selected as the rotation start point M0And end point of rotation M1Vector of said rotational reference point
Figure BDA00019282718300001314
And the rotation angle θ passes through the following modelObtaining:
Figure BDA00019282718300001315
Figure BDA00019282718300001316
wherein ,
Figure BDA00019282718300001317
is a vector of the reference point of rotation,
Figure BDA00019282718300001318
is the vector of the center point of rotation O,
Figure BDA00019282718300001319
the vector from one of the specified keypoints to the center point of rotation, theta is the angle of rotation,
Figure BDA00019282718300001320
is a rotation start point M around a rotation center point O0The vector of (a) is determined,
Figure BDA00019282718300001321
is a rotation end point M around a rotation center point O1The vector of (2). Fig. 10 and 11 illustrate the effect before and after rotation, wherein the left diagram of fig. 10 and 11 illustrates the current position of the key point to be moved before rotation, and the right diagram of fig. 10 and 11 illustrates the target position of the key point after rotation.
Referring to fig. 12, the present embodiment further provides an apparatus for adjusting a key point of a picture, including:
a selecting unit 121, configured to select a plurality of to-be-moved key points from the key points of the picture;
the operation unit 122 is configured to determine a reference point in the adjustment process, and respectively calculate a target position of each adjusted to-be-moved key point according to the position of the reference point and the current position of each to-be-moved key point;
and a moving unit 123, configured to move the key points to be moved to corresponding target positions respectively.
The present embodiment further provides a terminal, which includes:
one or more processors;
a memory;
one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to: the method for adjusting the picture key points according to any one of the above embodiments is performed.
As shown in fig. 13, for convenience of description, only the parts related to the embodiment of the present invention are shown, and details of the specific technology are not disclosed, please refer to the method part of the embodiment of the present invention. The terminal may be any terminal device including a mobile phone, a tablet computer, a PDA (Personal Digital Assistant), a POS (Point of sales), a vehicle-mounted computer, etc., taking the terminal as the mobile phone as an example:
fig. 13 is a block diagram showing a partial structure of a cellular phone related to a terminal provided in an embodiment of the present invention. Referring to fig. 13, the handset includes: radio Frequency (RF) circuitry 1310, memory 1320, input unit 1330, display unit 1340, sensor 1350, audio circuitry 1360, wireless fidelity (Wi-Fi) module 1370, processor 1380, and power supply 1390. Those skilled in the art will appreciate that the handset configuration shown in fig. 13 is not intended to be limiting and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
In the embodiment of the present invention, the processor 1380 included in the terminal further has the following functions: selecting a plurality of key points to be moved from the key points of the picture; determining a reference point in the adjusting process, and respectively calculating the target position of each adjusted key point to be moved according to the position of the reference point and the current position of each key point to be moved; and respectively moving each key point to be moved to a corresponding target position. That is, the processor 1380 has the function of executing the adjusting method for the key points of the image slice in any of the above embodiments, and is not described herein again.
According to the method and the device for adjusting the picture key points and the mobile terminal, the plurality of key points to be moved are selected from the key points of the picture; determining a reference point in the adjusting process, and respectively calculating the target position of each adjusted key point to be moved according to the position of the reference point and the current position of each key point to be moved; the technical scheme of moving each key point to be moved to the corresponding target position respectively can realize the adjustment of the key points to be moved from the current position to the target position in batches by utilizing the rule between the key points to be moved and the reference points, and has high adjustment efficiency and strong accuracy.
In some improved schemes, the remaining key points to be identified can be adjusted by adjusting one of the key points to be identified, so that the adjustment is more intuitive and is more beneficial to user operation.
In some improved schemes, all selected key points to be identified can be adjusted by using the track of the external input equipment, the adjustment is convenient, and the operation of a user is facilitated.
It should be understood that, although the steps in the flowcharts of the figures are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and may be performed in other orders unless explicitly stated herein. Moreover, at least a portion of the steps in the flow chart of the figure may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed alternately or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
The foregoing is only a partial embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (14)

1. A method for adjusting key points of a picture is characterized by comprising the following steps:
selecting a plurality of key points to be moved from the key points of the picture;
determining a reference point in the adjusting process, and respectively calculating the target position of each adjusted key point to be moved according to the position of the reference point and the current position of each key point to be moved;
and respectively moving each key point to be moved to a corresponding target position.
2. The method according to claim 1, wherein the step of determining a reference point in the adjustment process, and respectively calculating the target position of each adjusted to-be-moved key point according to the reference point position and the current position of each to-be-moved key point comprises:
determining a reference point of the smooth adjustment process; the reference points are two adjacent key points of the key points to be moved;
acquiring the position of the reference point and the current position of each key point to be moved;
and smoothing the key points to be moved by using a smoothing model, and calculating the target position of each key point to be moved.
3. The method for adjusting the key points of the picture according to claim 2, wherein the smooth model is described as:
Figure FDA0001928271820000011
a+b+c=1;
wherein ,
Figure FDA0001928271820000012
is a vector of keypoints adjusted to the target position,
Figure FDA0001928271820000013
is the vector of the keypoint to be moved,
Figure FDA0001928271820000014
is a vector of one of the reference points,
Figure FDA0001928271820000015
is a vector of another reference point, i is the serial number of the key point to be moved, and a, b and c are smoothing coefficients.
4. The method according to claim 3, wherein the smoothing coefficient a is 0.5, and the smoothing coefficients b and c are 0.25.
5. The method according to claim 1, wherein the step of determining a reference point in the adjustment process, and respectively calculating the target position of each adjusted to-be-moved key point according to the reference point position and the current position of each to-be-moved key point comprises:
determining a zooming reference point serving as a zooming center in the zooming adjustment process; the zooming reference point is used for determining the distance of the key point zoomed to the target position;
acquiring a zooming distance, a zooming angle taking a zooming reference point as a center and a current position;
and carrying out scaling treatment on the key points to be moved by using the scaling model, and calculating the target position of each key point to be moved.
6. The method for adjusting the key points of the picture according to claim 5, wherein the scaling model is described as:
Δxi=di·cos(r);
Δyi=di·sin(r);
Figure FDA0001928271820000021
wherein ,diFor the zoom distance, r is a zoom angle centered at a zoom reference point, Δ xiIs the transverse distance, Δ yiIs the longitudinal distance between the first and second end of the rail,
Figure FDA0001928271820000022
is the vector of the key point to be moved at the current position,
Figure FDA0001928271820000023
is corresponding to
Figure FDA0001928271820000024
And (3) scaling to the vector of the key point of the target position, wherein i is the key point and the serial number of the key point correspondingly adjusted to the target position.
7. The method of claim 6, wherein the scaling distance d isiAnd the zoom angle r is obtained by the following model:
Figure FDA0001928271820000025
Figure FDA0001928271820000026
wherein ,diFor the zoom distance, r is the zoom angle centered at the zoom reference point,
Figure FDA0001928271820000027
is the vector between the keypoint and the zoom reference point,
Figure FDA0001928271820000028
is a vector of the current position to the target position of one of the keypoints,
Figure FDA0001928271820000029
is the vector between the current position of one of the keypoints and the zoom reference point,
Figure FDA00019282718200000210
is a vector of the current position of the keypoint,
Figure FDA00019282718200000211
is a vector of the current position of one of the keypoints,
Figure FDA00019282718200000212
is a vector of the target locations of the keypoints,
Figure FDA00019282718200000213
is corresponding to
Figure FDA00019282718200000214
And i is the key point and the serial number of the key point correspondingly adjusted to the target position.
8. The method according to claim 1, wherein the step of determining a reference point in the adjustment process, and respectively calculating the target position of each adjusted to-be-moved key point according to the reference point position and the current position of each to-be-moved key point comprises:
determining a reference point of the translation adjustment process; wherein the reference points comprise a translation starting point and a translation end point;
acquiring the current positions of the reference point and each key point to be moved;
and translating the key points to be moved by using the translation model, and calculating the target position of each key point to be moved.
9. The method for adjusting the key points of the picture according to claim 8, wherein the panning model is described as:
Figure FDA0001928271820000031
wherein ,
Figure FDA0001928271820000032
is the vector of the keypoint at the current position,
Figure FDA0001928271820000033
is the vector of the keypoint at the target location,
Figure FDA0001928271820000034
and the translation vector is constructed by the translation starting point and the translation end point.
10. The method according to claim 1, wherein the step of determining a reference point in the adjustment process, and respectively calculating the target position of each adjusted to-be-moved key point according to the reference point position and the current position of each to-be-moved key point comprises:
determining a rotation reference point indicating a rotation position in a rotation adjustment process and a rotation center point serving as a rotation center; the rotating reference point is used for determining the distance and the angle of the key point rotating to the target position;
acquiring and according to a rotating reference point, a rotating central point and the current position of a key point;
and performing rotation processing on the key points to be moved by using the rotation model, and calculating the target position of each key point to be moved.
11. The method for adjusting the key points of the picture according to claim 10, wherein the rotation model is described as:
Figure FDA0001928271820000035
Figure FDA0001928271820000036
Figure FDA0001928271820000037
wherein ,
Figure FDA0001928271820000038
is the vector of the keypoint at the current position,
Figure FDA0001928271820000039
is a vector of the reference point of rotation,
Figure FDA00019282718200000310
theta is a vector from the rotation reference point to the rotation center point, and is a rotation angle with the rotation center point as the center, (x)1,y1) Is a rotating superimposed vector, x1Is the transverse coordinate, y, of the rotated superposition vector1Is the longitudinal coordinate of the rotated superposition vector,
Figure FDA00019282718200000311
is the vector of the keypoint at the target location.
12. The method of claim 11, wherein a reference point is selected as a rotation start point and a rotation end point, and a vector of the reference point is selected as a rotation start point and a rotation end point
Figure FDA00019282718200000312
And the rotation angle θ is obtained by the following model:
Figure FDA0001928271820000041
Figure FDA0001928271820000042
wherein ,
Figure FDA0001928271820000043
is a vector of the reference point of rotation,
Figure FDA0001928271820000044
is the vector of the center point of rotation,
Figure FDA0001928271820000045
the vector from one of the specified keypoints to the center point of rotation, theta is the angle of rotation,
Figure FDA0001928271820000046
is a vector of the rotation starting point around the rotation center point,
Figure FDA0001928271820000047
is a vector of the rotation end point around the rotation center point.
13. An adjusting device for key points of a picture, comprising:
the selection unit is used for selecting a plurality of key points to be moved from the key points of the picture;
the operation unit is used for determining a reference point in the adjustment process, and respectively calculating the target position of each adjusted key point to be moved according to the position of the reference point and the current position of each key point to be moved;
and the moving unit is used for respectively moving each key point to be moved to the corresponding target position.
14. A terminal, characterized in that it comprises:
one or more processors;
a memory;
one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to: the method for adjusting the key points of the picture according to any one of claims 1 to 12 is performed.
CN201811627458.4A 2018-12-28 2018-12-28 Picture key point adjusting method, device and terminal Active CN111383170B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811627458.4A CN111383170B (en) 2018-12-28 2018-12-28 Picture key point adjusting method, device and terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811627458.4A CN111383170B (en) 2018-12-28 2018-12-28 Picture key point adjusting method, device and terminal

Publications (2)

Publication Number Publication Date
CN111383170A true CN111383170A (en) 2020-07-07
CN111383170B CN111383170B (en) 2023-08-15

Family

ID=71219259

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811627458.4A Active CN111383170B (en) 2018-12-28 2018-12-28 Picture key point adjusting method, device and terminal

Country Status (1)

Country Link
CN (1) CN111383170B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060056727A1 (en) * 2004-09-16 2006-03-16 Jones Graham R System for combining multiple disparity maps
CN101877796A (en) * 2009-04-28 2010-11-03 青岛海信数字多媒体技术国家重点实验室有限公司 Optical parallax acquiring method, device and system
CN107122774A (en) * 2017-03-28 2017-09-01 武汉斗鱼网络科技有限公司 A kind of adaptive chart pasting method moved with key point in image and system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060056727A1 (en) * 2004-09-16 2006-03-16 Jones Graham R System for combining multiple disparity maps
CN101877796A (en) * 2009-04-28 2010-11-03 青岛海信数字多媒体技术国家重点实验室有限公司 Optical parallax acquiring method, device and system
CN107122774A (en) * 2017-03-28 2017-09-01 武汉斗鱼网络科技有限公司 A kind of adaptive chart pasting method moved with key point in image and system

Also Published As

Publication number Publication date
CN111383170B (en) 2023-08-15

Similar Documents

Publication Publication Date Title
US20200236283A1 (en) Method, system and apparatus for stabilising frames of a captured video sequence
US10026183B2 (en) Method, system and apparatus for determining distance to an object in a scene
US8718324B2 (en) Method, apparatus and computer program product for providing object tracking using template switching and feature adaptation
CN108776970A (en) Image processing method and device
US20160086336A1 (en) System and method of pose estimation
WO2021017358A1 (en) Pose determination method and apparatus, electronic device, and storage medium
WO2016145755A1 (en) Image rotation method for intelligent terminal, and intelligent terminal
WO2014050210A1 (en) Image processing device, image processing method, program, and information recording medium
CN108573269B (en) Image feature point matching method, matching device, electronic device and storage medium
WO2017167159A1 (en) Image positioning method and device
EP3550467B1 (en) Image matching method, device and system, and storage medium
US20180174326A1 (en) Method, System and Apparatus for Determining Alignment Data
WO2010083751A1 (en) Image processing method and apparatus
Guo et al. Vision-based measurement for rotational speed by improving Lucas–Kanade template tracking algorithm
CN112150580A (en) Image processing method and device, intelligent terminal and storage medium
CN109409321B (en) Method and device for determining lens movement mode
US20200160560A1 (en) Method, system and apparatus for stabilising frames of a captured video sequence
CN103237156A (en) Modified block matching algorithm applied to electronic image stabilization
CN114298902A (en) Image alignment method and device, electronic equipment and storage medium
US20200193637A1 (en) Image processing apparatus and image processing method
JP6579727B1 (en) Moving object detection device, moving object detection method, and moving object detection program
CN105574834A (en) Image processing method and apparatus
CN111383170A (en) Method and device for adjusting picture key points and terminal
JP7003617B2 (en) Estimator, estimation method, and estimation program
JP6308962B2 (en) Displacement or strain calculation program and displacement or strain measurement method

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