public class KinectController extends Object
| Modifier and Type | Field and Description |
|---|---|
protected static List<KinectController> |
ACTIVE_CONTROLLERS |
protected static org.bridj.Pointer<libfreenectLibrary.freenect_context> |
CONTEXT |
KinectDepthStream |
depthStream
The depth stream
|
protected org.bridj.Pointer<libfreenectLibrary.freenect_device> |
device |
protected static org.openimaj.hardware.kinect.EventThread |
EVENT_THREAD |
KinectStream<?> |
videoStream
The RGB or IR video stream
|
| Constructor and Description |
|---|
KinectController()
Default constructor.
|
KinectController(boolean irmode)
Construct with the first device in the given mode.
|
KinectController(int deviceId)
Construct with given device
|
KinectController(int deviceId,
boolean irmode,
boolean registeredDepthMode)
Construct with the given device and mode.
|
| Modifier and Type | Method and Description |
|---|---|
float[][] |
cameraToWorld(FImage regDepth,
int startx,
int stopx,
int stepx,
int starty,
int stopy,
int stepy)
Compute the world coordinates from the pixel locations in the given
registered depth image.
|
double[] |
cameraToWorld(int x,
int y,
int depth)
Compute the world coordinates from the pixel location and registered
depth.
|
float[] |
cameraToWorld(int x,
int y,
int depth,
double factor)
Compute the world coordinates from the pixel location and registered
depth.
|
float[] |
cameraToWorld(int x,
int y,
int depth,
double factor,
float[] pt)
Compute the world coordinates from the pixel location and registered
depth.
|
void |
close()
Close the device.
|
double |
computeScalingFactor()
Compute the scaling factor for computing world coordinates.
|
static int |
connectedDevices()
Get the number of connected devices.
|
void |
finalize() |
KinectAcceleration |
getAcceleration()
Get the current acceleration values from the device
|
double |
getTilt()
Get the current angle in degrees
|
KinectTiltStatus |
getTiltStatus()
Determine the current tilt status of the device
|
void |
identify()
Sets the LEDs to blink red and yellow for five seconds before resetting
to green.
|
static void |
main(String[] args)
Test
|
void |
setIRMode(boolean irmode)
Switch the main camera between InfraRed and RGB modes.
|
void |
setLED(KinectLEDMode option)
Set the device status LEDs
|
void |
setRegisteredDepth(boolean rdepth)
Set whether depth should be registered
|
void |
setTilt(double angle)
Set the tilt to the given angle in degrees
|
static void |
shutdownFreenect()
Completely shutdown the context.
|
protected static volatile org.bridj.Pointer<libfreenectLibrary.freenect_context> CONTEXT
protected static volatile org.openimaj.hardware.kinect.EventThread EVENT_THREAD
protected static volatile List<KinectController> ACTIVE_CONTROLLERS
protected org.bridj.Pointer<libfreenectLibrary.freenect_device> device
public KinectStream<?> videoStream
public KinectDepthStream depthStream
public KinectController(int deviceId) throws KinectException
deviceId - the device idKinectExceptionpublic KinectController(boolean irmode) throws KinectException
irmode - if true then the camera is set to IR mode; otherwise its in
RGB modeKinectExceptionpublic KinectController() throws KinectException
KinectExceptionpublic KinectController(int deviceId, boolean irmode, boolean registeredDepthMode) throws KinectException
deviceId - the device identifier. 0 for the first one.irmode - whether to use infra-red mode or rgb mode.registeredDepthMode - whether to register the depth image. If true, depth
measurements are in millimeters.KinectExceptionpublic static void shutdownFreenect()
public void setIRMode(boolean irmode)
irmode - if true, then switches to IR mode, otherwise switches to RGB
mode.public void setRegisteredDepth(boolean rdepth)
rdepth - if true, then switches to depth registered mode, otherwise
depth is not registeredpublic static int connectedDevices() throws KinectException
KinectExceptionpublic void close()
public double getTilt()
public void setTilt(double angle)
angle - the anglepublic KinectTiltStatus getTiltStatus()
public void setLED(KinectLEDMode option)
option - the LED status to setpublic void identify()
public KinectAcceleration getAcceleration()
public double[] cameraToWorld(int x, int y, int depth)
x - pixel x-ordinatey - pixel y-ordinatedepth - the depthpublic double computeScalingFactor()
cameraToWorld(int, int, int, double)public float[] cameraToWorld(int x, int y, int depth, double factor)
computeScalingFactor(), but it should be faster than using
cameraToWorld(int, int, int).x - pixel x-ordinatey - pixel y-ordinatedepth - the depthfactor - the scaling factorpublic float[] cameraToWorld(int x, int y, int depth, double factor, float[] pt)
computeScalingFactor(), but it should be faster than using
cameraToWorld(int, int, int).
This method is the same as cameraToWorld(int, int, int, double),
but reuses the point array for efficiency.x - pixel x-ordinatey - pixel y-ordinatedepth - the depthfactor - pt - the point to write topublic float[][] cameraToWorld(FImage regDepth, int startx, int stopx, int stepx, int starty, int stopy, int stepy)
regDepth - the registered depth imagestartx - the starting x-ordinate in the imagestopx - the stopping x-ordinate in the imagestepx - the number of pixels in the x direction to skip between
samplesstarty - the starting y-ordinate in the imagestopy - the stopping y-ordinate in the imagestepy - the number of pixels in the y direction to skip between
samplespublic static void main(String[] args) throws KinectException
args - KinectException