Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hi may be it can helpp

nclude header file "opencv2/features2d/features2d.hpp" where brisk class is implemented

//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

Hi may be it can helpp

nclude header file "opencv2/features2d/features2d.hpp" where brisk class is implemented

//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>

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

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

Hi may be it can helpp

nclude header file "opencv2/features2d/features2d.hpp" where brisk class is implemented

//read some images in gray scale

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

image cv::Mat GrayA =cv::imread(PimA); cv::Mat GrayB =cv::imread(PimB);

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

descriptorsB;

//set brisk parameters parameters

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

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.create("Feature2D.BRISK"); BRISKD.detect(GrayA, keypointsA); BRISKD.compute(GrayA, keypointsA,descriptorsA);

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

keypointsB,descriptorsB);

Declare one type off matcher cv::BruteForceMatcher<cv::hamming> matcher;

matcher

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

another match that can be use use

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

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>

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

cv::Algorithm::create<cv::FeatureDetector>("Feature2D.BRISK"); detector->detect(GrayA, keypointsA); detector->detect(GrayB, keypointsB);

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

=cv::Algorithm::create<cv::DescriptorExtractor>("Feature2D.BRISK"); descriptorExtractor->compute(GrayA, keypointsA, descriptorsA); descriptorExtractor->compute(GrayB, keypointsB, descriptorsB);

descriptorsB);

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

Hi may be it can helpp

nclude include header file "opencv2/features2d/features2d.hpp" 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