Commit e975259c authored by Vladislav Vinogradov's avatar Vladislav Vinogradov

several fixes in gpu module

fixed iterations>1 case in morphological operations
fixed possible access violation in HSV2RGB
fixed the case learningRate==0 in BackgroundSubtractorMOG2
parent 9956c428
......@@ -251,7 +251,6 @@ 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));
}
......
......@@ -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
......
......@@ -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);
......
......@@ -64,10 +64,6 @@ namespace
{
return fabs(v) > numeric_limits<float>::epsilon();
}
/*bool notNull(double v)
{
return fabs(v) > numeric_limits<double>::epsilon();
}*/
class GHT_Pos : public GeneralizedHough
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment