-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsurf.cpp
More file actions
56 lines (33 loc) · 1.33 KB
/
surf.cpp
File metadata and controls
56 lines (33 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include <opencv2/opencv.hpp>
#include <iostream>
#include <cstdlib>
#include <cstdlib>
#include <random>
#include <vector>
#define OPENCV_FEATURES_2D_HPP
#include "opencv2/opencv_modules.hpp"
#include "opencv2/features2d.hpp"
#include "opencv2/xfeatures2d.hpp"
#include <opencv2/xfeatures2d/nonfree.hpp>
#include <opencv2/xfeatures2d.hpp>
int main(int argc, char** argv){
cv::Mat img, result1, result2;
img = cv::imread("images.jpeg");
std::vector<cv::KeyPoint> keypoints, keypoints2;
cv::Ptr<cv::xfeatures2d::SiftFeatureDetector> ptrSIFT = cv::xfeatures2d::SiftFeatureDetector::create();
ptrSIFT->detect(img, keypoints2);
// cv::Ptr<cv::FastFeatureDetector> ptrFAST = cv::FastFeatureDetector::create(40);
// ptrFAST->detect(image,keypoints);
cv::Ptr<cv::BRISK> ptrBRISK = cv::BRISK::create();
ptrBRISK->detect(img, keypoints);
cv::drawKeypoints(img, keypoints2, result1);// drawing flag
cv::drawKeypoints(img, keypoints, result2);
// cv::drawKeypoints(img, keypoints, result, cv::Scalar(255,255,255), cv::DrawMatchesFlags::DRAW_OVER_OUTIMG);// drawing flag
// cv::drawKeypoints(img, keypoints, result, cv::Scalar(0,0,255),cv::DrawMatchesFlags::DRAW_RICH_KEYPOINTS);
cv::namedWindow("Image");
cv::imshow("Image",result1);
// cv::waitKey(0);
cv::namedWindow("Image2");
cv::imshow("Image2",result2);
cv::waitKey(0);
}