This notebook shows an overview over all cvloop functions provided in the cvloop.functions
module.
cvloop.functions.ForegroundExtractor
[[Source](https://github.com/shoeffner/cvloop/blob/develop/cvloop/functions.py#L9)]Performs background subtraction using the supplied Subtractor and extracts the foreground accordingly.
ForegroundExtractor.__init__(...)
:Initializes the ForegroundExtractor
.
Uses the supplied BackgroundSubtractor as subtractor to get a mask and apply the mask to the image.
Args:
BackgroundSubtractorMOG2
.
In [ ]:
from cvloop import cvloop, ForegroundExtractor
cvloop(function=ForegroundExtractor(), side_by_side=True)
cvloop.functions.BackgroundSubtractorGMG
[[Source](https://github.com/shoeffner/cvloop/blob/develop/cvloop/functions.py#L32)]Performs background subtraction with a mixture of gaussians.
The method used was described by Godbehere, Matsukawa, and Goldberg in Visual Tracking of Human Visitors under Variable-Lighting Conditions for a Responsive Audio Art Installation (2012).
See also http://docs.opencv.org/3.1.0/db/d5c/tutorial_py_bg_subtraction.html.
BackgroundSubtractorGMG.__init__(...)
:Initializes the BackgroundSubtractorGMG
.
Note: Requires OpenCV to be built with --contrib
as it uses the
bgsegm
package.
Unless a custom structuring_element
is specified, it uses:
cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (3, 3))
Args:
In [ ]:
from cvloop import cvloop, BackgroundSubtractorGMG
cvloop(function=BackgroundSubtractorGMG(), side_by_side=True)
cvloop.functions.BackgroundSubtractorMOG
[[Source](https://github.com/shoeffner/cvloop/blob/develop/cvloop/functions.py#L68)]Performs background subtraction with a mixture of gaussians.
The method used was described by KaewTraKulPong and Bowden in An improved adaptive background mixture model for real-time tracking with shadow detection (2001).
See also http://docs.opencv.org/3.1.0/db/d5c/tutorial_py_bg_subtraction.html.
BackgroundSubtractorMOG.__init__(...)
:Initializes the BackgroundSubtractorMOG
.
Note: Requires OpenCV to be built with --contrib
as it uses the
bgsegm
package.
In [ ]:
from cvloop import cvloop, BackgroundSubtractorMOG
cvloop(function=BackgroundSubtractorMOG(), side_by_side=True)
cvloop.functions.BackgroundSubtractorMOG2
[[Source](https://github.com/shoeffner/cvloop/blob/develop/cvloop/functions.py#L93)]Performs background subtraction with a mixture of gaussians.
The method used was described in two papers by Zivkovic and van der Heijden, Improved adaptive Gausian mixture model for background subtraction (2004) and Efficient Adaptive Density Estimation per Image Pixel for the Task of Background Subtraction (2006)
See also http://docs.opencv.org/3.1.0/db/d5c/tutorial_py_bg_subtraction.html.
BackgroundSubtractorMOG2.__init__(...)
:Initializes the BackgroundSubtractorMOG2
.
In [ ]:
from cvloop import cvloop, BackgroundSubtractorMOG2
cvloop(function=BackgroundSubtractorMOG2(), side_by_side=True)
In [ ]:
from cvloop import cvloop, Inverter
cvloop(function=Inverter(), side_by_side=True)
cvloop.functions.DrawHat
[[Source](https://github.com/shoeffner/cvloop/blob/develop/cvloop/functions.py#L134)]Draws hats above detected faces.
Uses a Haar cascade for face detection and draws provided hats above the detected faces.
The default hat (examples/hat.png) is taken from https://pixabay.com/en/hat-trilby-black-brim-crease-felt-157581/ and was released unter CC0 Public Domain.
DrawHat.__init__(...)
:Initializes a DrawHat
instance.
Args:
In [ ]:
from cvloop import cvloop, DrawHat
cvloop(function=DrawHat(), side_by_side=True)