Subtract¶
Auto-generated documentation for musicalgestures._subtract module.
- Mgt-python / Modules / Musicalgestures / Subtract
mg_subtract¶
def mg_subtract(
self,
color=True,
filtertype=None,
threshold=0.05,
blur=False,
curves=0.15,
use_median=False,
kernel_size=5,
bg_img=None,
bg_color='#000000',
target_name=None,
overwrite=False,
):
Renders background subtraction using ffmpeg.
Arguments¶
colorbool, optional - If False the input is converted to grayscale at the start of the process. This can significantly reduce render time. Defaults to True.filtertypestr, optional - 'Regular' turns all values belowthreshto 0. 'Binary' turns all values belowthreshto 0, abovethreshto 1. 'Blob' removes individual pixels with erosion method. Defaults to 'Regular'.thresholdfloat, optional - Eliminates pixel values less than given threshold. Ranges from 0 to 1. Defaults to 0.05.blurbool, optional - Whether to apply a smartblur ffmpeg filter or not. Defaults to False.curvesint, optional - Apply curves and equalisation threshold filter to subtract the background. Ranges from 0 to 1. Defaults to 0.15.use_medianbool, optional - If True the algorithm applies a median filter on the thresholded frame-difference stream. Defaults to False.kernel_sizeint, optional - Size of the median filter (ifuse_median=True) or the erosion filter (iffiltertype='blob'). Defaults to 5.bg_imgstr, optional - Path to a background image (.png) that needs to be subtracted from the video. If set to None, it uses an average image of all frames in the video. Defaults to None.bg_colorstr, optional - Set the background color in the video file in hex value. Defaults to '#000000' (black).target_namestr, optional - Target output name for the motiongram. Defaults to None.overwritebool, optional - Whether to allow overwriting existing files or to automatically increment target filenames to avoid overwriting. Defaults to False.
Returns¶
MgVideo- A MgVideo as subtract for parent MgVideo