Mercurial > hg > nsaunier > traffic-intelligence
comparison c/feature-based-tracking.cpp @ 535:5ad2f51ae42f
cleaning up initialization of intrinsic matrix
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Sun, 29 Jun 2014 23:31:38 -0400 |
| parents | d0419b1267dd |
| children | a3add9f751ef |
comparison
equal
deleted
inserted
replaced
| 534:d0419b1267dd | 535:5ad2f51ae42f |
|---|---|
| 71 | 71 |
| 72 Mat homography = ::loadMat(params.homographyFilename, " "); | 72 Mat homography = ::loadMat(params.homographyFilename, " "); |
| 73 Mat invHomography; | 73 Mat invHomography; |
| 74 if (params.display && !homography.empty()) | 74 if (params.display && !homography.empty()) |
| 75 invHomography = homography.inv(); | 75 invHomography = homography.inv(); |
| 76 Mat intrinsicCameraMatrix = ::loadMat(params.intrinsicCameraFilename, " "); | |
| 77 //cout << intrinsicCameraMatrix << endl; | |
| 78 | 76 |
| 79 float minTotalFeatureDisplacement = params.nDisplacements*params.minFeatureDisplacement; | 77 float minTotalFeatureDisplacement = params.nDisplacements*params.minFeatureDisplacement; |
| 80 Size window = Size(params.windowSize, params.windowSize); | 78 Size window = Size(params.windowSize, params.windowSize); |
| 81 | 79 |
| 82 int interpolationMethod = -1; | 80 int interpolationMethod = -1; |
| 112 cout << "Video " << params.videoFilename << | 110 cout << "Video " << params.videoFilename << |
| 113 ": width=" << videoSize.width << | 111 ": width=" << videoSize.width << |
| 114 ", height=" << videoSize.height << | 112 ", height=" << videoSize.height << |
| 115 ", nframes=" << nFrames << endl; | 113 ", nframes=" << nFrames << endl; |
| 116 | 114 |
| 117 Mat newIntrinsicCameraMatrix = intrinsicCameraMatrix.clone(); | |
| 118 Mat map1, map2; | 115 Mat map1, map2; |
| 119 if (params.undistort) { | 116 if (params.undistort) { |
| 117 Mat intrinsicCameraMatrix = ::loadMat(params.intrinsicCameraFilename, " "); | |
| 118 Mat newIntrinsicCameraMatrix = intrinsicCameraMatrix.clone(); | |
| 120 videoSize = Size(static_cast<int>(round(videoSize.width*params.undistortedImageMultiplication)), static_cast<int>(round(videoSize.height*params.undistortedImageMultiplication))); | 119 videoSize = Size(static_cast<int>(round(videoSize.width*params.undistortedImageMultiplication)), static_cast<int>(round(videoSize.height*params.undistortedImageMultiplication))); |
| 121 newIntrinsicCameraMatrix.at<float>(0,2) = videoSize.width/2.; | 120 newIntrinsicCameraMatrix.at<float>(0,2) = videoSize.width/2.; |
| 122 newIntrinsicCameraMatrix.at<float>(1,2) = videoSize.height/2.; | 121 newIntrinsicCameraMatrix.at<float>(1,2) = videoSize.height/2.; |
| 123 initUndistortRectifyMap(intrinsicCameraMatrix, params.distortionCoefficients, Mat::eye(3,3, CV_32FC1), newIntrinsicCameraMatrix, videoSize, CV_32FC1, map1, map2); | 122 initUndistortRectifyMap(intrinsicCameraMatrix, params.distortionCoefficients, Mat::eye(3,3, CV_32FC1), newIntrinsicCameraMatrix, videoSize, CV_32FC1, map1, map2); |
| 124 | 123 |
