fgsdfgsda 2020-12-25 14:52 采纳率: 75%
浏览 113
已结题

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条回答 默认 最新

  • 明哲慕鸿 2020-12-25 16:35
    关注

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

     

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?

问题事件

  • 系统已结题 4月8日
  • 已采纳回答 3月31日

悬赏问题

  • ¥15 想问一下stata17中这段代码哪里有问题呀
  • ¥15 flink cdc无法实时同步mysql数据
  • ¥100 有人会搭建GPT-J-6B框架吗?有偿
  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决