Ask Your Question

spawnrider's profile - activity

2013-11-22 15:14:08 -0600 received badge  Supporter (source)
2013-11-22 09:07:00 -0600 answered a question [Android] Problem with FlannBasedMatcher and Orb

It is better to use Brute force matcher with Hamming method like this :

BFMatcher matcher(NORM_HAMMING);
2013-11-22 05:21:49 -0600 answered a question Multiple object recognition in Video with OpenCV using SURF and FLANN

Hi everyone,

The sample code published by chicio inspired me because i'm trying to do the same stuff. I am encountering an issue on the Descriptor Extractor compute method using an Mat vector argument (EXC_BAD_ACCESS below). Do you faced the same issue ?

By the way, Is it possible to see all your code ? Do you explored/tried the ORB method ?

Here is my code :

//-- Step 0: Create image references
UIImage *objectImage1 = [UIImage imageNamed:@"star.png"];
Mat object1 = [self cvMatFromUIImage:objectImage1];
cvtColor(object1, object1, CV_BGRA2BGR);


UIImage *objectImage2 = [UIImage imageNamed:@"spawn.png"];
Mat object2 = [self cvMatFromUIImage:objectImage2];
cvtColor(object2, object2, CV_BGRA2BGR);

vector<Mat> trainImgCollection;
trainImgCollection.push_back(object1);
trainImgCollection.push_back(object2);

//-- Step 1: Detect the keypoints using XXX Detector
NSLog(@"Create ORB Detector");
int minHessian = 400;

OrbFeatureDetector detector( minHessian );

vector<vector<KeyPoint> > trainPointCollection;
vector<KeyPoint> queryPoints;
detector.detect(queryImage, queryPoints );
detector.detect(trainImgCollection, trainPointCollection );

//-- Step 2: Calculate descriptors (feature vectors)
NSLog(@"Create ORB Extractor");
DescriptorExtractor *extractor = DescriptorExtractor::create("SURF");

vector<Mat> trainDescCollection;
Mat queryDescriptors;

//extractor.compute(myMat, keypoints_2, descriptors_2 );
NSLog(@"Compute descriptors");
//extractor.compute(queryImage, queryPoints, queryDescriptors );
extractor->compute(trainImgCollection, trainPointCollection, trainDescCollection); <== EXC_BAD_ACCESS HERE

Thanks in advance, Regards