0

I am getting an error when I am trying to execute the below-mentioned code of line by using OpenCV 3 version.

bg.set("nmixtures", 10); 

Error bg object does not have any member name .set

Can anybody tell me how to use the same function in OpenCV 3 version

frogatto
  • 28,539
  • 11
  • 83
  • 129
Gagandeep
  • 11
  • 6

1 Answers1

0

The right way:

cv::BackgroundSubtractorMOG2* bgsegm = bg.dynamicCast<cv::BackgroundSubtractorMOG2>();
    if (bgsegm)
    {
            bgsegm->setNMixtures(10);
    }
Nuzhny
  • 1,869
  • 1
  • 7
  • 13