fgsdfgsda
2020-12-25 14:52
采纳率: 28.6%
浏览 50

Ubuntu opencv2.4.10kcf跟踪算法

最近在学习kcf算法,从GitHub上面克隆了相关的库https://github.com/rockkingjy/OpenTracker,但奈何GitHub上面的项目是基于opencv3,与opencv2.4.10不太兼容,在运行

cd OpenTracker/kcf
make

出现了如下的一些问题:

g++ -c -o kcftracker.o kcftracker.cpp -Wall `pkg-config --cflags opencv` -std=c++0x -lstdc++ -O3 -fPIC
In file included from kcftracker.cpp:84:0:
kcftracker.hpp:99:43: error: ‘Rect2d’ in namespace ‘cv’ does not name a type
     void init( const cv::Mat image, const cv::Rect2d& roi);
                                           ^
kcftracker.hpp:99:55: error: ISO C++ forbids declaration of ‘roi’ with no type [-fpermissive]
     void init( const cv::Mat image, const cv::Rect2d& roi);
                                                       ^
kcftracker.hpp:103:43: error: ‘cv::Rect2d’ has not been declared
     bool update( const cv::Mat image, cv::Rect2d& roi);
                                           ^
kcftracker.hpp:137:47: error: ‘cv::Rect2d’ has not been declared
     bool update_kcf( const cv::Mat image, cv::Rect2d& roi);
                                               ^
In file included from kcftracker.cpp:84:0:
kcftracker.hpp:161:47: error: ‘Rect2d’ in namespace ‘cv’ does not name a type
     void init_dsst(const cv::Mat image, const cv::Rect2d& roi);
                                               ^
kcftracker.hpp:161:59: error: ISO C++ forbids declaration of ‘roi’ with no type [-fpermissive]
     void init_dsst(const cv::Mat image, const cv::Rect2d& roi);
                                                           ^
kcftracker.hpp:163:48: error: ‘cv::Rect2d’ has not been declared
     bool update_dsst( const cv::Mat image, cv::Rect2d& roi);
                                                ^
kcftracker.cpp:184:50: error: ‘Rect2d’ in namespace ‘cv’ does not name a type
 void KCFTracker::init(const cv::Mat image, const cv::Rect2d &roi)
                                                  ^
kcftracker.cpp:184:62: error: ISO C++ forbids declaration of ‘roi’ with no type [-fpermissive]
 void KCFTracker::init(const cv::Mat image, const cv::Rect2d &roi)
                                                              ^
kcftracker.cpp: In member function ‘void kcf::KCFTracker::init(cv::Mat, const int&)’:
kcftracker.cpp:186:10: error: no match for ‘operator=’ (operand types are ‘cv::Rect_<float>’ and ‘const int’)
     _roi = roi;
          ^
kcftracker.cpp:186:10: note: candidate is:
In file included from /usr/local/include/opencv2/core/core.hpp:4860:0,
                 from /usr/local/include/opencv2/opencv.hpp:47,
                 from kcftracker.hpp:84,
                 from kcftracker.cpp:84:
/usr/local/include/opencv2/core/operations.hpp:1910:43: note: cv::Rect_<_Tp>& cv::Rect_<_Tp>::operator=(const cv::Rect_<_Tp>&) [with _Tp = float]
 template<typename _Tp> inline Rect_<_Tp>& Rect_<_Tp>::operator = ( const Rect_<_Tp>& r )
                                           ^
/usr/local/include/opencv2/core/operations.hpp:1910:43: note:   no known conversion for argument 1 from ‘const int’ to ‘const cv::Rect_<float>&’
In file included from /usr/local/include/opencv2/core/types_c.h:55:0,
                 from /usr/local/include/opencv2/core/core_c.h:47,
                 from /usr/local/include/opencv2/opencv.hpp:46,
                 from kcftracker.hpp:84,
                 from kcftracker.cpp:84:
kcftracker.cpp:187:16: error: request for member ‘width’ in ‘roi’, which is of non-class type ‘const int’
     assert(roi.width >= 0 && roi.height >= 0);
                ^
kcftracker.cpp:187:34: error: request for member ‘height’ in ‘roi’, which is of non-class type ‘const int’
     assert(roi.width >= 0 && roi.height >= 0);
                                  ^
kcftracker.cpp: At global scope:
kcftracker.cpp:202:50: error: ‘cv::Rect2d’ has not been declared
 bool KCFTracker::update(const cv::Mat image, cv::Rect2d &roi)
                                                  ^
kcftracker.cpp:214:54: error: ‘cv::Rect2d’ has not been declared
 bool KCFTracker::update_kcf(const cv::Mat image, cv::Rect2d &roi)
                                                      ^
kcftracker.cpp: In member function ‘bool kcf::KCFTracker::update_kcf(cv::Mat, int&)’:
kcftracker.cpp:281:13: error: cannot convert ‘cv::Rect_<float>’ to ‘int’ in assignment
         roi = _roi;
             ^
kcftracker.cpp: At global scope:
kcftracker.cpp:290:55: error: ‘cv::Rect2d’ has not been declared
 bool KCFTracker::update_dsst(const cv::Mat image, cv::Rect2d &roi)
                                                       ^
kcftracker.cpp: In member function ‘bool kcf::KCFTracker::update_dsst(cv::Mat, int&)’:
kcftracker.cpp:367:13: error: cannot convert ‘cv::Rect_<float>’ to ‘int’ in assignment
         roi = _roi;
             ^
kcftracker.cpp: At global scope:
kcftracker.cpp:729:55: error: ‘Rect2d’ in namespace ‘cv’ does not name a type
 void KCFTracker::init_dsst(const cv::Mat image, const cv::Rect2d &roi)
                                                       ^
kcftracker.cpp:729:67: error: ISO C++ forbids declaration of ‘roi’ with no type [-fpermissive]
 void KCFTracker::init_dsst(const cv::Mat image, const cv::Rect2d &roi)
                                                                   ^
kcftracker.cpp: In member function ‘void kcf::KCFTracker::init_dsst(cv::Mat, const int&)’:
kcftracker.cpp:732:27: error: request for member ‘width’ in ‘roi’, which is of non-class type ‘const int’
     base_width_dsst = roi.width;
                           ^
kcftracker.cpp:733:28: error: request for member ‘height’ in ‘roi’, which is of non-class type ‘const int’
     base_height_dsst = roi.height;
                            ^
make: *** [kcftracker.o] 错误 1

希望能有大神告知如何解决这些问题,要求是Ubuntu14.04,opencv2.4.10

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

5条回答 默认 最新

  • 重新编译出来opencv3 或者 4,不行吗。还是必须是这个2.4.10.

    点赞 打赏 评论
  • 明哲慕鸿 2020-12-25 16:22

    2和3是两个版本 很多东西都2里面有3没有了

     

    点赞 打赏 评论
  • fgsdfgsda 2020-12-25 16:33

    必须得是2.4.10

    点赞 打赏 评论
  • 明哲慕鸿 2020-12-25 16:35

    那你就只能修改github的源码了 把opencv部分的内容用2.4.10版本的重写

     

    点赞 打赏 评论
  • fgsdfgsda 2020-12-25 16:58

    好的谢谢

    点赞 打赏 评论

相关推荐 更多相似问题