Bartosz Firyn (SarXos)

com.github.sarxos.webcam
Class WebcamMotionDetector

java.lang.Object
  extended by com.github.sarxos.webcam.WebcamMotionDetector

public class WebcamMotionDetector
extends Object

Webcam motion detector.

Author:
Bartosz Firyn (SarXos)

Field Summary
static int DEFAULT_THREASHOLD
           
 
Constructor Summary
WebcamMotionDetector(Webcam webcam)
          Create motion detector with default parameters - threshold = 25, inertia = 0.
WebcamMotionDetector(Webcam webcam, int threshold)
          Create motion detector with default parameter inertia = 0.
WebcamMotionDetector(Webcam webcam, int threshold, int inertia)
          Create motion detector.
 
Method Summary
 boolean addMotionListener(WebcamMotionListener l)
          Add motion listener.
 int getInterval()
           
 WebcamMotionListener[] getMotionListeners()
           
 int getMotionStrength()
           
 Webcam getWebcam()
           
 boolean isMotion()
           
 boolean removeMotionListener(WebcamMotionListener l)
          Removes motion listener.
 void setInterval(int interval)
           
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_THREASHOLD

public static final int DEFAULT_THREASHOLD
See Also:
Constant Field Values
Constructor Detail

WebcamMotionDetector

public WebcamMotionDetector(Webcam webcam,
                            int threshold,
                            int inertia)
Create motion detector. Will open webcam if it is closed.

Parameters:
webcam - web camera instance
threshold - intensity threshold (0 - 255)
inertia - for how long motion is valid (seconds)

WebcamMotionDetector

public WebcamMotionDetector(Webcam webcam,
                            int threshold)
Create motion detector with default parameter inertia = 0.

Parameters:
webcam - web camera instance
threshold - intensity threshold (0 - 255)

WebcamMotionDetector

public WebcamMotionDetector(Webcam webcam)
Create motion detector with default parameters - threshold = 25, inertia = 0.

Parameters:
webcam - web camera instance
Method Detail

start

public void start()

stop

public void stop()

addMotionListener

public boolean addMotionListener(WebcamMotionListener l)
Add motion listener.

Parameters:
l - listener to add
Returns:
true if listeners list has been changed, false otherwise

getMotionListeners

public WebcamMotionListener[] getMotionListeners()
Returns:
All motion listeners as array

removeMotionListener

public boolean removeMotionListener(WebcamMotionListener l)
Removes motion listener.

Parameters:
l - motion listener to remove
Returns:
true if listener was available on the list, false otherwise

getInterval

public int getInterval()
Returns:
Motion check interval in milliseconds

setInterval

public void setInterval(int interval)

getWebcam

public Webcam getWebcam()

isMotion

public boolean isMotion()

getMotionStrength

public int getMotionStrength()

Bartosz Firyn (SarXos)

Copyright © 2012-2013 Bartosz Firyn (SarXos). All Rights Reserved.