Calculating the orientation of a square and displaying an object with the same orientation

I wrote an application that detects a square inside an image. To give you a good idea of ​​how such an image containing such a square, in this case a marker, might look like this:

What I get after detection is the coordinates of the four corners of my marker. Now I do not know how to display an object on my marker. The object must have the same rotation angle / angle / direction as the marker.

Are there any documents on how to achieve this, any algorithms that I can use to be strong / working enough?

This does not have to be a working solution, it can be a simple description of how to achieve this or something like that. If you point me to a library or something like that, it should work under Linux, windows are not needed, but it would be great if I need to transfer the application at some point. I already looked at ARToolkit, but they were camera parameters and more complex matrices, while I got only four corner points and one image instead of the whole video / camera stream.

+3
source share
3 answers

I believe that you can use OpenCV cvGetPerspectiveTransformto find a transformation that can convert a square to the corners of a marker, and then cvWarpPerspectiveto warp the image.

+1
0

. , , , . , y cooridnates 0, . , 0-1. 0 x, 1, z - get 0 1. , . , . -

       x z
left:  0 ?
right: 1 ?
front: ? 0
back:  ? 1

, ? . . , , , z 0,5. 3 -, . y , , 0,1,0 , , 2D- . , , , , , , , - .

0

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


All Articles