diff c/feature-based-tracking.cpp @ 1093:05ccd8ef150c

updated to OpenCV4
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Sat, 02 Feb 2019 09:33:26 -0500
parents 9fb82fe0156f
children 164dab203037
line wrap: on
line diff
--- a/c/feature-based-tracking.cpp	Wed Jan 30 16:51:52 2019 -0500
+++ b/c/feature-based-tracking.cpp	Sat Feb 02 09:33:26 2019 -0500
@@ -7,13 +7,14 @@
 #include "src/TrajectoryDBAccessList.h"
 #include "src/TrajectoryDBAccessBlob.h"
 
-#include "opencv2/core/core.hpp"
-#include "opencv2/imgproc/imgproc.hpp"
+#include "opencv2/core.hpp"
+#include "opencv2/imgproc.hpp"
 #include "opencv2/video/tracking.hpp"
-#include "opencv2/features2d/features2d.hpp"
-#include "opencv2/highgui/highgui.hpp"
-#include "opencv2/objdetect/objdetect.hpp"
-#include "opencv2/calib3d/calib3d.hpp"
+#include "opencv2/features2d.hpp"
+#include "opencv2/highgui.hpp"
+#include "opencv2/videoio.hpp"
+#include "opencv2/objdetect.hpp"
+#include "opencv2/calib3d.hpp"
 
 #include <boost/foreach.hpp>
 #include <boost/filesystem.hpp>
@@ -101,8 +102,8 @@
     exit(0);
   }
   
-  Size videoSize = Size(capture.get(CV_CAP_PROP_FRAME_WIDTH), capture.get(CV_CAP_PROP_FRAME_HEIGHT));
-  unsigned int nFrames = capture.get(CV_CAP_PROP_FRAME_COUNT);
+  Size videoSize = Size(capture.get(CAP_PROP_FRAME_WIDTH), capture.get(CAP_PROP_FRAME_HEIGHT));
+  unsigned int nFrames = capture.get(CAP_PROP_FRAME_COUNT);
   if (nFrames <= 0) {
     cout << "Guessing that the number of frames could not be read: " << nFrames << endl;
     nFrames = numeric_limits<int>::max();
@@ -154,7 +155,7 @@
   if (params.nFrames > 0)
     lastFrameNum = MIN(params.frame1+static_cast<unsigned int>(params.nFrames), nFrames);
 
-  capture.set(CV_CAP_PROP_POS_FRAMES, params.frame1);
+  capture.set(CAP_PROP_POS_FRAMES, params.frame1);
   for (unsigned int frameNum = params.frame1; (frameNum < lastFrameNum) && !::interruptionKey(key); frameNum++) {
     capture >> frame;
     if (frame.empty()) {
@@ -163,7 +164,7 @@
     } else if (!params.quiet && (frameNum%50 ==0))
       cout << "frame " << frameNum << endl;
     
-    cvtColor(frame, currentFrameBW, CV_RGB2GRAY);
+    cvtColor(frame, currentFrameBW, COLOR_RGB2GRAY);
     
     if (!prevPts.empty()) {
       currPts.clear();