#include <cv.h> #include <highgui.h> #include <stdio.h>
#define CHESSBOARD_WIDTH 9 #define CHESSBOARD_HEIGHT 6 #define COUNT_OF_CORNERS (CHESSBOARD_WIDTH*CHESSBOARD_HEIGHT)
void findChessBoardCalibrationObject(IplImage* chessBoardImage); int main(void) { IplImage* chessBoardImage=cvLoadImage("right04.jpg");
findChessBoardCalibrationObject(chessBoardImage);
cvReleaseImage(&chessBoardImage); }
void findChessBoardCalibrationObject(IplImage* chessBoardImage) {
CvPoint2D32f corners[COUNT_OF_CORNERS]; int corner_count; int pattern_was_found;
pattern_was_found=cvFindChessboardCorners(chessBoardImage, cvSize(CHESSBOARD_WIDTH, CHESSBOARD_HEIGHT), corners, &corner_count, CV_CALIB_CB_ADAPTIVE_THRESH);
printf("corner_count : %d\n", corner_count);
for(int i=0; i<COUNT_OF_CORNERS; i++) { printf("x : %f, y : %f\n", corners[i].x, corners[i].y); }
cvDrawChessboardCorners(chessBoardImage, cvSize(CHESSBOARD_WIDTH, CHESSBOARD_HEIGHT), corners, corner_count, pattern_was_found);
cvNamedWindow("lueseypid", CV_WINDOW_AUTOSIZE); cvShowImage("lueseypid", chessBoardImage); cvWaitKey(0);
cvDestroyWindow("lueseypid"); } |
'Developer > OpenCV' 카테고리의 다른 글
어파인변환, 투시변환 (0) | 2013.01.31 |
---|---|
보정함수 (0) | 2013.01.30 |
회전행렬과 이동백터 (1) | 2013.01.29 |
Homogeneous coordinates(동차 좌표계), Projective transform(투영변환) (0) | 2013.01.29 |
객체 움직임 추적 - 혼-셩크, 블록매칭, 평균이동(MeanShift) (0) | 2013.01.24 |