Ask Your Question

Revision history [back]

DrawMatches img2 shows up blank in outImg.

I have been testing openCV 2.4.6 on iOS and I have come across a strange error.

Whenever I get the output of cv::DrawMatches the key points are matched just fine, but the img2 that I pass in is never drawn. Even though it's key points are matched.

Here is what the input and outputs look like:

img1: image description

img2: image description

outimg: image description

The code that I am using is pulled directly from the Feature Matching Tutorial with just a few iOS specific changes to handle conversion from UIImage to cv::Mat:

Mat img_matches;
drawMatches(trackingImage, trackingImageKeypoints,
            searchFrame, kp,
            good_matches, img_matches);

NSString *docDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString *pngFilePath = [NSString stringWithFormat:@"%@/searchDetectorTest.png",docDir];
NSData *data = [NSData dataWithData:UIImagePNGRepresentation( [UIImage UIImageFromCVMat:img_matches] )];
[data writeToFile:pngFilePath atomically:YES];
click to hide/show revision 2
retagged

DrawMatches img2 shows up blank in outImg.

I have been testing openCV 2.4.6 on iOS and I have come across a strange error.

Whenever I get the output of cv::DrawMatches the key points are matched just fine, but the img2 that I pass in is never drawn. Even though it's key points are matched.

Here is what the input and outputs look like:

img1: image description

img2: image description

outimg: image description

The code that I am using is pulled directly from the Feature Matching Tutorial with just a few iOS specific changes to handle conversion from UIImage to cv::Mat:

Mat img_matches;
drawMatches(trackingImage, trackingImageKeypoints,
            searchFrame, kp,
            good_matches, img_matches);

NSString *docDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString *pngFilePath = [NSString stringWithFormat:@"%@/searchDetectorTest.png",docDir];
NSData *data = [NSData dataWithData:UIImagePNGRepresentation( [UIImage UIImageFromCVMat:img_matches] )];
[data writeToFile:pngFilePath atomically:YES];
click to hide/show revision 3
retagged

DrawMatches img2 shows up blank in outImg.

I have been testing openCV 2.4.6 on iOS and I have come across a strange error.

Whenever I get the output of cv::DrawMatches the key points are matched just fine, but the img2 that I pass in is never drawn. Even though it's key points are matched.

Here is what the input and outputs look like:

img1: image description

img2: image description

outimg: image description

The code that I am using is pulled directly from the Feature Matching Tutorial with just a few iOS specific changes to handle conversion from UIImage to cv::Mat:

Mat img_matches;
drawMatches(trackingImage, trackingImageKeypoints,
            searchFrame, kp,
            good_matches, img_matches);

NSString *docDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString *pngFilePath = [NSString stringWithFormat:@"%@/searchDetectorTest.png",docDir];
NSData *data = [NSData dataWithData:UIImagePNGRepresentation( [UIImage UIImageFromCVMat:img_matches] )];
[data writeToFile:pngFilePath atomically:YES];