createBackgroundSubtractorMOG2 function

BackgroundSubtractorMOG2 createBackgroundSubtractorMOG2({
  1. int history = 500,
  2. double varThreshold = 16,
  3. bool detectShadows = true,
})

NewBackgroundSubtractorMOG2 returns a new BackgroundSubtractor algorithm of type MOG2. MOG2 is a Gaussian Mixture-based Background/Foreground Segmentation Algorithm.

For further details, please see: https://docs.opencv.org/master/de/de1/group__video__motion.html#ga2beb2dee7a073809ccec60f145b6b29c https://docs.opencv.org/master/d7/d7b/classcv_1_1BackgroundSubtractorMOG2.html

Implementation

BackgroundSubtractorMOG2 createBackgroundSubtractorMOG2({
  int history = 500,
  double varThreshold = 16,
  bool detectShadows = true,
}) {
  final p = calloc<cvideo.BackgroundSubtractorMOG2>();
  cvRun(
    () => cvideo.BackgroundSubtractorMOG2_CreateWithParams(
      history,
      varThreshold,
      detectShadows,
      p,
    ),
  );
  return BackgroundSubtractorMOG2(p);
}