在TX1上配置TLD算法环境遇到的问题(二)

安装完opencv3.1,正式开始编译TLD,一开始就遇到了之前的问题,TLD中的算法,新版opencv不包含,更重要的是,在opencv2.4.8中,我们可以利用include legacy.hpp来使编译通过,但是在opencv3.1 中,完全移除了legacy.hpp,下图是官网上的介绍。


即使复制一个legacy文件夹过来,也无法编译通过,会报错

error: 'cv::EM' has not been declares
通过在网上的寻找,找到了解决方法,来自于http://blog.csdn.net/j10527/article/details/51305087

首先建立一个头文件PatchGenerator.h

#include <opencv2/opencv.hpp>  
#ifndef PATCHGENERATOR_H  
#define PATCHGENERATOR_H  

namespace cv  
{  
class CV_EXPORTS PatchGenerator  
{  
public:  
    PatchGenerator();  
    PatchGenerator(double _backgroundMin, double _backgroundMax,  
                   double _noiseRange, bool _randomBlur=true,  
                   double _lambdaMin=0.6, double _lambdaMax=1.5,  
                   double _thetaMin=-CV_PI, double _thetaMax=CV_PI,  
                   double _phiMin=-CV_PI, double _phiMax=CV_PI );  
    void operator()(const Mat& image, Point2f pt, Mat& patch, Size patchSize, RNG& rng) const;  
    void operator()(const Mat& image, const Mat& transform, Mat& patch,  
                    Size patchSize, RNG& rng) const;  
    void warpWholeImage(const Mat& image, Mat& matT, Mat& buf,  
                        CV_OUT Mat& warped, int border, RNG& rng) const;  
    void generateRandomTransform(Point2f srcCenter, Point2f dstCenter,  
                                 CV_OUT Mat& transform, RNG& rng,  
                                 bool inverse=false) const;  
    void setAffineParam(double lambda, double theta, double phi);  
  
    double backgroundMin, backgroundMax;  
    double noiseRange;  
    bool randomBlur;  
    double lambdaMin, lambdaMax;  
    double thetaMin, thetaMax;  
    double phiMin, phiMax;  
};  
};  
#endif

1

2

然后,需要在TLD.cpp开头加入如下代码


#include <PatchGenerator.h> 

 

namespace cv 

 

/*

  The code below implements keypoint detector,fern-based point classifier and a planar object detector.

 

  References:

   1. Mustafa Özuysal, Michael Calonder,Vincent Lepetit, Pascal Fua,

      "Fast KeyPoint Recognition UsingRandom Ferns,"

      IEEE Transactions on Pattern Analysis andMachine Intelligence, 15 Jan. 2009.

 

   2. Vincent Lepetit, Pascal Fua,

      "Towards Recognizing Feature PointsUsing Classification Trees,"

      Technical Report IC/2004/74, EPFL, 2004.

*/ 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值