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

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 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么