When trying to perform feature matching between different images, it is often the case that the size and direction of the image change, in short, the problem of scale change. Each image is taken at a different distance from the target object, so the object to be identified will naturally have different dimensions in the image.
Therefore, the introduction of scale invariant features in computer vision, the main idea is that each detected feature points are accompanied by the corresponding scale factor. The well-known scale invariant feature detector sift (scale invariant feature transform) has scales, rotations, affine, viewing angles, and illumination invariance. The accelerated robust feature surf (speeded up robust Features) algorithm is an efficient variant of sift.
About the characteristics of sift and surf, has a lot of blog on its introduction, see the Reference blog. Since the 2004 original was not carefully read, here is just a way to provide a feature detection of these two algorithms in OpenCV. The development platform used here is qt5.3.2+opencv2.4.9. The Cv::featuredetector interface is used in the implementation of SURF and sift features in OpenCV. Here, the feature points are calculated based on the floating point core, so the two algorithms are more accurate in space and scale detection than other algorithms, but are relatively time-consuming.
As for the theoretical part is still to be updated.
I. Characteristics of SIFT
Create a console project directly in QT and add it in the main function:
#include <QCoreApplication>#include <opencv2/core/core.hpp>#include <opencv2/highgui/highgui.hpp>#include <opencv2/features2d/features2d.hpp>#include <opencv2/nonfree/nonfree.hpp>#include <QDebug>intMainintargcChar*argv[]) {qcoreapplication A (argc, argv);//Read in imageCv::mat image= Cv::imread ("C:/018.jpg",0); Cv::namedwindow ("Original Image"); Cv::imshow ("Original Image", image);//vector of feature points STD:: vector<cv::KeyPoint>keypoints;//Structure SIFT feature detectorCv::siftfeaturedetector Sift (0.03,//threshold value of the feature .);//To reduce //Detect SIFT eigenvaluesSift.detect (image,keypoints); CV::d rawkeypoints (Image,//RAW imageKeypoints,//vector of feature pointsFeatureimage,//Generate imagesCv::scalar (255,255,255),//color of feature pointsCV::D rawmatchesflags::D raw_rich_keypoints);//Flag bitCv::namedwindow ("SIFT Features"); Cv::imshow ("SIFT Features", featureimage);returnA.exec ();}
The effect is as follows, in function CV::d rawkeypoints We use CV::D rawmatchesflags::D raw_rich_keypoints as the flag bit, so alas use Draw_rich_ The dimensions of the circle at each key point after keypoints are proportional to the scale of the feature:
Ii. Characteristics of Surf
#include <QCoreApplication>#include <opencv2/core/core.hpp>#include <opencv2/highgui/highgui.hpp>#include <opencv2/features2d/features2d.hpp>#include <opencv2/nonfree/nonfree.hpp>#include <QDebug>intMainintargcChar*argv[]) {qcoreapplication A (argc, argv);//Read in imageCv::mat image= Cv::imread ("C:/018.jpg",0); Cv::namedwindow ("Original Image"); Cv::imshow ("Original Image", image);//vector of feature points STD:: vector<cv::KeyPoint>keypoints;//Structure surf feature detectorCv::surffeaturedetector Surf (2500);//Detect surf featuresSurf.detect (image,keypoints); Cv::mat Featureimage; CV::d rawkeypoints (Image,//RAW imageKeypoints,//vector of feature pointsFeatureimage,//Generate imagesCv::scalar (255,255,255),//color of feature pointsCV::D rawmatchesflags::D raw_rich_keypoints);//Flag bitCv::namedwindow ("SURF Features"); Cv::imshow ("SURF Features", featureimage);returnA.exec ();}
Effect:
Compared with SIFT features, surf sacrificed a certain amount of precision in exchange for the improvement of computational efficiency. The theoretical parts of these two algorithms need to be further explored and updated ...
Reference blog:
http://blog.csdn.net/xiaowei_cqu/article/details/8069548
Http://www.cnblogs.com/tornadomeet/archive/2012/08/16/2643168.html
OpenCV2 Study Notes (12): Surf and SIFT algorithm