Square Homogenic coordinates

白昼怎懂夜的黑 提交于 2020-01-14 05:43:06

问题


I have a 2D picture (projection) of a square in 3D space. I know that this is a perfect square (90 degree angles, and equal length sides).

I would like to be able to poke a point on the projection of the square and find the "real" coordinates on the square. From reading a little bit around the internet I have come to understand that these are called "homogenic coordinates" of the point. (is this right?). For simplicities sake, please assume that the length of each of the square's edges is 1.

For simplicity's sake assume that the camera is a non-distorted pinhole camera, and that I can measure any of it's properties if needed. Also that the x,y coordinates on the camera are symmetric in length.

My program is that I am trying to locate a chess piece on a chessboard. It's easy for me to detect the board's corners, and easy to locate the piece. However I'm trying to skip detecting the individual squares on the board.


回答1:


Your quad vertices (u(i),v(i)) are perspective projection of square vertices (x(i),y(i)). To find coordinates of some point on square, you have to find matrix of inverse perspective transform using four pairs of points, and apply this matrix to given point coordinates.
Paul Heckbert article shows the math of this process.

Probably you can find ready-to-use libraries for calculation of persp. matrix. C++ variant: Agg2



来源:https://stackoverflow.com/questions/37093249/square-homogenic-coordinates

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!