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)

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.
protected  void detect()
           
 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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()

detect

protected void detect()

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()


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