public class Kinect
extends java.lang.Object
Constructor and Description |
---|
Kinect(java.lang.String dllPath,
java.lang.String title,
int ulx,
int uly,
int width,
int height,
long windowStyle)
Same as Kinect(dllPath, title, ulx, uly, width, height, windowStyle,
" audioBufferSize) with audioBufferSize = 0 (sound level detection disabled).
|
Kinect(java.lang.String dllPath,
java.lang.String title,
int ulx,
int uly,
int width,
int height,
long windowStyle,
int audioBufferSize)
Creates an abstraction of Microsoft's Kinect device using the
Java Native Interface (JNI) and the Java API Wrapper (JAW).
|
Modifier and Type | Method and Description |
---|---|
void |
addCloseListener(KinectCloseListener listener)
Registers a callback that is called when the close button of the native
window is hit.
|
void |
addSoundLevelListener(SoundLevelListener listener)
Registers a SoundLevelListener for sound level detection.
|
static void |
delay(int timeout)
Delays current thread execution for given amount of time.
|
void |
doBMPSnapShot(java.lang.String filename)
Performs a native snap shot of the current image and copies it in the given
file in BMP format by native code.
|
boolean |
doGIFSnapShot(java.lang.String filename)
Performs snap shot of the current image and copies it in the given
file in GIF format by Java code.
|
boolean |
doJPGSnapShot(java.lang.String filename)
Performs snap shot of the current image and copies it in the given
file in JPG format by Java code.
|
boolean |
doPNGSnapShot(java.lang.String filename)
Performs snap shot of the current image and copies it in the given
file in PNG format by Java code.
|
void |
enableClose(boolean enable)
Enables/disables notification of clicking the title bar's close button.
|
void |
enableSoundDirection(boolean enabled)
Enables/disable the native sound direction finder.
|
int |
getCameraElevationAngle()
Returns the current camera elevation angle.
|
int |
getCameraMaximumElevationAngle()
Returns the maximum camera elevation angle.
|
int |
getCameraMinimumElevationAngle()
Returns the minimum camera elevation angle.
|
java.awt.image.BufferedImage |
getImage()
Returns a snap shot image of the current video image for further treatment
by the Java code.
|
int |
getJoints(Point3D[] joints,
int timeout)
Returns the new 20 skeleton points and the skeleton identifier
as soon as they are available.
|
java.lang.String |
getLoadedDllName()
Returns the name of the loaded native library.
|
NativeHandler |
getNativeHandler()
Returns the NativeHandler instance reference used for communication with the
native dll.
|
SoundDirection |
getSoundDirection()
Asks the native sound detection finder to deliver the last
detected sound direction and its confidence level.
|
int |
getSoundLevel()
Returns the maximum level of the last captured sound sample.
|
int |
getSystemMetrics(int metricsIndex)
Returns the system metrics of the native windowing system.
|
static java.lang.String |
getVersion()
Returns current version information.
|
static boolean |
is64bit()
Returns true, if the Windows operating system is 64 bit.
|
boolean |
isInitialized()
Returns true, if the initialization of the Kinect device was successful after
creating the Kinect class instance.
|
boolean |
setCameraElevationAngle(int angle)
You should tilt the Kinect sensor as few times as possible,
to minimize wear on the camera and to minimize tilting time.
|
void |
setTitle(java.lang.String text)
Sets the title of the native window.
|
void |
setVisible(boolean visible)
Sets the visibility of the native video window.
|
void |
setWindowScaleFactor(int windowScaleFactor)
Sets a new window scale factor.
|
public Kinect(java.lang.String dllPath, java.lang.String title, int ulx, int uly, int width, int height, long windowStyle)
public Kinect(java.lang.String dllPath, java.lang.String title, int ulx, int uly, int width, int height, long windowStyle, int audioBufferSize)
dllPath
- the path to the native library DLL. Provide either the full
path (Drive:/Directory/Filename) or the DLL name without extension.
In the latter case, the DLL is searched in the Windows system path.title
- the title displayed in the native video windowulx
- the upper left x of the native video window (in screen pixels)uly
- the upper left y of the native video window (in screen pixels)width
- the width of the native video windowheight
- the height of the native video windowwindowStyle
- the Window style (see the fields in ch.aplu.jaw.NativeHandler).
The native video window may be hiddenaudioBufferSize
- the size in bytes used for sound level detection.
The following audio format is used: 22050 Hz sampling rate, 8 bit, mono, signed, little endian.
For audioBufferSize < 0, sound leve detection is disabled.NativeHandler
public void addSoundLevelListener(SoundLevelListener listener)
listener
- the SoundLevelListener to register.public int getSoundLevel()
public int getJoints(Point3D[] joints, int timeout)
joints
- the 20 joint coordinates passed backtimeout
- the maximum time to wait for a valid skeleton (in units of 10 ms),
<= 0 to wait indefinitely.public void enableClose(boolean enable)
enable
- if true, the notification is enabled, otherwise the
application terminates when the close button is hit.public void addCloseListener(KinectCloseListener listener)
listener
- the listener that gets the close notificationpublic static void delay(int timeout)
timeout
- the time to sleep (in ms)public java.awt.image.BufferedImage getImage()
public void doBMPSnapShot(java.lang.String filename)
filename
- the snap shot filepublic boolean doPNGSnapShot(java.lang.String filename)
filename
- the snap shot filepublic boolean doGIFSnapShot(java.lang.String filename)
filename
- the snap shot filepublic boolean doJPGSnapShot(java.lang.String filename)
filename
- the snap shot filepublic boolean setCameraElevationAngle(int angle)
angle
- to elevation angle in degrees. Zero indicates that the sensor
array should point exactly horizontally. Positive values indicate that
the sensor array should point above the horizon, and negative values
indicate that the sensor array should point below the horizon.
The values are limited to the interval between getCameraMinimumElevationAngle()
and getCameraMaximumElevationAngle().public int getCameraElevationAngle()
public int getCameraMinimumElevationAngle()
public int getCameraMaximumElevationAngle()
public boolean isInitialized()
public static boolean is64bit()
public void setVisible(boolean visible)
visible
- if true, the window is showed; otherwise it is hidden
+public NativeHandler getNativeHandler()
public java.lang.String getLoadedDllName()
public void setTitle(java.lang.String text)
text
- the new text in the window title barpublic int getSystemMetrics(int metricsIndex)
metricsIndex
- (search Internet 'msdn GetSystemMetrics'public static java.lang.String getVersion()
public void setWindowScaleFactor(int windowScaleFactor)
windowScaleFactor
- the new scale factor applied to x- and y-coordinatespublic void enableSoundDirection(boolean enabled)
enabled
- if true, enables the native sound direction scanner; if false,
releases all sound resourcespublic SoundDirection getSoundDirection()