45 #include <visp3/core/vpCameraParameters.h> 46 #include <visp3/core/vpDebug.h> 47 #include <visp3/core/vpException.h> 48 #include <visp3/core/vpMath.h> 49 #include <visp3/core/vpMeterPixelConversion.h> 60 const double &rho_m,
const double &theta_m,
61 double &rho_p,
double &theta_p)
63 double co = cos(theta_m);
64 double si = sin(theta_m);
72 theta_p = atan2(cam.px * si, cam.py * co);
73 rho_p = (cam.px * cam.py * rho_m + cam.u0 * cam.py * co + cam.v0 * cam.px * si);
104 double &n20_p,
double &n11_p,
double &n02_p)
107 double xc_m = circle.
p[0];
108 double yc_m = circle.
p[1];
109 double n20_m = circle.
p[2];
110 double n11_m = circle.
p[3];
111 double n02_m = circle.
p[4];
146 double &n20_p,
double &n11_p,
double &n02_p)
149 double xc_m = sphere.
p[0];
150 double yc_m = sphere.
p[1];
151 double n20_m = sphere.
p[2];
152 double n11_m = sphere.
p[3];
153 double n02_m = sphere.
p[4];
179 double xc_m,
double yc_m,
double n20_m,
double n11_m,
double n02_m,
180 vpImagePoint ¢er_p,
double &n20_p,
double &n11_p,
double &n02_p)
189 #if VISP_HAVE_OPENCV_VERSION >= 0x020300 200 const double &rho_m,
const double &theta_m,
201 double &rho_p,
double &theta_p)
203 double co = cos(theta_m);
204 double si = sin(theta_m);
205 double px = cameraMatrix.at<
double>(0,0);
206 double py = cameraMatrix.at<
double>(1,1);
207 double u0 = cameraMatrix.at<
double>(0,2);
208 double v0 = cameraMatrix.at<
double>(1,2);
211 if (fabs(d) < 1e-6) {
216 theta_p = atan2(px * si, py * co);
217 rho_p = (px * py * rho_m + u0 * py * co + v0 * px * si);
251 double &n20_p,
double &n11_p,
double &n02_p)
253 double px = cameraMatrix.at<
double>(0,0);
254 double py = cameraMatrix.at<
double>(1,1);
255 cv::Mat distCoeffs = cv::Mat::zeros(5,1,CV_64FC1);
257 double xc_m = circle.
p[0];
258 double yc_m = circle.
p[1];
259 double n20_m = circle.
p[2];
260 double n11_m = circle.
p[3];
261 double n02_m = circle.
p[4];
266 n11_p = n11_m * px * py;
300 double &n20_p,
double &n11_p,
double &n02_p)
302 double px = cameraMatrix.at<
double>(0,0);
303 double py = cameraMatrix.at<
double>(1,1);
304 cv::Mat distCoeffs = cv::Mat::zeros(5,1,CV_64FC1);
306 double xc_m = sphere.
p[0];
307 double yc_m = sphere.
p[1];
308 double n20_m = sphere.
p[2];
309 double n11_m = sphere.
p[3];
310 double n02_m = sphere.
p[4];
315 n11_p = n11_m * px * py;
335 double xc_m,
double yc_m,
double n20_m,
double n11_m,
double n02_m,
336 vpImagePoint ¢er_p,
double &n20_p,
double &n11_p,
double &n02_p)
338 double px = cameraMatrix.at<
double>(0,0);
339 double py = cameraMatrix.at<
double>(1,1);
340 cv::Mat distCoeffs = cv::Mat::zeros(5,1,CV_64FC1);
345 n11_p = n11_m * px * py;
366 const double &x,
const double &y,
double &u,
double &v)
368 std::vector<cv::Point3d> objectPoints_vec;
369 objectPoints_vec.push_back(cv::Point3d(x, y, 1.0));
370 std::vector<cv::Point2d> imagePoints_vec;
371 cv::projectPoints(objectPoints_vec, cv::Mat::eye(3,3,CV_64FC1), cv::Mat::zeros(3,1,CV_64FC1), cameraMatrix, distCoeffs, imagePoints_vec);
372 u = imagePoints_vec[0].x;
373 v = imagePoints_vec[0].y;
393 std::vector<cv::Point3d> objectPoints_vec;
394 objectPoints_vec.push_back(cv::Point3d(x, y, 1.0));
395 std::vector<cv::Point2d> imagePoints_vec;
396 cv::projectPoints(objectPoints_vec, cv::Mat::eye(3,3,CV_64FC1), cv::Mat::zeros(3,1,CV_64FC1), cameraMatrix, distCoeffs, imagePoints_vec);
397 iP.
set_u(imagePoints_vec[0].x);
398 iP.
set_v(imagePoints_vec[0].y);
static void convertEllipse(const vpCameraParameters &cam, const vpSphere &sphere, vpImagePoint ¢er_p, double &n20_p, double &n11_p, double &n02_p)
static void convertPoint(const vpCameraParameters &cam, const double &x, const double &y, double &u, double &v)
error that can be emited by ViSP classes.
Class that defines a 3D sphere in the object frame and allows forward projection of a 3D sphere in th...
static double sqr(double x)
Generic class defining intrinsic camera parameters.
static void convertLine(const vpCameraParameters &cam, const double &rho_m, const double &theta_m, double &rho_p, double &theta_p)
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Class that defines a 3D circle in the object frame and allows forward projection of a 3D circle in th...