CN111383170B - Picture key point adjusting method, device and terminal - Google Patents

Picture key point adjusting method, device and terminal Download PDF

Info

Publication number
CN111383170B
CN111383170B CN201811627458.4A CN201811627458A CN111383170B CN 111383170 B CN111383170 B CN 111383170B CN 201811627458 A CN201811627458 A CN 201811627458A CN 111383170 B CN111383170 B CN 111383170B
Authority
CN
China
Prior art keywords
point
moved
key points
key
vector
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
CN201811627458.4A
Other languages
Chinese (zh)
Other versions
CN111383170A (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

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 application provides a method for adjusting picture key points, which comprises the following steps: a plurality of key points to be moved are selected from the key points of the picture; determining a reference point in an adjustment process, and respectively calculating the target positions of all the key points to be moved after adjustment according to the positions of the reference point and the current positions of all the key points to be moved; and respectively moving the key points to be moved to the corresponding target positions. The application also provides a device and a terminal for adjusting the picture key points. The adjustment method, the device and the terminal for the key points of the picture can adjust 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 are high in adjustment efficiency and high in accuracy. According to the technical scheme, one of the key points to be identified can be adjusted, the rest key points to be identified can be adjusted, adjustment is more visual, and user operation is facilitated.

Description

Picture key point adjusting method, device and terminal
Technical Field
The application 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 present key point recognition scenarios, such as face recognition, object recognition, etc., it is often necessary to train some models. When training a model, key points need to be labeled in advance for an object (for example, a picture) input to the training model. However, these pre-labeled objects often have key point deviations that cannot be used for recognition or training.
Prior art solutions typically move one by one for multiple keypoints. In the existing scheme, the number of key points to be adjusted on a single picture is large, so that the adjustment efficiency is low, the problem that the key points are inaccurate after adjustment is often caused, and finally, the adjustment effect of the key points is poor.
Disclosure of Invention
The application aims to at least solve one of the technical defects, in particular to the technical defects of low key point adjustment efficiency, inaccurate key point adjustment and poor key point adjustment effect.
The application provides a method for adjusting picture key points, which comprises the following steps:
a plurality of key points to be moved are selected from the key points of the picture;
determining a reference point in an adjustment process, and respectively calculating the target positions of all the key points to be moved after adjustment according to the positions of the reference point and the current positions of all the key points to be moved;
and respectively moving the key points to be moved to the corresponding target positions.
In one embodiment, the step of determining the reference point in the adjustment process, and calculating the target position of each adjusted key point to be moved according to the reference point position and the current position of each key point to be moved, includes:
determining a reference point of a 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 carrying out smoothing treatment on the key points to be moved by using a smoothing model, and calculating the target positions of the key points to be moved.
In one embodiment, the smoothing model is described as:
a+b+c=1;
wherein ,is a vector of key points adjusted to the target position,/->Is the vector of the key points to be moved, < ->Is a vector of said one of the reference points, +.>Is the vector of the other reference point, i is the sequence 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 coefficient b and the smoothing coefficient 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 key point to be moved according to the reference point position and the current position of each key point to be moved, includes:
determining a scaling reference point serving as a scaling center in a scaling adjustment process; the zoom reference point is used for determining the distance from the key point to the target position;
obtaining a scaling distance, a scaling angle taking a scaling reference point as a center and a current position;
and scaling the key points to be moved by using the scaling model, and calculating the target positions of the key points to be moved.
In one embodiment, the scaling model is described as:
Δx i =d i ·cos(r);
Δy i =d i ·sin(r);
wherein ,di For scaling distance, r is the scaling angle centered on the scaling reference point, Δx i Is the lateral distance, deltay i Is the longitudinal distance of the device,is the vector of the key point to be moved at the current position, < ->Is corresponding to->And (3) scaling the vector of the key points to the target position, wherein i is the sequence number of the key points and the key points correspondingly adjusted to the target position.
In one embodiment, the scaling distance d i And the zoom angle r is obtained by the following model:
wherein ,di For the scaling distance, r is the scaling angle centered on the scaling reference point,is the vector between the key point and the scaled reference point, < ->Is the vector from the current position of one of the key points to the target position,/->Is the vector between the current position of one of the keypoints and the zoom reference point, +.>Is the vector of the current position of the key point, +.>Is a vector of the current position of one of the keypoints, < +.>Is a vector of the target position of the keypoint, +.>Is corresponding to->And the vector of the target position of the key point, i is the sequence number of the key point and 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 key point to be moved according to the reference point position and the current position of each key point to be moved, includes:
determining a reference point for a translational adjustment process; wherein the reference point comprises a translation start point and a translation end point;
acquiring the current positions of the reference point and each key point to be moved;
and carrying out translation processing on the key points to be moved by using the translation model, and calculating the target positions of the key points to be moved.
In one embodiment, the translation model is described as:
wherein ,is the vector of the key point at the current position, +.>Is the vector of the key point at the target position, +.>Is a translation vector constructed with the translation start point and 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 key point to be moved according to the reference point position and the current position of each key point to be moved, includes:
determining a rotation reference point indicating a rotation position in a rotation adjustment process and a rotation center point as a rotation center; the rotation reference point is used for determining the distance and the angle from the rotation of the key point to the target position;
acquiring and according to the rotation reference point, the rotation center point and the current position of the key point;
and carrying out rotation processing on the key points to be moved by using the rotation model, and calculating the target positions of the key points to be moved.
In one embodiment, the rotation model is described as:
wherein ,is the vector of the key point at the current position, +.>Is a vector of rotating reference points, +.>For the vector of the rotation reference point to the rotation center point, θ is the rotation angle centered on the rotation center point, (x) 1 ,y 1 ) Is a rotation superposition vector, x 1 Is the transverse coordinate of the rotation superposition vector, y 1 Is what is shown asLongitudinal coordinates of the rotated superimposed vector, +.>Is the vector of the keypoint at the target position.
In one embodiment, reference points are selected as the start and end points of rotation, the vectors of the reference points of rotationAnd the rotation angle θ is obtained by the following model:
wherein ,is a vector of rotating reference points, +.>Is the vector of the rotation center point, +.>For a vector from one of the specified key points to the rotation center point, θ is the rotation angle, +.>Is the vector of the rotation origin around the rotation center point,/->Is the vector of the rotational end point around the rotational center point.
The application also provides a device for adjusting the key points of the picture, which comprises the following steps:
a selection unit, configured to select a plurality of key points to be moved from the key points of the picture;
the computing unit is used for determining a reference point in the adjustment process, and respectively computing the target positions of the adjusted key points to be moved according to the positions of the reference point and the current positions of the key points to be moved;
and the moving unit is used for respectively moving the key points to be moved to the corresponding target positions.
The application also provides a terminal, which 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 applications configured to: the method for adjusting the picture key points according to any embodiment is performed.
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 an adjustment process, and respectively calculating the target positions of all the key points to be moved after adjustment according to the positions of the reference point and the current positions of all the key points to be moved; according to the technical scheme, the key points to be moved are moved to the corresponding target positions respectively, the key points to be moved can be adjusted to the target positions from the current positions in batches by utilizing the rule between the key points to be moved and the reference points, and the adjustment efficiency is high and the accuracy is high.
In some improvements, one of the key points to be identified can be adjusted, and the rest key points to be identified can be adjusted, so that the adjustment is more visual and is more beneficial to user operation.
In some improvements, the tracks of the external input equipment can be used for adjusting all selected key points to be identified, so that the adjustment is convenient and fast, and the operation of a user is facilitated.
Additional aspects and advantages of the application 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 application.
Drawings
The foregoing and/or additional aspects and advantages of the application will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings, in which:
FIG. 1 is a method flow chart of a method for adjusting picture key points according to an embodiment;
FIG. 2 is a flowchart of a method for smooth adjustment of picture keypoints according to an embodiment;
FIG. 3 is a comparison graph of the effects of smooth adjustment of picture keypoints according to an embodiment;
FIG. 4 is a flowchart of a method for shrinkage adjustment of picture keypoints according to one embodiment;
FIG. 5 is a graph comparing the effects of shrinkage adjustment of picture keypoints according to one embodiment;
FIG. 6 is a flow chart of a method for magnification adjustment of picture keypoints according to one embodiment;
FIG. 7 is a comparison chart of the effect of the magnification adjustment of the picture key points according to one embodiment;
FIG. 8 is a flow chart of a method for pan adjustment of picture keypoints according to an embodiment;
FIG. 9 is a graph comparing the effects of translational adjustment of a picture key point according to one embodiment;
FIG. 10 is a flow chart of a method for rotational adjustment of picture keypoints according to an embodiment;
FIG. 11 is a comparison of effects of rotation adjustment of picture keypoints according to an embodiment;
FIG. 12 is a device configuration diagram of a device for adjusting picture key points according to an embodiment;
fig. 13 is a block diagram of a terminal device for executing a method for adjusting a picture key point in the embodiment.
Detailed Description
Embodiments of the present application are described in detail below, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to like or similar elements or elements having like or similar functions throughout. The embodiments described below by referring to the drawings are illustrative only and are not to be construed as limiting the application.
Referring to fig. 1, in order to solve the technical defect of low adjustment efficiency and inaccurate adjustment, which ultimately results in poor adjustment effect of key points, the application provides an adjustment method of picture key points, comprising 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 constructing a model and training the model, a plurality of pictures with preset key points are required to be acquired, and when inaccurate situations such as deviation exist in the key points, a plurality of key points can be selected from the pictures for processing.
Step S12: and determining a reference point in the adjustment process, and respectively calculating the target positions of the adjusted key points to be moved according to the positions of the reference point and the current positions of the key points to be moved.
Since the determination of the relative position in the picture is difficult, a reference point is introduced during the adjustment. In the adjustment process, the reference point may be a key point to be moved, or may be a reference point having a relative positional relationship or a geometric correspondence relationship with the key point to be moved, for example, an arc position point or a circle center, etc. And according to the positions of the reference points and the current positions of a plurality of key points to be moved, obtaining parameters such as the distance, the angle or the movement vector of corresponding movement through calculation.
Step S13: and respectively moving the key points to be moved to the corresponding target positions.
And moving the key point to be moved from the current position to the target position according to the calculated target position.
In the above process, since 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 movement track of the reference point, batch processing is realized, and the adjustment efficiency and accuracy are improved.
Referring to fig. 2 and 3 on the basis of fig. 1, in order to solve the technical defect of smaller smoothness of the key points to be moved in the deviation situation of the key points to be moved, the present application provides a method for adjusting the key points of a picture, wherein the step S12 of determining the reference points in the adjustment process and respectively calculating the target positions of the adjusted key points to be moved according to the positions of the reference points and the current positions of the key points to be moved includes the steps of:
step A1: determining a reference point of a smooth adjustment process; the reference points are two adjacent key points of the key points to be moved.
In the above process, the key point to be moved, such as P in FIG. 2, which needs to be smoothed is determined i-1 、P i 、P i+1 . Wherein P is i Located P i-1 and Pi+1 Intermediate position. At this time, P i-1 and Pi+1 Is the reference point in the smoothing adjustment process.
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 the key point to be moved (P i-1 、P i 、P i+1 ) Is a position of (c). It should be 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, but may be merely a reference point indicating the smoothing process.
Step A3: and carrying out smoothing treatment on the key points to be moved by using a smoothing model, and calculating the target positions of the key points to be moved.
In the above process, the positions of the key points to be moved and the reference points are input into a smoothing model, and the key points to be moved (P i-1 、P i 、P i+1 ) And (3) carrying out smoothing treatment on 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 moved i Is the key point Q i The method comprises the steps of carrying out a first treatment on the surface of the Key point P to be moved i-1 Is the key point Q i-1 The method comprises the steps of carrying out a first treatment on the surface of the To be movedKey point P i+1 Is the key point Q i+1
In addition, in some embodiments, the movement from the current position of the key point to be moved to the target position can be realized through a space vector in an algebraic geometric mode.
For better achieving the purpose of smooth movement adjustment, the present embodiment also provides a smoothing model described as:
a+b+c=1;
wherein ,is a vector of key points adjusted to the target position,/->Is the vector of the key points to be moved, < ->Is a vector of said one of the reference points, +.>Is the vector of the other reference point, i is the sequence number of the key point to be moved, and a, b and c are smoothing coefficients.
In the above process, taking a cartesian coordinate system as an example, an arbitrary cartesian coordinate system is established on the picture to be processed, and an arbitrary point on the plane of the picture, for example, the point O in fig. 2, is selected as a reference point, and the point O is used as a reference point to be moved with the key point (P i-1 、P i 、P i+1 ) Composing corresponding space vectorsObtaining the representative key point to be moved by the smooth operation of the smooth model under the adjustment of the smooth coefficient>Vectors of corresponding target positions, i.e. +.>As the key point to be moved, the key point P to be moved is passed i-1 and Pi+1 And the corresponding reference points, and the vector Q of the corresponding target positions can be obtained respectively by using the smoothing model i-1 and Qi+1
In the above smoothing operation, the sum of the smoothing coefficient of the same point as the smoothing processing and the smoothing coefficient of the reference point is 1. The present embodiment provides a smoothing coefficient composition with better smoothing effect: the smoothing coefficient a is 0.5, and the smoothing coefficient b and the smoothing coefficient c are 0.25. The target position generated by the smoothing coefficient is smooth in integral transition and is closer to the condition of actual marking key points. Referring to fig. 3, it should be noted that, for the sake of image and exemplary explanation of the present solution, the number and positions of the key points and the reference points to be moved in fig. 2 take the state of number, positions, etc. that are easy for those skilled in the art to observe and understand, but the present application is not limited by the number, positions, auxiliary points for aiding 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 key points to be moved in the deviation situation of the key points to be moved, the application provides a method for adjusting the key points of a picture, wherein the step S12 of determining the reference point in the adjustment 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 comprises the following steps:
step B1: determining a scaling reference point serving as a scaling center in a scaling adjustment process; the zoom reference point is used for determining the distance from the key point to the target position.
Referring to fig. 4, the zoom reference point O in the above process is a reference point used 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 key point from the zoom point to the target position. Wherein the zoom operation may be used in case the key point to be moved is too far from or too close to the zoom reference point O.
Step B2: and obtaining the zoom distance, the zoom angle taking the zoom reference point as the center and the current position.
And acquiring the input scaling distance, the scaling angle taking the scaling 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 the designated point, a trajectory of an external input device such as a mouse, or the like.
Step B3: and scaling the key points to be moved by using the scaling model, and calculating the target positions of the key points to be moved.
Treating mobile keypoints (e.g. P in fig. 4 and 6 using a scaling model i and P1 ) And performing scaling processing. Fig. 4 shows a shrinking process, and fig. 6 shows a shrinking process. Calculating each key point to be moved (e.g. P in FIGS. 4 and 6 i and P1 ) Target position (e.g. Q in FIGS. 4 and 6) i and Q1 )。
In order to obtain a better scaling effect, the present embodiment provides a scaling model, which is described as:
Δx i =d i ·cos(r);
Δy i =d i ·sin(r);
wherein ,di For scaling distance, r is the scaling angle centered on the scaling reference point, Δx i Is the lateral distance, deltay i Is the longitudinal distance of the device,is the vector of the key point to be moved at the current position, < ->Is corresponding to->And (3) scaling the vector of the key points to the target position, wherein i is the sequence number of the key points and the key points correspondingly adjusted to the target position.
Taking fig. 4 as an example, during the contraction process of fig. 4, the distance d is scaled i The related parameters can be directly input to the scaling angle r, and the scaling distance d can be measured by the current position of one of the key points to be moved and the key point which has been moved to the target position i And scaling the angle r, and then scaling the distance d i And the zoom angle r is applied to other keypoints to be moved. Selected as the measurement scaling distance d i And the key point to be moved of the zoom angle r may be marked as a reference point. For example, in FIG. 4, the key point P to be moved is selected 1 Current location and keypoint Q of (2) 1 For measuring scaling distance d i And a reference point of a zoom angle r, and other key points to be moved are P i The key point after moving to the target position is Q i . Since the shrinkage process is shown in FIG. 4Correspondingly turn into->
In the above process, a cartesian coordinate system may be established on the map with an arbitrary point as the origin, and the zoom reference point O may be selected. In some embodiments, the key point to be moved may be P i The scaled reference point O is determined by fitting. Wherein the distance d is scaled i And the zoom angle r can be obtained by the following model:
wherein ,di For the scaling distance, r is the scaling angle centered on the scaling reference point,is the vector between the key point and the scaled reference point, < ->Is the vector from the current position of one of the key points to the target position,/->Is the vector between the current position of one of the keypoints and the zoom reference point, +.>Is the vector of the current position of the key point, +.>Is a vector of the current position of one of the keypoints, < +.>Is a vector of the target position of the keypoint, +.>Is corresponding to->And the vector of the target position of the key point, i is the sequence number of the key point and the key point correspondingly adjusted to the target position.
In the above process, the reference point P can be designated 1 and Q1 Calculating a scaling distance d i And a zoom angle r.Taking the vector as an example of the vector,is the key point P to be moved as the reference point 1 A vector between the current position of (c) and the zoom reference point O,is the key point P to be moved as the reference point 1 To the key point P to be moved as a reference point 1 Target position (i.e. Q 1 ) Is a vector of (a). Scaling distance d i Namely P 1 and Q1 The zoom angle r is P with respect to the zoom reference point O 1 and Q1 The angle is reduced relative to the zoom reference point O. Fig. 4 and 5 show the effect of the reduction processing, wherein the left graph is the effect graph before reduction, and the right graph is the effect graph after reduction.
Taking fig. 6 as an example, the distance d is scaled during the diffusion process of fig. 6 i The related parameters can be directly input to the scaling angle r, and the scaling distance d can be measured by the current position of one of the key points to be moved and the key point which has been moved to the target position i And scaling the angle r, and then scaling the distance d i And the zoom angle r is applied to other keypoints to be moved. Selected as the measurement scaling distance d i And the key point to be moved of the zoom angle r may be marked as a reference point. For example, in FIG. 6, the key point P to be moved is selected 1 Current location and keypoint Q of (2) 1 For measuring scaling distance d i And a reference point of a zoom angle r, and other key points to be moved are P i The key point after moving to the target position is Q i . Since the diffusion process is shown in FIG. 6Correspondingly turn into->
In the above process, any point on the graph can be used as the originA cartesian coordinate system is established and a zoom reference point O is selected. In some embodiments, the key point to be moved may be P i The scaled reference point O is determined by fitting. Wherein the distance d is scaled i And the zoom angle r can be obtained by the following model:
wherein ,di For the scaling distance, r is the scaling angle centered on the scaling reference point,is the vector between the key point and the scaled reference point, < ->Is the vector from the current position of one of the key points to the target position,/->Is the vector between the current position of one of the keypoints and the zoom reference point, +.>Is the vector of the current position of the key point, +.>Is a vector of the current position of one of the keypoints, < +.>Is a vector of the target position of the keypoint, +.>Is corresponding to->And the vector of the target position of the key point, i is the sequence number of the key point and the key point correspondingly adjusted to the target position.
In the above process, the reference point P can be designated 1 and Q1 Calculating a scaling distance d i And a zoom angle r. Taking the vector as an example of the vector,is the key point P to be moved as the reference point 1 A vector between the current position of (c) and the zoom reference point O,is the key point P to be moved as the reference point 1 To the key point P to be moved as a reference point 1 Target position (i.e. Q 1 ) Is a vector of (a). Scaling distance d i Namely P 1 and Q1 The zoom angle r is P with respect to the enlarged distance between the zoom reference points O 1 and Q1 The angle is enlarged with respect 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 of linear deviation of key points to be moved in the deviation situation of the key points to be moved, the present application provides a method for adjusting the key points of a picture, wherein the step S12 of determining the reference points in the adjustment process and respectively calculating the target positions of the adjusted key points to be moved according to the positions of the reference points and the current positions of the key points to be moved comprises the steps of:
step C1: determining a reference point for a translational adjustment process; wherein the reference point includes a translation start point and a translation end point.
By clicking, framing or designating a plurality of points within a certain range as key points to be moved, such as P 1 and Pi . The reference point may be the key point to be moved, or may be another selected reference point, such as L 1 and L0. wherein ,L0 Is the translation start point, L 1 Is the translation endpoint. Of course, P may be selected in this embodiment 1 As translation start point, Q 1 Is used as the translation endpoint.
Step C2: and acquiring the reference point and the current position of each key point to be moved.
In one embodiment, the reference point (e.g., P 1 and Q1 ) And each key point to be moved (e.g. P i ) Is used for the current position of the car.
Step C3: and carrying out translation processing on the key points to be moved by using the translation model, and calculating the target positions of the key points to be moved.
Treating the moving key point P by using translation model i Performing translation processing, and calculating target positions Q of key points to be moved i
In order to obtain a better translation effect, a translation model is further provided in this embodiment, where the translation model is described as follows:
wherein ,is the vector of the key point at the current position, +.>Is the vector of the key point at the target position, +.>Is based on the translation starting point L 1 And translation endpoint L 0 Constructed translation vector->Vector at current position through key point +.>And translation vectorSuperposition to obtain the key point P to be moved i Vector at target position ∈>With reference to fig. 8 and 9, the left effect diagram in fig. 8 and 9 is the effect diagram before translation, and the left effect diagram in fig. 8 and 9 is the effect diagram after translation. In addition, can also pass through P 1 As translation origin and Q 1 Constructing a translation vector as translation endpoint>
Referring to fig. 10 to 11 on the basis of fig. 1, in order to solve the technical defect of center rotation deviation of the key points to be moved in the deviation situation of the key points to be moved, the present application provides a method for adjusting the key points of a picture, wherein the step S12 of determining the reference points in the adjustment process and respectively calculating the target positions of the adjusted key points to be moved according to the positions of the reference points and the current positions of the key points to be moved comprises the steps of:
step D1: determining a rotation reference point indicating a rotation position in a rotation adjustment process and a rotation center point as a rotation center; the rotation reference point is used for determining the distance and the angle of the rotation of the key point to the target position.
In the above process, the rotation center point of the rotation center is point O, and the rotation reference point of the rotation adjustment process indicating the rotation position may be point P of the key point to be moved at the current position i And point Q of the target position i . In addition to this, the rotation reference point, at which the rotation adjustment process indicates the rotation position, may also be a rotation start point M, which can additionally indicate the rotation angle 0 And a rotation end point M 1 . The following steps rotate the starting point M 0 And a rotation end point M 1 The illustration is given for example.
Step D2: and acquiring and according to the rotation reference point, the rotation center point and the current position of the key point.
Acquisition of rotation reference Point rotation origin M 0 End of rotation M 1 And a rotation center point O, a key point P to be moved i Is used for the current position of the car.
Step D3: and carrying out rotation processing on the key points to be moved by using the rotation model, and calculating the target positions of the key points to be moved.
Using the rotation starting point M 0 End of rotation M 1 Construction of rotation vectorsBy means of rotation vectors->For the moving key point P i And performing rotation treatment.
In addition, the rotation model can be used for treating the moving key point P i Performing rotation processing, and calculating to obtain target positions Q of key points to be moved i . Through P 1 As a rotation origin and Q 1 Construction of a rotation vector as a rotation endpointBy means of rotation vectors->For the moving key point P i And performing rotation treatment.
In order to better implement the technical solution of the rotational movement, the present embodiment also provides a rotational model, which is described as:
wherein ,is the vector of the key point at the current position, +.>Is a vector of rotating reference points, +.>For the vector of the rotation reference point to the rotation center point, θ is the rotation angle centered on the rotation center point, (x) 1 ,y 1 ) Is a rotation superposition vector, x 1 Is the transverse coordinate of the rotation superposition vector, y 1 Is the longitudinal coordinate of the rotational superposition vector, < >>Is the vector of the keypoint at the target position. Vector of key point at current position +.>I.e. the key point P to be moved i Is superimposed with a rotational superimposed vector (x 1 ,y 1 ) Obtaining the vector of the key point at the target position +.>I.e. the key point Q to be moved i Is used for the current position of the car.
Wherein a reference point is selected as a rotation start point M 0 And a rotation end point M 1 The vector of the rotation reference pointAnd the rotation angle θ is obtained by the following model:
wherein ,is a vector of rotating reference points, +.>Is the vector of the rotation center point O, +.>For a vector from one of the specified key points to the rotation center point, θ is the rotation angle, +.>Is a rotation start point M around a rotation center point O 0 Vector of->Is a rotation end point M around a rotation center point O 1 Is a vector of (a). Fig. 10 and 11 show effects before and after rotation, wherein the left diagrams of fig. 10 and 11 show the current position of the key point to be moved before rotation, and the right diagrams of fig. 10 and 11 show 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 key points to be moved from the key points of the picture;
the computing unit 122 is configured to determine a reference point in the adjustment process, and calculate target positions of the adjusted key points to be moved according to the positions of the reference point and the current positions of the key points to be moved;
and the moving unit 123 is used for respectively moving the key points to be moved to the corresponding target positions.
The embodiment also 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 applications configured to: the adjustment method of the picture key points according to any one of the above embodiments is performed.
The embodiment of the present application further provides a mobile terminal, as shown in fig. 13, for convenience of explanation, only the relevant parts of the embodiment of the present application are shown, and specific technical details are not disclosed, please refer to the method parts of the embodiment of the present application. 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, and the like, taking the terminal as an example of the mobile phone:
fig. 13 is a block diagram showing a part of the structure of a mobile phone related to a terminal provided by an embodiment of the present application. Referring to fig. 13, the mobile phone includes: radio Frequency (RF) circuitry 1310, memory 1320, input unit 1330, display unit 1340, sensors 1350, audio circuitry 1360, wireless fidelity (wireless fidelity, wi-Fi) modules 1370, processor 1380, and power supply 1390. It will be appreciated by those skilled in the art that the handset construction shown in fig. 13 is not limiting of the handset and may include more or fewer components than shown, or may combine certain components, or a different arrangement of components.
In an embodiment of the present application, the processor 1380 included in the terminal further has the following functions: a plurality of key points to be moved are selected from the key points of the picture; determining a reference point in an adjustment process, and respectively calculating the target positions of all the key points to be moved after adjustment according to the positions of the reference point and the current positions of all the key points to be moved; and respectively moving the key points to be moved to the corresponding target positions. That is, the processor 1380 has the function of executing the adjustment method of the slice key point in any of the above embodiments, which is not described herein.
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 an adjustment process, and respectively calculating the target positions of all the key points to be moved after adjustment according to the positions of the reference point and the current positions of all the key points to be moved; according to the technical scheme, the key points to be moved are moved to the corresponding target positions respectively, the key points to be moved can be adjusted to the target positions from the current positions in batches by utilizing the rule between the key points to be moved and the reference points, and the adjustment efficiency is high and the accuracy is high.
In some improvements, one of the key points to be identified can be adjusted, and the rest key points to be identified can be adjusted, so that the adjustment is more visual and is more beneficial to user operation.
In some improvements, the tracks of the external input equipment can be used for adjusting all selected key points to be identified, so that the adjustment is convenient and fast, 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, these steps are not necessarily performed in order as indicated by the arrows. The steps are not strictly limited in order and may be performed in other orders, unless explicitly stated herein. Moreover, at least some of the steps in the flowcharts of the figures may include a plurality of sub-steps or stages that are not necessarily performed at the same time, but may be performed at different times, the order of their execution not necessarily being sequential, but may be performed in turn or alternately with other steps or at least a portion of the other steps or stages.
The foregoing is only a partial embodiment of the present application, and it should be noted that it will be apparent to those skilled in the art that modifications and adaptations can be made without departing from the principles of the present application, and such modifications and adaptations are intended to be comprehended within the scope of the present application.

Claims (13)

1. The method for adjusting the picture key points is characterized by comprising the following steps:
a plurality of key points to be moved are selected from the key points of the picture;
determining a reference point of an adjustment process, and respectively calculating target positions of all the adjusted key points to be moved according to the positions of the reference point and the current positions of all the key points to be moved, wherein the method comprises the following steps: determining a reference point of a 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; performing smoothing treatment on the key points to be moved by using a smoothing model, and calculating target positions of the key points to be moved;
and respectively moving the key points to be moved to the corresponding target positions.
2. The method for adjusting picture key points according to claim 1, wherein the smoothing model is described as:
a+b+c=1;
wherein ,is a vector of key points adjusted to the target position,/->Is the vector of the key points to be moved, < ->Is the vector of one of the reference points, +.>Is a vector of another reference point, i is the sequence number of the key point to be moved, and a, b and c are smoothing coefficients.
3. The method for adjusting picture key points according to claim 2, wherein the smoothing coefficient a is 0.5, and the smoothing coefficient b and the smoothing coefficient c are 0.25.
4. The method for adjusting the key points of the picture according to claim 1, wherein the step of determining the reference point of the adjustment process and calculating the target position of each key point to be moved after adjustment according to the reference point position and the current position of each key point to be moved, respectively, comprises:
determining a scaling reference point serving as a scaling center in a scaling adjustment process; the zoom reference point is used for determining the distance from the key point to the target position;
obtaining a scaling distance, a scaling angle taking a scaling reference point as a center and a current position;
and scaling the key points to be moved by using the scaling model, and calculating the target positions of the key points to be moved.
5. The method for adjusting picture key points according to claim 4, wherein the scaling model is described as:
Δx ii ·cos(r);
Δy ii ·sin(r);
wherein ,di For the scaling distance, r is the scaling angle centered on the scaling reference point, i is the lateral distance, deltay i Is the longitudinal distance of the device,is the vector of the key point to be moved at the current position, < ->Is corresponding to->And (3) scaling the vector of the key points to the target position, wherein i is the sequence number of the key points and the key points correspondingly adjusted to the target position.
6. The method for adjusting picture key point according to claim 5, wherein the scaling distance d i And the zoom angle r is obtained by the following model:
wherein ,di For the scaling distance, r is the scaling angle centered on the scaling reference point,is the vector between the key point and the scaled reference point, < ->Is the vector from the current position of one of the key points to the target position,/->Is the vector between the current position of one of the keypoints and the zoom reference point, +.>Is the vector of the current position of the key point, +.>Is a vector of the current position of one of the keypoints, < +.>Is a vector of the target position of the keypoint, +.>Is corresponding to->And the vector of the target position of the key point, i is the sequence number of the key point and the key point correspondingly adjusted to the target position.
7. The method for adjusting the key points of the picture according to claim 1, wherein the step of determining the reference point of the adjustment process and calculating the target position of each key point to be moved after adjustment according to the reference point position and the current position of each key point to be moved, respectively, comprises:
determining a reference point for a translational adjustment process; wherein the reference point comprises a translation start point and a translation end point;
acquiring the current positions of the reference point and each key point to be moved;
and carrying out translation processing on the key points to be moved by using the translation model, and calculating the target positions of the key points to be moved.
8. The method for adjusting picture key points according to claim 7, wherein the translation model is described as:
wherein ,is the vector of the key point at the current position, +.>Is the vector of the key point at the target position, +.>Is a translation vector constructed with the translation start point and translation end point.
9. The method for adjusting the key points of the picture according to claim 1, wherein the step of determining the reference point of the adjustment process and calculating the target position of each key point to be moved after adjustment according to the reference point position and the current position of each key point to be moved, respectively, comprises:
determining a rotation reference point indicating a rotation position in a rotation adjustment process and a rotation center point as a rotation center; the rotation reference point is used for determining the distance and the angle from the rotation of the key point to the target position;
acquiring and according to the rotation reference point, the rotation center point and the current position of the key point;
and carrying out rotation processing on the key points to be moved by using the rotation model, and calculating the target positions of the key points to be moved.
10. The method for adjusting picture key points according to claim 9, wherein the rotation model is described as:
wherein ,is the vector of the key point at the current position, +.>Is a vector of rotating reference points, +.>For the vector from the rotation reference point to the rotation center point, θ is the rotation angle centered on the rotation center point, (-) 1 , 1 ) Is a rotation superposition vector, x 1 Is the transverse coordinate of the rotation superposition vector, y 1 Is the longitudinal coordinate of the rotational superposition vector, < >>Is the vector of the keypoint at the target position.
11. The method for adjusting picture key points according to claim 10, wherein reference points are selected as a rotation start point and a rotation end point, and vectors of the rotation reference pointsAnd the rotation angle θ is obtained by the following model:
wherein ,is a vector of rotating reference points, +.>Is the vector of the rotation center point, +.>For a vector from one of the specified key points to the rotation center point, θ is the rotation angle, +.>Is the vector of the rotation origin around the rotation center point,/->Is the vector of the rotational end point around the rotational center point.
12. An adjusting device for key points of a picture is characterized by comprising:
a selection unit, configured to select 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 positions of the adjusted key points to be moved according to the positions of the reference point and the current positions of the key points to be moved, and comprises the following steps: determining a reference point of a 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; performing smoothing treatment on the key points to be moved by using a smoothing model, and calculating target positions of the key points to be moved;
and the moving unit is used for respectively moving the key points to be moved to the corresponding target positions.
13. 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 applications configured to: the adjustment method of picture key points according to any one of claims 1 to 11 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 CN111383170A (en) 2020-07-07
CN111383170B true 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 (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB2418314A (en) * 2004-09-16 2006-03-22 Sharp Kk A system for combining multiple disparity maps

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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
CN111383170A (en) 2020-07-07

Similar Documents

Publication Publication Date Title
JP5699788B2 (en) Screen area detection method and system
CN114664722A (en) Square wafer pre-alignment method and system, electronic equipment and storage medium
US8531505B2 (en) Imaging parameter acquisition apparatus, imaging parameter acquisition method and storage medium
CN106296587B (en) Splicing method of tire mold images
JP7188201B2 (en) Image processing device, image processing method, and image processing program
WO2011118476A1 (en) Three dimensional distance measuring device and method
CN113099111A (en) Dispensing track generation method and device, electronic equipment and storage medium
CN114332183A (en) Image registration method and device, computer equipment and storage medium
JP6579727B1 (en) Moving object detection device, moving object detection method, and moving object detection program
CN106771329B (en) Method for detecting running speed of unmanned aerial vehicle in deceleration process
CN111383170B (en) Picture key point adjusting method, device and terminal
JP7003617B2 (en) Estimator, estimation method, and estimation program
WO2008032375A1 (en) Image correcting device and method, and computer program
JP6308962B2 (en) Displacement or strain calculation program and displacement or strain measurement method
CN116486126B (en) Template determination method, device, equipment and storage medium
JP2009301181A (en) Image processing apparatus, image processing program, image processing method and electronic device
JP7230722B2 (en) Image processing device and image processing method
WO2023070919A1 (en) Product movement track calculation method and apparatus, device, and storage medium
JP4097255B2 (en) Pattern matching apparatus, pattern matching method and program
JP2014038606A (en) Feature point extraction method for photographed image, and feature point extraction device
CN113327232B (en) Relay contact set contact surface alignment method, apparatus and computer storage medium
JP4796295B2 (en) Camera angle change detection method, apparatus and program, and image processing method, equipment monitoring method, surveying method, and stereo camera setting method using the same
CN114049404B (en) Method and device for calibrating internal phase and external phase of vehicle
KR102247057B1 (en) Method and apparatus for calculating the length of slabs using artificial neural networks
CN114720915B (en) Calibration method and device for three-dimensional Hall probe and visual guidance system

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