以上是源码 我的编程环境是vs2015+opencv3.3.0 选取的图片“LENA”。大家可以自行选取图片作业

//#include "stdafx.h"
#include <opencv2/core/utility.hpp>
#include "opencv2/video/tracking.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/videoio.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/xfeatures2d.hpp"

#include <iostream>
#include <ctype.h>

using namespace cv;
using namespace std;
using namespace xfeatures2d;
void main()
{

    Mat matSrc = imread("e:/cc/lena.jpg");
    Mat gray;
    Mat draw;
    cvtColor(matSrc, gray, CV_RGB2GRAY);
    Mat descriptors;
    namedWindow("lena");
    imshow("lena", matSrc);
    std::vector<KeyPoint> keypoints;
    // 生产sift结构
    Ptr<SiftFeatureDetector> siftFD = SiftFeatureDetector::create();
    siftFD->detectAndCompute(gray, Mat(), keypoints, draw);
    drawKeypoints(gray, keypoints, gray, Scalar(0, 0, 255), DrawMatchesFlags::DEFAULT);
    imshow("gray", gray);
    waitKey(0);
    return;

};

以下是作业处理的图片,有不足的地方希望大家指正,

记录学习配置成功OpenCV,并且读取ljpg图片,转换为灰度图片,显示出来在前面的灰度图片中寻找sift特征点

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-24
  • 2021-11-28
  • 2022-03-09
  • 2021-05-01
  • 2021-11-22
  • 2021-12-17
猜你喜欢
  • 2021-07-27
  • 2021-11-25
  • 2022-01-02
  • 2021-07-19
  • 2021-12-05
  • 2021-07-03
  • 2021-08-03
相关资源
相似解决方案