ToF Camera Manager

Connect to the ToF camera on the Lumepad
TofCameraManager is a system service manager for detecting, characterizing, and connecting to ToF camera. Developers can register listeners to listen for ToF frames when they become available. Due to firmware and hardware limitations, the current output format is a Bitmap.

Set up your Environment

Follow the steps mentioned in the Getting Started guide to set up the Camera SDK in your project.
Listening for ToF Frames
To listen for ToF frames, you need to instantiate an object of the ToFCameraManager and pass in the Context and TofCameraManager.OnTofImageAvailableListener as parameters.
TofCameraManager tofCameraManager = new TofCameraManager(this, new TofCameraManager.OnTofImageAvailableListener() {
public void onTofBitmapAvailable(Bitmap ir, Bitmap depth, ByteBuffer depthBuffer, long timestamp) {
Matrix matrix = new Matrix();
matrix.preScale(1.0f, -1.0f);
Bitmap irBitmap = Bitmap.createBitmap(ir.copy(Bitmap.Config.RGB_565, false), 0, 0, ir.getWidth(), ir.getHeight(), matrix, true);
matrix.preScale(1.0f, -1.0f);
Bitmap depthBitmap = Bitmap.createBitmap(depth.copy(Bitmap.Config.RGB_565, false), 0, 0, depth.getWidth() - 8, depth.getHeight() - 8, matrix, true);
mDepthBuffer = depthBuffer;

Opening the ToF Camera

To open the ToF camera, you can call openCamera() using the TofCameraManager

Closing the ToF Camera

To close the ToF camera, you can call closeCamera() on the TofCameraManager
Copyright © 2023 Leia Inc. All Rights Reserved