Commit e95f8194 authored by Maria Dimashova's avatar Maria Dimashova

uncommented Opponent descriptors test, fixed descriptors mat size

parent 814336f4
...@@ -371,6 +371,7 @@ void OpponentColorDescriptorExtractor::computeImpl( const Mat& bgrImage, vector< ...@@ -371,6 +371,7 @@ void OpponentColorDescriptorExtractor::computeImpl( const Mat& bgrImage, vector<
vector<int> idxs[N]; vector<int> idxs[N];
// Compute descriptors three times, once for each Opponent channel to concatenate into a single color descriptor // Compute descriptors three times, once for each Opponent channel to concatenate into a single color descriptor
int maxKeypointsCount = 0;
for( int ci = 0; ci < N; ci++ ) for( int ci = 0; ci < N; ci++ )
{ {
channelKeypoints[ci].insert( channelKeypoints[ci].begin(), keypoints.begin(), keypoints.end() ); channelKeypoints[ci].insert( channelKeypoints[ci].begin(), keypoints.begin(), keypoints.end() );
...@@ -385,13 +386,14 @@ void OpponentColorDescriptorExtractor::computeImpl( const Mat& bgrImage, vector< ...@@ -385,13 +386,14 @@ void OpponentColorDescriptorExtractor::computeImpl( const Mat& bgrImage, vector<
idxs[ci][ki] = (int)ki; idxs[ci][ki] = (int)ki;
} }
std::sort( idxs[ci].begin(), idxs[ci].end(), KP_LessThan(channelKeypoints[ci]) ); std::sort( idxs[ci].begin(), idxs[ci].end(), KP_LessThan(channelKeypoints[ci]) );
maxKeypointsCount = std::max( maxKeypointsCount, (int)channelKeypoints[ci].size());
} }
vector<KeyPoint> outKeypoints; vector<KeyPoint> outKeypoints;
outKeypoints.reserve( keypoints.size() ); outKeypoints.reserve( keypoints.size() );
int descriptorSize = descriptorExtractor->descriptorSize(); int descriptorSize = descriptorExtractor->descriptorSize();
Mat mergedDescriptors( (int)keypoints.size(), 3*descriptorSize, descriptorExtractor->descriptorType() ); Mat mergedDescriptors( maxKeypointsCount, 3*descriptorSize, descriptorExtractor->descriptorType() );
int mergedCount = 0; int mergedCount = 0;
// cp - current channel position // cp - current channel position
size_t cp[] = {0, 0, 0}; size_t cp[] = {0, 0, 0};
......
...@@ -1059,12 +1059,12 @@ TEST( Features2d_DescriptorExtractor_BRIEF, regression ) ...@@ -1059,12 +1059,12 @@ TEST( Features2d_DescriptorExtractor_BRIEF, regression )
test.safe_run(); test.safe_run();
} }
//TEST( Features2d_DescriptorExtractor_OpponentSIFT, regression ) TEST( Features2d_DescriptorExtractor_OpponentSIFT, regression )
//{ {
// CV_DescriptorExtractorTest<L2<float> > test( "descriptor-opponent-sift", 0.18f, CV_DescriptorExtractorTest<L2<float> > test( "descriptor-opponent-sift", 0.18f,
// DescriptorExtractor::create("OpponentSIFT"), 8.06652f ); DescriptorExtractor::create("OpponentSIFT"), 8.06652f );
// test.safe_run(); test.safe_run();
//} }
TEST( Features2d_DescriptorExtractor_OpponentSURF, regression ) TEST( Features2d_DescriptorExtractor_OpponentSURF, regression )
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment