bgsegm: convert rgb images to gray in CNT

pull/1064/head
Vladislav Sovrasov 8 years ago
parent 34f910bb72
commit d253a0fa13
  1. 0
      modules/bgsegm/samples/bgfg.cpp
  2. 5
      modules/bgsegm/src/bgfg_subcnt.cpp

@ -341,9 +341,12 @@ private:
void BackgroundSubtractorCNTImpl::apply(InputArray image, OutputArray _fgmask, double learningRate) void BackgroundSubtractorCNTImpl::apply(InputArray image, OutputArray _fgmask, double learningRate)
{ {
CV_Assert(image.type() == CV_8UC1); CV_Assert(image.depth() == CV_8U);
Mat frameIn = image.getMat(); Mat frameIn = image.getMat();
if(frameIn.channels() != 1)
cvtColor(frameIn, frameIn, COLOR_BGR2GRAY);
_fgmask.create(image.size(), CV_8U); // OutputArray usage requires this step _fgmask.create(image.size(), CV_8U); // OutputArray usage requires this step
Mat fgMask = _fgmask.getMat(); Mat fgMask = _fgmask.getMat();

Loading…
Cancel
Save