Answer the question
In order to leave comments, you need to log in
How to fix camera perspective in OpenCV and get orthogonal projection?
Hello!
There is a camera installed at an angle (rotate, tilt along several axes, shift) to the plane.
It is necessary to calculate the angle of rotation of the rectangle from this plane.
Now I do this:
1. I get a frame from the camera
2. I correct the distortion of the camera lens (I found the coefficients using a chessboard)
3. I find 4 marks in the picture, the position of which is exactly known, using getPerspectiveTransform and warpPerspective I restore the perspective.
Here's APPROXIMATELY what happens:
The problem is that when I find the sides of the rectangle - the angle between them is less than 90 degrees (I'm sure that in real life this is a rectangle and physically the angles in it == 90)!
Accordingly, the angle of rotation of the rectangle differs from the correct one. The angle between the edges jumps from 87 to 89, the closer the rectangle is to the marks (in the upper left corner of the picture), the more accurate the angle. Camera 8 megapixels, maximum resolution, the size of the rectangle itself is almost half the frame, so an error of a couple of pixels has nothing to do with it (I tried to measure the frame from the camera in a graphics editor - the angle is also less than 90).
As I think, there are some distortions from the fact that somehow I find the perspective matrix incorrectly, or I need to apply something else ... Tell me, please, where to look and how to do it right?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question