Ask Your Question

nickq's profile - activity

2013-04-18 00:08:28 -0600 received badge  Student (source)
2013-04-17 01:21:07 -0600 received badge  Necromancer (source)
2013-04-16 09:26:12 -0600 received badge  Editor (source)
2013-04-16 08:51:02 -0600 answered a question How to use BRISK in OpenCV?

Hi may be it can helpp

include header file where brisk class is implemented

 "opencv2/features2d/features2d.hpp"

//read some images in gray scale

   const char * PimA="box.png";   // object
   const char * PimB="box_in_scene.png"; // image

   cv::Mat GrayA =cv::imread(PimA);
   cv::Mat GrayB =cv::imread(PimB);
   std::vector<cv::KeyPoint> keypointsA, keypointsB;
   cv::Mat descriptorsA, descriptorsB;

//set brisk parameters

   int Threshl=60;
   int Octaves=4; (pyramid layer) from which the keypoint has been extracted
   float PatternScales=1.0f;

//declare a variable BRISKD of the type cv::BRISK

   cv::BRISK  BRISKD(Threshl,Octaves,PatternScales);//initialize algoritm
   BRISKD.create("Feature2D.BRISK");

   BRISKD.detect(GrayA, keypointsA);
   BRISKD.compute(GrayA, keypointsA,descriptorsA);

   BRISKD.detect(GrayB, keypointsB);
   BRISKD.compute(GrayB, keypointsB,descriptorsB);

Declare one type off matcher

cv::BruteForceMatcher<cv::Hamming> matcher;

another match that can be use

///cv::FlannBasedMatcher matcher(new cv::flann::LshIndexParams(20,10,2));


std::vector<cv::DMatch> matches;
matcher.match(descriptorsA, descriptorsB, matches);

cv::Mat all_matches;
cv::drawMatches( GrayA, keypointsA, GrayB, keypointsB,
                     matches, all_matches, cv::Scalar::all(-1), cv::Scalar::all(-1),
                     vector<char>(),cv::DrawMatchesFlags::NOT_DRAW_SINGLE_POINTS );
cv::imshow( "BRISK All Matches", all_matches );
cv::waitKey(0);

IplImage* outrecog = new IplImage(all_matches);
cvSaveImage( "BRISK All Matches.jpeg", outrecog );

you can also use: Common Interfaces of Feature Detectors

cv::Ptr<cv::FeatureDetector> detector = cv::Algorithm::create<cv::FeatureDetector>("Feature2D.BRISK");

detector->detect(GrayA, keypointsA);
detector->detect(GrayB, keypointsB);

cv::Ptr<cv::DescriptorExtractor> descriptorExtractor =cv::Algorithm::create<cv::DescriptorExtractor>("Feature2D.BRISK");

descriptorExtractor->compute(GrayA, keypointsA, descriptorsA);
descriptorExtractor->compute(GrayB, keypointsB, descriptorsB);

the result with this code is like at this http://docs.opencv.org/_images/Feature_Description_BruteForce_Result.jpg

2013-04-16 08:46:40 -0600 asked a question opencv 2.4.5 compilation erros

Hi Alll

I try compile the last opencv 2.4.5 in debug mode with the flags -D WITH_CUDA=OFF -D WITH_OPENCL=OFF

affter compile the [ 83%] get this errors

In file included / debug/src/OpenCV-2.4.5/modules/nonfree/src/precomp.hpp: 57:0,
                  from error: redefinition of 'class cv :: gpu :: SURF_GPU'
/ debug/include/opencv2/gpu/gpu.hpp: 1542:18: error: previous definition of 'class cv :: gpu :: SURF_GPU'
/ debug/src/OpenCV2.4.5/modules/nonfree/include/opencv2/nonfree/gpu.hpp: 134:18: error: redefinition of 'class cv :: gpu :: VIBE_GPU'
/ debug/include/opencv2/gpu/gpu.hpp: 2296:18: error: previous definition of 'class cv :: gpu :: VIBE_GPU'
cc1plus: warning: unrecognized command line option "-WNO-unnamed-type-template-args" [enabled by default]
cc1plus: warning: unrecognized command line option "-WNO-delete-non-virtual-dtor" [enabled by default]
cc1plus: warning: unrecognized command line option "-WNO-narrowing" [enabled by default]
make [3]: *** [modules / nonfree / CMakeFiles / opencv_nonfree_pch_dephelp.dir / opencv_nonfree_pch_dephelp.cxx.o] Error 1
make [2]: *** [modules / nonfree / CMakeFiles / opencv_nonfree_pch_dephelp.dir / all] Error 2

have some one any idea how fix it?

regards