Skip to content

Commit e45887e

Browse files
ab-dragonalalek
authored andcommitted
Merge pull request #2301 from ab-dragon:conditionally_compute_dog_pyramid
Build DoG Pyramid if useProvideKeypoints is false The buildDoGPyramid operation need not be performed unconditionally. In cases where it is not needed, both memory and speed performance can be improved
1 parent 94d1b9b commit e45887e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

modules/xfeatures2d/src/sift.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,19 +1147,20 @@ void SIFT_Impl::detectAndCompute(InputArray _image, InputArray _mask,
11471147
}
11481148

11491149
Mat base = createInitialImage(image, firstOctave < 0, (float)sigma);
1150-
std::vector<Mat> gpyr, dogpyr;
1150+
std::vector<Mat> gpyr;
11511151
int nOctaves = actualNOctaves > 0 ? actualNOctaves : cvRound(std::log( (double)std::min( base.cols, base.rows ) ) / std::log(2.) - 2) - firstOctave;
11521152

11531153
//double t, tf = getTickFrequency();
11541154
//t = (double)getTickCount();
11551155
buildGaussianPyramid(base, gpyr, nOctaves);
1156-
buildDoGPyramid(gpyr, dogpyr);
11571156

11581157
//t = (double)getTickCount() - t;
11591158
//printf("pyramid construction time: %g\n", t*1000./tf);
11601159

11611160
if( !useProvidedKeypoints )
11621161
{
1162+
std::vector<Mat> dogpyr;
1163+
buildDoGPyramid(gpyr, dogpyr);
11631164
//t = (double)getTickCount();
11641165
findScaleSpaceExtrema(gpyr, dogpyr, keypoints);
11651166
KeyPointsFilter::removeDuplicatedSorted( keypoints );

0 commit comments

Comments
 (0)