ed7000mk1
2011-01-24 16:56:33 UTC
I have a set of 3d points (they are arranged in two planes), which I am trying to convert to 2d points, as if a camera had taken a photo of them.
When I put them really far from the camera, (z value of tvec is really large, and focal length is also large) it works as expected. http://db.tt/gtmrSUA (The red ones are closer to the camera)
If I move them all closer to the camera, they look distorted somehow (my distortion matrix is all zeroes). http://db.tt/OFJQsV7 If I use project points at the point I actually want to use, the points are all over the place - I can't even work out what kind of projection would cause this effect http://db.tt/c2c4vpM
Can anyone please help me identify what I am doing wrong, or is this a bug?
Extra info - I am doing it like this:
//camera matrix
cv::Mat camM(3,3,CV_32FC1);
camM.at<float>(0,0) = 5000;
camM.at<float>(0,1) = 0;
camM.at<float>(0,2) = 255;
camM.at<float>(1,0) = 0;
camM.at<float>(1,1) = 5000;
camM.at<float>(1,2) = 255;
camM.at<float>(2,0) = 0;
camM.at<float>(2,1) = 0;
camM.at<float>(2,2) = 1;
//rotation matrix
cv::Mat rvec(3,1,CV_32FC1);
rvec.at<float>(0,0)=0;
rvec.at<float>(1,0)=0;
rvec.at<float>(2,0)=-1.57079633;//(-2/pi)
//translation matrix
cv::Mat tvec(3,1,CV_32FC1);
tvec.at<float>(0,0)=-30;
tvec.at<float>(1,0)=+25;
tvec.at<float>(2,0)=-1000;// this gives sensible looking images at 100000 or higher
cv::Mat distortions(5,1,CV_32FC1);
cv::projectPoints(Mat(calmatrix1_3d),rvec,tvec,camM,distortions,calmatrix1);
cv::projectPoints(Mat(calmatrix2_3d),rvec,tvec,camM,distortions,calmatrix2);
all the variables are single precision floating point, I did try to change everything to double, but then I just got a load of zeroes.
------------------------------------
Change settings: http://www.yahoogroups.com/mygroups, select
Get Emails (get all posts)
Daily Digest (one summary email per day)
Read on the web (read posts on the web only)Or Unsubscribe by mailing OpenCV-***@yahoogroups.com
When I put them really far from the camera, (z value of tvec is really large, and focal length is also large) it works as expected. http://db.tt/gtmrSUA (The red ones are closer to the camera)
If I move them all closer to the camera, they look distorted somehow (my distortion matrix is all zeroes). http://db.tt/OFJQsV7 If I use project points at the point I actually want to use, the points are all over the place - I can't even work out what kind of projection would cause this effect http://db.tt/c2c4vpM
Can anyone please help me identify what I am doing wrong, or is this a bug?
Extra info - I am doing it like this:
//camera matrix
cv::Mat camM(3,3,CV_32FC1);
camM.at<float>(0,0) = 5000;
camM.at<float>(0,1) = 0;
camM.at<float>(0,2) = 255;
camM.at<float>(1,0) = 0;
camM.at<float>(1,1) = 5000;
camM.at<float>(1,2) = 255;
camM.at<float>(2,0) = 0;
camM.at<float>(2,1) = 0;
camM.at<float>(2,2) = 1;
//rotation matrix
cv::Mat rvec(3,1,CV_32FC1);
rvec.at<float>(0,0)=0;
rvec.at<float>(1,0)=0;
rvec.at<float>(2,0)=-1.57079633;//(-2/pi)
//translation matrix
cv::Mat tvec(3,1,CV_32FC1);
tvec.at<float>(0,0)=-30;
tvec.at<float>(1,0)=+25;
tvec.at<float>(2,0)=-1000;// this gives sensible looking images at 100000 or higher
cv::Mat distortions(5,1,CV_32FC1);
cv::projectPoints(Mat(calmatrix1_3d),rvec,tvec,camM,distortions,calmatrix1);
cv::projectPoints(Mat(calmatrix2_3d),rvec,tvec,camM,distortions,calmatrix2);
all the variables are single precision floating point, I did try to change everything to double, but then I just got a load of zeroes.
------------------------------------
Change settings: http://www.yahoogroups.com/mygroups, select
Get Emails (get all posts)
Daily Digest (one summary email per day)
Read on the web (read posts on the web only)Or Unsubscribe by mailing OpenCV-***@yahoogroups.com