opencv-0.0.1.1: Haskell binding to OpenCV-3.x

Safe HaskellNone
LanguageHaskell2010

OpenCV.Video.MotionAnalysis

Contents

Synopsis

BackgroundSubtractor

class BackgroundSubtractor a where Source #

Minimal complete definition

bgSubApply, getBackgroundImage

Methods

bgSubApply :: PrimMonad m => a (PrimState m) -> Double -> Mat (S '[h, w]) channels depth -> m (Mat (S '[h, w]) (S 1) (S Word8)) Source #

getBackgroundImage :: PrimMonad m => a (PrimState m) -> m (Mat (S '[h, w]) channels depth) Source #

Instances

BackgroundSubtractor (BackgroundSubtractorMOG2 *) Source # 

Methods

bgSubApply :: PrimMonad m => BackgroundSubtractorMOG2 * (PrimState m) -> Double -> Mat (S [DS Nat] ((DS Nat ': h) ((DS Nat ': w) [DS Nat]))) channels depth -> m (Mat (S [DS Nat] ((DS Nat ': h) ((DS Nat ': w) [DS Nat]))) (S Nat 1) (S * Word8)) Source #

getBackgroundImage :: PrimMonad m => BackgroundSubtractorMOG2 * (PrimState m) -> m (Mat (S [DS Nat] ((DS Nat ': h) ((DS Nat ': w) [DS Nat]))) channels depth) Source #

BackgroundSubtractor (BackgroundSubtractorKNN *) Source # 

Methods

bgSubApply :: PrimMonad m => BackgroundSubtractorKNN * (PrimState m) -> Double -> Mat (S [DS Nat] ((DS Nat ': h) ((DS Nat ': w) [DS Nat]))) channels depth -> m (Mat (S [DS Nat] ((DS Nat ': h) ((DS Nat ': w) [DS Nat]))) (S Nat 1) (S * Word8)) Source #

getBackgroundImage :: PrimMonad m => BackgroundSubtractorKNN * (PrimState m) -> m (Mat (S [DS Nat] ((DS Nat ': h) ((DS Nat ': w) [DS Nat]))) channels depth) Source #

Background subtractors

data BackgroundSubtractorMOG2 s Source #

Instances

Algorithm (BackgroundSubtractorMOG2 *) Source # 

Methods

algorithmClearState :: PrimMonad m => BackgroundSubtractorMOG2 * (PrimState m) -> m () Source #

algorithmIsEmpty :: PrimMonad m => BackgroundSubtractorMOG2 * (PrimState m) -> m Bool Source #

BackgroundSubtractor (BackgroundSubtractorMOG2 *) Source # 

Methods

bgSubApply :: PrimMonad m => BackgroundSubtractorMOG2 * (PrimState m) -> Double -> Mat (S [DS Nat] ((DS Nat ': h) ((DS Nat ': w) [DS Nat]))) channels depth -> m (Mat (S [DS Nat] ((DS Nat ': h) ((DS Nat ': w) [DS Nat]))) (S Nat 1) (S * Word8)) Source #

getBackgroundImage :: PrimMonad m => BackgroundSubtractorMOG2 * (PrimState m) -> m (Mat (S [DS Nat] ((DS Nat ': h) ((DS Nat ': w) [DS Nat]))) channels depth) Source #

FromPtr (BackgroundSubtractorMOG2 k s) Source # 
WithPtr (BackgroundSubtractorMOG2 k s) Source # 

Methods

withPtr :: BackgroundSubtractorMOG2 k s -> (Ptr (C (BackgroundSubtractorMOG2 k s)) -> IO b) -> IO b

data BackgroundSubtractorKNN s Source #

Example:

carAnim :: Animation (ShapeT [240, 320]) ('S 3) ('S Word8)
carAnim = carOverhead

mog2Anim :: IO (Animation (ShapeT [240, 320]) ('S 3) ('S Word8))
mog2Anim = do
    mog2 <- newBackgroundSubtractorMOG2 Nothing Nothing Nothing
    forM carOverhead $ (delay, img) -> do
      fg <- bgSubApply mog2 0.1 img
      fgBgr <- exceptErrorIO $ pureExcept $ cvtColor gray bgr fg
      pure (delay, fgBgr)

Original:

Foreground:

Instances

Algorithm (BackgroundSubtractorKNN *) Source # 

Methods

algorithmClearState :: PrimMonad m => BackgroundSubtractorKNN * (PrimState m) -> m () Source #

algorithmIsEmpty :: PrimMonad m => BackgroundSubtractorKNN * (PrimState m) -> m Bool Source #

BackgroundSubtractor (BackgroundSubtractorKNN *) Source # 

Methods

bgSubApply :: PrimMonad m => BackgroundSubtractorKNN * (PrimState m) -> Double -> Mat (S [DS Nat] ((DS Nat ': h) ((DS Nat ': w) [DS Nat]))) channels depth -> m (Mat (S [DS Nat] ((DS Nat ': h) ((DS Nat ': w) [DS Nat]))) (S Nat 1) (S * Word8)) Source #

getBackgroundImage :: PrimMonad m => BackgroundSubtractorKNN * (PrimState m) -> m (Mat (S [DS Nat] ((DS Nat ': h) ((DS Nat ': w) [DS Nat]))) channels depth) Source #

FromPtr (BackgroundSubtractorKNN k s) Source # 
WithPtr (BackgroundSubtractorKNN k s) Source # 

Methods

withPtr :: BackgroundSubtractorKNN k s -> (Ptr (C (BackgroundSubtractorKNN k s)) -> IO b) -> IO b

newBackgroundSubtractorKNN Source #

Arguments

:: PrimMonad m 
=> Maybe Int32

Length of the history.

-> Maybe Double

Threshold on the squared distance between the pixel and the sample to decide whether a pixel is close to that sample. This parameter does not affect the background update.

-> Maybe Bool

If True, the algorithm will detect shadows and mark them. It decreases the speed a bit, so if you do not need this feature, set the parameter to False.

-> m (BackgroundSubtractorKNN (PrimState m)) 

newBackgroundSubtractorMOG2 Source #

Arguments

:: PrimMonad m 
=> Maybe Int32

Length of the history.

-> Maybe Double

Threshold on the squared Mahalanobis distance between the pixel and the model to decide whether a pixel is well described by the background model. This parameter does not affect the background update.

-> Maybe Bool

If True, the algorithm will detect shadows and mark them. It decreases the speed a bit, so if you do not need this feature, set the parameter to False.

-> m (BackgroundSubtractorMOG2 (PrimState m))