diff --git a/modules/gpu/src/bgfg_mog.cpp b/modules/gpu/src/bgfg_mog.cpp index 94668e817f..67cac76526 100644 --- a/modules/gpu/src/bgfg_mog.cpp +++ b/modules/gpu/src/bgfg_mog.cpp @@ -251,8 +251,7 @@ void cv::gpu::MOG2_GPU::operator()(const GpuMat& frame, GpuMat& fgmask, float le learningRate = learningRate >= 0.0f && nframes_ > 1 ? learningRate : 1.0f / std::min(2 * nframes_, history); CV_Assert(learningRate >= 0.0f); - if (learningRate > 0.0f) - mog2_gpu(frame, frame.channels(), fgmask, bgmodelUsedModes_, weight_, variance_, mean_, learningRate, -learningRate * fCT, bShadowDetection, StreamAccessor::getStream(stream)); + mog2_gpu(frame, frame.channels(), fgmask, bgmodelUsedModes_, weight_, variance_, mean_, learningRate, -learningRate * fCT, bShadowDetection, StreamAccessor::getStream(stream)); } void cv::gpu::MOG2_GPU::getBackgroundImage(GpuMat& backgroundImage, Stream& stream) const diff --git a/modules/gpu/src/filtering.cpp b/modules/gpu/src/filtering.cpp index 1e9fbc5f10..d90a0d8210 100644 --- a/modules/gpu/src/filtering.cpp +++ b/modules/gpu/src/filtering.cpp @@ -576,8 +576,10 @@ namespace else if (iterations > 1 && countNonZero(_kernel) == _kernel.rows * _kernel.cols) { anchor = Point(anchor.x * iterations, anchor.y * iterations); - kernel = getStructuringElement(MORPH_RECT, Size(ksize.width + iterations * (ksize.width - 1), - ksize.height + iterations * (ksize.height - 1)), anchor); + kernel = getStructuringElement(MORPH_RECT, + Size(ksize.width + (iterations - 1) * (ksize.width - 1), + ksize.height + (iterations - 1) * (ksize.height - 1)), + anchor); iterations = 1; } else diff --git a/modules/gpu/src/opencv2/gpu/device/detail/color_detail.hpp b/modules/gpu/src/opencv2/gpu/device/detail/color_detail.hpp index 900958f929..61f9f2c976 100644 --- a/modules/gpu/src/opencv2/gpu/device/detail/color_detail.hpp +++ b/modules/gpu/src/opencv2/gpu/device/detail/color_detail.hpp @@ -1140,6 +1140,12 @@ namespace cv { namespace gpu { namespace device int sector = __float2int_rd(h); h -= sector; + if ( (unsigned)sector >= 6u ) + { + sector = 0; + h = 0.f; + } + float tab[4]; tab[0] = v; tab[1] = v * (1.f - s); diff --git a/modules/imgproc/src/generalized_hough.cpp b/modules/imgproc/src/generalized_hough.cpp index e07a5f0b38..a42de39828 100644 --- a/modules/imgproc/src/generalized_hough.cpp +++ b/modules/imgproc/src/generalized_hough.cpp @@ -64,10 +64,6 @@ namespace { return fabs(v) > numeric_limits::epsilon(); } - /*bool notNull(double v) - { - return fabs(v) > numeric_limits::epsilon(); - }*/ class GHT_Pos : public GeneralizedHough {