Detect, compute and draw keypoints - OpenCV 키포인트 찾기
OpenCV 2019. 11. 2. 22:51 |반응형
Detect, compute and draw key points.
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 | #include <opencv2/opencv.hpp> using namespace std; using namespace cv; int main(int argc, char** argv) { Mat src = imread("Source.jpg", IMREAD_GRAYSCALE); if (src.empty()) { cerr << "Image load failed!" << endl; return -1; } Ptr<Feature2D> feature = ORB::create(); // static Ptr<ORB> cv::ORB::create(int nfeatures = 500, float scaleFactor = 1.2f, int nlevels = 8, // int edgeThreshold = 31, int firstLevel = 0, int WTA_K = 2, ORB::ScoreType scoreType = ORB::HARRIS_SCORE, // int patchSize = 31, int fastThreshold = 20) vector<KeyPoint> keypoints; feature->detect(src, keypoints); // Detects keypoints in an image (first variant) or image set (second variant). Mat desc; feature->compute(src, keypoints, desc); // Computes the descriptors for a set of keypoints detected in an image (first variant) or image set (second variant). cout << "keypoints.size(): " << keypoints.size() << endl; cout << "desc.size(): " << desc.size() << endl; Mat dst; drawKeypoints(src, keypoints, dst, Scalar::all(-1), DrawMatchesFlags::DRAW_RICH_KEYPOINTS); // Draws keypoints. imshow("src", src); imshow("dst", dst); waitKey(); return 0; } |
Sizes of keypoints and descriptors.
Source image.
Keypoints with sizes and orientations.
반응형
'OpenCV' 카테고리의 다른 글
Finding a homography matrix - OpenCV 두 평면 사이의 투영 변환 행렬 (0) | 2019.11.03 |
---|---|
Keypoint matching - OpenCV 키포인트 매칭 (0) | 2019.11.02 |
Screen capture - Windows API, OpenCV로 화면 캡쳐하기 (0) | 2019.10.28 |
Windows dialog-based OpenCV program 윈도우 대화상자 OpenCV 프로그램 만들기 (2) | 2019.10.26 |
Convert Mat to Bitmap for Windows applications with GDI+ and surface crack detection - OpenCV Mat에서 비트맵으로 변환과 표면 크랙 검출 (0) | 2019.10.26 |