Mercurial Hosting > traffic-intelligence
comparison 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 |
comparison
equal
deleted
inserted
replaced
932:66f382852e61 | 933:8ac7f61c6e4f |
---|---|
20 y = (homography.at<float>(1,0)*p.x+homography.at<float>(1,1)*p.y+homography.at<float>(1,2))/w; | 20 y = (homography.at<float>(1,0)*p.x+homography.at<float>(1,1)*p.y+homography.at<float>(1,2))/w; |
21 } else { | 21 } else { |
22 x = 0; | 22 x = 0; |
23 y = 0; | 23 y = 0; |
24 } | 24 } |
25 return Point2f(x, y); | |
26 } | |
27 | |
28 Point2f cameraProject(const Point2f& p, const Mat& cameraMatrix) { | |
29 //Mat homogeneous(3, 1, CV_32FC1); | |
30 float x, y; | |
31 x = cameraMatrix.at<double>(0,0)*p.x+cameraMatrix.at<double>(0,2); | |
32 y = cameraMatrix.at<double>(1,1)*p.y+cameraMatrix.at<double>(1,2); | |
25 return Point2f(x, y); | 33 return Point2f(x, y); |
26 } | 34 } |
27 | 35 |
28 Mat loadMat(const string& filename, const string& separator) { | 36 Mat loadMat(const string& filename, const string& separator) { |
29 vector<vector<float> > numbers = ::loadNumbers(filename, separator); | 37 vector<vector<float> > numbers = ::loadNumbers(filename, separator); |