N
N
Nikolai Chuprik2018-11-29 17:59:47
Mathematics
Nikolai Chuprik, 2018-11-29 17:59:47

How to find the linear transformation of a plane?

There are two images of a flat object (for example, a book). Found a set of numbered key points on both photos. Their correspondence has been established. It is required to find a linear transformation (scale, rotation, perspective) from one photo to another.
It is clear that for any quadruple of points it is possible to compose a system of linear equations, and by solving it, obtain the parameters of the transformation of the plane.
But the fact is that such quadruples can be chosen in many ways, and the solutions of the systems will differ slightly (due to the inaccuracy of the coordinates of the recognized key points). Those. there is an excess number of competing systems of linear equations.
I can't figure out how to quickly get the parameters of the best transformation. Enumeration of all options for the formation of fours is not realistic, and it is clear that this is generally a bad way. But what about?
The criterion of the best is the minimum sum of standard deviations of the images of all points of the first photo from the actual points of the second photo.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
X
xmoonlight, 2018-11-30
@choupa

That's all there is to answering the question.

G
Griboks, 2018-11-29
@Griboks

For any quadruple we find an approximate solution. Further, having set the accuracy, we apply the found solution adjusted for +-delta. We find the most optimal delta according to the specified criterion.
Let me explain:
1) found the affine transformation: +10 - shift of all points by 10 to the right
2) set the accuracy: 0.01
3) in the loop evaluate your criterion for all shifts to the right from 5 to 15 with a step of 0.01
4) choose the best shift

K
Karpion, 2018-12-03
@Karpion

You have the answer in your question!
Let the coordinates of the points of the first picture = P[i], the second one = V[i] (each coordinate = a vector with two values).
Next, you need to write a linear transformation:
P[i] -> A + B*P[i]
(A and B also have two components each; A = generally a normal ordinary vector).
Looking for the difference, squaring:
(A + B*P[i] - V[i])^2
sum it over i (over all points).
Now we take four partial derivatives with respect to each component A and B, equate them to zero. We get four linear equations.
Well, everyone should be able to solve linear equations.
Upd1: What is "perspective" - ​​I did not understand. Camera tilt, right?
If B is one component, then the algorithm remains the same.
Upd2: If you also need to take into account the possibility of turning at a certain angle, it will be more difficult; but the transformation is still linear.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question