views:

448

answers:

1

Hi,

Does anyone have a function that returns the perspective projection of a 3x3 matrix in C++?

Matrix Perspective()
{
   Matrix m(0, 0, 0);  // Creates identity matrix
   // Perspective projection formulas here
   return m;
}
A: 

With OpenCV 2.0 you can almost implement your pseudocode.

There's a Mat class for matrices and perspectiveTransform for perspective projection. And Mat::eye returns an identity matrix.

The documentation I've linked to is for OpenCV 1.1 (which is in C) but it's quite simple to infer the correct usage in OpenCV 2.0 (with the Mat class) from the manual.

Jacob