public class WebcamMotionDetectorDefaultAlgorithm extends java.lang.Object implements WebcamMotionDetectorAlgorithm
| Modifier and Type | Field and Description |
|---|---|
static double |
DEFAULT_AREA_THREASHOLD
Default percentage image area fraction threshold (set to 0.2%).
|
static double |
DEFAULT_AREA_THREASHOLD_MAX
Default max percentage image area fraction threshold (set to 100%).
|
static int |
DEFAULT_MAX_POINTS
The default for the max amount of points that can be detected at one time
|
static int |
DEFAULT_PIXEL_THREASHOLD
Default pixel difference intensity threshold (set to 25).
|
static int |
DEFAULT_RANGE
The default minimum range between each point where motion has been detected
|
| Constructor and Description |
|---|
WebcamMotionDetectorDefaultAlgorithm()
Creates default motion detector algorithm with default pixel and area thresholds.
|
WebcamMotionDetectorDefaultAlgorithm(int pixelThreshold,
double areaThreshold)
Creates default motion detector algorithm.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
detect(java.awt.image.BufferedImage previousModified,
java.awt.image.BufferedImage currentModified)
Detects motion by comparison of the two specified images content.
|
java.awt.image.BufferedImage |
filter(java.awt.image.BufferedImage original)
WebcamMotionDetector calls this method for each image used as parameter of the method
WebcamMotionDetectorAlgorithm.detect(BufferedImage, BufferedImage). |
double |
getArea()
Get percentage fraction of image covered by motion.
|
java.awt.Point |
getCog()
Get motion center of gravity.
|
int |
getMaxPoints()
Get the current max amount of points that can be detected at one time
|
int |
getPointRange()
Get the current minimum range between each point
|
java.util.ArrayList<java.awt.Point> |
getPoints()
Returns the currently stored points that have been detected
|
java.util.ArrayList<java.lang.Integer> |
getThresholds() |
void |
setAreaThreshold(double threshold)
Set percentage fraction of detected motion area threshold above which it is classified as
"moved".
|
void |
setDoNotEngageZones(java.util.List<java.awt.Rectangle> doNotEngageZones)
Set list of the rectangular zones where motion detection should be ignored.
|
void |
setMaxAreaThreshold(double threshold)
Set max percentage fraction of detected motion area threshold, below which it is classified
as "moved".
|
void |
setMaxPoints(int i)
Set the max amount of points that can be detected at one time
|
void |
setPixelThreshold(int threshold)
Set pixel intensity difference threshold above which pixel is classified as "moved".
|
void |
setPointRange(int i)
Set the minimum range between each point detected
|
public static final int DEFAULT_PIXEL_THREASHOLD
public static final double DEFAULT_AREA_THREASHOLD
public static final double DEFAULT_AREA_THREASHOLD_MAX
public static final int DEFAULT_RANGE
public static final int DEFAULT_MAX_POINTS
public WebcamMotionDetectorDefaultAlgorithm()
DEFAULT_PIXEL_THREASHOLD,
DEFAULT_AREA_THREASHOLDpublic WebcamMotionDetectorDefaultAlgorithm(int pixelThreshold,
double areaThreshold)
pixelThreshold - intensity threshold (0 - 255)areaThreshold - percentage threshold of image covered by motionpublic java.awt.image.BufferedImage filter(java.awt.image.BufferedImage original)
WebcamMotionDetectorAlgorithmWebcamMotionDetectorAlgorithm.detect(BufferedImage, BufferedImage). Implementation may transform the original
image and prepare it for comparison of two images. May return the same instance if no there
is no need to transform.filter in interface WebcamMotionDetectorAlgorithmoriginal - imagepublic boolean detect(java.awt.image.BufferedImage previousModified,
java.awt.image.BufferedImage currentModified)
WebcamMotionDetectorAlgorithmWebcamMotionDetectorAlgorithm.filter(BufferedImage) method was called for both specified images.detect in interface WebcamMotionDetectorAlgorithmpublic java.awt.Point getCog()
WebcamMotionDetectorAlgorithmgetCog in interface WebcamMotionDetectorAlgorithmpublic double getArea()
WebcamMotionDetectorAlgorithmgetArea in interface WebcamMotionDetectorAlgorithmpublic void setPixelThreshold(int threshold)
threshold - the pixel intensity difference thresholdDEFAULT_PIXEL_THREASHOLDpublic void setAreaThreshold(double threshold)
threshold - the percentage fraction of image areaDEFAULT_AREA_THREASHOLDpublic void setMaxAreaThreshold(double threshold)
threshold - the percentage fraction of image areaDEFAULT_AREA_THREASHOLD_MAXpublic java.util.ArrayList<java.lang.Integer> getThresholds()
public void setPointRange(int i)
setPointRange in interface WebcamMotionDetectorAlgorithmi - the range to setpublic int getPointRange()
getPointRange in interface WebcamMotionDetectorAlgorithmpublic void setMaxPoints(int i)
setMaxPoints in interface WebcamMotionDetectorAlgorithmi - The amount of points that can be detectedpublic int getMaxPoints()
getMaxPoints in interface WebcamMotionDetectorAlgorithmpublic java.util.ArrayList<java.awt.Point> getPoints()
getPoints in interface WebcamMotionDetectorAlgorithmpublic void setDoNotEngageZones(java.util.List<java.awt.Rectangle> doNotEngageZones)
WebcamMotionDetectorAlgorithmsetDoNotEngageZones in interface WebcamMotionDetectorAlgorithmdoNotEngageZones - the list of rectangles to ignoreCopyright © 2012-2018 Bartosz Firyn (SarXos). All Rights Reserved.