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
This commit is contained in:
Vladislav Vinogradov 2012-09-11 14:59:52 +04:00
parent 9956c42804
commit e975259c06
4 changed files with 11 additions and 8 deletions

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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
{