sendRgbFrame method

void sendRgbFrame(
  1. Pointer<Uint8> rawRGB
)

Sends the RealSense's RGB frame and optionally detects ArUco tags.

Implementation

void sendRgbFrame(Pointer<Uint8> rawRGB) {
  if (rawRGB == nullptr) return;
  final Pointer<Mat> rgbMatrix = getMatrix(camera.rgbResolution.height, camera.rgbResolution.width, rawRGB);
  //detectAndAnnotateFrames(rgbMatrix);  // detect ArUco tags

  // Compress the RGB frame into a JPG
  if (rgbMatrix != nullptr) {
    final OpenCVImage? rgbJpg = encodeJpg(rgbMatrix, quality: details.quality);
    if (rgbJpg == null) {
      sendLog(LogLevel.debug, "Could not encode RGB frame");
    } else {
      final newDetails = details.deepCopy()..name = CameraName.ROVER_FRONT;
      sendFrame(rgbJpg, detailsOverride: newDetails);
    }
    nativeLib.Mat_destroy(rgbMatrix);
  }
}