Search in sources :

Example 1 with org.bytedeco.libfreenect2

use of org.bytedeco.libfreenect2 in project javacv by bytedeco.

the class OpenKinect2FrameGrabber method grabIR.

protected void grabIR() {
    /**
     * 512x424 float. Range is [0.0, 65535.0].
     */
    org.bytedeco.libfreenect2.Frame IRImage = frames.get(org.bytedeco.libfreenect2.Frame.Ir);
    int channels = 1;
    int iplDepth = IPL_DEPTH_32F;
    int bpp = (int) IRImage.bytes_per_pixel();
    int deviceWidth = (int) IRImage.width();
    int deviceHeight = (int) IRImage.height();
    Pointer rawIRData = IRImage.data();
    if (rawIRImage == null) {
        rawIRImage = IplImage.createHeader(deviceWidth, deviceHeight, iplDepth, channels);
    }
    cvSetData(rawIRImage, rawIRData, deviceWidth * channels * iplDepth / 8);
}
Also used : Pointer(org.bytedeco.javacpp.Pointer) BytePointer(org.bytedeco.javacpp.BytePointer) org.bytedeco.libfreenect2(org.bytedeco.libfreenect2)

Example 2 with org.bytedeco.libfreenect2

use of org.bytedeco.libfreenect2 in project javacv by bytedeco.

the class OpenKinect2FrameGrabber method grabVideo.

protected void grabVideo() {
    int iplDepth = IPL_DEPTH_8U;
    org.bytedeco.libfreenect2.Frame rgb = frames.get(org.bytedeco.libfreenect2.Frame.Color);
    int channels = (int) rgb.bytes_per_pixel();
    int deviceWidth = (int) rgb.width();
    int deviceHeight = (int) rgb.height();
    BytePointer rawVideoImageData = rgb.data();
    if (rawVideoImage == null) {
        rawVideoImage = IplImage.createHeader(deviceWidth, deviceHeight, iplDepth, channels);
    }
    cvSetData(rawVideoImage, rawVideoImageData, deviceWidth * channels * iplDepth / 8);
    if (videoImageRGBA == null) {
        videoImageRGBA = rawVideoImage.clone();
    }
    cvCvtColor(rawVideoImage, videoImageRGBA, COLOR_BGRA2RGBA);
}
Also used : BytePointer(org.bytedeco.javacpp.BytePointer) org.bytedeco.libfreenect2(org.bytedeco.libfreenect2)

Example 3 with org.bytedeco.libfreenect2

use of org.bytedeco.libfreenect2 in project javacv by bytedeco.

the class OpenKinect2FrameGrabber method grabDepth.

protected void grabDepth() {
    /**
     * 512x424 float also ?.
     */
    org.bytedeco.libfreenect2.Frame depthImage = frames.get(org.bytedeco.libfreenect2.Frame.Depth);
    int channels = 1;
    int iplDepth = IPL_DEPTH_32F;
    int bpp = (int) depthImage.bytes_per_pixel();
    int deviceWidth = (int) depthImage.width();
    int deviceHeight = (int) depthImage.height();
    Pointer rawDepthData = depthImage.data();
    if (rawDepthImage == null) {
        rawDepthImage = IplImage.createHeader(deviceWidth, deviceHeight, iplDepth, channels);
    }
    cvSetData(rawDepthImage, rawDepthData, deviceWidth * channels * iplDepth / 8);
}
Also used : Pointer(org.bytedeco.javacpp.Pointer) BytePointer(org.bytedeco.javacpp.BytePointer) org.bytedeco.libfreenect2(org.bytedeco.libfreenect2)

Aggregations

BytePointer (org.bytedeco.javacpp.BytePointer)3 org.bytedeco.libfreenect2 (org.bytedeco.libfreenect2)3 Pointer (org.bytedeco.javacpp.Pointer)2