|
|||||||||
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
useWindow
useCanvasFrame
serverPort
iff useServer
(see CvBase.ImageServer
)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.
Nested Class Summary | |
---|---|
protected class |
CvBase.ExchangeHandler
Http exchange handler for CvBase.ImageServer , see which. |
protected class |
CvBase.ImageServer
HTTP multipart/x-mixed-replace image server. |
Field Summary | |
---|---|
java.lang.String |
appname
Application name. |
double |
brightness
OpenCV capgure property override or NaN to use default |
protected com.googlecode.javacv.CanvasFrame |
canvasFrame
The JavaCV CanvasFrame, iff useCanvasFrame . |
protected java.awt.event.KeyEvent |
canvasFrameKeyEvent
Last KeyEvent on canvasFrame iff useCanvasFrame |
protected com.googlecode.javacv.cpp.opencv_highgui.CvCapture |
cap
The OpenCV capture object, if used. |
static java.lang.String[] |
CAP_PROP_NAMES
OpenCV capture property names |
static int[] |
CAP_PROPS
OpenCV capture properties |
protected com.googlecode.javacv.cpp.opencv_core.IplImage |
capImage
Most recently captured image, if any (do not mutate or free). |
boolean |
dbg
Whether debug is requested for next frame. |
static java.lang.String |
DEF_APPNAME
Default application name. |
static int |
DEF_CAM_H
Default width and height for camera input. |
static int |
DEF_CAM_W
Default width and height for camera input. |
static java.lang.String |
DEF_INPUT
Default input specification (use next available camera). |
static float |
DEF_MAX_FPS
Default maximum frames per second for processing and local display. |
static float |
DEF_MAX_SERVER_FPS
Default maximum frames per second for server. |
static int |
DEF_MIN_DELAY_MS
Default minimum inter-frame delay in ms. |
static java.lang.String |
DEF_SERVER_FORMAT
Default server ImageIO format name. |
static java.lang.String |
DEF_SERVER_MIME_TYPE
Default server image mime type. |
static int |
DEF_SERVER_PORT
Default CvBase.ImageServer TCP port. |
double |
exposure
OpenCV capgure property override or NaN to use default |
static java.text.DecimalFormat |
FMT
Number formatter. |
protected double |
frameEndMS
Last frame end time. |
protected int |
frameN
Most recent captured frame number. |
double |
gain
OpenCV capgure property override or NaN to use default |
protected com.googlecode.javacv.FrameGrabber |
grabber
The JavaCV frame grabber, if used. |
int |
height
Capture dimensions. |
static int |
HTTP_FORBIDDEN
HTTP response codes |
static int |
HTTP_NOT_FOUND
HTTP response codes |
static int |
HTTP_OK
HTTP response codes |
double |
hue
OpenCV capgure property override or NaN to use default |
float |
maxFPS
Maximum frames per second. |
float |
maxServerFPS
Maximum server framerate. |
private static java.lang.String |
MIME_BOUNDARY
MIME multipart boundary |
int |
minDelayMS
Minimum inter-frame delay. |
protected com.googlecode.javacv.cpp.opencv_highgui.CvMouseCallback |
mouseCallback
Mouse event callback object. |
protected double |
msPerTick
Milliseconds per OpenCV clock tick. |
boolean |
paused
Whether processing is currently paused. |
protected com.googlecode.javacv.cpp.opencv_core.IplImage |
procImage
Most recently processed image, if any (do not free). |
double |
saturation
OpenCV capgure property override or NaN to use default |
protected com.googlecode.javacv.cpp.opencv_core.IplImage |
saveImage
The file save image, if any (freed by destructor iff allocated). |
protected CvBase.ImageServer |
server
The CvBase.ImageServer , if useServer . |
static java.lang.String |
SERVER_HTML
Server html file. |
protected boolean |
serverActive
Whether the server is currently serving images. |
boolean |
serverDBG
Debug next server frame. |
java.lang.String |
serverFormat
Image format for the CvBase.ImageServer |
protected com.googlecode.javacv.cpp.opencv_core.IplImage |
serverImage
Current server image, if any and if useServer |
protected boolean |
serverImagePending
Whether a fresh serverImage is ready. |
protected char |
serverKey
Last key char from serer iff useServer or 0 if none |
protected java.lang.Object |
serverLock
Synchronization lock for server state. |
java.lang.String |
serverMimeType
Image format for the CvBase.ImageServer |
int |
serverPort
TCP port for the CvBase.ImageServer |
protected int |
streamIndex
The OpenCV capture stream index. |
private static java.lang.String |
svnid
|
boolean |
useCanvasFrame
Whether to open and use a JavaCV CanvasFrame. |
boolean |
useConsole
Whether to look for keypresses with ConsoleNonblocking . |
boolean |
useServer
Whether to start an CvBase.ImageServer on serverPort . |
boolean |
useWindow
Whether to open and use an OpenCV window. |
static java.lang.String[] |
V4L2_AUTO_PROP_NAMES
V4L2 auto camera property names |
static int[] |
V4L2_AUTO_PROP_OFF_VALS
V4L2 auto camera property off values |
static int[] |
V4L2_AUTO_PROP_ON_VALS
V4L2 auto camera property on values |
static int[] |
V4L2_AUTO_PROPS
V4L2 auto camera properties |
static int |
V4L2_CID_AUDIO_BALANCE
V4L2 control constants |
static int |
V4L2_CID_AUDIO_BASS
V4L2 control constants |
static int |
V4L2_CID_AUDIO_LOUDNESS
V4L2 control constants |
static int |
V4L2_CID_AUDIO_MUTE
V4L2 control constants |
static int |
V4L2_CID_AUDIO_TREBLE
V4L2 control constants |
static int |
V4L2_CID_AUDIO_VOLUME
V4L2 control constants |
static int |
V4L2_CID_AUTO_WHITE_BALANCE
V4L2 control constants |
static int |
V4L2_CID_AUTOGAIN
V4L2 control constants |
static int |
V4L2_CID_BACKLIGHT_COMPENSATION
V4L2 control constants |
static int |
V4L2_CID_BASE
V4L2 control constants |
static int |
V4L2_CID_BLACK_LEVEL
V4L2 control constants |
static int |
V4L2_CID_BLUE_BALANCE
V4L2 control constants |
static int |
V4L2_CID_BRIGHTNESS
V4L2 control constants |
static int |
V4L2_CID_CAMERA_CLASS
V4L2 control constants |
static int |
V4L2_CID_CAMERA_CLASS_BASE
V4L2 control constants |
static int |
V4L2_CID_CONTRAST
V4L2 control constants |
static int |
V4L2_CID_DO_WHITE_BALANCE
V4L2 control constants |
static int |
V4L2_CID_EXPOSURE
V4L2 control constants |
static int |
V4L2_CID_EXPOSURE_ABSOLUTE
V4L2 control constants |
static int |
V4L2_CID_EXPOSURE_AUTO
V4L2 control constants |
static int |
V4L2_CID_EXPOSURE_AUTO_PRIORITY
V4L2 control constants |
static int |
V4L2_CID_FOCUS_ABSOLUTE
V4L2 control constants |
static int |
V4L2_CID_FOCUS_AUTO
V4L2 control constants |
static int |
V4L2_CID_FOCUS_RELATIVE
V4L2 control constants |
static int |
V4L2_CID_GAIN
V4L2 control constants |
static int |
V4L2_CID_GAMMA
V4L2 control constants |
static int |
V4L2_CID_HCENTER_DEPRECATED
V4L2 control constants |
static int |
V4L2_CID_HFLIP
V4L2 control constants |
static int |
V4L2_CID_HUE
V4L2 control constants |
static int |
V4L2_CID_HUE_AUTO
V4L2 control constants |
static int |
V4L2_CID_LASTP1
V4L2 control constants |
static int |
V4L2_CID_PAN_ABSOLUTE
V4L2 control constants |
static int |
V4L2_CID_PAN_RELATIVE
V4L2 control constants |
static int |
V4L2_CID_PAN_RESET
V4L2 control constants |
static int |
V4L2_CID_POWER_LINE_FREQUENCY
V4L2 control constants |
static int |
V4L2_CID_POWER_LINE_FREQUENCY_50HZ
V4L2 control constants |
static int |
V4L2_CID_POWER_LINE_FREQUENCY_60HZ
V4L2 control constants |
static int |
V4L2_CID_POWER_LINE_FREQUENCY_DISABLED
V4L2 control constants |
static int |
V4L2_CID_PRIVATE_BASE
V4L2 control constants |
static int |
V4L2_CID_RED_BALANCE
V4L2 control constants |
static int |
V4L2_CID_SATURATION
V4L2 control constants |
static int |
V4L2_CID_SHARPNESS
V4L2 control constants |
static int |
V4L2_CID_TILT_ABSOLUTE
V4L2 control constants |
static int |
V4L2_CID_TILT_RELATIVE
V4L2 control constants |
static int |
V4L2_CID_TILT_RESET
V4L2 control constants |
static int |
V4L2_CID_USER_BASE
V4L2 control constants |
static int |
V4L2_CID_USER_CLASS
V4L2 control constants |
static int |
V4L2_CID_VCENTER_DEPRECATED
V4L2 control constants |
static int |
V4L2_CID_VFLIP
V4L2 control constants |
static int |
V4L2_CID_WHITE_BALANCE_TEMPERATURE
V4L2 control constants |
static int |
V4L2_CID_WHITENESS
V4L2 control constants |
static int |
V4L2_CTRL_CLASS_CAMERA
V4L2 control constants |
static int |
V4L2_CTRL_CLASS_MPEG
V4L2 control constants |
static int |
V4L2_CTRL_CLASS_USER
V4L2 control constants |
static int |
V4L2_EXPOSURE_APERTURE_PRIORITY
V4L2 control constants |
static int |
V4L2_EXPOSURE_AUTO
V4L2 control constants |
static int |
V4L2_EXPOSURE_MANUAL
V4L2 control constants |
static int |
V4L2_EXPOSURE_SHUTTER_PRIORITY
V4L2 control constants |
protected boolean |
v4l2Auto
Whether v4l2EnableAuto() was called more recently than v4l2DisableAuto() . |
int |
width
Capture dimensions. |
Constructor Summary | |
---|---|
CvBase()
Uses DEF_APPNAME . |
|
CvBase(java.lang.String appname)
Constructor initializes members. |
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. |
static double |
getCaptureProperty(com.googlecode.javacv.cpp.opencv_highgui.CvCapture cap,
int id)
Wraps cvGetCaptureProperty(), catches RuntimeException. |
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. |
java.lang.String |
mouseEventToString(int event,
int x,
int y,
int flags)
Make a human-readable string summarizing a mouse event. |
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. |
static int |
setCaptureProperty(com.googlecode.javacv.cpp.opencv_highgui.CvCapture cap,
int id,
double value)
Wraps cvSetCaptureProperty(), catches RuntimeException. |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final java.lang.String svnid
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 float DEF_MAX_SERVER_FPS
public static final int DEF_MIN_DELAY_MS
public static java.lang.String DEF_APPNAME
public static final java.text.DecimalFormat FMT
public static final int DEF_SERVER_PORT
CvBase.ImageServer
TCP port.
public static final java.lang.String DEF_SERVER_MIME_TYPE
public static final java.lang.String DEF_SERVER_FORMAT
public static final java.lang.String SERVER_HTML
public static final int HTTP_OK
public static final int HTTP_NOT_FOUND
public static final int HTTP_FORBIDDEN
private static final java.lang.String MIME_BOUNDARY
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
CvBase.ImageServer
on serverPort
.
public boolean useConsole
ConsoleNonblocking
.
public int serverPort
CvBase.ImageServer
public volatile java.lang.String serverMimeType
CvBase.ImageServer
public volatile java.lang.String serverFormat
CvBase.ImageServer
public boolean paused
public boolean dbg
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 CvBase.ImageServer server
CvBase.ImageServer
, if useServer
.
protected com.googlecode.javacv.cpp.opencv_core.IplImage serverImage
useServer
protected java.lang.Object serverLock
protected volatile boolean serverImagePending
serverImage
is ready.
protected volatile boolean serverActive
public volatile float maxServerFPS
public volatile boolean serverDBG
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)
Constructor initializes members.
Call init(int, String[])
and then mainLoop()
to run the
default application.
public CvBase()
DEF_APPNAME
.
Method Detail |
---|
public static final java.lang.String fmt(double d)
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_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 finalize()
release()
.
finalize
in class java.lang.Object
public 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
).
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.
public 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[])
public void mainLoop()
Main frame processing loop.
Default impl acquires a new frame from cap
streamIndex
or grabber
, calls process(com.googlecode.javacv.cpp.opencv_core.IplImage)
, displays the
result (if any), quits if doneProcessing()
, otherwise delays for
the remainder of the minimum frame time (inverse of maxFPS
),
handles user input, and then loops.
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 useServer
, or the
console if useConsole
.Throws:
java.lang.InterruptedException
public 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 static int setCaptureProperty(com.googlecode.javacv.cpp.opencv_highgui.CvCapture cap, int id, double value)
Wraps cvSetCaptureProperty(), catches RuntimeException.
public static double getCaptureProperty(com.googlecode.javacv.cpp.opencv_highgui.CvCapture cap, int id)
Wraps cvGetCaptureProperty(), catches RuntimeException.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |