Keystone Correction using 3D-Points of Kinect
Posted
by
philllies
on Game Development
See other posts from Game Development
or by philllies
Published on 2012-04-08T10:23:06Z
Indexed on
2012/04/08
11:48 UTC
Read the original article
Hit count: 500
With XNA, I am displaying a simple rectangle which is projected onto the floor. The projector can be placed at an arbitrary position. Obviously, the projected rectangle gets distorted according to the projectors position and angle. A Kinect scans the floor looking for the four corners. Now my goal is to transform the original rectangle such that the projection is no longer distorted by basically pre-warping the rectangle.
My first approach was to do everything in 2D: First compute a perspective transformation (using OpenCV's warpPerspective()
) from the scanned points to the internal rectangle's points und apply the inverse to the rectangle. This seemed to work but was too slow as it couldn't be rendered on the GPU.
The second approach was to do everything in 3D in order to use XNA's rendering features. First, I would display a plane, scan its corners with Kinect and map the received 3D-Points to the original plane. Theoretically, I could apply the inverse of the perspective transformation to the plane, as I did in the 2D-approach. However, in since XNA works with a view and projection matrix, I can't just call a function such as warpPerspective()
and get the desired result. I would need to compute the new parameters for the camera's view and projection matrix.
Question: Is it possible to compute these parameters and split them into two matrices (view and projection)? If not, is there another approach I could use?
© Game Development or respective owner