Perspective transformation, How to locate the 4 po

2019-09-11 06:12发布

问题:

What I am trying to do is to make the people's sizes in the output image all the same. So I performed a perspective transformation so that the viewing angle is right above the scene. The scene picture is showing below:

The functions I am using is cv2.getPerspectiveTransform and cv2.warpPerspective, and this method need 4 points on the input image and corresponding points on the output image. For the 4 points on the output image, i always choose the four corners. However it's very hard to choose the 4 points on the input image.My mentor told me the 4 points must choose from the vanishing lines(parallel to each other), Below is an example of how i chose the 4 points on the input image in this way:

However, the people's sizes are still different, the people on the upper side of the image are larger and they are blur. Then I tried to change the 4 points by looking at the output image(not following the vanishing lines,just change the points based on the output), here is what i got:

It's better but it's too complicated, it took me quite a long time to adjust the four points. Are there any easier ways to locate the 4 points on the input image so that the people's sizes on the output image is the same? Your help is greatly appreciated. Thanks!