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_THREASHOLD
public 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)
WebcamMotionDetectorAlgorithm
WebcamMotionDetectorAlgorithm.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 WebcamMotionDetectorAlgorithm
original
- imagepublic boolean detect(java.awt.image.BufferedImage previousModified, java.awt.image.BufferedImage currentModified)
WebcamMotionDetectorAlgorithm
WebcamMotionDetectorAlgorithm.filter(BufferedImage)
method was called for both specified images.detect
in interface WebcamMotionDetectorAlgorithm
public java.awt.Point getCog()
WebcamMotionDetectorAlgorithm
getCog
in interface WebcamMotionDetectorAlgorithm
public double getArea()
WebcamMotionDetectorAlgorithm
getArea
in interface WebcamMotionDetectorAlgorithm
public void setPixelThreshold(int threshold)
threshold
- the pixel intensity difference thresholdDEFAULT_PIXEL_THREASHOLD
public void setAreaThreshold(double threshold)
threshold
- the percentage fraction of image areaDEFAULT_AREA_THREASHOLD
public void setMaxAreaThreshold(double threshold)
threshold
- the percentage fraction of image areaDEFAULT_AREA_THREASHOLD_MAX
public java.util.ArrayList<java.lang.Integer> getThresholds()
public void setPointRange(int i)
setPointRange
in interface WebcamMotionDetectorAlgorithm
i
- the range to setpublic int getPointRange()
getPointRange
in interface WebcamMotionDetectorAlgorithm
public void setMaxPoints(int i)
setMaxPoints
in interface WebcamMotionDetectorAlgorithm
i
- The amount of points that can be detectedpublic int getMaxPoints()
getMaxPoints
in interface WebcamMotionDetectorAlgorithm
public java.util.ArrayList<java.awt.Point> getPoints()
getPoints
in interface WebcamMotionDetectorAlgorithm
public void setDoNotEngageZones(java.util.List<java.awt.Rectangle> doNotEngageZones)
WebcamMotionDetectorAlgorithm
setDoNotEngageZones
in interface WebcamMotionDetectorAlgorithm
doNotEngageZones
- the list of rectangles to ignoreCopyright © 2012-2018 Bartosz Firyn (SarXos). All Rights Reserved.