Console



calibration을 위한 체스판


#include <cv.h>
#include <highgui.h>
#include<stdio.h>

#define xSize 4
#define ySize 4

int main(void)
{
    IplImage* image = NULL;
    CvCapture* capture = cvCaptureFromCAM(0);
    cvNamedWindow("camera", 0);
    cvResizeWindow("camera", 640, 480);
    int numCorners[xSize * ySize];
    CvPoint2D32f corners[xSize * ySize];
    int what;

    while(1){

        cvGrabFrame( capture ); 
        image = cvRetrieveFrame(capture);
  
        if(what = cvFindChessboardCorners( image, cvSize(xSize,ySize), corners, 
            numCorners, CV_CALIB_CB_FAST_CHECK)
) {

            for( int n = 0; n < sizeof(numCorners)/4; n++ )
                if( n%2==0 ) printf("%2d=[%lf, %lf]\t\t", n, corners[n].x, corners[n].y);
                else   printf("%2d=[%lf, %lf]\n", n, corners[n].x, corners[n].y);

            puts("");
 
            cvDrawChessboardCorners( image, cvSize(xSize,ySize), corners,
                sizeof(numCorners)/4, what );   

            }

        cvShowImage( "camera", image );

        if(cvWaitKey(10)>=0) break;
        }

    cvReleaseCapture( &capture );
    cvDestroyAllWindows();

 return 0;
}

'OpenSTUDY > openProjects' 카테고리의 다른 글

Calibration Cam ver 3.0.0  (0) 2011.11.30
Calibration Cam ver 2.0.0  (0) 2011.11.23
Cyworld Visitor ver 1.0.0  (0) 2011.11.15
MFC Dotmatrix ver 2.0.1  (0) 2011.10.28
MFC Dotmatrix ver 2.0.0  (4) 2011.10.28

+ Recent posts