OpenCV Getting Started-extracting sift key points

Source: Internet
Author: User

OpenCV Getting Started-extracting sift key points


In the content-based image retrieval, the local invariant feature of the image is relative to the global feature, the local feature can powerfully describe the feature of the image, it has important significance, and in many gray-based local feature extraction algorithm sift has the best effect, the concrete principle depends on the Lowe paper, Below use OpenCV to feel the following effect.
#include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv2/nonfree/ Features2d.hpp>//using namespace Cv;int main (int argc, const char *argv[]) {    Mat input = Imread ("Input.jpg", 0);// Load as grayscale        siftfeaturedetector detector;    Vector<keypoint> keypoints;    Detector.detect (input, keypoints);        Show the keypoints on an image    Mat output;    Drawkeypoints (input, keypoints, output);    Imwrite ("sift_result.jpg", output);    return 0;}

Run:
g++ sift_demo.cxx Compile link error:
/tmp/cczzicnk.o:in function ' main ':
Sift_demo.cxx: (. text+0x4d): Undefined reference to ' Cv::imread (std::string const&, int) '
/tmp/cczzicnk.o:in function ' Cv::mat::~mat () ':
Sift_demo.cxx: (. text._zn2cv3matd2ev[_zn2cv3matd5ev]+0x2b): Undefined reference to ' Cv::fastfree (void*) '
/tmp/cczzicnk.o:in function ' Cv::mat::release () ':
Sift_demo.cxx: (. text._zn2cv3mat7releaseev[_zn2cv3mat7releaseev]+0x3b): Undefined reference to ' Cv::mat::d eallocate ()‘
Collect2:error:ld returned 1 exit status
Workaround: The description did not find the location of the library, developed, g++ Sift_demo.cxx' pkg-config opencv--cflags--libs '


Finally, the results are as follows, we can see a lot of key points, in the form of the circle in the original image.


OpenCV Getting Started-extracting sift key points

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.