processFrame method
Process a single frame manually (for testing or one-off processing)
frameData - Raw frame data in RGBA format
width - Frame width
height - Frame height
Implementation
Future<ProcessedFrame?> processFrame(
Uint8List frameData, {
required int width,
required int height,
}) async {
if (!_isInitialized || _segmenter == null) {
throw StateError('FrameProcessor not initialized');
}
final metadata = SegmenterInputMetadata(
width: width,
height: height,
format: SegmenterInputFormat.rgba8888,
);
final result = await _segmenter!.processFrame(frameData, metadata);
if (result.success && result.mask != null) {
return ProcessedFrame(
originalBytes: frameData,
segmentationMask: result.mask!,
width: width,
height: height,
);
}
return null;
}