diff --git a/mediapipe/tasks/web/components/containers/bounding_box.d.ts b/mediapipe/tasks/web/components/containers/bounding_box.d.ts index 77f2837d1..85811f443 100644 --- a/mediapipe/tasks/web/components/containers/bounding_box.d.ts +++ b/mediapipe/tasks/web/components/containers/bounding_box.d.ts @@ -24,4 +24,10 @@ export declare interface BoundingBox { width: number; /** The height of the bounding box, in pixels. */ height: number; + /** + * Angle of rotation of the original non-rotated box around the top left + * corner of the original non-rotated box, in clockwise degrees from the + * horizontal. + */ + angle: number; } diff --git a/mediapipe/tasks/web/components/processors/detection_result.test.ts b/mediapipe/tasks/web/components/processors/detection_result.test.ts index 0fa8156ba..8e3e413e1 100644 --- a/mediapipe/tasks/web/components/processors/detection_result.test.ts +++ b/mediapipe/tasks/web/components/processors/detection_result.test.ts @@ -58,7 +58,7 @@ describe('convertFromDetectionProto()', () => { categoryName: 'foo', displayName: 'bar', }], - boundingBox: {originX: 1, originY: 2, width: 3, height: 4}, + boundingBox: {originX: 1, originY: 2, width: 3, height: 4, angle: 0}, keypoints: [{ x: 5, y: 6, @@ -85,7 +85,7 @@ describe('convertFromDetectionProto()', () => { categoryName: '', displayName: '', }], - boundingBox: {originX: 0, originY: 0, width: 0, height: 0}, + boundingBox: {originX: 0, originY: 0, width: 0, height: 0, angle: 0}, keypoints: [] }); }); diff --git a/mediapipe/tasks/web/components/processors/detection_result.ts b/mediapipe/tasks/web/components/processors/detection_result.ts index 4999ed31b..6cb5e6230 100644 --- a/mediapipe/tasks/web/components/processors/detection_result.ts +++ b/mediapipe/tasks/web/components/processors/detection_result.ts @@ -42,7 +42,8 @@ export function convertFromDetectionProto(source: DetectionProto): Detection { originX: boundingBox.getXmin() ?? 0, originY: boundingBox.getYmin() ?? 0, width: boundingBox.getWidth() ?? 0, - height: boundingBox.getHeight() ?? 0 + height: boundingBox.getHeight() ?? 0, + angle: 0.0, }; } diff --git a/mediapipe/tasks/web/vision/face_detector/face_detector_test.ts b/mediapipe/tasks/web/vision/face_detector/face_detector_test.ts index dfe84bb17..049edefd6 100644 --- a/mediapipe/tasks/web/vision/face_detector/face_detector_test.ts +++ b/mediapipe/tasks/web/vision/face_detector/face_detector_test.ts @@ -191,7 +191,7 @@ describe('FaceDetector', () => { categoryName: '', displayName: '', }], - boundingBox: {originX: 0, originY: 0, width: 0, height: 0}, + boundingBox: {originX: 0, originY: 0, width: 0, height: 0, angle: 0}, keypoints: [] }); }); diff --git a/mediapipe/tasks/web/vision/object_detector/object_detector_test.ts b/mediapipe/tasks/web/vision/object_detector/object_detector_test.ts index 9c63eaba1..6437216b1 100644 --- a/mediapipe/tasks/web/vision/object_detector/object_detector_test.ts +++ b/mediapipe/tasks/web/vision/object_detector/object_detector_test.ts @@ -210,7 +210,7 @@ describe('ObjectDetector', () => { categoryName: '', displayName: '', }], - boundingBox: {originX: 0, originY: 0, width: 0, height: 0}, + boundingBox: {originX: 0, originY: 0, width: 0, height: 0, angle: 0}, keypoints: [] }); });