comparison c/feature-based-tracking.cpp @ 228:23da16442433

minor modifications for unsigned int (nframes is now 0 to process all frames)
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Wed, 27 Jun 2012 18:11:34 -0400
parents b7612c6d5702
children 249d65ff6c35
comparison
equal deleted inserted replaced
227:b7612c6d5702 228:23da16442433
78 // BruteForceMatcher<Hamming> descMatcher; 78 // BruteForceMatcher<Hamming> descMatcher;
79 // vector<DMatch> matches; 79 // vector<DMatch> matches;
80 80
81 VideoCapture capture; 81 VideoCapture capture;
82 Size videoSize; 82 Size videoSize;
83 int nFrames = -1; 83 unsigned int nFrames = 0;
84 capture.open(params.videoFilename); 84 capture.open(params.videoFilename);
85 if(capture.isOpened()) { 85 if(capture.isOpened()) {
86 videoSize = Size(capture.get(CV_CAP_PROP_FRAME_WIDTH), capture.get(CV_CAP_PROP_FRAME_HEIGHT)); 86 videoSize = Size(capture.get(CV_CAP_PROP_FRAME_WIDTH), capture.get(CV_CAP_PROP_FRAME_HEIGHT));
87 nFrames = capture.get(CV_CAP_PROP_FRAME_COUNT); 87 nFrames = capture.get(CV_CAP_PROP_FRAME_COUNT);
88 cout << "Video " << params.videoFilename << 88 cout << "Video " << params.videoFilename <<
125 125
126 int key = '?'; 126 int key = '?';
127 unsigned int savedFeatureId=0; 127 unsigned int savedFeatureId=0;
128 Mat frame, currentFrameBW, previousFrameBW; 128 Mat frame, currentFrameBW, previousFrameBW;
129 129
130 unsigned int lastFrameNum = nFrames; 130 unsigned int lastFrameNum = params.frame1+nFrames;
131 if (params.nFrames >= 0) 131 if (params.nFrames > 0)
132 lastFrameNum = min(params.frame1+params.nFrames, nFrames); 132 lastFrameNum = MIN(params.frame1+params.nFrames, nFrames);
133 133
134 capture.set(CV_CAP_PROP_POS_FRAMES, params.frame1); 134 capture.set(CV_CAP_PROP_POS_FRAMES, params.frame1);
135 for (unsigned int frameNum = params.frame1; (frameNum < lastFrameNum) && !::interruptionKey(key); frameNum++) { 135 for (unsigned int frameNum = params.frame1; (frameNum < lastFrameNum) && !::interruptionKey(key); frameNum++) {
136 capture >> frame; 136 capture >> frame;
137 if (frameNum%50 ==0) 137 if (frameNum%50 ==0)