Brisk algorithm Learning

Source: Internet
Author: User

Not finished: Cond.

Reference URL:

Http://bbs.sciencenet.cn/blog-261330-540049.html not completed the explanation blog.
Http://www.cnblogs.com/frischzenger/p/3326790.html Brisk's Chinese translation.

Http://www.asl.ethz.ch/people/lestefan/personal/BRISK/index Brisk author's official website.

The brisk algorithm can not strictly implement real-time operation. The comparison chart of time and efficiency between the original text and the existing Stat_of_the_art algorithm is as follows:


You can see that implementing a match requires 39+29 = 68ms, which can calculate 14 images per second.

The same as freak, Orb algorithm, OPENCV also implemented brisk. You can also view the code provided by the brisk author can also view the code implemented by the OPENCV, you must use opencv2.2 as the code provided by the person, the version is not too high, because the high version has implemented the brisk algorithm some classes will conflict, and cannot be used. If you look at the code, the recommendations are provided by the author, and the authors expose more interfaces, and if you use OPENCV for just the sake of use, the OPENCV provides less bugs and more robustness.

Rough generalization of the algorithm:

1. Create the image pyramid. 2. Use the fast algorithm to detect corner points. 3. Suppress the non-maximum value of the angular point calculated by fast and remove the corner points that do not meet the criteria.

Using opencv2.4.8 to run the code of the brisk algorithm, from the compute corner to the match, the success on my picture is about 172ms, which does not meet the real-time conditions:

#include "highgui.h" #include "cv.h" #include "vector" #include "opencv\cxcore.hpp" #include "iostream" #include "Opencv.hpp" #include <opencv2/nonfree/features2d.hpp> #include <opencv2/nonfree/nonfree.hpp> using name  
Space CV;  

using namespace Std; #include <Windows.h> int main ()//(int argc, _tchar* argv[]) {//load Image Mat c_src1 = Imread ("hello.jpg  
	");  
	Mat c_src2 = Imread ("hello2.jpg");  
	Mat Src1 = Imread ("hello.jpg", Cv_load_image_grayscale);  
	Mat src2 = Imread ("hello2.jpg", Cv_load_image_grayscale); if (!src1.data | |!src2.data) {std::cout<< "--(!) Error reading Images "<< Std::endl; return-1;  
	}//sift feature detect Cv::brisk detector;  
	Std::vector<keypoint> Kp1, KP2;
	Double start = GetTickCount ();  
	Detector.detect (Src1, KP1);  
	Detector.detect (SRC2, KP2);  
	Cv::brisk extractor;  
	Mat des1,des2;//descriptor Detector.compute (src1,kp1,des1); Detector.compute (Src2,kp2,des2);   
	Mat Res1,res2;  
	int drawmode = drawmatchesflags::D raw_rich_keypoints; Drawkeypoints (C_src1,kp1,res1,scalar::all ( -1), drawmode);//Draw feature points in memory drawkeypoints (C_src2,kp2,res2,scalar::all (-  
	1), DrawMode);  
	cout<< "Size of description of IMG1:" <<kp1.size () <<endl;  

	cout<< "Size of description of Img2:" <<kp2.size () <<endl;  
	Bfmatcher Matcher (norm_hamming);  
	Vector<dmatch> matches;  
	Matcher.match (des1,des2,matches);
	Double end = GetTickCount ();
	cout<<end-start<<endl;  
	Mat Img_match; Drawmatches (Src1,kp1,src2,kp2,matches,img_match);//,scalar::all ( -1), Scalar::all ( -1),vector<char> (),  
	DrawMode);  
	cout<< "Number of matched points:" <<matches.size () <<endl;  
	Imshow ("matches", Img_match);  
	Cvwaitkey ();  
	Cvdestroyallwindows ();  
	Cv::sift SIFT;  
	Sift.  
return 0;   }

Version two: Use the camera to capture images in real time and perform brisk operations.

#include "highgui.h" #include "cv.h" #include "vector" #include "opencv\cxcore.hpp" #include "iostream"     
#include "opencv.hpp" #include <opencv2/nonfree/features2d.hpp> #include <opencv2/nonfree/nonfree.hpp>    
using namespace CV;    

using namespace Std; #include <Windows.h> int main ()//(int argc, _tchar* argv[]) {//load Image Mat c_src1 = Imread ("H    
	Ello.jpg ");    
	 
	Mat Src1 = Imread ("hello.jpg", Cv_load_image_grayscale);    
	Cv::brisk detector;    
	Std::vector<keypoint> Kp1, KP2;    

	Detector.detect (Src1, KP1);    

	Mat des1,des2;//descriptor Detector.compute (src1,kp1,des1);     
	Mat Res1,res2;    
	int drawmode = drawmatchesflags::D raw_rich_keypoints;    
	Drawkeypoints (C_src1,kp1,res1,scalar::all ( -1), drawmode);//Draw feature points in memory Bfmatcher Matcher (norm_hamming);    

	Vector<dmatch> matches;    

	Mat Imgmatch;
	Cv::videocapture Cap (0);
	Mat frame;
	Mat Framegray; Std::vector<keypOint> KPF;
	Mat DESF;  
	Mat Img_match;
		while (1) {cap>>frame;
		Cvtcolor (Frame,framegray,cv_rgb2gray);
		Detector.detect (FRAMEGRAY,KPF);
		if (Kpf.empty ()) continue;
		Drawkeypoints (Framegray,kpf,frame,scalar::all ( -1), DrawMode);
		Detector.compute (FRAME,KPF,DESF);
		Matcher.match (des1,desf,matches);
		Imshow ("Frame", frame);
		Drawmatches (Src1,kp1,frame,kpf,matches,img_match);
		Imshow ("Match", Img_match);
	Waitkey (2);    
} return 0;     }


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.