qq_34837137
Auroratan
采纳率10%
2017-02-18 03:41 阅读 4.8k

opencv的 FastFeatureDetector fast(40)怎么用不了

#include

#include
#include
#include
#include

using namespace cv;

int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);

       Mat image;
       image = imread("1.jpg");
       // 存储为关键点
       std::vector<KeyPoint> keyPoints;
       // 定义特征检测
        FastFeatureDetector fast(40);        // 检测的阈值为40  “cv::FastFeatureDetector”: 不能实例化抽象类


       // 特征点检测
       fast.detect(image,keyPoints);
       drawKeypoints(image, keyPoints, image, Scalar::all(255), DrawMatchesFlags::DRAW_OVER_OUTIMG);
       imshow("FAST feature", image);
       waitKey(0);
return a.exec();

}

error: C2259: “cv::FastFeatureDetector”: 不能实例化抽象类
error: C2664: “cv::FastFeatureDetector::FastFeatureDetector(cv::FastFeatureDetector &&)”: 无法将参数 1 从“int”转换为“const cv::FastFeatureDetector &”

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

4条回答 默认 最新

  • eereere 饿二饿二饿 2017-08-24 03:09

    http://docs.opencv.org/3.0-beta/doc/user_guide/ug_features2d.html
    试了是楼上的还是不行
    去google了一下

     FastFeatureDetector fast(40);
    fast.detect(image,keypoints);
    

    改为:

     Ptr<FeatureDetector> fast=FastFeatureDetector::create(40);
        fast->detect(image, keypoints);
    
    点赞 8 评论 复制链接分享
  • devmiao devmiao 2017-02-18 15:10
    点赞 评论 复制链接分享
  • chishuideyu Xuefeng_BUPT 2017-07-05 09:14

    http://blog.csdn.net/traumland/article/details/51045244
    版本原因, 书上下面这一条始终是使用不了, 创建方法变了

    cv::FastFeatureDetector fastDet(80);

    QT提示 error: no matching function for call to 'cv::FastFeatureDetector::FastFeatureDetector(int)'
    cv::FastFeatureDetector fastDet(80);
    ^

    点赞 评论 复制链接分享
  • ProSmaug ProSmaug 2017-07-10 03:36

    将 FastFeatureDetector fast(40);这一句修改为:
    cv::Ptrcv::FeatureDetector fast =
    cv::FastFeatureDetector::create(40, true, cv::FastFeatureDetector::TYPE_9_16);
    这一句即可使用,具体的参考上一楼的引用博客。

    点赞 评论 复制链接分享

相关推荐