Interface LeapC
- All Superinterfaces:
Library
The main interface for interacting with the UltraLeap C API.
Use LeapC.INSTANCE
to obtain an instance of this interface
that is linked to the native API using JNA. After that all API methods can be
called on that instance in a similar way to how the C API is used.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.sun.jna.Library
Library.Handler
-
Field Summary
FieldsFields inherited from interface com.sun.jna.Library
OPTION_ALLOW_OBJECTS, OPTION_CALLING_CONVENTION, OPTION_CLASSLOADER, OPTION_FUNCTION_MAPPER, OPTION_INVOCATION_MAPPER, OPTION_OPEN_FLAGS, OPTION_STRING_ENCODING, OPTION_STRUCTURE_ALIGNMENT, OPTION_TYPE_MAPPER
-
Method Summary
Modifier and TypeMethodDescriptionvoid
LeapCameraMatrix
(Pointer hConnection, int camera, PrimitiveArrayPointer dest) Returns an OpenCV-compatible camera matrix.void
LeapCameraMatrixEx
(Pointer hConnection, Pointer hDevice, int camera, PrimitiveArrayPointer dest) Returns an OpenCV-compatible camera matrix for a particular device.void
LeapCloseConnection
(Pointer hConnection) Closes a previously opened connection.void
LeapCloseDevice
(Pointer hDevice) Closes a device handle previously opened withLeapOpenDevice(LEAP_DEVICE_REF, LEAP_DEVICE)
.LeapCreateClockRebaser
(LEAP_CLOCK_REBASER phClockRebaser) Initializes a new Leap clock-rebaser handle object.LeapCreateConnection
(LEAP_CONNECTION_CONFIG pConfig, LEAP_CONNECTION phConnection) Creates a new connection to the Ultraleap Tracking Service and stores a handle for the connection in the providedLEAP_CONNECTION
.void
LeapDestroyClockRebaser
(Pointer hClockRebaser) Destroys a previously created clock-rebaser object.void
LeapDestroyConnection
(Pointer hConnection) Destroys a previously opened connection.LeapDevicePIDToString
(int pid) Provides the human-readable canonical name of the specified device model.void
LeapDistortionCoeffs
(Pointer hConnection, int camera, PrimitiveArrayPointer dest) Returns an OpenCV-compatible lens distortion using the 8-parameter rational model.void
LeapDistortionCoeffsEx
(Pointer hConnection, Pointer hDevice, int camera, PrimitiveArrayPointer dest) Returns an OpenCV-compatible lens distortion for a particular device, using the 8-parameter rational model.void
LeapExtrinsicCameraMatrix
(Pointer hConnection, int camera, PrimitiveArrayPointer dest) This finds the default device and returns the resultLeapExtrinsicCameraMatrixEx(Pointer, Pointer, int, PrimitiveArrayPointer)
.void
LeapExtrinsicCameraMatrixEx
(Pointer hConnection, Pointer hDevice, int camera, PrimitiveArrayPointer dest) Returns a transformation matrix from 3D Leap coordinate space to the coordinate system of the requested camera This is composed of a 4 x 4 matrix of the form:LeapGetConnectionInfo
(Pointer hConnection, LEAP_CONNECTION_INFO pInfo) Retrieves status information about the specified connection.LeapGetDeviceInfo
(Pointer hDevice, LEAP_DEVICE_INFO info) Gets device properties.LeapGetDeviceList
(Pointer hConnection, ArrayPointer<LEAP_DEVICE_REF> pArray, IntByReference pnArray) Retrieves a list of Ultraleap Tracking camera devices currently attached to the system.LeapGetDeviceTransform
(Pointer hDevice, PrimitiveArrayPointer transform) Get the transform to world coordinates from 3D Leap coordinates.LeapGetFrameSize
(Pointer hConnection, long timestamp, LongByReference pncbEvent) Retrieves the number of bytes required to allocate an interpolated frame at the specified time.LeapGetFrameSizeEx
(Pointer hConnection, Pointer hDevice, long timestamp, LongByReference pncbEvent) Retrieves the number of bytes required to allocate an interpolated frame at the specified time for a particular device.long
Samples the universal clock used by the system to timestamp image and tracking frames.LeapGetPointMapping
(Pointer hConnection, LEAP_POINT_MAPPING pointMapping, LongByReference pSize) Deprecated.This function is no longer supported.LeapGetPointMappingSize
(Pointer hConnection, LongByReference pSize) Deprecated.This function is no longer supported.LeapGetTrackingMode
(Pointer hConnection) Requests the currently set tracking mode.LeapGetTrackingModeEx
(Pointer hConnection, Pointer hDevice) Requests the currently set tracking mode.LeapGetVersion
(Pointer hConnection, int versionPart, LEAP_VERSION pVersion) Returns the version of a specified part of the system.LeapInterpolateFrame
(Pointer hConnection, long timestamp, LEAP_TRACKING_EVENT pEvent, long ncbEvent) Constructs a frame at the specified timestamp by interpolating between measured frames.LeapInterpolateFrameEx
(Pointer hConnection, Pointer hDevice, long timestamp, LEAP_TRACKING_EVENT pEvent, long ncbEvent) Constructs a frame at the specified timestamp for a particular device by interpolating between measured frames.LeapInterpolateFrameFromTime
(Pointer hConnection, long timestamp, long sourceTimestamp, LEAP_TRACKING_EVENT pEvent, long ncbEvent) Constructs a frame at the specified timestamp by interpolating between a frame near the timestamp and a frame near the sourceTimestamp.LeapInterpolateFrameFromTimeEx
(Pointer hConnection, Pointer hDevice, long timestamp, long sourceTimestamp, LEAP_TRACKING_EVENT pEvent, long ncbEvent) Constructs a frame at the specified timestamp for a particular device by interpolating between a frame near the timestamp and a frame near the sourceTimestamp.LeapInterpolateHeadPose
(Pointer hConnection, long timestamp, LEAP_HEAD_POSE_EVENT pEvent) Deprecated.This function is no longer supported.LeapOpenConnection
(Pointer hConnection) Opens a connection to the Ultraleap Tracking Service.LeapOpenDevice
(LEAP_DEVICE_REF rDevice, LEAP_DEVICE phDevice) Opens a device reference and retrieves a handle to the device.LeapPixelToRectilinear
(Pointer hConnection, int camera, LEAP_VECTOR.ByValue pixel) Provides the corrected camera ray intercepting the specified point on the image.LeapPixelToRectilinearEx
(Pointer hConnection, Pointer hDevice, int camera, LEAP_VECTOR.ByValue pixel) Provides the corrected camera ray intercepting the specified point on the image for a particular device.LeapPollConnection
(Pointer hConnection, int timeout, LEAP_CONNECTION_MESSAGE message) Polls the connection for a new event.LeapRebaseClock
(Pointer hClockRebaser, long userClock, LongByReference pLeapClock) Computes the Ultraleap Tracking Service clock corresponding to a specified application clock value.LeapRecordingClose
(LEAP_RECORDING ppRecording) Closes aLEAP_RECORDING
.LeapRecordingGetStatus
(Pointer pRecording, LEAP_RECORDING_STATUS pStatus) Fills in aLEAP_RECORDING_STATUS
struct for an open recording.LeapRecordingOpen
(LEAP_RECORDING ppRecording, String filePath, LEAP_RECORDING_PARAMETERS params) Opens or creates aLEAP_RECORDING
.LeapRecordingRead
(Pointer pRecording, LEAP_TRACKING_EVENT pEvent, long ncbEvent) Reads a tracking frame from aLEAP_RECORDING
file.LeapRecordingReadSize
(Pointer pRecording, LongByReference pncbEvent) Retrieves the number of bytes required to allocate the next frame in a recording.LeapRecordingWrite
(Pointer pRecording, LEAP_TRACKING_EVENT pEvent, LongByReference pnBytesWritten) Writes a tracking frame to aLEAP_RECORDING
file.LeapRectilinearToPixel
(Pointer hConnection, int camera, LEAP_VECTOR.ByValue rectilinear) Provides the point in the image corresponding to a ray projecting from the camera.LeapRectilinearToPixelEx
(Pointer hConnection, Pointer hDevice, int camera, LEAP_VECTOR.ByValue rectilinear) Provides the point in the image corresponding to a ray projecting from the camera for a particular device.LeapRequestConfigValue
(Pointer hConnection, String key, LongByReference pRequestID) Requests the current value of a service configuration setting.LeapSaveConfigValue
(Pointer hConnection, String key, LEAP_VARIANT value, LongByReference pRequestID) Causes the client to commit a configuration change to the Ultraleap Tracking Service.void
LeapScaleOffsetMatrix
(Pointer hConnection, int camera, PrimitiveArrayPointer dest) This finds the default device and returns the result ofLeapScaleOffsetMatrixEx(Pointer, Pointer, int, PrimitiveArrayPointer)
void
LeapScaleOffsetMatrixEx
(Pointer hConnection, Pointer hDevice, int camera, PrimitiveArrayPointer dest) Returns the appropriate scale and offset coefficients required to project normalised Rectilinear coordinates to image-scale coordinates.LeapSetAllocator
(Pointer hConnection, LEAP_ALLOCATOR allocator) Sets the allocator functions to use for a particular connection.LeapSetPause
(Pointer hConnection, int pause) Pauses the service.LeapSetPolicyFlags
(Pointer hConnection, long set, long clear) Sets or clears one or more policy flags.LeapSetPolicyFlagsEx
(Pointer hConnection, Pointer hDevice, long set, long clear) Sets or clears one or more policy flags for a particular device.LeapSetPrimaryDevice
(Pointer hConnection, Pointer hDevice, int unsubscribeOthers) For a multi-device aware client, sets the device to use in the context of non-"Ex" API functions which are logically device-specific but don't provide a device parameter.LeapSetTrackingMode
(Pointer hConnection, int mode) Requests a tracking mode.LeapSetTrackingModeEx
(Pointer hConnection, Pointer hDevice, int mode) Requests a tracking mode for a particular device.LeapSubscribeEvents
(Pointer hConnection, Pointer hDevice) Subscribe to event messages based on device.long
Deprecated.This function is no longer supported.LeapTelemetryProfiling
(Pointer hConnection, LEAP_TELEMETRY_DATA telemetryData) Deprecated.This function is no longer supported.LeapUnsubscribeEvents
(Pointer hConnection, Pointer hDevice) Unsubscribe from event messages based on device.LeapUpdateRebase
(Pointer hClockRebaser, long userClock, long leapClock) Updates the relationship between the Ultraleap Tracking Service clock and the user clock.
-
Field Details
-
INSTANCE
-
-
Method Details
-
LeapCreateConnection
Creates a new connection to the Ultraleap Tracking Service and stores a handle for the connection in the provided
LEAP_CONNECTION
.Pass the LEAP_CONNECTION pointer to
LeapOpenConnection(Pointer)
to establish a connection to the Ultraleap Tracking Service; and to subsequent operations on the same connection.- Parameters:
pConfig
- The configuration to be used with the newly created connection. If pConfig is null, a connection is created with a default configuration.phConnection
- Receives a pointer to the connection object, set to invalid on failure.- Returns:
- The operation result code, a member of the
eLeapRS
enumeration. - Since:
- LeapJna 1.0.0, Ultraleap Orion SDK 3.0.0
- See Also:
-
LeapDestroyConnection
Destroys a previously opened connection.
This method closes the specified connection object if it is opened, destroys the underlying object, and releases all resources associated with it.
This method never fails.
Be sure that no other functions are accessing the connection when this function is called.
- Parameters:
hConnection
- A handle to the connection object to be destroyed, created byLeapCreateConnection()
. UseLEAP_CONNECTION.handle
to obtain the handle from the connection object.- Since:
- LeapJna 1.0.0, Ultraleap Orion SDK 3.0.0
- See Also:
-
LeapOpenConnection
Opens a connection to the Ultraleap Tracking Service.
This routine will not block. A connection to the service will not be established until the first invocation of
LeapPollConnection(Pointer, int, LEAP_CONNECTION_MESSAGE)
.- Parameters:
hConnection
- A handle to the connection object, created byLeapCreateConnection()
. UseLEAP_CONNECTION.handle
to obtain the handle from the connection object.- Returns:
- The operation result code, a member of the
eLeapRS
enumeration. - Since:
- LeapJna 1.0.0, Ultraleap Orion SDK 3.0.0
- See Also:
-
LeapCloseConnection
Closes a previously opened connection.
This method closes the specified connection object if it is opened
This method never fails.
- Parameters:
hConnection
- A handle to the connection object, created byLeapCreateConnection()
. UseLEAP_CONNECTION.handle
to obtain the handle from the connection object.- Since:
- LeapJna 1.0.0, Ultraleap Orion SDK 4.0.0
- See Also:
-
LeapPollConnection
Polls the connection for a new event.
The specific types of events that may be received are not configurable in this entrypoint. Configure the device or connection object directly to change what events will be received.
Pointers in the retrieved event message structure will be valid until the associated connection or device is closed, or the next call to
LeapPollConnection()
.Calling this method concurrently will return
eLeapRS.ConcurrentPoll
.- Parameters:
hConnection
- The connection handle created byLeapCreateConnection()
. UseLEAP_CONNECTION.handle
to obtain the handle from the connection object.timeout
- The maximum amount of time to wait, in milliseconds. If this value is zero, themessage
pointer references the next queued message, if there is one, and returns immediately.message
- A structure that is filled with event information. This structure will be valid as long as theLEAP_CONNECTION
object is valid.- Returns:
- The operation result code, a member of the
eLeapRS
enumeration. If the operation times out, this method will returneLeapRS.Timeout
and themessage
pointer will reference a message of typeeLeapEventType.None
. - Since:
- LeapJna 1.0.0, Ultraleap Orion SDK 3.0.0
- See Also:
-
LeapGetConnectionInfo
Retrieves status information about the specified connection.
Call
LeapCreateConnection()
to generate the handle for the connection; callLeapOpenConnection
to establish the connection; then call this function to check the connection status.- Parameters:
hConnection
- The handle of the connection of interest. Created byLeapCreateConnection()
. UseLEAP_CONNECTION.handle
to obtain the handle from the connection object.pInfo
- A pointer to a structure that receives additional connection information. On input, the size field ofpInfo
is the size of the buffer (i.e. the size of aLEAP_CONNECTION_INFO
struct); On output, the size field ofpInfo
receives the size necessary to hold the entire information block.- Returns:
- The operation result code, a member of the
eLeapRS
enumeration. - Since:
- LeapJna 1.0.0, Ultraleap Orion SDK 3.0.0
- See Also:
-
LeapGetDeviceList
eLeapRS LeapGetDeviceList(Pointer hConnection, ArrayPointer<LEAP_DEVICE_REF> pArray, IntByReference pnArray) Retrieves a list of Ultraleap Tracking camera devices currently attached to the system.
To get the number of connected devices, call this function with the
pArray
parameter set tonull
. The number of devices is written to the memory specified bypnArray
. Use the device count to create an array ofLEAP_DEVICE_REF
structs large enough to hold the number of connected devices. Finally, callLeapGetDeviceList()
with this array and known count to get the list of Leap devices. A device must be opened withLeapOpenDevice(LEAP_DEVICE_REF, LEAP_DEVICE)
before device properties can be queried.- Parameters:
hConnection
- The connection handle created byLeapCreateConnection()
. UseLEAP_CONNECTION.handle
to obtain the handle from the connection object.pArray
- A pointer to an array that LeapC fills with the device list. UseArrayPointer.empty(Class, int)
with the appropriate array size to create the pointer.pnArray
- On input, set to the number of elements inpArray
; on output LeapC sets this to the number of valid device handles.- Returns:
- The operation result code, a member of the
eLeapRS
enumeration. - Since:
- LeapJna 1.0.0, Ultraleap Orion SDK 3.0.0
- See Also:
-
LeapOpenDevice
Opens a device reference and retrieves a handle to the device.
To ensure resources are properly freed, users must call
LeapCloseDevice(Pointer)
when finished with the device, even if the retrieved device has problems or cannot stream.- Parameters:
rDevice
- A device reference.phDevice
- A pointer that receives the opened device handle.- Returns:
- The operation result code, a member of the
eLeapRS
enumeration. - Since:
- LeapJna 1.0.0, Ultraleap Orion SDK 3.0.0
- See Also:
-
LeapCloseDevice
Closes a device handle previously opened withLeapOpenDevice(LEAP_DEVICE_REF, LEAP_DEVICE)
.- Parameters:
hDevice
- The device handle to close. UseLEAP_DEVICE.handle
to obtain the handle from the device object.- Since:
- LeapJna 1.0.0, Ultraleap Orion SDK 3.0.0
- See Also:
-
LeapSetPrimaryDevice
For a multi-device aware client, sets the device to use in the context of non-"Ex" API functions which are logically device-specific but don't provide a device parameter.
Automatically subscribes to the specified device (see
LeapSubscribeEvents(Pointer, Pointer)
), and ifunsubscribeOthers
is '1
', then unsubscribes from all other devices as well (seeLeapUnsubscribeEvents(Pointer, Pointer)
).Affects future invocations of the following functions:
- LeapCameraMatrix()
- LeapDistortionCoeffs()
- LeapGetFrameSize()
- LeapInterpolateFrame()
- LeapInterpolateFrameFromTime()
- LeapPixelToRectilinear()
- LeapRectilinearToPixel()
It is not necessary to call this function from a client that does not claim to be multi-device-aware (see
eLeapConnectionConfig
andLeapCreateConnection(LEAP_CONNECTION_CONFIG, LEAP_CONNECTION)
).- Parameters:
hConnection
- The connection handle created byLeapCreateConnection()
. UseLEAP_CONNECTION.handle
to obtain the handle from the connection object.hDevice
- A handle to the device to be queried. UseLEAP_DEVICE.handle
to obtain the handle from the device object.unsubscribeOthers
- Set to '1
' to unsubscribe from all other devices, or0
to keep all subscriptions.- Returns:
- The operation result code, a member of the
eLeapRS
enumeration. - Since:
- LeapJna 1.2.0, Ultraleap Gemini SDK 5.4.0
-
LeapGetDeviceInfo
Gets device properties.
To get the device serial number you must supply a
LEAP_DEVICE_INFO
struct whose serial member points to a char array large enough to hold the null-terminated serial number string. To get the required length, callLeapGetDeviceInfo(Pointer, LEAP_DEVICE_INFO)
using aLEAP_DEVICE_INFO
struct that has serial set tonull
. This will returneLeapRS.InsufficientBuffer
, but LeapC still sets theserial_length
field of the struct to the required length. You can then allocate memory for the string (using e.g.LEAP_DEVICE_INFO.allocateSerialBuffer(int)
), set the serial field, and call this function again.- Parameters:
hDevice
- A handle to the device to be queried. UseLEAP_DEVICE.handle
to obtain the handle from the device object.info
- The struct to receive the device property data.- Returns:
- The operation result code, a member of the
eLeapRS
enumeration. - Since:
- LeapJna 1.0.0, Ultraleap Orion SDK 3.0.0
- See Also:
-
LeapGetDeviceTransform
Get the transform to world coordinates from 3D Leap coordinates.
To get the transform, you must supply an array of 16 elements.
The function will return a an array representing a 4 x 4 matrix of the form:
R, t 0, 1 where: R is a 3 x 3 rotation matrix t is a 3 x 1 translation vector
Note that the matrix is in column major, e.g. transform[12] corresponds to the x coordinate of the translation vector t.
A possible pipeline would be, for example:
- Get "palm_pos" the position of the center of the palm (as a 3x1 vector)
- Construct a 4x1 vector using the palm_position: palm_pos_4 = (palm_pos.x; palm_pos.y; palm_pos.z; 1.0f)
- Create a 4x4 matrix "trans_mat" as illustrated above using the returned transform
- Get the position of the center of the palm in world coordinates by multiplying trans_mat and palm_pos_4: center_world_4 = trans_mat * palm_pos_4
This function returns eLeapRS_Unsupported in the case where this functionality is not yet supported.
- Parameters:
hDevice
- A handle to the device to be queried. UseLEAP_DEVICE.handle
to obtain the handle from the device object.transform
- A pointer to a single-precision float array of size 16, containing the coefficients of the 4x4 matrix in Column Major order.- Returns:
- The operation result code, a member of the
eLeapRS
enumeration. - Since:
- LeapJna 1.2.0, Ultraleap Gemini SDK 5.4.0
-
LeapDevicePIDToString
Provides the human-readable canonical name of the specified device model.
This method is guaranteed to never return
null
for theLEAP_DEVICE_INFO.pid
field returned by a successful call toLeapGetDeviceInfo(Pointer, LEAP_DEVICE_INFO)
.- Parameters:
pid
- The pid of the device.- Returns:
- The string name of the device model, or
null
if the device type string is invalid. - Since:
- LeapJna 1.0.0
- See Also:
-
LeapSubscribeEvents
Subscribe to event messages based on device.
If events from multiple devices are being sent from a service, this function allows the client to receive events from the specified device. Clients that claim to be multi-device-aware (see
eLeapConnectionConfig
andLeapCreateConnection(LEAP_CONNECTION_CONFIG, LEAP_CONNECTION)
) must subscribe to a device to receive various device-specific events.- Parameters:
hConnection
- The connection handle created byLeapCreateConnection()
. UseLEAP_CONNECTION.handle
to obtain the handle from the connection object.hDevice
- The device handle to close. UseLEAP_DEVICE.handle
to obtain the handle from the device object.- Returns:
- The operation result code, a member of the
eLeapRS
enumeration. - Since:
- LeapJna 1.2.0, Ultraleap Gemini SDK 5.4.0
-
LeapUnsubscribeEvents
Unsubscribe from event messages based on device.
If events from multiple devices are being sent from a service, this function prevents receiving further events from the specified device that had previously been enabled using a call to
LeapSubscribeEvents(Pointer, Pointer)
.- Parameters:
hConnection
- The connection handle created byLeapCreateConnection()
. UseLEAP_CONNECTION.handle
to obtain the handle from the connection object.hDevice
- The device handle to close. UseLEAP_DEVICE.handle
to obtain the handle from the device object.- Returns:
- The operation result code, a member of the
eLeapRS
enumeration. - Since:
- LeapJna 1.2.0, Ultraleap Gemini SDK 5.4.0
-
LeapGetVersion
Returns the version of a specified part of the system. If an invalid connection handle is provided only the version details of the client will be available.- Parameters:
hConnection
- The connection handle created byLeapCreateConnection()
. UseLEAP_CONNECTION.handle
to obtain the handle from the connection object.versionPart
- The version part to return, this will reference one part of the system. A member of theeLeapVersionPart
enumeration.pVersion
- A pointer to a struct used to store the version number.- Returns:
- The operation result code, a member of the
eLeapRS
enumeration. - Since:
- LeapJna 1.2.0, Ultraleap Gemini SDK 5.2.0
- See Also:
-
LeapGetFrameSize
Retrieves the number of bytes required to allocate an interpolated frame at the specified time.
Use this function to determine the size of the buffer to allocate when calling
LeapInterpolateFrame(Pointer, long, LEAP_TRACKING_EVENT, long)
.- Parameters:
hConnection
- The connection handle created byLeapCreateConnection()
. UseLEAP_CONNECTION.handle
to obtain the handle from the connection object.timestamp
- The timestamp of the frame whose size is to be queried.pncbEvent
- A pointer that receives the number of bytes required to store the specified frame.- Returns:
- The operation result code, a member of the
eLeapRS
enumeration. - Since:
- LeapJna 1.0.0, Ultraleap Orion SDK 3.1.1
- See Also:
-
LeapGetFrameSizeEx
eLeapRS LeapGetFrameSizeEx(Pointer hConnection, Pointer hDevice, long timestamp, LongByReference pncbEvent) Retrieves the number of bytes required to allocate an interpolated frame at the specified time for a particular device.
Use this function to determine the size of the buffer to allocate when calling
LeapInterpolateFrameEx(Pointer, Pointer, long, LEAP_TRACKING_EVENT, long)
.- Parameters:
hConnection
- The connection handle created byLeapCreateConnection()
. UseLEAP_CONNECTION.handle
to obtain the handle from the connection object.hDevice
- The device handle to close. UseLEAP_DEVICE.handle
to obtain the handle from the device object.timestamp
- The timestamp of the frame whose size is to be queried.pncbEvent
- A pointer that receives the number of bytes required to store the specified frame.- Returns:
- The operation result code, a member of the
eLeapRS
enumeration. - Since:
- LeapJna 1.2.0
- See Also:
-
LeapInterpolateFrameFromTime
eLeapRS LeapInterpolateFrameFromTime(Pointer hConnection, long timestamp, long sourceTimestamp, LEAP_TRACKING_EVENT pEvent, long ncbEvent) Constructs a frame at the specified timestamp by interpolating between a frame near the timestamp and a frame near the sourceTimestamp.
Caller is responsible for allocating a buffer large enough to hold the data of the frame. Use
LeapGetFrameSize(Pointer, long, LongByReference)
to calculate the minimum size of this buffer.Use
LeapCreateClockRebaser(LEAP_CLOCK_REBASER)
,LeapUpdateRebase(Pointer, long, long)
, andLeapRebaseClock(Pointer, long, LongByReference)
to synchronize time measurements in the application with time measurements in the Ultraleap Tracking Service. This process is required to achieve accurate, smooth interpolation.- Parameters:
hConnection
- The connection handle created byLeapCreateConnection()
. UseLEAP_CONNECTION.handle
to obtain the handle from the connection object.timestamp
- The timestamp to which to interpolate the frame data.sourceTimestamp
- The timestamp of the beginning frame from which to interpolate the data.pEvent
- ALEAP_TRACKING_EVENT
with enough allocated memory to fit the frame data. UseLeapGetFrameSize
to get the required size, and thenLEAP_TRACKING_EVENT(int)
to create the struct and allocate memory.ncbEvent
- The size of thepEvent
struct in bytes.- Returns:
- The operation result code, a member of the
eLeapRS
enumeration. - Since:
- LeapJna 1.0.0, Ultraleap Orion SDK 3.1.1
- See Also:
-
LeapInterpolateFrameFromTimeEx
eLeapRS LeapInterpolateFrameFromTimeEx(Pointer hConnection, Pointer hDevice, long timestamp, long sourceTimestamp, LEAP_TRACKING_EVENT pEvent, long ncbEvent) Constructs a frame at the specified timestamp for a particular device by interpolating between a frame near the timestamp and a frame near the sourceTimestamp.
Caller is responsible for allocating a buffer large enough to hold the data of the frame. Use
LeapGetFrameSize(Pointer, long, LongByReference)
to calculate the minimum size of this buffer.Use
LeapCreateClockRebaser(LEAP_CLOCK_REBASER)
,LeapUpdateRebase(Pointer, long, long)
, andLeapRebaseClock(Pointer, long, LongByReference)
to synchronize time measurements in the application with time measurements in the Ultraleap Tracking Service. This process is required to achieve accurate, smooth interpolation.- Parameters:
hConnection
- The connection handle created byLeapCreateConnection()
. UseLEAP_CONNECTION.handle
to obtain the handle from the connection object.hDevice
- The device handle to close. UseLEAP_DEVICE.handle
to obtain the handle from the device object.timestamp
- The timestamp to which to interpolate the frame data.sourceTimestamp
- The timestamp of the beginning frame from which to interpolate the data.pEvent
- ALEAP_TRACKING_EVENT
with enough allocated memory to fit the frame data. UseLeapGetFrameSize
to get the required size, and thenLEAP_TRACKING_EVENT(int)
to create the struct and allocate memory.ncbEvent
- The size of thepEvent
struct in bytes.- Returns:
- The operation result code, a member of the
eLeapRS
enumeration. - Since:
- LeapJna 1.2.0
- See Also:
-
LeapInterpolateFrame
eLeapRS LeapInterpolateFrame(Pointer hConnection, long timestamp, LEAP_TRACKING_EVENT pEvent, long ncbEvent) Constructs a frame at the specified timestamp by interpolating between measured frames.
Caller is responsible for allocating a buffer large enough to hold the data of the frame. Use
LeapGetFrameSize(Pointer, long, LongByReference)
to calculate the minimum size of this buffer.Use
LeapCreateClockRebaser(LEAP_CLOCK_REBASER)
,LeapUpdateRebase(Pointer, long, long)
, andLeapRebaseClock(Pointer, long, LongByReference)
to synchronize time measurements in the application with time measurements in the Ultraleap Tracking Service. This process is required to achieve accurate, smooth interpolation.- Parameters:
hConnection
- The connection handle created byLeapCreateConnection()
. UseLEAP_CONNECTION.handle
to obtain the handle from the connection object.timestamp
- The timestamp at which to interpolate the frame data.pEvent
- ALEAP_TRACKING_EVENT
with enough allocated memory to fit the frame data. UseLeapGetFrameSize
to get the required size, and thenLEAP_TRACKING_EVENT(int)
to create the struct and allocate memory.ncbEvent
- The size of thepEvent
struct in bytes.- Returns:
- The operation result code, a member of the
eLeapRS
enumeration. - Since:
- LeapJna 1.0.0, Ultraleap Orion SDK 3.1.1
- See Also:
-
LeapInterpolateFrameEx
eLeapRS LeapInterpolateFrameEx(Pointer hConnection, Pointer hDevice, long timestamp, LEAP_TRACKING_EVENT pEvent, long ncbEvent) Constructs a frame at the specified timestamp for a particular device by interpolating between measured frames. frames.
Caller is responsible for allocating a buffer large enough to hold the data of the frame. Use
LeapGetFrameSizeEx(Pointer, Pointer, long, LongByReference)
to calculate the minimum size of this buffer.Use
LeapCreateClockRebaser(LEAP_CLOCK_REBASER)
,LeapUpdateRebase(Pointer, long, long)
, andLeapRebaseClock(Pointer, long, LongByReference)
to synchronize time measurements in the application with time measurements in the Ultraleap Tracking Service. This process is required to achieve accurate, smooth interpolation.- Parameters:
hConnection
- The connection handle created byLeapCreateConnection()
. UseLEAP_CONNECTION.handle
to obtain the handle from the connection object.hDevice
- The device handle to close. UseLEAP_DEVICE.handle
to obtain the handle from the device object.timestamp
- The timestamp at which to interpolate the frame data.pEvent
- ALEAP_TRACKING_EVENT
with enough allocated memory to fit the frame data. UseLeapGetFrameSize
to get the required size, and thenLEAP_TRACKING_EVENT(int)
to create the struct and allocate memory.ncbEvent
- The size of thepEvent
struct in bytes.- Returns:
- The operation result code, a member of the
eLeapRS
enumeration. - Since:
- LeapJna 1.2.0
- See Also:
-
LeapInterpolateHeadPose
@Deprecated eLeapRS LeapInterpolateHeadPose(Pointer hConnection, long timestamp, LEAP_HEAD_POSE_EVENT pEvent) Deprecated.This function is no longer supported. Calling it will have no effect.Gets the head tracking pose at the specified timestamp by interpolating between measured frames.
Use
LeapCreateClockRebaser(LEAP_CLOCK_REBASER)
,LeapUpdateRebase(Pointer, long, long)
, andLeapRebaseClock(Pointer, long, LongByReference)
to synchronize time measurements in the application with time measurements in the Ultraleap Tracking Service. This process is required to achieve accurate, smooth interpolation.- Parameters:
hConnection
- The connection handle created byLeapCreateConnection()
. UseLEAP_CONNECTION.handle
to obtain the handle from the connection object.timestamp
- The timestamp at which to interpolate the frame data.pEvent
- A pointer to a flat buffer which is filled with an interpolated frame.- Returns:
- The operation result code, a member of the
eLeapRS
enumeration. - Since:
- LeapJna 1.0.0
- See Also:
-
LeapSetPolicyFlags
Sets or clears one or more policy flags.
Changing policies is asynchronous. After you call this function, a subsequent call to
To get the current policies without changes, specify zero for both the set and clear parameters. When ready,LeapPollConnection(Pointer, int, LEAP_CONNECTION_MESSAGE)
provides aLEAP_POLICY_EVENT
containing the current policies, reflecting any changes.LeapPollConnection()
provides the aLEAP_POLICY_EVENT
containing the current settings.The
eLeapPolicyFlag
enumeration defines the policy flags.- Parameters:
hConnection
- The connection handle created byLeapCreateConnection()
. UseLEAP_CONNECTION.handle
to obtain the handle from the connection object.set
- A bitwise combination of flags to be set. Set to 0 if not setting any flags.clear
- A bitwise combination of flags to be cleared. Set to 0 if not clearing any flags.- Returns:
- The operation result code, a member of the
eLeapRS
enumeration. - Since:
- LeapJna 1.0.0, Ultraleap Orion SDK 3.0.0
- See Also:
-
LeapSetPolicyFlagsEx
Sets or clears one or more policy flags for a particular device.
Changing policies is asynchronous. After you call this function, a subsequent call to
To get the current policies without changes, specify zero for both the set and clear parameters. When ready,LeapPollConnection(Pointer, int, LEAP_CONNECTION_MESSAGE)
provides aLEAP_POLICY_EVENT
containing the current policies, reflecting any changes.LeapPollConnection()
provides the aLEAP_POLICY_EVENT
containing the current settings.The
eLeapPolicyFlag
enumeration defines the policy flags.- Parameters:
hConnection
- The connection handle created byLeapCreateConnection()
. UseLEAP_CONNECTION.handle
to obtain the handle from the connection object.hDevice
- The device handle to close. UseLEAP_DEVICE.handle
to obtain the handle from the device object.set
- A bitwise combination of flags to be set. Set to 0 if not setting any flags.clear
- A bitwise combination of flags to be cleared. Set to 0 if not clearing any flags.- Returns:
- The operation result code, a member of the
eLeapRS
enumeration. - Since:
- LeapJna 1.2.0, Ultraleap Gemini SDK 5.4.0
- See Also:
-
LeapSetTrackingMode
Requests a tracking mode.
Changing tracking modes is asynchronous. After you call this function, a subsequent call to
LeapPollConnection(Pointer, int, LEAP_CONNECTION_MESSAGE)
provides aLEAP_POLICY_EVENT
containing the current policies, reflecting any changes.The
eLeapTrackingMode
enumeration defines the tracking mode.- Parameters:
hConnection
- The connection handle created byLeapCreateConnection()
. UseLEAP_CONNECTION.handle
to obtain the handle from the connection object.mode
- The enum value specifying the requested tracking mode.- Returns:
- The operation result code, a member of the
eLeapRS
enumeration. - Since:
- LeapJna 1.1.0, Ultraleap Gemini SDK 5.0.0
- See Also:
-
LeapSetTrackingModeEx
Requests a tracking mode for a particular device.
Changing tracking modes is asynchronous. After you call this function, a subsequent call to
LeapPollConnection(Pointer, int, LEAP_CONNECTION_MESSAGE)
provides aLEAP_POLICY_EVENT
containing the current policies, reflecting any changes.The
eLeapTrackingMode
enumeration defines the tracking mode.- Parameters:
hConnection
- The connection handle created byLeapCreateConnection()
. UseLEAP_CONNECTION.handle
to obtain the handle from the connection object.hDevice
- The device handle to close. UseLEAP_DEVICE.handle
to obtain the handle from the device object.mode
- The enum value specifying the requested tracking mode.- Returns:
- The operation result code, a member of the
eLeapRS
enumeration. - Since:
- LeapJna 1.2.0, Ultraleap Gemini SDK 5.4.0
-
LeapGetTrackingMode
Requests the currently set tracking mode.
Requesting the current tracking mode is asynchronous. After you call this function, a subsequent call to
LeapPollConnection(Pointer, int, LEAP_CONNECTION_MESSAGE)
provides aLEAP_TRACKING_MODE_EVENT
containing the current tracking mode, reflecting any changes.The
eLeapTrackingMode
enumeration defines the tracking mode.- Parameters:
hConnection
- The connection handle created byLeapCreateConnection()
. UseLEAP_CONNECTION.handle
to obtain the handle from the connection object.- Returns:
- The operation result code, a member of the
eLeapRS
enumeration. - Since:
- LeapJna 1.2.0
- See Also:
-
LeapGetTrackingModeEx
Requests the currently set tracking mode.
Requesting the current tracking mode is asynchronous. After you call this function, a subsequent call to
LeapPollConnection(Pointer, int, LEAP_CONNECTION_MESSAGE)
provides aLEAP_TRACKING_MODE_EVENT
containing the current tracking mode, reflecting any changes.The
eLeapTrackingMode
enumeration defines the tracking mode.- Parameters:
hConnection
- The connection handle created byLeapCreateConnection()
. UseLEAP_CONNECTION.handle
to obtain the handle from the connection object.hDevice
- The device handle to close. UseLEAP_DEVICE.handle
to obtain the handle from the device object.- Returns:
- The operation result code, a member of the
eLeapRS
enumeration. - Since:
- LeapJna 1.2.0, Ultraleap Gemini SDK 5.4.0
-
LeapSetPause
Pauses the service.
Attempts to pause or unpause the service depending on the argument. This is treated as a 'user pause', as though a user had requested a pause through the Leap Control Panel. The connection must have the
eLeapPolicyFlag.AllowPauseResume
policy set or it will fail witheLeapRS.InvalidArgument
.- Parameters:
hConnection
- The connection handle created byLeapCreateConnection()
. UseLEAP_CONNECTION.handle
to obtain the handle from the connection object.pause
- Set to '1
' to pause, or '0
' to unpause- Returns:
- The operation result code, a member of the
eLeapRS
enumeration. - Since:
- LeapJna 1.0.0, Ultraleap Orion SDK 4.0.0
- See Also:
-
LeapRequestConfigValue
Requests the current value of a service configuration setting.
The value is fetched asynchronously since it requires a service transaction.
LeapPollConnection(Pointer, int, LEAP_CONNECTION_MESSAGE)
returns aLEAP_CONFIG_RESPONSE_EVENT
structure when the request has been processed. Use thepRequestID
value to correlate the response to the originating request.- Parameters:
hConnection
- The connection handle created byLeapCreateConnection()
. UseLEAP_CONNECTION.handle
to obtain the handle from the connection object.key
- The key of the configuration to request. SeeConfigurations
for a list of keys.pRequestID
- A pointer to a memory location to which the id for this request is written.- Returns:
- The operation result code, a member of the
eLeapRS
enumeration. - Since:
- LeapJna 1.0.0, Ultraleap Orion SDK 3.0.0
- See Also:
-
LeapSaveConfigValue
eLeapRS LeapSaveConfigValue(Pointer hConnection, String key, LEAP_VARIANT value, LongByReference pRequestID) Causes the client to commit a configuration change to the Ultraleap Tracking Service.
The change is performed asynchronously � and may fail.
LeapPollConnection(Pointer, int, LEAP_CONNECTION_MESSAGE)
returns aLEAP_CONFIG_CHANGE_EVENT
structure when the request has been processed. Use thepRequestID
value to correlate the response to the originating request.- Parameters:
hConnection
- The connection handle created byLeapCreateConnection()
. UseLEAP_CONNECTION.handle
to obtain the handle from the connection object.key
- The key of the configuration to commit. SeeConfigurations
for a list of keys.value
- The value of the configuration to commit.pRequestID
- A pointer to a memory location to which the id for this request is written, or a null pointer if this value is not needed.- Returns:
- The operation result code, a member of the
eLeapRS
enumeration. - Since:
- LeapJna 1.0.0, Ultraleap Orion SDK 3.0.0
- See Also:
-
LeapGetPointMappingSize
Deprecated.This function is no longer supported. Calling it will have no effect.- Parameters:
hConnection
- The connection handle created byLeapCreateConnection()
. UseLEAP_CONNECTION.handle
to obtain the handle from the connection object.pSize
- A pointer that receives the number of bytes required to store the point mapping.- Returns:
- The operation result code, a member of the
eLeapRS
enumeration. - Since:
- LeapJna 1.0.0
-
LeapGetPointMapping
@Deprecated eLeapRS LeapGetPointMapping(Pointer hConnection, LEAP_POINT_MAPPING pointMapping, LongByReference pSize) Deprecated.This function is no longer supported. Calling it will have no effect.- Parameters:
hConnection
- The connection handle created byLeapCreateConnection()
. UseLEAP_CONNECTION.handle
to obtain the handle from the connection object.pointMapping
- ALEAP_POINT_MAPPING
with enough allocated memory to fit the frame data. UseLeapGetPointMappingSize(Pointer, LongByReference)
to get the required size, and thenLEAP_POINT_MAPPING(int)
to create the struct and allocate memory.pSize
- A pointer to the size ofpointMapping
.- Returns:
- The operation result code, a member of the
eLeapRS
enumeration. - Since:
- LeapJna 1.0.0
-
LeapGetNow
long LeapGetNow()Samples the universal clock used by the system to timestamp image and tracking frames. The returned counter value is given in microseconds since an epoch time.
The clock used for the counter itself is implementation-defined, but generally speaking, it is global, monotonic, and makes use of the most accurate high-performance counter available on the system.
- Returns:
- microseconds since an unspecified epoch
- Since:
- LeapJna 1.0.0, Ultraleap Orion SDK 3.0.0
- See Also:
-
LeapSetAllocator
Sets the allocator functions to use for a particular connection.
If user-supplied allocator functions are not supplied, the functions that require dynamic memory allocation will not be available.
Note: Not required for e.g.
LEAP_IMAGE_EVENT
s even though its documentation says otherwise.- Parameters:
hConnection
- The connection handle created byLeapCreateConnection()
. UseLEAP_CONNECTION.handle
to obtain the handle from the connection object.allocator
- ALEAP_ALLOCATOR
structure containing the allocator functions to be called as needed by the library.- Returns:
- The operation result code, a member of the
eLeapRS
enumeration. - Since:
- LeapJna 1.0.0, Ultraleap Orion SDK 4.0.0
- See Also:
-
LeapCreateClockRebaser
Initializes a new Leap clock-rebaser handle object.
Pass the filled-in
LEAP_CLOCK_REBASER
object to calls toLeapUpdateRebase(Pointer, long, long)
,LeapRebaseClock(Pointer, long, LongByReference)
, andLeapDestroyClockRebaser(Pointer)
.- Parameters:
phClockRebaser
- A pointer to the clock-rebaser object to be initialized.- Returns:
- The operation result code, a member of the
eLeapRS
enumeration. - Since:
- LeapJna 1.0.0, Ultraleap Orion SDK 3.1.2
- See Also:
-
LeapDestroyClockRebaser
Destroys a previously created clock-rebaser object.
This method destroys the specified clock-rebaser object, and releases all resources associated with it.
- Parameters:
hClockRebaser
- The handle to the clock-rebaser object to be destroyed. UseLEAP_CLOCK_REBASER.handle
to obtain the handle from the clock rebaser object.- Since:
- LeapJna 1.0.0, Ultraleap Orion SDK 3.1.2
- See Also:
-
LeapRebaseClock
Computes the Ultraleap Tracking Service clock corresponding to a specified application clock value.
Use this function to translate your application clock to the Ultraleap Tracking Service clock when interpolating frames.
LeapUpdateRebase(Pointer, long, long)
must be called for every rendered frame for the relationship between the two clocks to remain synchronised.- Parameters:
hClockRebaser
- The handle to a rebaser object created byLeapCreateClockRebaser(LEAP_CLOCK_REBASER)
. UseLEAP_CLOCK_REBASER.handle
to obtain the handle from the clock rebaser object.userClock
- The clock in microseconds referenced to the application clock.pLeapClock
- The corresponding Ultraleap Tracking Service clock value.- Returns:
- The operation result code, a member of the
eLeapRS
enumeration. - Since:
- LeapJna 1.0.0, Ultraleap Orion SDK 3.1.2
- See Also:
-
LeapUpdateRebase
Updates the relationship between the Ultraleap Tracking Service clock and the user clock.
When using
LeapInterpolateFrame(Pointer, long, LEAP_TRACKING_EVENT, long)
, call this function for every graphics frame rendered by your application. The function should be called as close to the actual point of rendering as possible.The relationship between the application clock and the Ultraleap Tracking Service clock is neither fixed nor stable. Simulation restarts can cause user clock values to change instantaneously. Certain systems simulate slow motion, or respond to heavy load, by reducing the tick rate of the user clock. As a result, the
LeapUpdateRebase()
function must be called for every rendered frame.- Parameters:
hClockRebaser
- The handle to a rebaser object created byLeapCreateClockRebaser(LEAP_CLOCK_REBASER)
. UseLEAP_CLOCK_REBASER.handle
to obtain the handle from the clock rebaser object.userClock
- A clock value supplied by the application, in microseconds, sampled at about the same time asLeapGetNow()
was sampled.leapClock
- The Ultraleap Tracking Service clock value sampled by a call toLeapGetNow()
.- Returns:
- The operation result code, a member of the
eLeapRS
enumeration. - Since:
- LeapJna 1.0.0, Ultraleap Orion SDK 3.1.2
- See Also:
-
LeapPixelToRectilinear
LEAP_VECTOR.ByValue LeapPixelToRectilinear(Pointer hConnection, int camera, LEAP_VECTOR.ByValue pixel) Provides the corrected camera ray intercepting the specified point on the image.
Given a point on the image,
LeapPixelToRectilinear()
corrects for camera distortion and returns the true direction from the camera to the source of that image point within the Ultraleap Tracking camera field of view.This direction vector has an x and y component [x, y, 1], with the third element always 1. Note that this vector uses the 2D camera coordinate system where the x-axis parallels the longer (typically horizontal) dimension and the y-axis parallels the shorter (vertical) dimension. The camera coordinate system does not correlate to the 3D Ultraleap Tracking coordinate system.
- Parameters:
hConnection
- The connection handle created byLeapCreateConnection()
. UseLEAP_CONNECTION.handle
to obtain the handle from the connection object.camera
- The camera to use, a member of theeLeapPerspectiveType
enumeration.pixel
- A vector containing the position of a pixel in the image.- Returns:
- A vector containing the ray direction (the z-component of the vector is always 1).
- Since:
- LeapJna 1.0.0, Ultraleap Orion SDK 3.1.3
- See Also:
-
LeapPixelToRectilinearEx
LEAP_VECTOR.ByValue LeapPixelToRectilinearEx(Pointer hConnection, Pointer hDevice, int camera, LEAP_VECTOR.ByValue pixel) Provides the corrected camera ray intercepting the specified point on the image for a particular device.
Given a point on the image,
LeapPixelToRectilinearEx()
corrects for camera distortion and returns the true direction from the camera to the source of that image point within the Ultraleap Tracking camera field of view.This direction vector has an x and y component [x, y, 1], with the third element always 1. Note that this vector uses the 2D camera coordinate system where the x-axis parallels the longer (typically horizontal) dimension and the y-axis parallels the shorter (vertical) dimension. The camera coordinate system does not correlate to the 3D Ultraleap Tracking coordinate system.
- Parameters:
hConnection
- The connection handle created byLeapCreateConnection()
. UseLEAP_CONNECTION.handle
to obtain the handle from the connection object.hDevice
- The device handle to close. UseLEAP_DEVICE.handle
to obtain the handle from the device object.camera
- The camera to use, a member of theeLeapPerspectiveType
enumeration.pixel
- A vector containing the position of a pixel in the image.- Returns:
- A vector containing the ray direction (the z-component of the vector is always 1).
- Since:
- LeapJna 1.2.0, Ultraleap Gemini SDK 5.4.0
- See Also:
-
LeapRectilinearToPixel
LEAP_VECTOR.ByValue LeapRectilinearToPixel(Pointer hConnection, int camera, LEAP_VECTOR.ByValue rectilinear) Provides the point in the image corresponding to a ray projecting from the camera.
Given a ray projected from the camera in the specified direction,
LeapRectilinearToPixel()
corrects for camera distortion and returns the corresponding pixel coordinates in the image.The ray direction is specified in relationship to the camera. The first vector element is the tangent of the "horizontal" view angle; the second element is the tangent of the "vertical" view angle.
The
LeapRectilinearToPixel()
function returns pixel coordinates outside of the image bounds if you project a ray toward a point for which there is no recorded data.LeapRectilinearToPixel()
is typically not fast enough for realtime distortion correction. For better performance, use a shader program executed on a GPU.- Parameters:
hConnection
- The connection handle created byLeapCreateConnection()
. UseLEAP_CONNECTION.handle
to obtain the handle from the connection object.camera
- The camera to use, a member of theeLeapPerspectiveType
enumeration.rectilinear
- A vector containing the ray direction.- Returns:
- A vector containing the pixel coordinates [x, y, 1] (with z always 1).
- Since:
- LeapJna 1.0.0, Ultraleap Orion SDK 3.1.3
- See Also:
-
LeapRectilinearToPixelEx
LEAP_VECTOR.ByValue LeapRectilinearToPixelEx(Pointer hConnection, Pointer hDevice, int camera, LEAP_VECTOR.ByValue rectilinear) Provides the point in the image corresponding to a ray projecting from the camera for a particular device.
Given a ray projected from the camera in the specified direction,
LeapRectilinearToPixelEx()
corrects for camera distortion and returns the corresponding pixel coordinates in the image.The ray direction is specified in relationship to the camera. The first vector element is the tangent of the "horizontal" view angle; the second element is the tangent of the "vertical" view angle.
The
LeapRectilinearToPixelEx()
function returns pixel coordinates outside of the image bounds if you project a ray toward a point for which there is no recorded data.LeapRectilinearToPixelEx()
is typically not fast enough for realtime distortion correction. For better performance, use a shader program executed on a GPU.- Parameters:
hConnection
- The connection handle created byLeapCreateConnection()
. UseLEAP_CONNECTION.handle
to obtain the handle from the connection object.hDevice
- The device handle to close. UseLEAP_DEVICE.handle
to obtain the handle from the device object.camera
- The camera to use, a member of theeLeapPerspectiveType
enumeration.rectilinear
- A vector containing the ray direction.- Returns:
- A vector containing the pixel coordinates [x, y, 1] (with z always 1).
- Since:
- LeapJna 1.2.0, Ultraleap Gemini SDK 5.4.0
- See Also:
-
LeapCameraMatrix
Returns an OpenCV-compatible camera matrix.- Parameters:
hConnection
- The connection handle created byLeapCreateConnection()
. UseLEAP_CONNECTION.handle
to obtain the handle from the connection object.camera
- The camera to use, a member of theeLeapPerspectiveType
enumerationdest
- A pointer to a single-precision float array of size 9- Since:
- LeapJna 1.2.0
- See Also:
-
LeapCameraMatrixEx
void LeapCameraMatrixEx(Pointer hConnection, Pointer hDevice, int camera, PrimitiveArrayPointer dest) Returns an OpenCV-compatible camera matrix for a particular device.- Parameters:
hConnection
- The connection handle created byLeapCreateConnection()
. UseLEAP_CONNECTION.handle
to obtain the handle from the connection object.hDevice
- The device handle to close. UseLEAP_DEVICE.handle
to obtain the handle from the device object.camera
- The camera to use, a member of theeLeapPerspectiveType
enumerationdest
- A pointer to a single-precision float array of size 9- Since:
- LeapJna 1.2.0, Ultraleap Gemini SDK 5.4.0
- See Also:
-
LeapExtrinsicCameraMatrix
This finds the default device and returns the resultLeapExtrinsicCameraMatrixEx(Pointer, Pointer, int, PrimitiveArrayPointer)
.- Parameters:
hConnection
- The connection handle created byLeapCreateConnection()
. UseLEAP_CONNECTION.handle
to obtain the handle from the connection object.camera
- The camera to use, a member of theeLeapPerspectiveType
enumerationdest
- A pointer to a single-precision float array of size 16, containing the coefficients of the 4x4 matrix in Column Major order- Since:
- LeapJna 1.2.0, Ultraleap Gemini SDK 5.1.0
- See Also:
-
LeapExtrinsicCameraMatrixEx
void LeapExtrinsicCameraMatrixEx(Pointer hConnection, Pointer hDevice, int camera, PrimitiveArrayPointer dest) Returns a transformation matrix from 3D Leap coordinate space to the coordinate system of the requested camera This is composed of a 4 x 4 matrix of the form:
R, t 0, 1 R is a 3 x 3 rotation matrix t is a 3 x 1 translation vector
- Parameters:
hConnection
- The connection handle created byLeapCreateConnection()
. UseLEAP_CONNECTION.handle
to obtain the handle from the connection object.hDevice
- The device handle to close. UseLEAP_DEVICE.handle
to obtain the handle from the device object.camera
- The camera to use, a member of theeLeapPerspectiveType
enumerationdest
- A pointer to a single-precision float array of size 16, containing the coefficients of the 4x4 matrix in Column Major order- Since:
- LeapJna 1.2.0, Ultraleap Gemini SDK 5.1.0
- See Also:
-
LeapDistortionCoeffs
Returns an OpenCV-compatible lens distortion using the 8-parameter rational model.
The order of the returned array is: [k1, k2, p1, p2, k3, k4, k5, k6]
- Parameters:
hConnection
- The connection handle created byLeapCreateConnection()
. UseLEAP_CONNECTION.handle
to obtain the handle from the connection object.camera
- The camera to use, a member of theeLeapPerspectiveType
enumerationdest
- A pointer to a single-precision float array of size 8- Since:
- LeapJna 1.2.0
- See Also:
-
LeapDistortionCoeffsEx
void LeapDistortionCoeffsEx(Pointer hConnection, Pointer hDevice, int camera, PrimitiveArrayPointer dest) Returns an OpenCV-compatible lens distortion for a particular device, using the 8-parameter rational model.
The order of the returned array is: [k1, k2, p1, p2, k3, k4, k5, k6]
- Parameters:
hConnection
- The connection handle created byLeapCreateConnection()
. UseLEAP_CONNECTION.handle
to obtain the handle from the connection object.hDevice
- The device handle to close. UseLEAP_DEVICE.handle
to obtain the handle from the device object.camera
- The camera to use, a member of theeLeapPerspectiveType
enumerationdest
- A pointer to a single-precision float array of size 8- Since:
- LeapJna 1.2.0, Ultraleap Gemini SDK 5.4.0
- See Also:
-
LeapScaleOffsetMatrix
This finds the default device and returns the result ofLeapScaleOffsetMatrixEx(Pointer, Pointer, int, PrimitiveArrayPointer)
- Parameters:
hConnection
- The connection handle created byLeapCreateConnection()
. UseLEAP_CONNECTION.handle
to obtain the handle from the connection object.camera
- The camera to use, a member of theeLeapPerspectiveType
enumerationdest
- A pointer to a single-precision float array of size 16, containing the coefficients of the 4x4 matrix in Column Major order- Since:
- LeapJna 1.2.0, Ultraleap Gemini SDK 5.x.x
- See Also:
-
LeapScaleOffsetMatrixEx
void LeapScaleOffsetMatrixEx(Pointer hConnection, Pointer hDevice, int camera, PrimitiveArrayPointer dest) Returns the appropriate scale and offset coefficients required to project normalised Rectilinear coordinates to image-scale coordinates.
This is composed of a 4 x 4 matrix of the form:
scale_x, 0, 0, offset_x, 0, 1, 0, 0, 0, 0, scale_z, offset_z 0, 0, 0, 1
This matrix is specific to the size of the current image as contained within
LEAP_IMAGE
.In practical terms, use this matrix in combination with normalised rays to project 3D points into a rectilinear image space (i.e. to visualise hands on an undistorted image).
The pipeline would be:
- Take 3D points from hand tracking.
- Apply an extrinsic transformation to a specific camera's coordinate system (@sa LeapExtrinsicCameraMatrixEx)
- Apply a perspective division to transform 3D points to rays.
- Apply the ScaleOffset matrix to these points.
These points will now be in the correct coordinate system consistent with the undistorted rectilinear image provided by
LEAP_IMAGE.distortion_matrix
.- Parameters:
hConnection
- The connection handle created byLeapCreateConnection()
. UseLEAP_CONNECTION.handle
to obtain the handle from the connection object.hDevice
- The device handle to close. UseLEAP_DEVICE.handle
to obtain the handle from the device object.camera
- The camera to use, a member of theeLeapPerspectiveType
enumerationdest
- A pointer to a single-precision float array of size 16, containing the coefficients of the 4x4 matrix in Column Major order- Since:
- LeapJna 1.2.0, Ultraleap Gemini SDK 5.x.x
- See Also:
-
LeapTelemetryProfiling
Deprecated.This function is no longer supported. Calling it will have no effect.Note: Telemetry profiling has documentation in neither the API reference norleapc.h
in the SDK. It seems liketelemetryData
needs to be pre-populated with information before passed into this method, but what that information should be I don't know.- Parameters:
hConnection
- The connection handle created byLeapCreateConnection()
. UseLEAP_CONNECTION.handle
to obtain the handle from the connection object.telemetryData
- ALEAP_TELEMETRY_DATA
instance.- Returns:
- The operation result code, a member of the
eLeapRS
enumeration. - Since:
- LeapJna 1.0.0
-
LeapTelemetryGetNow
Deprecated.This function is no longer supported. Calling it will have no effect.- Returns:
- Since:
- LeapJna 1.0.0
-
LeapRecordingOpen
eLeapRS LeapRecordingOpen(LEAP_RECORDING ppRecording, String filePath, LEAP_RECORDING_PARAMETERS params) Opens or creates a
LEAP_RECORDING
.Pass the
LEAP_RECORDING
pointer toLeapRecordingOpen()
to initiate reading from or writing to a recording. The recording path is relative to the "user path" which is the SD card on Android.- Parameters:
ppRecording
- The recording being opened.filePath
- The file path. This will be passed directly to the OS without modification. An ".lmt" suffix is suggested.params
- TheLEAP_RECORDING_PARAMETERS
describing what operations are requested.- Returns:
- The operation result code, a member of the
eLeapRS
enumeration. - Since:
- LeapJna 1.0.0, Ultraleap Orion SDK 3.2.0
- See Also:
-
LeapRecordingWrite
eLeapRS LeapRecordingWrite(Pointer pRecording, LEAP_TRACKING_EVENT pEvent, LongByReference pnBytesWritten) Writes a tracking frame to aLEAP_RECORDING
file.- Parameters:
pRecording
- The recording being written to. UseLEAP_RECORDING.handle
to obtain the handle from the recording object.pEvent
- ALEAP_TRACKING_EVENT
with the frame data to write.pnBytesWritten
- If non-null the number of bytes written.- Returns:
- The operation result code, a member of the
eLeapRS
enumeration. - Since:
- LeapJna 1.0.0, Ultraleap Orion SDK 3.2.0
- See Also:
-
LeapRecordingGetStatus
Fills in a
LEAP_RECORDING_STATUS
struct for an open recording.This struct provides the applicable
eLeapRecordingFlags
.- Parameters:
pRecording
- The open recording. UseLEAP_RECORDING.handle
to obtain the handle from the recording object.pStatus
- ALEAP_RECORDING_STATUS
struct to receive the recording status.- Returns:
- The operation result code, a member of the
eLeapRS
enumeration. - Since:
- LeapJna 1.0.0, Ultraleap Orion SDK 3.2.0
- See Also:
-
LeapRecordingRead
Reads a tracking frame from a
LEAP_RECORDING
file.Caller is responsible for allocating a buffer large enough to hold the data of the frame. Use
LeapRecordingReadSize(Pointer, LongByReference)
to calculate the minimum size of this buffer.- Parameters:
pRecording
- The recording being read from. UseLEAP_RECORDING.handle
to obtain the handle from the recording object.pEvent
- ALEAP_TRACKING_EVENT
with enough allocated memory to fit the frame data. UseLeapRecordingReadSize
to get the required size, and thenLEAP_TRACKING_EVENT(int)
to create the struct and allocate memory.ncbEvent
- The size of thepEvent
struct in bytes.- Returns:
- The operation result code, a member of the
eLeapRS
enumeration. - Since:
- LeapJna 1.0.0, Ultraleap Orion SDK 3.2.0
- See Also:
-
LeapRecordingReadSize
Retrieves the number of bytes required to allocate the next frame in a recording.
Use this function to determine the size of the buffer to allocate before calling
LeapRecordingRead(Pointer, LEAP_TRACKING_EVENT, long)
.- Parameters:
pRecording
- The recording being read from. UseLEAP_RECORDING.handle
to obtain the handle from the recording object.pncbEvent
- A pointer that receives the number of bytes required to store the next frame.- Returns:
- The operation result code, a member of the
eLeapRS
enumeration. - Since:
- LeapJna 1.0.0, Ultraleap Orion SDK 3.2.0
- See Also:
-
LeapRecordingClose
Closes aLEAP_RECORDING
.- Parameters:
ppRecording
- The recording being closed. Will modify *ppRecording to be null.- Returns:
- The operation result code, a member of the
eLeapRS
enumeration. - Since:
- LeapJna 1.0.0, Ultraleap Orion SDK 3.2.0
- See Also:
-