sendFrames method
override
Reads frame/s from the camera and sends it/them.
Implementation
@override
void sendFrames() {
// Get frames from RealSense
final frames = camera.getFrames();
if (frames == nullptr) return;
// Compress colorized frame
final Pointer<Uint8> rawColorized = frames.ref.colorized_data;
final Pointer<Mat> colorizedMatrix = getMatrix(camera.depthResolution.height, camera.depthResolution.width, rawColorized);
final OpenCVImage? colorizedJpg = encodeJpg(colorizedMatrix, quality: details.quality);
if (colorizedJpg == null) {
sendLog(LogLevel.debug, "Could not encode colorized frame");
} else {
sendFrame(colorizedJpg);
}
sendRgbFrame(frames.ref.rgb_data);
fpsCount++;
// send(DepthFramePayload(frames.address)); // For autonomy
nativeLib.Mat_destroy(colorizedMatrix);
frames.dispose();
}