List of usage examples for org.opencv.video Video createBackgroundSubtractorMOG2
public static BackgroundSubtractorMOG2 createBackgroundSubtractorMOG2(int history, double varThreshold, boolean detectShadows)
From source file:com.davidmiguel.gobees.monitoring.algorithm.processors.BackgroundSubtractor.java
License:Open Source License
/** * Get the instance of BackgroundSubtractorMOG2 with the desired configuration. * * @param history the number of frames to consider in the background model. * @param shadowThreshold the threshold to consider a pixel as shadow or not. * @return instance of BackgroundSubtractorMOG2. *//*from w w w. jav a2 s. c o m*/ private BackgroundSubtractorMOG2 getMogInstance(int history, double shadowThreshold) { BackgroundSubtractorMOG2 instance = Video.createBackgroundSubtractorMOG2(history, VAR_THRESHOLD, DETECT_SHADOWS); instance.setBackgroundRatio(BACKGROUND_RATIO); instance.setVarInit(VAR_INIT); instance.setShadowThreshold(shadowThreshold); return instance; }
From source file:com.example.afs.makingmusic.process.MotionDetector.java
License:Open Source License
public MotionDetector(BlockingQueue<Frame> inputQueue) { super(inputQueue); backgroundSubtractor = Video.createBackgroundSubtractorMOG2(5, 16, false); foregroundMask = new Mat(); }