diff c/cvutils.cpp @ 933:8ac7f61c6e4f

major rework of homography calibration, no in ideal points if correcting for distortion
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Fri, 14 Jul 2017 02:11:21 -0400
parents 1e3c7fe21a38
children 05ccd8ef150c
line wrap: on
line diff
--- a/c/cvutils.cpp	Fri Jul 14 00:12:03 2017 -0400
+++ b/c/cvutils.cpp	Fri Jul 14 02:11:21 2017 -0400
@@ -25,6 +25,14 @@
   return Point2f(x, y);
 }
 
+Point2f cameraProject(const Point2f& p, const Mat& cameraMatrix) {
+  //Mat homogeneous(3, 1, CV_32FC1);
+  float x, y;
+  x = cameraMatrix.at<double>(0,0)*p.x+cameraMatrix.at<double>(0,2);
+  y = cameraMatrix.at<double>(1,1)*p.y+cameraMatrix.at<double>(1,2);
+  return Point2f(x, y);
+}
+
 Mat loadMat(const string& filename, const string& separator) {
   vector<vector<float> > numbers = ::loadNumbers(filename, separator);