Ask Your Question

mrmuto21245's profile - activity

2020-02-05 05:51:36 -0600 received badge  Popular Question (source)
2015-12-27 01:03:16 -0600 received badge  Scholar (source)
2015-12-23 06:17:38 -0600 received badge  Supporter (source)
2015-12-23 06:17:33 -0600 commented answer How to get the scale factor of getPerspectiveTransform in opencv?

Thank you for your comment.But i think that the result from height of the rectangle, divided by the (top of the trapezoid minus the bottom) is not very accruate. Is my idea not good? Using the matrix got from getPerspectiveTransform method and decompose it into scale. Then using the scale to change the Mat size.I have updated my question to show more details.

2015-12-21 22:24:31 -0600 received badge  Editor (source)
2015-12-21 22:20:47 -0600 commented answer How to get the scale factor of getPerspectiveTransform in opencv?

Thank you for your comment.In my case, i want to get the bird-eye's view of image when the target in different size. For example,the target is trapezium and i need to convert it to rectangle.So i set four points of rectangle and these points position has been fixed. But i think when the camera height changed,the trapezium size in the image will be changed. As a result, different size trapezium will convert into a same size rectangle. The details of rectangle will have little different,right? So, i think can i
change them into same scale. But i don't konw how to set into same scale. And you said"different parts of the image have different scale factors". I have wondered is my idea right or not. Can you give me some advice?Detaisl i have update in my question

2015-12-20 02:30:27 -0600 asked a question How to get the scale factor of getPerspectiveTransform in opencv?

I have image A and i want to get the bird-eye's view of image A. So I used getPerspectiveTransform method to get the transform matrix. The output result is 3x3 matrix. See my code. In my case i want to know the scale factor of the 3x3 matrix. I have looked the opencv document, but i cannot find detail of the transform matrix and i don't know how to get the scale. Also i have read some paper, the paper said we can get scaling, shearing and ratotion from a11, a12, a21, a22. See the pic. So how can i get the scale factor.Can you give me some advice? Thank you!

Points[0] = Point2f(..., ...);
Points[1] = Point2f(..., ...);
Points[2] = Point2f(..., ...);
Points[3] = Point2f(..., ...);

dst[0] = Point2f(..., ...);
dst[1] = Point2f(..., ...);
dst[2] = Point2f(..., ...);
dst[3] = Point2f(..., ...);
Mat trans = getPerspectiveTransform(gpsPoints, dst);//I want to know the scale of trans
warpPerspective(A, B, trans, img.size());

image description

image description

I use getPerspectiveTransform(trapezoids1, rectangle),from left to right. Here are two sample,trapezoids1 to rectangle and trapezoids2 to rectangle.The rectangle is the bird-eye's view. You know we can change the rectangle length but keep height:width(2:3). The result also is bird-eye's view.My problem is the small warp into 10 times large rectange, it should resize image to high resolutions and may lose pixels.So i think we should resize the rectangle first, then warp the trapezoids to the small size rectangle. To resize the rectangle, i need to get the scale first.This is my thought.