]> rtime.felk.cvut.cz Git - hercules2020/kcf.git/blobdiff - src/kcf.cpp
Add backward compatibility code for OpenCV 2.4
[hercules2020/kcf.git] / src / kcf.cpp
index fd622bfe7825f20d04a9dca8c2e98d321c93cdc5..5aeb1612d047f4cfa502ccfa943ba8af6b2c46a7 100644 (file)
@@ -34,6 +34,14 @@ void clamp2(T& n, const T& lower, const T& upper)
     n = std::max(lower, std::min(n, upper));
 }
 
+#if CV_VERSION_EPOCH < 3
+template<typename _Tp> static inline
+cv::Size_<_Tp> operator / (const cv::Size_<_Tp>& a, _Tp b)
+{
+    return cv::Size_<_Tp>(a.width / b, a.height / b);
+}
+#endif
+
 class Kcf_Tracker_Private {
     friend KCF_Tracker;
     std::vector<ThreadCtx> threadctxs;
@@ -191,8 +199,6 @@ void KCF_Tracker::init(cv::Mat &img, const cv::Rect &bbox, int fit_size_x, int f
         std::cerr << "cuFFT supports only Gaussian kernel." << std::endl;
         std::exit(EXIT_FAILURE);
     }
-#else
-    p_xf.create(feature_size.height, feature_size.height / 2 + 1, p_num_of_feats);
 #endif
 
 #if defined(CUFFT) || defined(FFTW)