OpenCV 库版本 2.42。我想在BackgroundSubtractorMOG2
对象中设置一个参数,例如
BackgroundSubtractorMOG2 bgr;
// the following doesn't work because 'nmixtures', 'backgroundRatio'
// and 'fVarMin' are a protected members.
bgr.nmixtures = 3;
bgr.backgroundRatio = 0.9;
bgr.fVarMin = 5;
// the following works
bgr.set('nmixtures', 3);
// both of the following lines will give a run-time error
// `Access violation reading location 0x0000000000000008.`
bgr.set("backgroundRatio", 0.9);
bgr.set("fVarMin", 5);
backgroundRatio
fVarMin
是控制算法的参数。用户应该能够根据文档更改这些参数。
怎么设置参数BackgroundSubtractorMOG2
?
编辑正如在下面的答案中正确提到的,这是 OpenCV 中的一个错误。该错误已在 OpenCV 版本 2.4.6 中修复。