decodeGestureRecognizerResult function
Decodes a Gesture Recognizer result.
Implementation
GestureRecognizerResult decodeGestureRecognizerResult(VisionResultData data) =>
GestureRecognizerResult(
imageWidth: data.width,
imageHeight: data.height,
timestampMilliseconds: data.timestamp,
handLandmarks: _imageLandmarks(data, 'landmarks'),
handWorldLandmarks: _worldLandmarks(data, 'worldLandmarks'),
handedness: _categoryLists(data.result['handedness']),
gestures: [
for (final hand in data.result['gestures'] as List)
[
// Canned and custom labels are numbered independently, so the
// merged index carries no meaning; Google's C API reports -1.
for (final gesture in _categories(hand))
MediaPipeCategory(
index: -1,
score: gesture.score,
categoryName: gesture.categoryName,
displayName: gesture.displayName,
),
],
],
);