features 2D : DenseFeatureDetector fails when using OpponentSIFT descriptor but works with SIFT, SURF and OpponentSURF (Bug #1824)
Description
Hi all,
When using a Descriptor extractor based on the OpponentSIFT descriptor and using the DenseFeatureDetector
keypoint detector, a segmentation fault occurs.
This error is not encountered when the descriptor is SIFT, SURF or OpponentSURF
The problem seems to come from the fact that the number of keypoints returned by the SIFT descriptor on each opponent channel is not the same for each channels... which is strange if a dense grid is chosen
Explanations :
if the Feature detector object used is a DenseFeatureDetector
and if the feature descriptor is the OpponentSIFTDescriptor
:
in modules/features2d/src/descriptors.cpp : void OpponentColorDescriptorExtractor::computeImpl
the single component extractor (SIFT/SURF, etc.) is applied on a dense grid on each Opponent channel in the for loop.
However, in the case of the OpponentSIFT the number of "channelKeypoints" is not the same for each channel
Then, the remaining of the function fails at the while loop level :
1while( channelKeypoints[0][idxs[0][cp[0]]].class_id < maxInitIdx && cp[0] < channelKeypoints[0].size() ) { cp[0]++; }
2while( channelKeypoints[1][idxs[1][cp[1]]].class_id < maxInitIdx && cp[1] < channelKeypoints[1].size() ) { cp[1]++; }
3while( channelKeypoints[2][idxs[2][cp[2]]].class_id < maxInitIdx && cp[2] < channelKeypoints[2].size() ) { cp[2]++; }
here is the segmentation fault location.
hope it helps.
Best regards.
Alex
History
Updated by Andrey Kamaev almost 13 years ago
- Description changed from Hi all, When using a Descriptor extractor based on the OpponentSIFT descripto... to Hi all, When using a Descriptor extractor based on the OpponentSIFT descripto... More
Updated by Vadim Pisarevsky almost 13 years ago
- Assignee changed from Vadim Pisarevsky to Maria Dimashova
Updated by Alexander Shishkov almost 13 years ago
I can't reproduce your problem on 2.4 branch.
My code sample:
1 Mat im = imread(argv[1],1);
2
3 DenseFeatureDetector df;
4 vector<KeyPoint> kpts;
5 df.detect(im, kpts);
6 Ptr<DescriptorExtractor> sift = new SiftDescriptorExtractor();
7 OpponentColorDescriptorExtractor desc(sift);
8 Mat descriptors;
9 desc.compute(im, kpts, descriptors);
We done some updates in the opponent descriptor code, please try your code on 8263 revision. If the problem still occurs, please add code sample and image for reproducing.
- Status changed from Open to Cancelled
- Assignee changed from Maria Dimashova to Alexander Shishkov