lucas3.cpp
1 | #include "opencv/cv.h" // include core library interface |
---|---|
2 | #include "opencv/highgui.h" // include GUI library interface |
3 | #include <stdio.h> |
4 | #include <math.h> |
5 | #include <string.h> |
6 | |
7 | |
8 | const int MAX_CORNERS = 500; |
9 | |
10 | int main(int argc, char* argv[]) |
11 | { |
12 | // Load two images and allocate other structures
|
13 | IplImage* imgA = cvLoadImage("sample1.bmp", CV_LOAD_IMAGE_GRAYSCALE);
|
14 | |
15 | CvSize img_sz = cvGetSize( imgA ); |
16 | int win_size = 15; |
17 | |
18 | IplImage* eig_image = cvCreateImage( img_sz, IPL_DEPTH_32F, 1 );
|
19 | IplImage* tmp_image = cvCreateImage( img_sz, IPL_DEPTH_32F, 1 );
|
20 | |
21 | int corner_count = MAX_CORNERS;
|
22 | CvPoint2D32f* cornersA = new CvPoint2D32f[ MAX_CORNERS ];
|
23 | |
24 | cvGoodFeaturesToTrack( imgA, eig_image, tmp_image, cornersA, &corner_count, |
25 | 0.05, 5.0, 0, 3, 0, 0.04 ); |
26 | |
27 | printf("Debug 1\n");
|
28 | cvFindCornerSubPix( imgA, cornersA, corner_count, cvSize( win_size, win_size ), |
29 | cvSize( -1, -1 ), cvTermCriteria( CV_TERMCRIT_ITER | CV_TERMCRIT_EPS, 20, 0.03 ) ); |
30 | printf("Debug 2\n");
|
31 | |
32 | return 0; |
33 | } |
34 |