Mercurial > hg > nsaunier > traffic-intelligence
comparison c/Motion.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 | 6022350f8173 |
| children | c3c3a90c08f8 |
comparison
equal
deleted
inserted
replaced
| 932:66f382852e61 | 933:8ac7f61c6e4f |
|---|---|
| 123 trajectoryDB.write(*velocities, velocitiesTableName); | 123 trajectoryDB.write(*velocities, velocitiesTableName); |
| 124 } | 124 } |
| 125 | 125 |
| 126 #ifdef USE_OPENCV | 126 #ifdef USE_OPENCV |
| 127 /// \todo add option for anti-aliased drawing, thickness | 127 /// \todo add option for anti-aliased drawing, thickness |
| 128 void FeatureTrajectory::draw(Mat& img, const Mat& homography, const Scalar& color) const { | 128 void FeatureTrajectory::draw(Mat& img, const Mat& homography, const Mat& intrinsicCameraMatrix, const Scalar& color) const { |
| 129 Point2f p1, p2; | 129 Point2f p1, p2; |
| 130 if (!homography.empty()) | 130 if (!homography.empty()) |
| 131 p1 = project((*positions)[0], homography); | 131 p1 = project((*positions)[0], homography); |
| 132 else | 132 else |
| 133 p1 = (*positions)[0]; | 133 p1 = (*positions)[0]; |
| 134 if (!intrinsicCameraMatrix.empty()) | |
| 135 p1 = cameraProject(p1, intrinsicCameraMatrix); | |
| 134 for (unsigned int i=1; i<positions->size(); i++) { | 136 for (unsigned int i=1; i<positions->size(); i++) { |
| 135 if (!homography.empty()) | 137 if (!homography.empty()) |
| 136 p2 = project((*positions)[i], homography); | 138 p2 = project((*positions)[i], homography); |
| 137 else | 139 else |
| 138 p2 = (*positions)[i]; | 140 p2 = (*positions)[i]; |
| 141 if (!intrinsicCameraMatrix.empty()) | |
| 142 p2 = cameraProject(p2, intrinsicCameraMatrix); | |
| 139 line(img, p1, p2, color, 1); | 143 line(img, p1, p2, color, 1); |
| 140 p1 = p2; | 144 p1 = p2; |
| 141 } | 145 } |
| 142 } | 146 } |
| 143 #endif | 147 #endif |
