Fast plane rotation algorithm?

I am working on an application that detects the most visible rectangle in the image, and then tries to rotate it so that the bottom left of the rectangle is at the origin, similar to how the IUPR OSCAR system works. However, as soon as the most prominent rectangle is detected, I’m not sure how to account for the depth component or the z axis, since the rectangle will not always be “frontal”. Any examples for my understanding would be very helpful. The following is an example of an IUPR OSCAR system.

alt text http://quito.informatik.uni-kl.de/oscar/oscar.php?serverimage=img_0324.jpg&montage=use

+4
source share
2 answers

In fact, you do not need to deal with 3D information, it is just a function of displaying from one set of coordinates to another.

Look at affine transformations; they can correct simple oblique and promising effects. You should find somewhere a code that will calculate a 4-point transformation in the corners of your rectangle.

I almost forgot - if “fast” is really important, you can simplify the system only by using simple shear transforms in combination, although this will adversely affect the image quality for strongly inclined objects.

+3
source

In fact, I think you can get away with something much simpler than the Mark up approach .

  • When you have 2D coordinates in a skewed image, reassign these coordinates as texture coordinates.

  • In the renderer, draw a simple rectangle where each vertex of the corner is textured to the vertices found in the skewed 2D image (normalized and otherwise converted to your coordinate plane of the rendering texture).

Now you can rely on hardware (using OpenGL or the like) to do the correction for you, or you can write your own texture builder:

The aspect ratio should be guessed as we get rid of the actual 3D information. However, you can get away simply by using the maximum width and maximum height of your skewed rectangle.

Perspective texture mapping by Chris Hecker

+2
source

Source: https://habr.com/ru/post/1277089/


All Articles