mirror of
https://github.com/opencv/opencv_contrib.git
synced 2025-10-22 16:08:41 +08:00
Update sift.cpp
This commit is contained in:
@@ -220,10 +220,12 @@ static Mat createInitialImage( const Mat& img, bool doubleImageSize, float sigma
|
|||||||
{
|
{
|
||||||
Mat gray, gray_fpt;
|
Mat gray, gray_fpt;
|
||||||
if( img.channels() == 3 || img.channels() == 4 )
|
if( img.channels() == 3 || img.channels() == 4 )
|
||||||
|
{
|
||||||
cvtColor(img, gray, COLOR_BGR2GRAY);
|
cvtColor(img, gray, COLOR_BGR2GRAY);
|
||||||
|
gray.convertTo(gray_fpt, DataType<sift_wt>::type, SIFT_FIXPT_SCALE, 0);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
img.copyTo(gray);
|
img.convertTo(gray_fpt, DataType<sift_wt>::type, SIFT_FIXPT_SCALE, 0);
|
||||||
gray.convertTo(gray_fpt, DataType<sift_wt>::type, SIFT_FIXPT_SCALE, 0);
|
|
||||||
|
|
||||||
float sig_diff;
|
float sig_diff;
|
||||||
|
|
||||||
@@ -231,7 +233,7 @@ static Mat createInitialImage( const Mat& img, bool doubleImageSize, float sigma
|
|||||||
{
|
{
|
||||||
sig_diff = sqrtf( std::max(sigma * sigma - SIFT_INIT_SIGMA * SIFT_INIT_SIGMA * 4, 0.01f) );
|
sig_diff = sqrtf( std::max(sigma * sigma - SIFT_INIT_SIGMA * SIFT_INIT_SIGMA * 4, 0.01f) );
|
||||||
Mat dbl;
|
Mat dbl;
|
||||||
resize(gray_fpt, dbl, Size(gray.cols*2, gray.rows*2), 0, 0, INTER_LINEAR);
|
resize(gray_fpt, dbl, Size(gray_fpt.cols*2, gray_fpt.rows*2), 0, 0, INTER_LINEAR);
|
||||||
GaussianBlur(dbl, dbl, Size(), sig_diff, sig_diff);
|
GaussianBlur(dbl, dbl, Size(), sig_diff, sig_diff);
|
||||||
return dbl;
|
return dbl;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user