Camera Calibration Problem

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

Camera Calibration Problem

Mahmoud A.Hamed
I¢m new to
OpenCV, and I was trying after I¢ve made a corner detection, I¢ve tried to make
a camera calibration using chessboard.
My code is the
code below and a strange problem appears when I try to run it, the
object_points which must be a nx3 matrix is said to be a bad argument, and obeying
to the demand of the VS,I¢ve made the distortion_coeffs to 4x1 which isn¢t
mathimatically true.
I was wondering
if any one can help me with that problem, I¢ve really spend a lot of time to
solve that but all in vain.
Thanks in
usingnamespace std;
voidmain ()
      IplImage *img = cvLoadImage("D:\\TestImage.jpg");
      CvMat *object_points = cvCreateMat(54,3,CV_32FC1);
      int p = 0;
      for (int z = 0; z < 6; z++)// to fill the object_points(X,Y,Z=0)
            for (int x = 0; x < 9; x++)
= x * 3;
= z * 3;
= 0.0f;
                  p ++;
& corners/////////////////////////
      int x=0;
      CvPoint2D32f* corners= new CvPoint2D32f[ 54 ];// number of corners = 54 from the
      int y=cvFindChessboardCorners(img,cvSize(9,6),corners);
      CvMat *image_points = cvCreateMat(54,2,CV_32FC1);
      for (int i = 0; i < 54; i++)// tofill the image_points with
corner points
= corners[i].x;
= corners[i].y;
      CvMat *points_count = cvCreateMat(1,1,CV_32SC1);// include the size of image (width * hight)
= img->width*img->height;
& distortion////////////////////
      CvMat *intrinsic_matrix = cvCreateMat(3,3,CV_32FC1);
      CvMat* distortion_coeffs = cvCreateMat(4,1,CV_32FC1);
      cvCalibrateCamera2(object_points,image_points,points_count,cvSize(img->width,img->height),intrinsic_matrix,distortion_coeffs,NULL/*Rotation mat.*/,NULL/*Translation


[Non-text portions of this message have been removed]


Change settings:, 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 [hidden email]
Yahoo! Groups Links

<*> To visit your group on the web, go to:

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[hidden email]
    mailto:[hidden email]

<*> To unsubscribe from this group, send an email to:
    [hidden email]

<*> Your use of Yahoo! Groups is subject to: