createBackgroundSubtractorMOG2Async function

Future<BackgroundSubtractorMOG2> createBackgroundSubtractorMOG2Async({
  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

Future<BackgroundSubtractorMOG2> createBackgroundSubtractorMOG2Async({
  int history = 500,
  double varThreshold = 16,
  bool detectShadows = true,
}) async =>
    cvRunAsync(
      (callback) => cffi.BackgroundSubtractorMOG2_CreateWithParams_Async(
        history,
        varThreshold,
        detectShadows,
        callback,
      ),
      (c, p) => c.complete(BackgroundSubtractorMOG2(p.cast<cvg.BackgroundSubtractorMOG2>())),
    );