Skip to content

Instantly share code, notes, and snippets.

@satoruhiga
Created December 5, 2011 08:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save satoruhiga/1432894 to your computer and use it in GitHub Desktop.
Save satoruhiga/1432894 to your computer and use it in GitHub Desktop.
homography2glModelViewMatrix
inline ofMatrix4x4 homography2glModelViewMatrix(const cv::Mat &homography)
{
ofMatrix4x4 matrix;
matrix(0, 0) = homography.at<double>(0, 0);
matrix(0, 1) = homography.at<double>(1, 0);
matrix(0, 2) = 0;
matrix(0, 3) = homography.at<double>(2, 0);
matrix(1, 0) = homography.at<double>(0, 1);
matrix(1, 1) = homography.at<double>(1, 1);
matrix(1, 2) = 0;
matrix(1, 3) = homography.at<double>(2, 1);
matrix(2, 0) = 0;
matrix(2, 1) = 0;
matrix(2, 2) = 1;
matrix(2, 3) = 0;
matrix(3, 0) = homography.at<double>(0, 2);
matrix(3, 1) = homography.at<double>(1, 2);
matrix(3, 2) = 0;
matrix(3, 3) = 1;
return matrix;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment