Pose.from constructor

Pose.from(
  1. Map json
)

Implementation

factory Pose.from(Map json) {
  Map<PoseLandmarkType, PoseLandmark> landmarks = {};

  for (String key in json.keys) {
    PoseLandmarkType? type = toPoseLandmarkType(key);
    Map item = json[key];

    if (type != null) {
      landmarks[type] = PoseLandmark(
        type: type,
        position: toPoint(item['position']),
        inFrameLikelihood: item['inFrameLikelihood'] as double,
      );
    }
  }

  return Pose(landmarks: landmarks);
}