#include <CVCalibration.h>
#include <Utils.h>
#include <HighResTimer.h>
#include <utility>
Go to the source code of this file.
|
void | getInnerAndOuterRectangles (const cv::Mat &cameraMatrix, const cv::Mat &distCoeffs, const cv::Mat &R, const cv::Mat &newCameraMatrix, const cv::Size &imgSize, cv::Rect_< float > &inner, cv::Rect_< float > &outer) |
| get inscribed and circumscribed rectangle More...
|
|
- Date
- Winter 2016
- Authors
- Marcus Hudritsch, Michael Goettlicher
- Copyright
- http://opensource.org/licenses/GPL-3.0
Definition in file CVCalibration.cpp.
◆ getInnerAndOuterRectangles()
void getInnerAndOuterRectangles |
( |
const cv::Mat & |
cameraMatrix, |
|
|
const cv::Mat & |
distCoeffs, |
|
|
const cv::Mat & |
R, |
|
|
const cv::Mat & |
newCameraMatrix, |
|
|
const cv::Size & |
imgSize, |
|
|
cv::Rect_< float > & |
inner, |
|
|
cv::Rect_< float > & |
outer |
|
) |
| |
get inscribed and circumscribed rectangle
Definition at line 284 of file CVCalibration.cpp.
294 cv::Mat pts(N * N, 2, CV_32F);
295 for (
int y = 0, k = 0; y < N; y++)
297 for (
int x = 0; x < N; x++)
299 pts.at<
float>(k, 0) = (
float)x * (float)imgSize.width / (N - 1);
300 pts.at<
float>(k, 1) = (
float)y * (float)imgSize.height / (N - 1);
305 pts = pts.reshape(2);
306 cv::undistortPoints(pts,
312 pts = pts.reshape(1);
314 float iX0 = -FLT_MAX, iX1 = FLT_MAX, iY0 = -FLT_MAX, iY1 = FLT_MAX;
315 float oX0 = FLT_MAX, oX1 = -FLT_MAX, oY0 = FLT_MAX, oY1 = -FLT_MAX;
318 for (
int y = 0, k = 0; y < N; y++)
319 for (
int x = 0; x < N; x++)
321 cv::Point2f p = {pts.at<
float>(k, 0),
322 pts.at<
float>(k, 1)};
338 inner = cv::Rect_<float>(iX0, iY0, iX1 - iX0, iY1 - iY0);
339 outer = cv::Rect_<float>(oX0, oY0, oX1 - oX0, oY1 - oY0);