Perspective transform with whole image

So I have four points in an array A , denoting the corners of a rectangular object (but not a rectangle when projected onto the image plane). I know the size of the rectangle, so I can calculate the perspective transform with

cv2.getPerspectiveTransform(four_corners, np.array([[0, 0], [0, height], [width, height], [width, 0], dtype=np.float32))

Then I can transform the image with cv2.warpPerspective .

The problem (which can be demonstrated by another people's question Counting aspect ratio of Perspective Transform destination image) is that the warped result is cropped. Only the region inside the four corners are in the final image, while I want the whole original image to be warped into the final result.

How do I achieve that?

链接地址: http://www.djcxy.com/p/64020.html

上一篇: 对数据库中的一组记录进行排序?

下一篇: 透视转换与整个图像