Merge pull request #4149 from LaurentBerger:ThreshGaussianFloat

This commit is contained in:
Vadim Pisarevsky 2015-08-05 17:25:01 +00:00
commit 4a2aad5bba

View File

@ -1301,11 +1301,17 @@ void cv::adaptiveThreshold( InputArray _src, OutputArray _dst, double maxValue,
if( src.data != dst.data )
mean = dst;
if( method == ADAPTIVE_THRESH_MEAN_C )
if (method == ADAPTIVE_THRESH_MEAN_C)
boxFilter( src, mean, src.type(), Size(blockSize, blockSize),
Point(-1,-1), true, BORDER_REPLICATE );
else if( method == ADAPTIVE_THRESH_GAUSSIAN_C )
GaussianBlur( src, mean, Size(blockSize, blockSize), 0, 0, BORDER_REPLICATE );
else if (method == ADAPTIVE_THRESH_GAUSSIAN_C)
{
Mat srcfloat,meanfloat;
src.convertTo(srcfloat,CV_32F);
meanfloat=srcfloat;
GaussianBlur(srcfloat, meanfloat, Size(blockSize, blockSize), 0, 0, BORDER_REPLICATE);
meanfloat.convertTo(dst, src.type());
}
else
CV_Error( CV_StsBadFlag, "Unknown/unsupported adaptive threshold method" );