|
Camera Calibration: msg#00676lib.opencv
I wrote the code for calibrate my camera, it seems to find the chessboard but cvCalibrateCamera fills rotation matrix with identity and the others with numbers not valid. Anybody knows why? Here's my code, I append also my chessboard picture. Thanks... bool calibrate (unsigned cam) { const char *name= "Grayscale image"; const int width= 5; const int height= 6; int npoints[]= { width*height }; float distortion[4]; float homography[9]; float translation[3]; float rotation[9]; CvMat mat1, mat2; static CvPoint2D32f img_point[width*height]; static CvPoint3D32f obj_point[width*height]= { cvPoint3D32f(1.0, 1.0, 0.0), cvPoint3D32f(2.0, 1.0, 0.0), cvPoint3D32f (3.0, 1.0, 0.0), cvPoint3D32f(4.0, 1.0, 0.0), cvPoint3D32f(1.0, 2.0, 0.0), cvPoint3D32f(2.0, 2.0, 0.0), cvPoint3D32f(3.0, 2.0, 0.0), cvPoint3D32f(4.0, 2.0, 0.0), cvPoint3D32f(1.0, 3.0, 0.0), cvPoint3D32f(2.0, 3.0, 0.0), cvPoint3D32f(3.0, 3.0, 0.0), cvPoint3D32f (4.0, 3.0, 0.0), cvPoint3D32f(1.0, 4.0, 0.0), cvPoint3D32f(2.0, 4.0, 0.0), cvPoint3D32f(3.0, 4.0, 0.0), cvPoint3D32f(4.0, 4.0, 0.0), cvPoint3D32f(1.0, 5.0, 0.0), cvPoint3D32f(2.0, 5.0, 0.0), cvPoint3D32f(3.0, 5.0, 0.0), cvPoint3D32f(4.0, 5.0, 0.0) }; static IplImage *gray= cvCreateImage(size, IPL_DEPTH_8U, 1); static IplImage *tmp= cvCreateImage(size, IPL_DEPTH_8U, 1); cvCvtColor (rgb, gray, CV_BGR2GRAY); gray->origin= rgb->origin; cvNamedWindow(name, 1); cvShowImage(name, gray); if (cvFindChessBoardCornerGuesses(gray, tmp, 0, cvSize(width, height), img_point)) return false; cvCalibrateCamera(1, npoints, size, img_point, obj_point, distortion, homography, translation, rotation, 1); cvSetIdentity(camera_mat[cam]); mat1= cvMat(3, 3, CV_32FC1, rotation); cvGetSubRect(camera_mat [cam], &mat2, cvRect(0, 0, 3, 3)); cvCopy(&mat1, &mat2); mat1= cvMat(3, 1, CV_32FC1, translation); cvGetSubRect(camera_mat [cam], &mat2, cvRect(3, 0, 1, 3)); cvCopy(&mat1, &mat2); mat1= cvMat(3, 3, CV_32FC1, homography); cvGetSubRect(camera_mat [cam], &mat2, cvRect(0, 0, 4, 3)); cvMatMul(&mat1, &mat2, &mat2); cvInvert(camera_mat[cam], camera_invmat[cam]); trace (camera_mat[cam]); trace(camera_invmat[cam]); return true; } [Non-text portions of this message have been removed] 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-unsubscribe@xxxxxxxxxxxxxxx |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: converting grey-scale img => mask: 00676, dugalh |
|---|---|
| Next by Date: | Simple Question: Converting image from 8 bit to 32 bit: 00676, cegparamesh |
| Previous by Thread: | Noobie! - Urgent help required for 2 camera, camshift image analysis programi: 00676, siddus19 |
| Next by Thread: | Simple Question: Converting image from 8 bit to 32 bit: 00676, cegparamesh |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |