Safe Haskell | None |
---|---|
Language | Haskell2010 |
- class BackgroundSubtractor a where
- data BackgroundSubtractorMOG2 s
- data BackgroundSubtractorKNN s
- newBackgroundSubtractorKNN :: PrimMonad m => Maybe Int32 -> Maybe Double -> Maybe Bool -> m (BackgroundSubtractorKNN (PrimState m))
- newBackgroundSubtractorMOG2 :: PrimMonad m => Maybe Int32 -> Maybe Double -> Maybe Bool -> m (BackgroundSubtractorMOG2 (PrimState m))
BackgroundSubtractor
class BackgroundSubtractor a where Source #
:: PrimMonad m | |
=> a (PrimState m) | |
-> Double | The value between 0 and 1 that indicates how fast the background model is learnt. Negative parameter value makes the algorithm to use some automatically chosen learning rate. 0 means that the background model is not updated at all, 1 means that the background model is completely reinitialized from the last frame. |
-> Mat (S [h, w]) channels depth | Next video frame. |
-> m (Mat (S [h, w]) (S 1) (S Word8)) | The output foreground mask as an 8-bit binary image. |
Background subtractors
data BackgroundSubtractorMOG2 s Source #
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:
newBackgroundSubtractorKNN Source #
:: 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 |
-> m (BackgroundSubtractorKNN (PrimState m)) |
newBackgroundSubtractorMOG2 Source #
:: 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 |
-> m (BackgroundSubtractorMOG2 (PrimState m)) |