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> 61 const double &rho_m,
const double &theta_m,
62 double &rho_p,
double &theta_p)
64 double co = cos(theta_m);
65 double si = sin(theta_m);
73 theta_p = atan2(cam.px * si, cam.py * co);
74 rho_p = (cam.px * cam.py * rho_m + cam.u0 * cam.py * co + cam.v0 * cam.px * si);
104 double &mu20_p,
double &mu11_p,
double &mu02_p)
107 double xc_m = circle.
p[0];
108 double yc_m = circle.
p[1];
109 double mu20_m = circle.
p[2];
110 double mu11_m = circle.
p[3];
111 double mu02_m = circle.
p[4];
145 double &mu20_p,
double &mu11_p,
double &mu02_p)
148 double xc_m = sphere.
p[0];
149 double yc_m = sphere.
p[1];
150 double mu20_m = sphere.
p[2];
151 double mu11_m = sphere.
p[3];
152 double mu02_m = sphere.
p[4];
161 #if VISP_HAVE_OPENCV_VERSION >= 0x020300 172 const double &rho_m,
const double &theta_m,
173 double &rho_p,
double &theta_p)
175 double co = cos(theta_m);
176 double si = sin(theta_m);
177 double px = cameraMatrix.at<
double>(0,0);
178 double py = cameraMatrix.at<
double>(1,1);
179 double u0 = cameraMatrix.at<
double>(0,2);
180 double v0 = cameraMatrix.at<
double>(1,2);
183 if (fabs(d) < 1e-6) {
188 theta_p = atan2(px * si, py * co);
189 rho_p = (px * py * rho_m + u0 * py * co + v0 * px * si);
222 double &mu20_p,
double &mu11_p,
double &mu02_p)
224 double px = cameraMatrix.at<
double>(0,0);
225 double py = cameraMatrix.at<
double>(1,1);
226 cv::Mat distCoeffs = cv::Mat::zeros(5,1,CV_64FC1);
228 double xc_m = circle.
p[0];
229 double yc_m = circle.
p[1];
230 double mu20_m = circle.
p[2];
231 double mu11_m = circle.
p[3];
232 double mu02_m = circle.
p[4];
237 mu11_p = mu11_m * px * py;
270 double &mu20_p,
double &mu11_p,
double &mu02_p)
272 double px = cameraMatrix.at<
double>(0,0);
273 double py = cameraMatrix.at<
double>(1,1);
274 cv::Mat distCoeffs = cv::Mat::zeros(5,1,CV_64FC1);
276 double xc_m = sphere.
p[0];
277 double yc_m = sphere.
p[1];
278 double mu20_m = sphere.
p[2];
279 double mu11_m = sphere.
p[3];
280 double mu02_m = sphere.
p[4];
285 mu11_p = mu11_m * px * py;
305 const double &x,
const double &y,
double &u,
double &v)
307 std::vector<cv::Point3d> objectPoints_vec;
308 objectPoints_vec.push_back(cv::Point3d(x, y, 1.0));
309 std::vector<cv::Point2d> imagePoints_vec;
310 cv::projectPoints(objectPoints_vec, cv::Mat::eye(3,3,CV_64FC1), cv::Mat::zeros(3,1,CV_64FC1), cameraMatrix, distCoeffs, imagePoints_vec);
311 u = imagePoints_vec[0].x;
312 v = imagePoints_vec[0].y;
332 std::vector<cv::Point3d> objectPoints_vec;
333 objectPoints_vec.push_back(cv::Point3d(x, y, 1.0));
334 std::vector<cv::Point2d> imagePoints_vec;
335 cv::projectPoints(objectPoints_vec, cv::Mat::eye(3,3,CV_64FC1), cv::Mat::zeros(3,1,CV_64FC1), cameraMatrix, distCoeffs, imagePoints_vec);
336 iP.
set_u(imagePoints_vec[0].x);
337 iP.
set_v(imagePoints_vec[0].y);
static void convertEllipse(const vpCameraParameters &cam, const vpSphere &sphere, vpImagePoint ¢er, double &mu20_p, double &mu11_p, double &mu02_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 what is a sphere.
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 what is a circle.