Skip to content

Commit 4ff3501

Browse files
committed
Log Warning and GMG cuda patch
1 parent a3d235c commit 4ff3501

File tree

7 files changed

+18
-21
lines changed

7 files changed

+18
-21
lines changed

modules/bgsegm/src/bgfg_gaussmix.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ void BackgroundSubtractorMOGImpl::apply(InputArray _image, InputArray _knownFore
467467
Mat knownForegroundMask = _knownForegroundMask.getMat();
468468
if(!_knownForegroundMask.empty())
469469
{
470-
CV_Error( Error::StsNotImplemented, "Known Foreground Masking has not been implemented for this specific background subtractor, falling back to subtraction without known foreground");
470+
CV_LOG_WARNING(NULL, "Known Foreground Masking has not been implemented for this specific background subtractor, falling back to subtraction without known foreground");
471471
}
472472
apply(_image, _fgmask, learningRate);
473473
}

modules/bgsegm/src/bgfg_gmg.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ void BackgroundSubtractorGMGImpl::apply(InputArray _image, InputArray _knownFore
478478
Mat knownForegroundMask = _knownForegroundMask.getMat();
479479
if(!_knownForegroundMask.empty())
480480
{
481-
CV_Error( Error::StsNotImplemented, "Known Foreground Masking has not been implemented for this specific background subtractor, falling back to subtraction without known foreground");
481+
CV_LOG_WARNING(NULL, "Known Foreground Masking has not been implemented for this specific background subtractor, falling back to subtraction without known foreground");
482482
}
483483
apply(_image, _fgmask, newLearningRate);
484484
}

modules/bgsegm/src/bgfg_gsoc.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@ void BackgroundSubtractorGSOCImpl::apply(InputArray _image, InputArray _knownFor
799799
Mat knownForegroundMask = _knownForegroundMask.getMat();
800800
if(!_knownForegroundMask.empty())
801801
{
802-
CV_Error( Error::StsNotImplemented, "Known Foreground Masking has not been implemented for this specific background subtractor, falling back to subtraction without known foreground");
802+
CV_LOG_WARNING(NULL, "Known Foreground Masking has not been implemented for this specific background subtractor, falling back to subtraction without known foreground");
803803
}
804804
apply(_image, _fgmask, learningRate);
805805
}
@@ -943,7 +943,7 @@ void BackgroundSubtractorLSBPImpl::apply(InputArray _image, InputArray _knownFor
943943
Mat knownForegroundMask = _knownForegroundMask.getMat();
944944
if(!_knownForegroundMask.empty())
945945
{
946-
CV_Error( Error::StsNotImplemented, "Known Foreground Masking has not been implemented for this specific background subtractor, falling back to subtraction without known foreground");
946+
CV_LOG_WARNING(NULL, "Known Foreground Masking has not been implemented for this specific background subtractor, falling back to subtraction without known foreground");
947947
}
948948
apply(_image, _fgmask, learningRate);
949949
}

modules/bgsegm/src/bgfg_subcnt.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ void BackgroundSubtractorCNTImpl::apply(InputArray _image, InputArray _knownFore
415415
Mat knownForegroundMask = _knownForegroundMask.getMat();
416416
if(!_knownForegroundMask.empty())
417417
{
418-
CV_Error( Error::StsNotImplemented, "Known Foreground Masking has not been implemented for this specific background subtractor, falling back to subtraction without known foreground");
418+
CV_LOG_WARNING(NULL, "Known Foreground Masking has not been implemented for this specific background subtractor, falling back to subtraction without known foreground");
419419
}
420420
apply(_image, _fgmask, learningRate);
421421
}

modules/cudabgsegm/src/mog.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,15 +137,15 @@ namespace
137137
void MOGImpl::apply(InputArray _image, InputArray _knownForegroundMask, OutputArray _fgmask, double learningRate){
138138
if(!_knownForegroundMask.empty())
139139
{
140-
CV_Error( Error::StsNotImplemented, "Known Foreground Masking has not been implemented for this specific background subtractor, falling back to subtraction without known foreground");
140+
CV_LOG_WARNING(NULL, "Known Foreground Masking has not been implemented for this specific background subtractor, falling back to subtraction without known foreground");
141141
}
142142
apply(_image, _fgmask, learningRate, Stream::Null());
143143
}
144144

145145
void MOGImpl::apply(InputArray _image, InputArray _knownForegroundMask, OutputArray _fgmask, double learningRate, Stream &stream){
146146
if(!_knownForegroundMask.empty())
147147
{
148-
CV_Error( Error::StsNotImplemented, "Known Foreground Masking has not been implemented for this specific background subtractor, falling back to subtraction without known foreground");
148+
CV_LOG_WARNING(NULL, "Known Foreground Masking has not been implemented for this specific background subtractor, falling back to subtraction without known foreground");
149149
}
150150
apply(_image, _fgmask, learningRate, stream);
151151
}

modules/cudalegacy/src/fgd.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,14 @@ namespace
589589
{
590590
}
591591

592+
void FGDImpl::apply(InputArray _image, InputArray _knownForegroundMask, OutputArray _fgmask, double learningRate){
593+
if(!_knownForegroundMask.empty())
594+
{
595+
CV_LOG_WARNING(NULL, "Known Foreground Masking has not been implemented for this specific background subtractor, falling back to subtraction without known foreground");
596+
}
597+
apply(_image, _fgmask, learningRate);
598+
}
599+
592600
void FGDImpl::apply(InputArray _frame, OutputArray fgmask, double)
593601
{
594602
GpuMat curFrame = _frame.getGpuMat();
@@ -630,15 +638,6 @@ namespace
630638
foreground_.copyTo(fgmask);
631639
}
632640

633-
void FGDImpl::apply(InputArray _image, InputArray _knownForegroundMask, OutputArray _fgmask, double learningRate){
634-
Mat knownForegroundMask = _knownForegroundMask.getMat();
635-
if(!_knownForegroundMask.empty())
636-
{
637-
CV_Error( Error::StsNotImplemented, "Known Foreground Masking has not been implemented for this specific background subtractor, falling back to subtraction without known foreground");
638-
}
639-
apply(_image, _fgmask, learningRate);
640-
}
641-
642641
void FGDImpl::getBackgroundImage(OutputArray backgroundImage) const
643642
{
644643
cuda::cvtColor(background_, backgroundImage, COLOR_BGRA2BGR);

modules/cudalegacy/src/gmg.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,19 +170,17 @@ namespace
170170
}
171171

172172
void GMGImpl::apply(InputArray _image, InputArray _knownForegroundMask, OutputArray _fgmask, double learningRate){
173-
Mat knownForegroundMask = _knownForegroundMask.getMat();
174173
if(!_knownForegroundMask.empty())
175174
{
176-
CV_Error( Error::StsNotImplemented, "Known Foreground Masking has not been implemented for this specific background subtractor, falling back to subtraction without known foreground");
175+
CV_LOG_WARNING(NULL, "Known Foreground Masking has not been implemented for this specific background subtractor, falling back to subtraction without known foreground");
177176
}
178-
apply(_image, _fgmask, Stream::Null());
177+
apply(_image, _fgmask, learningRate);
179178
}
180179

181180
void GMGImpl::apply(InputArray _image, InputArray _knownForegroundMask, OutputArray _fgmask, double learningRate, Stream& stream){
182-
Mat knownForegroundMask = _knownForegroundMask.getMat();
183181
if(!_knownForegroundMask.empty())
184182
{
185-
CV_Error( Error::StsNotImplemented, "Known Foreground Masking has not been implemented for this specific background subtractor, falling back to subtraction without known foreground");
183+
CV_LOG_WARNING(NULL, "Known Foreground Masking has not been implemented for this specific background subtractor, falling back to subtraction without known foreground");
186184
}
187185
apply(_image, _fgmask, learningRate, stream);
188186
}

0 commit comments

Comments
 (0)