提交 a0cf8c32 编写于 作者: A Alexander Alekhin

Merge pull request #20793 from tomoaki0705:fixGaussianOverflow

......@@ -445,8 +445,8 @@ PARAM_TEST_CASE(GaussianBlur, cv::cuda::DeviceInfo, cv::Size, MatDepth, Channels
CUDA_TEST_P(GaussianBlur, Accuracy)
{
cv::Mat src = randomMat(size, type);
double sigma1 = randomDouble(0.1, 1.0);
double sigma2 = randomDouble(0.1, 1.0);
double sigma1 = randomDouble(0.0, 1.0);
double sigma2 = randomDouble(0.0, 1.0);
cv::Ptr<cv::cuda::Filter> gauss = cv::cuda::createGaussianFilter(src.type(), -1, ksize, sigma1, sigma2, borderType);
......
......@@ -1958,7 +1958,10 @@ public:
}
else if (kxlen % 2 == 1)
{
hlineSmoothFunc = hlineSmoothONa_yzy_a;
if (kx[(kxlen - 1)/ 2] == FT::one())
hlineSmoothFunc = hlineSmooth1N1;
else
hlineSmoothFunc = hlineSmoothONa_yzy_a;
for (int i = 0; i < kxlen / 2; i++)
if (!(kx[i] == kx[kxlen - 1 - i]))
{
......
......@@ -249,4 +249,15 @@ TEST(GaussianBlur_Bitexact, regression_9863)
checkGaussianBlur_8Uvs32F(src8u, src32f, 151, 30);
}
TEST(GaussianBlur_Bitexact, overflow_20792)
{
Mat src(128, 128, CV_16UC1, Scalar(255));
Mat dst;
double sigma = theRNG().uniform(0.0, 0.2); // a peaky kernel
GaussianBlur(src, dst, Size(7, 7), sigma, 0.9);
int count = (int)countNonZero(dst);
int nintyPercent = (int)(src.rows*src.cols * 0.9);
EXPECT_GT(count, nintyPercent);
}
}} // namespace
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册