Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

projectPoints() Wrong results??

Why is my code snippet giving my weird results for projected points?

vector<Point3d> points_3d;

points1_3d.push_back(Point3d(10, 10, 100));
Mat points3d = Mat(points_3d);


Mat rvec = (Mat_<double>(3, 3) << (1, 0, 0, 0, 1, 0, 0, 0, 1));

Mat tvec = (Mat_<double>(3, 1) << (0, 0, 0));

Mat K = (Mat_<double>(3,3) 
    << (1000, 0, 50,
        0, 1000, 50,
        0, 0, 1));


Mat points_2d;

projectPoints(points_3d, rvec, tvec, K, Mat(), points_2d);


cout << points_2d;

I get as projected 2D Point = -1.708699427820658e+024, -9.673395654445999e-026

projectPoints() Wrong results??

Why is my code snippet giving my me weird results for projected points?

vector<Point3d> points_3d;

points1_3d.push_back(Point3d(10, 10, 100));
Mat points3d = Mat(points_3d);


Mat rvec = (Mat_<double>(3, 3) << (1, 0, 0, 0, 1, 0, 0, 0, 1));

Mat tvec = (Mat_<double>(3, 1) << (0, 0, 0));

Mat K = (Mat_<double>(3,3) 
    << (1000, 0, 50,
        0, 1000, 50,
        0, 0, 1));


Mat points_2d;

projectPoints(points_3d, rvec, tvec, K, Mat(), points_2d);


cout << points_2d;

I get as projected 2D Point = -1.708699427820658e+024, -9.673395654445999e-026

projectPoints() Wrong results??

Why is my code snippet giving me weird results for projected points?

//Generate the 3D Point which i want to project onto 2D plane
vector<Point3d> points_3d;

points1_3d.push_back(Point3d(10, points_3d.push_back(Point3d(10, 10, 100));
Mat points3d = Mat(points_3d);

 //Generate the identity matrix and zero vector for rotation and translation vector
Mat rvec = (Mat_<double>(3, 3) << (1, 0, 0, 0, 1, 0, 0, 0, 1));
 Mat tvec = (Mat_<double>(3, 1) << (0, 0, 0));

//Generate a camera intrinsic matrix
Mat K = (Mat_<double>(3,3) 
 << (1000, 0, 50,
     0, 1000, 50,
     0, 0, 1));

 //Project the 3D Point onto 2D plane
Mat points_2d;

projectPoints(points_3d, rvec, tvec, K, Mat(), points_2d);

 //Output
cout << points_2d;

I get as projected 2D Point
P
= -1.708699427820658e+024, -9.673395654445999e-026

projectPoints() Wrong results??

Why is my code snippet giving me weird results for projected points?

//Generate the 3D Point which i want to project onto 2D plane
vector<Point3d> points_3d;
points_3d.push_back(Point3d(10, 10, 100));
Mat points3d = Mat(points_3d);

//Generate the identity matrix and zero vector for rotation and translation vector
Mat rvec = (Mat_<double>(3, 3) << (1, 0, 0, 0, 1, 0, 0, 0, 1));
Mat tvec = (Mat_<double>(3, 1) << (0, 0, 0));

//Generate a camera intrinsic matrix
Mat K = (Mat_<double>(3,3) 
<< (1000, 0, 50,
    0, 1000, 50,
    0, 0, 1));

//Project the 3D Point onto 2D plane
Mat points_2d;

projectPoints(points_3d, rvec, tvec, K, Mat(), points_2d);

//Output
cout << points_2d;

I get as projected 2D Point
P = -1.708699427820658e+024, -9.673395654445999e-026(-1.708699427820658e+024, -9.673395654445999e-026)

If i calculate it on a paper on my own, i'm expecting a point P = (150, 150) with that formula: image description

projectPoints() Wrong results??

Why is my code snippet giving me weird results for projected points?

//Generate the 3D Point which i want to project onto 2D plane
vector<Point3d> points_3d;
points_3d.push_back(Point3d(10, 10, 100));
Mat points3d = Mat(points_3d);

//Generate the identity matrix and zero vector for rotation and translation vector
Mat rvec = (Mat_<double>(3, 3) << (1, 0, 0, 0, 1, 0, 0, 0, 1));
Mat tvec = (Mat_<double>(3, 1) << (0, 0, 0));

//Generate a camera intrinsic matrix
Mat K = (Mat_<double>(3,3) 
<< (1000, 0, 50,
    0, 1000, 50,
    0, 0, 1));

//Project the 3D Point onto 2D plane
Mat points_2d;

projectPoints(points_3d, rvec, tvec, K, Mat(), points_2d);

//Output
cout << points_2d;

I get as projected 2D Point
P points_2d = (-1.708699427820658e+024, -9.673395654445999e-026)

If i calculate it on a paper on my own, i'm expecting a point P points_2d = (150, 150) with that formula: image description

projectPoints() Wrong results??

Why is my code snippet giving me weird results for projected points?

//Generate the one 3D Point which i want to project onto 2D plane
vector<Point3d> points_3d;
points_3d.push_back(Point3d(10, 10, 100));
Mat points3d = Mat(points_3d);

//Generate the identity matrix and zero vector for rotation and translation vector
Mat rvec = (Mat_<double>(3, 3) << (1, 0, 0, 0, 1, 0, 0, 0, 1));
Mat tvec = (Mat_<double>(3, 1) << (0, 0, 0));

//Generate a camera intrinsic matrix
Mat K = (Mat_<double>(3,3) 
<< (1000, 0, 50,
    0, 1000, 50,
    0, 0, 1));

//Project the 3D Point onto 2D plane
Mat points_2d;

projectPoints(points_3d, rvec, tvec, K, Mat(), points_2d);

//Output
cout << points_2d;

I get as projected 2D Point
points_2d = (-1.708699427820658e+024, -9.673395654445999e-026)

If i calculate it on a paper on my own, i'm expecting a point points_2d = (150, 150) with that formula: image description

projectPoints() Wrong results??

Why is my code snippet giving me weird results for projected points?

//Generate the one 3D Point which i want to project onto 2D plane
vector<Point3d> points_3d;
points_3d.push_back(Point3d(10, 10, 100));
Mat points3d = Mat(points_3d);

//Generate the identity matrix and zero vector for rotation matrix and translation vector
Mat rvec = (Mat_<double>(3, 3) << (1, 0, 0, 0, 1, 0, 0, 0, 1));
Mat tvec = (Mat_<double>(3, 1) << (0, 0, 0));

//Generate a camera intrinsic matrix
Mat K = (Mat_<double>(3,3) 
<< (1000, 0, 50,
    0, 1000, 50,
    0, 0, 1));

//Project the 3D Point onto 2D plane
Mat points_2d;

projectPoints(points_3d, rvec, tvec, K, Mat(), points_2d);

//Output
cout << points_2d;

I get as projected 2D Point
points_2d = (-1.708699427820658e+024, -9.673395654445999e-026)

If i calculate it on a paper on my own, i'm expecting a point points_2d = (150, 150) with that formula: image description