77 double n02_p,
double &xc_m,
double &yc_m,
double &n20_m,
double &n11_m,
double &n02_m);
110 switch (cam.m_projModel) {
112 convertPointWithoutDistortion(cam, u, v, x, y);
115 convertPointWithDistortion(cam, u, v, x, y);
118 convertPointWithKannalaBrandtDistortion(cam, u, v, x, y);
155 switch (cam.m_projModel) {
157 convertPointWithoutDistortion(cam, iP, x, y);
160 convertPointWithDistortion(cam, iP, x, y);
163 convertPointWithKannalaBrandtDistortion(cam, iP, x, y);
171#ifndef DOXYGEN_SHOULD_SKIP_THIS
184 inline static void convertPointWithoutDistortion(
const vpCameraParameters &cam,
const double &u,
const double &v,
185 double &x,
double &y)
187 x = (u - cam.m_u0) * cam.m_inv_px;
188 y = (v - cam.m_v0) * cam.m_inv_py;
206 inline static void convertPointWithoutDistortion(
const vpCameraParameters &cam,
const vpImagePoint &iP,
double &x,
227 inline static void convertPointWithDistortion(
const vpCameraParameters &cam,
const double &u,
const double &v,
228 double &x,
double &y)
231 x = (
u -
cam.m_u0) * r2 *
cam.m_inv_px;
232 y = (
v -
cam.m_v0) * r2 *
cam.m_inv_py;
251 inline static void convertPointWithDistortion(
const vpCameraParameters &cam,
const vpImagePoint &iP,
double &x,
280 inline static void convertPointWithKannalaBrandtDistortion(
const vpCameraParameters &cam,
const double &u,
281 const double &v,
double &x,
double &y)
283 double x_d = (
u -
cam.m_u0) /
cam.m_px, y_d = (v -
cam.m_v0) /
cam.m_py;
286 const unsigned int index_0 = 0;
287 const unsigned int index_1 = 1;
288 const unsigned int index_2 = 2;
289 const unsigned int index_3 = 3;
290 const unsigned int val_1 = 1;
291 const unsigned int val_3 = 3;
292 const unsigned int val_5 = 5;
293 const unsigned int val_7 = 7;
294 const unsigned int val_9 = 9;
295 const unsigned int val_10 = 10;
297 r_d = std::min<double>(std::max<double>(-M_PI, r_d), M_PI);
299 std::vector<double> k =
cam.getKannalaBrandtDistortionCoefficients();
301 const double EPS = 1
e-8;
307 for (
unsigned int j = 0;
j < val_10; ++
j) {
308 double theta2 = theta * theta;
309 double theta4 = theta2 * theta2;
310 double theta6 = theta4 * theta2;
311 double theta8 = theta6 * theta2;
312 double k0_theta2 = k[index_0] * theta2;
313 double k1_theta4 = k[index_1] * theta4;
314 double k2_theta6 = k[index_2] * theta6,
315 k3_theta8 = k[index_3] * theta8;
319 double theta_fix = ((theta * (val_1 + k0_theta2 + k1_theta4 + k2_theta6 + k3_theta8)) - r_d)
320 / (val_1 + (val_3 * k0_theta2) + (val_5 * k1_theta4) + (val_7 * k2_theta6) + (val_9 * k3_theta8));
321 theta = theta - theta_fix;
322 if (fabs(theta_fix) < EPS) {
327 scale = std::tan(theta) / r_d;
353 inline static void convertPointWithKannalaBrandtDistortion(
const vpCameraParameters &cam,
const vpImagePoint &iP,
354 double &x,
double &y)
359 const unsigned int index_0 = 0;
360 const unsigned int index_1 = 1;
361 const unsigned int index_2 = 2;
362 const unsigned int index_3 = 3;
363 const unsigned int val_1 = 1;
364 const unsigned int val_3 = 3;
365 const unsigned int val_5 = 5;
366 const unsigned int val_7 = 7;
367 const unsigned int val_9 = 9;
368 const unsigned int val_10 = 10;
370 r_d = std::min<double>(std::max<double>(-M_PI, r_d), M_PI);
372 std::vector<double> k =
cam.getKannalaBrandtDistortionCoefficients();
374 const double EPS = 1
e-8;
380 for (
unsigned int j = 0;
j < val_10; ++
j) {
381 double theta2 = theta * theta;
382 double theta4 = theta2 * theta2;
383 double theta6 = theta4 * theta2;
384 double theta8 = theta6 * theta2;
385 double k0_theta2 = k[index_0] * theta2;
386 double k1_theta4 = k[index_1] * theta4;
387 double k2_theta6 = k[index_2] * theta6;
388 double k3_theta8 = k[index_3] * theta8;
392 double theta_fix = ((theta * (val_1 + k0_theta2 + k1_theta4 + k2_theta6 + k3_theta8)) - r_d) /
393 (val_1 + (val_3 * k0_theta2) + (val_5 * k1_theta4) + (val_7 * k2_theta6) + (val_9 * k3_theta8));
394 theta = theta - theta_fix;
395 if (fabs(theta_fix) < EPS) {
400 scale = std::tan(theta) / r_d;
409#if defined(HAVE_OPENCV_IMGPROC) && \
410 (((VISP_HAVE_OPENCV_VERSION < 0x050000) && defined(HAVE_OPENCV_CALIB3D)) || ((VISP_HAVE_OPENCV_VERSION >= 0x050000) && defined(HAVE_OPENCV_CALIB) && defined(HAVE_OPENCV_3D)))
414 static void convertEllipse(
const cv::Mat &cameraMatrix,
const cv::Mat &distCoeffs,
const vpImagePoint ¢er_p,
415 double n20_p,
double n11_p,
double n02_p,
double &xc_m,
double &yc_m,
double &n20_m,
416 double &n11_m,
double &n02_m);
417 static void convertLine(
const cv::Mat &cameraMatrix,
const double &rho_p,
const double &theta_p,
double &rho_m,
419 static void convertMoment(
const cv::Mat &cameraMatrix,
unsigned int order,
const vpMatrix &moment_pixel,
420 vpMatrix &moment_meter);
421 static void convertPoint(
const cv::Mat &cameraMatrix,
const cv::Mat &distCoeffs,
const double &u,
const double &v,
422 double &x,
double &y);
423 static void convertPoint(
const cv::Mat &cameraMatrix,
const cv::Mat &distCoeffs,
const vpImagePoint &iP,
double &x,
static void convertEllipse(const vpCameraParameters &cam, const vpImagePoint ¢er_p, double n20_p, double n11_p, double n02_p, double &xc_m, double &yc_m, double &n20_m, double &n11_m, double &n02_m)