Add angle to BoundingBox

PiperOrigin-RevId: 547321781
This commit is contained in:
Sebastian Schmidt 2023-07-11 15:56:47 -07:00 committed by Copybara-Service
parent aabf61f28d
commit f2f49b9fc8
5 changed files with 12 additions and 5 deletions

View File

@ -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;
}

View File

@ -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: []
});
});

View File

@ -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,
};
}

View File

@ -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: []
});
});

View File

@ -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: []
});
});