You should used cv::bgsegm::createBackgroundSubtractorMOG(); in opencv 3.0
You have a tutorial for MOG
you can use this parameters for MOG
cv::Ptr<cv::BackgroundSubtractor> b;
b = cv::bgsegm::createBackgroundSubtractorMOG();
b.dynamicCast<cv::bgsegm::BackgroundSubtractorMOG>()->setHistory(history);
b.dynamicCast<cv::bgsegm::BackgroundSubtractorMOG>()->setBackgroundRatio(BackgroundRatio);
b.dynamicCast<cv::bgsegm::BackgroundSubtractorMOG>()->setNMixtures(mixtures);
b.dynamicCast<cv::bgsegm::BackgroundSubtractorMOG>()->setNoiseSigma(NoiseSigma);
b.dynamicCast<cv::bgsegm::BackgroundSubtractorMOG>()->apply(img, imDst,learningRate);
and this for MOG2
cv::Ptr<cv::BackgroundSubtractor> b;
b = cv::createBackgroundSubtractorMOG2();
b.dynamicCast<cv::BackgroundSubtractorMOG2>()->setHistory(history);
b.dynamicCast<cv::BackgroundSubtractorMOG2>()->setNMixtures(mixtures);
b.dynamicCast<cv::BackgroundSubtractorMOG2>()->setBackgroundRatio(BackgroundRatio);
b.dynamicCast<cv::BackgroundSubtractorMOG2>()->setVarThreshold(VarThreshold);
b.dynamicCast<cv::BackgroundSubtractorMOG2>()->setVarThresholdGen(VarThresholdGen);
b.dynamicCast<cv::BackgroundSubtractorMOG2>()->setVarInit(VarInit);
b.dynamicCast<cv::BackgroundSubtractorMOG2>()->setVarMin(VarMin);
b.dynamicCast<cv::BackgroundSubtractorMOG2>()->setVarMax(VarMax);
b.dynamicCast<cv::BackgroundSubtractorMOG2>()->setComplexityReductionThreshold(ComplexityReductionThreshold);
b.dynamicCast<cv::BackgroundSubtractorMOG2>()->setDetectShadows(DetectShadows);
b.dynamicCast<cv::BackgroundSubtractorMOG2>()->setShadowValue(ShadowValue);
b.dynamicCast<cv::BackgroundSubtractorMOG2>()->setVarThreshold(ShadowThreshold);
b.dynamicCast<cv::BackgroundSubtractorMOG2>()->apply(img, imDst, learningRate);
PS I haven't test syntax
Regarding BackgroundSubtractorMOG2 and shadows, in that very same link you provided you can see how to remove them. The constructor is
BackgroundSubtractorMOG2(int history, float varThreshold, bool bShadowDetection=true )
where bShadowDetection turns on/off shadow detection. The parameteruchar nShadowDetection
controls the value assigned to detected shadows (127 by default)