Transformation matrix definition

As a continuation of my previous question on determining the parameters of the camera, I formulated a new problem.

I have two images of the same rectangle:

The first is an image without any transformations and shows the rectangle as it is.

The second image shows a rectangle after some 3D transformation (XYZ rotation, scaling, XY translation). This made the rectangle look like a trapezoid.

Hope the following picture describes my problem:

alt text http://wilco.menge.nl/application.data/cms/upload/transformation%20matrix.png

How to determine which transformations (more precisely: which transformation matrix) caused this transformation?

I know the location of the pixel angles in both images, so I also know the distance between the corners.

+6
matrix transformation photography photogrammetry
source share
4 answers

I'm confused. Is this a 2d or 3d problem?

As I understand it, you have a flat rectangle embedded in 3D space, and you look at two of his β€œphotos” - one from the original version and one based on the converted version. Is it correct?

If this is correct, then there is not enough information to solve the problem. For example, suppose two pictures look the same. This may be due to the fact that the translation is an identity, or it may be due to the fact that the translation moves the rectangle two times further from the camera and doubles its size (so it looks exactly the same).

+2
source share

This is a mathematical problem, not programming.

you need to define a set of equations (your transformation matrix, my guess is 3 equations), and then solve it for 4 corner point transformations.

I only ever described it using German words ... so it sounds weird ..

+1
source share

Based on the information you have, it is not so simple. However, I will give you some ideas. If you had the 3D coordinates of the corners, it would be easier for you. Here is the basic idea.

  • Move the corner to the origin. After that, rotations will occur relative to the origin.
  • Define axis vectors. Do this by subtracting adjacent angles from the starting point. This will be the local x and y axis for your world.
  • Determine angles using vectors. You can use dots and cross products to determine the angle between the local x axis and the global x axis (1, 0, 0).
  • Rotate the angle in step 3. This will give you a new x axis, which should correspond to the global x axis and the new local y axis. You can then define another rotation around the x axis that will cause the y axis to align with the global y axis.

Without z coordinates, you can see that it will be difficult, but this is a common process. Hope this helps.

0
source share

The solution will not be unique, as pointed out by Alex319.

If the second image is really a trapezoid, as you say, it will not be too difficult. This is a trapezoid (not a parallelogram) because of the perspective, so it should be an isosceles trapezoid.

Draw two diagonals. They intersect in the center of the rectangle, so it takes care of the translation.

Rotate the trapezoid until its parallel sides are parallel to the two sides of the original rectangle. (Which two? It doesn't matter.)

Draw a third parallel through the center. Scale this on the sides of the rectangle that you selected.

Now for rotation from the plane. Measure the distance from the center to one of the parallel sides and use the law of sines.

If this is not a trapezoid, but only a quadrature, then it will be more difficult, you will need to use the angles between the diagonals to find the axis of rotation.

0
source share