| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectohmm.CvBase
public class CvBase
Base class for JavaCV applications.
See CvDemo for an example.
Reads input frames from either a camera or video file. Processes each frame (no operation by default) and displays the results in any combination of
useWindowuseCanvasFrameserverPort iff useServer (see ImageServer)useServer; the other options work both
 locally and over remote X window (use ssh -XC) but consume a
 lot of bandwidth in the latter case.
 This class provides basic functions to pause/unpause the live input, emit debugging information for selected frames, and to save both raw capture and processed images.
You can use this class as a base for your own work:
process(com.googlecode.javacv.cpp.opencv_core.IplImage) function.  Also,
 the various *Ext*() functions are hooks that mostly do nothing in the base
 class, but are convenient places for you to insert your own code in a
 subclass (but note that you can also override even non-Ext functions, if
 needed).maxFPS, useServer, useConsole, etc.init(int, String[]) or init() and then mainLoop()CvDemo for an example.
| Field Summary | |
|---|---|
|  java.lang.String | appnameApplication name. | 
|  double | brightnessOpenCV capgure property override or NaN to use default | 
| protected  com.googlecode.javacv.CanvasFrame | canvasFrameThe JavaCV CanvasFrame, iff useCanvasFrame. | 
| protected  java.awt.event.KeyEvent | canvasFrameKeyEventLast KeyEvent on canvasFrameiffuseCanvasFrame | 
| protected  com.googlecode.javacv.cpp.opencv_highgui.CvCapture | capThe OpenCV capture object, if used. | 
| static java.lang.String[] | CAP_PROP_NAMESOpenCV capture property names | 
| static int[] | CAP_PROPSOpenCV capture properties | 
| protected  com.googlecode.javacv.cpp.opencv_core.IplImage | capImageMost recently captured image, if any (do not mutate or free). | 
|  boolean | dbgWhether debug is requested for next frame. | 
| static java.lang.String | DEF_APPNAMEDefault application name. | 
| static int | DEF_CAM_HDefault width and height for camera input. | 
| static int | DEF_CAM_WDefault width and height for camera input. | 
| static java.lang.String | DEF_INPUTDefault input specification (use next available camera). | 
| static float | DEF_MAX_FPSDefault maximum frames per second for processing and local display. | 
| static int | DEF_MIN_DELAY_MSDefault minimum inter-frame delay in ms. | 
| static float | DEF_SERVER_FPSDefault serverFPS. | 
| static int | DEF_SERVER_PORTDefault serverPort. | 
| static boolean | DEF_USE_CANVAS_FRAMEDefault for useCanvasFrame. | 
| static boolean | DEF_USE_CONSOLEDefault for useConsole. | 
| static boolean | DEF_USE_SERVERDefault for useServer. | 
| static boolean | DEF_USE_WINDOWDefault for useWindow. | 
|  boolean | enableExitWhether to call System.exit()on fatal errors or user quit. | 
|  double | exposureOpenCV capgure property override or NaN to use default | 
| static java.text.DecimalFormat | FMTNumber formatter. | 
| protected  double | frameEndMSLast frame end time. | 
| protected  int | frameNMost recent captured frame number. | 
|  double | gainOpenCV capgure property override or NaN to use default | 
| protected  com.googlecode.javacv.FrameGrabber | grabberThe JavaCV frame grabber, if used. | 
|  int | heightCapture dimensions. | 
|  double | hueOpenCV capgure property override or NaN to use default | 
|  float | maxFPSMaximum frames per second. | 
|  int | minDelayMSMinimum inter-frame delay. | 
| protected  com.googlecode.javacv.cpp.opencv_highgui.CvMouseCallback | mouseCallbackMouse event callback object. | 
|  java.io.PrintStream | msgStreamStrems for messages and warnings, or null to disable. | 
| protected  double | msPerTickMilliseconds per OpenCV clock tick. | 
|  boolean | pausedWhether processing is currently paused. | 
| protected  com.googlecode.javacv.cpp.opencv_core.IplImage | procImageMost recently processed image, if any (do not free). | 
|  double | saturationOpenCV capgure property override or NaN to use default | 
| protected  com.googlecode.javacv.cpp.opencv_core.IplImage | saveImageThe file save image, if any (freed by destructor iff allocated). | 
|  ImageServer | serverThe ImageServer, ifuseServer. | 
|  float | serverFPSDefault max server framerate. | 
| protected  com.googlecode.javacv.cpp.opencv_core.IplImage | serverImageCurrent server image, if any and if useServer. | 
| protected  char | serverKeyLast key char from server iff useServeror 0 if none. | 
|  int | serverPortServer TCP listen port. | 
| protected  int | streamIndexThe OpenCV capture stream index. | 
|  boolean | useCanvasFrameWhether to open and use a JavaCV CanvasFrame. | 
|  boolean | useConsoleWhether to look for keypresses with ConsoleNonblocking. | 
|  boolean | useServerWhether to start an ImageServeronserverPort. | 
|  boolean | useWindowWhether to open and use an OpenCV window. | 
| static java.lang.String[] | V4L2_AUTO_PROP_NAMESV4L2 auto camera property names | 
| static int[] | V4L2_AUTO_PROP_OFF_VALSV4L2 auto camera property off values | 
| static int[] | V4L2_AUTO_PROP_ON_VALSV4L2 auto camera property on values | 
| static int[] | V4L2_AUTO_PROPSV4L2 auto camera properties | 
| static int | V4L2_CID_AUDIO_BALANCEV4L2 control constants | 
| static int | V4L2_CID_AUDIO_BASSV4L2 control constants | 
| static int | V4L2_CID_AUDIO_LOUDNESSV4L2 control constants | 
| static int | V4L2_CID_AUDIO_MUTEV4L2 control constants | 
| static int | V4L2_CID_AUDIO_TREBLEV4L2 control constants | 
| static int | V4L2_CID_AUDIO_VOLUMEV4L2 control constants | 
| static int | V4L2_CID_AUTO_WHITE_BALANCEV4L2 control constants | 
| static int | V4L2_CID_AUTOGAINV4L2 control constants | 
| static int | V4L2_CID_BACKLIGHT_COMPENSATIONV4L2 control constants | 
| static int | V4L2_CID_BASEV4L2 control constants | 
| static int | V4L2_CID_BLACK_LEVELV4L2 control constants | 
| static int | V4L2_CID_BLUE_BALANCEV4L2 control constants | 
| static int | V4L2_CID_BRIGHTNESSV4L2 control constants | 
| static int | V4L2_CID_CAMERA_CLASSV4L2 control constants | 
| static int | V4L2_CID_CAMERA_CLASS_BASEV4L2 control constants | 
| static int | V4L2_CID_CONTRASTV4L2 control constants | 
| static int | V4L2_CID_DO_WHITE_BALANCEV4L2 control constants | 
| static int | V4L2_CID_EXPOSUREV4L2 control constants | 
| static int | V4L2_CID_EXPOSURE_ABSOLUTEV4L2 control constants | 
| static int | V4L2_CID_EXPOSURE_AUTOV4L2 control constants | 
| static int | V4L2_CID_EXPOSURE_AUTO_PRIORITYV4L2 control constants | 
| static int | V4L2_CID_FOCUS_ABSOLUTEV4L2 control constants | 
| static int | V4L2_CID_FOCUS_AUTOV4L2 control constants | 
| static int | V4L2_CID_FOCUS_RELATIVEV4L2 control constants | 
| static int | V4L2_CID_GAINV4L2 control constants | 
| static int | V4L2_CID_GAMMAV4L2 control constants | 
| static int | V4L2_CID_HCENTER_DEPRECATEDV4L2 control constants | 
| static int | V4L2_CID_HFLIPV4L2 control constants | 
| static int | V4L2_CID_HUEV4L2 control constants | 
| static int | V4L2_CID_HUE_AUTOV4L2 control constants | 
| static int | V4L2_CID_LASTP1V4L2 control constants | 
| static int | V4L2_CID_PAN_ABSOLUTEV4L2 control constants | 
| static int | V4L2_CID_PAN_RELATIVEV4L2 control constants | 
| static int | V4L2_CID_PAN_RESETV4L2 control constants | 
| static int | V4L2_CID_POWER_LINE_FREQUENCYV4L2 control constants | 
| static int | V4L2_CID_POWER_LINE_FREQUENCY_50HZV4L2 control constants | 
| static int | V4L2_CID_POWER_LINE_FREQUENCY_60HZV4L2 control constants | 
| static int | V4L2_CID_POWER_LINE_FREQUENCY_DISABLEDV4L2 control constants | 
| static int | V4L2_CID_PRIVATE_BASEV4L2 control constants | 
| static int | V4L2_CID_RED_BALANCEV4L2 control constants | 
| static int | V4L2_CID_SATURATIONV4L2 control constants | 
| static int | V4L2_CID_SHARPNESSV4L2 control constants | 
| static int | V4L2_CID_TILT_ABSOLUTEV4L2 control constants | 
| static int | V4L2_CID_TILT_RELATIVEV4L2 control constants | 
| static int | V4L2_CID_TILT_RESETV4L2 control constants | 
| static int | V4L2_CID_USER_BASEV4L2 control constants | 
| static int | V4L2_CID_USER_CLASSV4L2 control constants | 
| static int | V4L2_CID_VCENTER_DEPRECATEDV4L2 control constants | 
| static int | V4L2_CID_VFLIPV4L2 control constants | 
| static int | V4L2_CID_WHITE_BALANCE_TEMPERATUREV4L2 control constants | 
| static int | V4L2_CID_WHITENESSV4L2 control constants | 
| static int | V4L2_CTRL_CLASS_CAMERAV4L2 control constants | 
| static int | V4L2_CTRL_CLASS_MPEGV4L2 control constants | 
| static int | V4L2_CTRL_CLASS_USERV4L2 control constants | 
| static int | V4L2_EXPOSURE_APERTURE_PRIORITYV4L2 control constants | 
| static int | V4L2_EXPOSURE_AUTOV4L2 control constants | 
| static int | V4L2_EXPOSURE_MANUALV4L2 control constants | 
| static int | V4L2_EXPOSURE_SHUTTER_PRIORITYV4L2 control constants | 
| protected  boolean | v4l2AutoWhether v4l2EnableAuto()was called more recently thanv4l2DisableAuto(). | 
|  java.io.PrintStream | warnStreamStrems for messages and warnings, or null to disable. | 
|  int | widthCapture dimensions. | 
| Constructor Summary | |
|---|---|
| CvBase()Uses defaults for all fields. | |
| CvBase(boolean useWindow,
       boolean useCanvasFrame,
       boolean useConsole,
       boolean useServer)Uses DEF_APPNAME. | |
| CvBase(java.lang.String appname)Uses TBD. | |
| CvBase(java.lang.String appname,
       boolean useWindow,
       boolean useCanvasFrame,
       boolean useConsole,
       boolean useServer)Constructor initializes fields. | |
| Method Summary | |
|---|---|
| protected  boolean | camIndexOptional()Whether the camera index is optional on the command line. | 
| protected  void | cmdHelp()Display command line help. | 
| protected  void | cmdHelpExt()Display extra command line help, for subclasses. | 
| protected  java.lang.String | cmdHelpExtParams()Extra command line parameters, for subclasses. | 
| protected  boolean | doneProcessing()Hook to check if mainLoop()should end. | 
|  void | dumpCaptureProperties()Dump all CAP_PROPS | 
|  void | finalize()Calls release(). | 
| static java.lang.String | fmt(double d)Format a number for printing. | 
|  double | getCaptureProperty(com.googlecode.javacv.cpp.opencv_highgui.CvCapture cap,
                   int id)Wraps cvGetCaptureProperty(), catches RuntimeException. | 
| protected  java.lang.String | getDefAppname()Gets the default appname, may be overridden. | 
| protected  java.lang.String | getDefInput()Gets the default input, may be overridden. | 
| protected  void | guiHelp()Display GUI help. | 
| protected  void | guiHelpExt()Display extra GUI help, for subclasses. | 
| protected  boolean | handleKey(int code)Handle keypresses. | 
| protected  boolean | handleKeyExt(int code)Keypresses not handled by the default implementation of handleKey() are passed here. | 
| protected  void | handleMouse(int event,
            int x,
            int y,
            int flags)Handle mouse events. | 
| protected  void | handleMouse(java.awt.event.MouseEvent e)forward an AWT mouse Event to handleMouse(int, int, int, int) | 
|  int | init()calls init(int, String[])with no args | 
|  int | init(int camIndex,
     int w,
     int h)calls init(int, String[])with cam index and dimensions | 
|  int | init(int argc,
     java.lang.String[] argv)Initialize members based on command line arguments. | 
|  int | init(java.lang.String fname)calls init(int, String[])with video file name | 
|  int | initExt(int argc,
        java.lang.String[] argv,
        int ate)Extra initialization, for subclasses. | 
|  void | mainLoop()Main frame processing loop. | 
| protected  com.googlecode.javacv.FrameGrabber | makeGrabber(int cameraIndex,
            int streamIndex)Hook to allow a JavaCV FrameGrabber to replace the usual OpenCV capture object. | 
| protected  ImageServer | makeServer()Hook to create the ImageServer. | 
|  java.lang.String | mouseEventToString(int event,
                   int x,
                   int y,
                   int flags)Make a human-readable string summarizing a mouse event. | 
| protected  void | msg(java.lang.String m)Display a message to msgStream, if any. | 
| protected  double | nowMS()Current time in milliseconds according to OpenCV clock. | 
| protected  com.googlecode.javacv.cpp.opencv_core.IplImage | process(com.googlecode.javacv.cpp.opencv_core.IplImage frame)Process the given frame. | 
|  void | release()Frees memory, closes windows, and releases resources. | 
| (package private)  boolean | save(java.lang.String filename,
     com.googlecode.javacv.cpp.opencv_core.IplImage image)Save an image to file using the OpenCV API. | 
|  int | setCaptureProperty(com.googlecode.javacv.cpp.opencv_highgui.CvCapture cap,
                   int id,
                   double value)Wraps cvSetCaptureProperty(), catches RuntimeException. | 
| protected  void | updateServerImage()Hook to update serverImage | 
|  void | v4l2DisableAuto()Try to disable all auto stuff for a V4L2 camera. | 
|  void | v4l2EnableAuto()Try to enable all auto stuff for a V4L2 camera. | 
|  float | v4l2GetExposure()Try to get the exposure time on a V4L2 camera. | 
|  void | v4l2SetExposure(float ms)Try to set the exposure time on a V4L2 camera. | 
|  int | waitForKeypresss(int timeoutMS)Wait for a keypress. | 
| protected  void | warn(java.lang.String m)Display a warning to warnStream, if any. | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
public static final boolean DEF_USE_WINDOW
useWindow.
public static final boolean DEF_USE_SERVER
useServer.
public static final boolean DEF_USE_CONSOLE
useConsole.
public static final boolean DEF_USE_CANVAS_FRAME
useCanvasFrame.
 True unless the graphics environment is headless.
public static final java.lang.String DEF_INPUT
public static final int DEF_CAM_W
public static final int DEF_CAM_H
public static final float DEF_MAX_FPS
public static final int DEF_MIN_DELAY_MS
public static final java.lang.String DEF_APPNAME
public static final int DEF_SERVER_PORT
serverPort.
public static final float DEF_SERVER_FPS
serverFPS.
public static final java.text.DecimalFormat FMT
public static final int[] CAP_PROPS
public static final java.lang.String[] CAP_PROP_NAMES
public static final int V4L2_CTRL_CLASS_USER
public static final int V4L2_CTRL_CLASS_MPEG
public static final int V4L2_CTRL_CLASS_CAMERA
public static final int V4L2_CID_BASE
public static final int V4L2_CID_USER_BASE
public static final int V4L2_CID_PRIVATE_BASE
public static final int V4L2_CID_USER_CLASS
public static final int V4L2_CID_BRIGHTNESS
public static final int V4L2_CID_CONTRAST
public static final int V4L2_CID_SATURATION
public static final int V4L2_CID_HUE
public static final int V4L2_CID_AUDIO_VOLUME
public static final int V4L2_CID_AUDIO_BALANCE
public static final int V4L2_CID_AUDIO_BASS
public static final int V4L2_CID_AUDIO_TREBLE
public static final int V4L2_CID_AUDIO_MUTE
public static final int V4L2_CID_AUDIO_LOUDNESS
public static final int V4L2_CID_BLACK_LEVEL
public static final int V4L2_CID_AUTO_WHITE_BALANCE
public static final int V4L2_CID_DO_WHITE_BALANCE
public static final int V4L2_CID_RED_BALANCE
public static final int V4L2_CID_BLUE_BALANCE
public static final int V4L2_CID_GAMMA
public static final int V4L2_CID_WHITENESS
public static final int V4L2_CID_EXPOSURE
public static final int V4L2_CID_AUTOGAIN
public static final int V4L2_CID_GAIN
public static final int V4L2_CID_HFLIP
public static final int V4L2_CID_VFLIP
public static final int V4L2_CID_HCENTER_DEPRECATED
public static final int V4L2_CID_VCENTER_DEPRECATED
public static final int V4L2_CID_POWER_LINE_FREQUENCY
public static final int V4L2_CID_POWER_LINE_FREQUENCY_DISABLED
public static final int V4L2_CID_POWER_LINE_FREQUENCY_50HZ
public static final int V4L2_CID_POWER_LINE_FREQUENCY_60HZ
public static final int V4L2_CID_HUE_AUTO
public static final int V4L2_CID_WHITE_BALANCE_TEMPERATURE
public static final int V4L2_CID_SHARPNESS
public static final int V4L2_CID_BACKLIGHT_COMPENSATION
public static final int V4L2_CID_LASTP1
public static final int V4L2_CID_CAMERA_CLASS_BASE
public static final int V4L2_CID_CAMERA_CLASS
public static final int V4L2_CID_EXPOSURE_AUTO
public static final int V4L2_EXPOSURE_AUTO
public static final int V4L2_EXPOSURE_MANUAL
public static final int V4L2_EXPOSURE_SHUTTER_PRIORITY
public static final int V4L2_EXPOSURE_APERTURE_PRIORITY
public static final int V4L2_CID_EXPOSURE_ABSOLUTE
public static final int V4L2_CID_EXPOSURE_AUTO_PRIORITY
public static final int V4L2_CID_PAN_RELATIVE
public static final int V4L2_CID_TILT_RELATIVE
public static final int V4L2_CID_PAN_RESET
public static final int V4L2_CID_TILT_RESET
public static final int V4L2_CID_PAN_ABSOLUTE
public static final int V4L2_CID_TILT_ABSOLUTE
public static final int V4L2_CID_FOCUS_ABSOLUTE
public static final int V4L2_CID_FOCUS_RELATIVE
public static final int V4L2_CID_FOCUS_AUTO
public static final int[] V4L2_AUTO_PROPS
public static final java.lang.String[] V4L2_AUTO_PROP_NAMES
public static final int[] V4L2_AUTO_PROP_OFF_VALS
public static final int[] V4L2_AUTO_PROP_ON_VALS
protected boolean v4l2Auto
Whether v4l2EnableAuto() was called more recently than v4l2DisableAuto().
public double brightness
public double saturation
public double hue
public double gain
public double exposure
public int width
public int height
public float maxFPS
public int minDelayMS
public java.lang.String appname
public boolean useWindow
public boolean useCanvasFrame
public boolean useServer
ImageServer on serverPort.
public boolean useConsole
ConsoleNonblocking.
public boolean enableExit
System.exit() on fatal errors or user quit.
public boolean paused
public boolean dbg
public ImageServer server
ImageServer, if useServer.
public int serverPort
public float serverFPS
public java.io.PrintStream msgStream
public java.io.PrintStream warnStream
protected com.googlecode.javacv.cpp.opencv_highgui.CvCapture cap
protected com.googlecode.javacv.FrameGrabber grabber
protected int streamIndex
protected com.googlecode.javacv.cpp.opencv_core.IplImage saveImage
protected com.googlecode.javacv.cpp.opencv_core.IplImage capImage
protected com.googlecode.javacv.cpp.opencv_core.IplImage procImage
protected com.googlecode.javacv.cpp.opencv_core.IplImage serverImage
useServer.
protected volatile char serverKey
useServer or 0 if none.
protected int frameN
protected double msPerTick
protected double frameEndMS
protected com.googlecode.javacv.cpp.opencv_highgui.CvMouseCallback mouseCallback
protected com.googlecode.javacv.CanvasFrame canvasFrame
useCanvasFrame.
protected volatile java.awt.event.KeyEvent canvasFrameKeyEvent
canvasFrame iff useCanvasFrame
| Constructor Detail | 
|---|
public CvBase(java.lang.String appname,
              boolean useWindow,
              boolean useCanvasFrame,
              boolean useConsole,
              boolean useServer)
Constructor initializes fields.
Call init(int, String[]) and then mainLoop() to run the
 default application.
public CvBase(boolean useWindow,
              boolean useCanvasFrame,
              boolean useConsole,
              boolean useServer)
DEF_APPNAME.
public CvBase(java.lang.String appname)
public CvBase()
| Method Detail | 
|---|
public static final java.lang.String fmt(double d)
public void finalize()
release().
finalize in class java.lang.Objectpublic void release()
public int init(int argc,
                java.lang.String[] argv)
Initialize members based on command line arguments.
In particular, this constructs cap or grabber (see
 makeGrabber(int, int)) and opens the main window (named appname).
java.lang.IllegalArgumentException - if there was an error initializing the
 inputpublic int init()
init(int, String[]) with no args
public int init(java.lang.String fname)
init(int, String[]) with video file name
public int init(int camIndex,
                int w,
                int h)
init(int, String[]) with cam index and dimensions
public int initExt(int argc,
                   java.lang.String[] argv,
                   int ate)
Extra initialization, for subclasses.
ate - the number of command line arguments already eaten by init(int, String[])
protected ImageServer makeServer()
                          throws java.io.IOException
Hook to create the ImageServer.
Called from init(int, java.lang.String[]) to set server iff useServer
 (and note that field will be overridden if "imserver" or "noimserver"
 command line args are given).
Default impl makes an ImageServer, using serverPort
 and serverFPS, hooks up its ImageServer.msgStream to
 msgStream and ImageServer.warnStream to warnStream, overrides ImageServer.updateImage(java.awt.image.BufferedImage) to read from
 serverImage, and connects ImageServer.handleKey(ohmm.ImageServer.ExchangeState) to handleKey(int) (via serverKey) and ImageServer.handleMouse(ohmm.ImageServer.ExchangeState)
 to handleMouse(int, int, int, int).
java.io.IOException
protected com.googlecode.javacv.FrameGrabber makeGrabber(int cameraIndex,
                                                         int streamIndex)
Hook to allow a JavaCV FrameGrabber to replace the usual OpenCV capture object.
cameraIndex - the OpenCV camera indexstreamIndex - the OpenCV stream index
Default impl only takes action if cameraIndex is in the range 950-999, which is the upper half of the range reserved for CV_CAP_OPENNI=900. In that case we try to use OpenKinectFrameGrabber, which uses libfreenect, if possible, instead of OpenCV which uses OpenNI. This only works if streamIndex is CV_CAP_OPENNI_DEPTH_MAP=0 or CV_CAP_OPENNI_BGR_IMAGE=5.
The stream index sets the default capture image type (the OpenKinectFrameGrabber "format" which can be either "depth" or "video"); the other image type an then be acquired by calling ((OpenKinectFrameGrabber) grabber).grabDepth() or ((OpenKinectFrameGrabber) grabber).grabVideo() specifically, or by changing the grabber format.
protected double nowMS()
protected void cmdHelp()
protected boolean camIndexOptional()
protected void cmdHelpExt()
protected java.lang.String cmdHelpExtParams()
protected void guiHelp()
protected void guiHelpExt()
public void dumpCaptureProperties()
CAP_PROPS
protected com.googlecode.javacv.cpp.opencv_core.IplImage process(com.googlecode.javacv.cpp.opencv_core.IplImage frame)
Process the given frame.
Default impl is identity.
Note that the passed image may not be mutated. So to do any significant processing, you will need to allocate your own return image. It is typically best to do this once for the first frame, store the results in subclass instance variables, and then deallocate any allocated space in the subclass destructor.
All frames are guaranteed to have the same dimensions and pixel format.
This will be called for every iteration of mainLoop(), even while
 paused.  You may use the various instance fields (frameN, capImage, paused, dbg, etc) to determine what
 operations to perform.  Of course, when writing a subclass, you may also
 add your own fields.
protected boolean doneProcessing()
Hook to check if mainLoop() should end.
Default impl returns false.
protected boolean handleKey(int code)
Handle keypresses.
protected boolean handleKeyExt(int code)
Keypresses not handled by the default implementation of handleKey() are passed here.
Default impl just prints the keycode.
Overriding this is one way that subclasses can handle extra keypresses.
protected void handleMouse(int event,
                           int x,
                           int y,
                           int flags)
Handle mouse events.
event - one of the CV_EVENT_* constants (see opencv_highgui.java in
 the JavaCV sources for a list)x - the x pixel coordinate of the mouse eventy - the y pixel coordinate of the mouse eventflags - bitmask of the CV_EVENT_FLAG_* constants (see
 opencv_highgui.java in the JavaCV sources for a list)
 Default impl prints a message using mouseEventToString(int, int, int, int) except
 for CV_EVENT_MOUSEMOVE.
Overriding this is one way that subclasses can handle mouse events.
protected void handleMouse(java.awt.event.MouseEvent e)
handleMouse(int, int, int, int)
public java.lang.String mouseEventToString(int event,
                                           int x,
                                           int y,
                                           int flags)
Make a human-readable string summarizing a mouse event.
See handleMouse(int, int, int, int).
boolean save(java.lang.String filename,
             com.googlecode.javacv.cpp.opencv_core.IplImage image)
Save an image to file using the OpenCV API.
public void mainLoop()
Main frame processing loop.
Default impl does the following in an infinite loop:
doneProcessing()cap:streamIndex or JavaCV grabber if the former is nullprocess(com.googlecode.javacv.cpp.opencv_core.IplImage)useWindow and the user closed the OpenCV window or if
 useCanvasFrame and the user closed the JavaCV canvas frameprocess(com.googlecode.javacv.cpp.opencv_core.IplImage), if not null, inuseWindowCanvasFrame iff useCanvasFrameupdateServerImage() hookdoneProcessing()maxFPS), handling user keypresses via handleKey(int)Thread.interrupted()
protected void updateServerImage()
Hook to update serverImage
Default impl does nothing if server or procImage is
 null.  Otherwise it synchronizes on server, (re-)allocates serverImage to match procImage iff necessary, and then copies
 procImage to serverImage.
public int waitForKeypresss(int timeoutMS)
                     throws java.lang.InterruptedException
Wait for a keypress.
timeoutMS - maximum time to wait or 0 to wait forever
 Returns when the first keypress is detected in the OpenCV window iff
 useWindow, any canvasFrame iff useCanvasFrame,
 any client connected to the server iff that field is non-null, or
 the console if useConsole.Throws:
java.lang.InterruptedExceptionpublic void v4l2DisableAuto()
Try to disable all auto stuff for a V4L2 camera.
Call e.g. from initExt(int, java.lang.String[], int).
public void v4l2EnableAuto()
Try to enable all auto stuff for a V4L2 camera.
Call e.g. from initExt(int, java.lang.String[], int).
public void v4l2SetExposure(float ms)
Try to set the exposure time on a V4L2 camera.
ms - the new exposure time in milliseconds (0.1ms resolution) if
 positive, else set auto exposurepublic float v4l2GetExposure()
Try to get the exposure time on a V4L2 camera.
public int setCaptureProperty(com.googlecode.javacv.cpp.opencv_highgui.CvCapture cap,
                              int id,
                              double value)
Wraps cvSetCaptureProperty(), catches RuntimeException.
public double getCaptureProperty(com.googlecode.javacv.cpp.opencv_highgui.CvCapture cap,
                                 int id)
Wraps cvGetCaptureProperty(), catches RuntimeException.
protected void msg(java.lang.String m)
msgStream, if any.
protected void warn(java.lang.String m)
warnStream, if any.
protected java.lang.String getDefAppname()
protected java.lang.String getDefInput()
| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||