Kinect API update, impl moved to separate package

This commit is contained in:
Kazik Pogoda
2019-08-24 18:34:48 +02:00
parent 40b919edd2
commit 4c6d4cc578
3 changed files with 40 additions and 12 deletions

View File

@@ -17,9 +17,10 @@ interface Kinects<CTX> {
/**
* Starts kinect device of a given number.
*
* @param num the kinect device index.
* @throws KinectException if device of such a number does not exist,
* better to count them first.
* @param num the kinect device index (starts with 0). If no value specified,
* it will default to 0.
* @throws KinectException if device of such a number does not exist
* (better to count them first), or it was already started.
* @see countDevices
*/
fun startDevice(num: Int = 0): KinectDevice<CTX>
@@ -34,15 +35,17 @@ interface Kinects<CTX> {
/**
* Represents specific device.
*
* @param <CTX> data needed to make low level kinect support calls.
* @param CTX type of data needed to make low level kinect support calls (e.g. freenect contexts).
*/
interface KinectDevice<CTX> : Extension {
val depthCamera: KinectDepthCamera
/**
* Executes low level Kinect commands in the kinect thread in the context of this device.
*/
fun <T> execute(commands: (CTX) -> T): T
}
interface KinectCamera {
@@ -51,6 +54,19 @@ interface KinectCamera {
val height: Int
var mirror: Boolean
val currentFrame: ColorBuffer
/**
* Returns the latest frame, but only once. Useful for the scenarios
* where each new frame triggers extra computation. Therefore the same
* expensive operation might happen only once, especially when the refresh
* rate of the target screen is higher than kinect's 30 fps.
* <p>
* Example usage:
* <pre>
* kinect.depthCamera.getLatestFrame()?.let { frame ->
* grayscaleFilter.apply(frame, grayscaleBuffer)
* }
* </pre>
*/
fun getLatestFrame(): ColorBuffer?
}