OPENCV Feature Point Detection

Source: Internet
Author: User

Feature point detection target

In this tutorial, we will cover:

    • Use the Featuredetector interface to discover points of interest. In particular:
      • Use Surffeaturedetector and its function detect to implement the detection process
      • Use function drawkeypoints to draw detected key points
Theoretical code

The code for this tutorial is shown below. You can also download from this link to the source code

#include <stdio.h>#include <iostream>#include "opencv2/core/core.hpp"#include "opencv2/features2d/features2d.hpp"#include "opencv2/highgui/highgui.hpp"UsingNamespaceCv;voidReadme();/** @function Main */IntMain(Intargc,Char**Argv){If(argc!=3){Readme();Return-1;}MatImg_1=Imread(Argv[1],Cv_load_image_grayscale);MatImg_2=Imread(Argv[2],Cv_load_image_grayscale);If(!Img_1.Data||!Img_2.Data){Std::cout<<" --(!) Error reading Images "<<Std::Endl;Return-1;}--Step 1:detect the keypoints using SURF DetectorIntMinhessian=400;SurffeaturedetectorDetector(Minhessian);Std::Vector<KeyPoint>Keypoints_1,Keypoints_2;Detector.Detect(Img_1,Keypoints_1);Detector.Detect(Img_2,Keypoints_2);--Draw KeypointsMatImg_keypoints_1;MatImg_keypoints_2;Drawkeypoints(Img_1,Keypoints_1,Img_keypoints_1,Scalar::All(-1),Drawmatchesflags::DEFAULT);Drawkeypoints(Img_2,Keypoints_2,Img_keypoints_2,Scalar::All(-1),Drawmatchesflags::DEFAULT);--Show detected (drawn) keypointsImshow("Keypoints 1", img_keypoints_1 ); imshow("Keypoints 2", img_keypoints_2 ); waitkey(0); return 0; } /** @function Readme *  /void Readme() { std::cout << "Usa GE:./surf_detector << std::Endl; }< /c13> 
Interpreting the results
    1. This is the feature point detection result of the first graph:

    2. Here is the feature point detection for the second image:

Translators

Shuai Zheng, <[email protected], http://www.cbsr.ia.ac.cn/users/szheng/

From:http://www.opencv.org.cn/opencvdoc/2.3.2/html/doc/tutorials/features2d/feature_detection/feature_ Detection.html#feature-detection

OPENCV Feature Point Detection

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.