|
12 | 12 | from supervision.draw.color import Color, ColorPalette
|
13 | 13 | from supervision.draw.utils import draw_polygon
|
14 | 14 | from supervision.geometry.core import Position
|
15 |
| -from supervision.utils.image import crop_image, resize_image, place_image |
| 15 | +from supervision.utils.image import crop_image, place_image, resize_image |
16 | 16 |
|
17 | 17 |
|
18 | 18 | class BoundingBoxAnnotator(BaseAnnotator):
|
@@ -1796,23 +1796,17 @@ def annotate(
|
1796 | 1796 | ```
|
1797 | 1797 | """
|
1798 | 1798 | crops = [
|
1799 |
| - crop_image(image=scene, xyxy=xyxy) |
1800 |
| - for xyxy |
1801 |
| - in detections.xyxy.astype(int) |
| 1799 | + crop_image(image=scene, xyxy=xyxy) for xyxy in detections.xyxy.astype(int) |
1802 | 1800 | ]
|
1803 | 1801 | resized_crops = [
|
1804 |
| - resize_image(image=crop, scale_factor=self.scale_factor) |
1805 |
| - for crop |
1806 |
| - in crops |
| 1802 | + resize_image(image=crop, scale_factor=self.scale_factor) for crop in crops |
1807 | 1803 | ]
|
1808 | 1804 | anchors = detections.get_anchors_coordinates(anchor=self.position).astype(int)
|
1809 | 1805 |
|
1810 | 1806 | for resized_crop, anchor in zip(resized_crops, anchors):
|
1811 | 1807 | crop_wh = resized_crop.shape[1], resized_crop.shape[0]
|
1812 | 1808 | crop_anchor = self.calculate_crop_coordinates(
|
1813 |
| - anchor=anchor, |
1814 |
| - crop_wh=crop_wh, |
1815 |
| - position=self.position |
| 1809 | + anchor=anchor, crop_wh=crop_wh, position=self.position |
1816 | 1810 | )
|
1817 | 1811 | scene = place_image(scene=scene, image=resized_crop, anchor=crop_anchor)
|
1818 | 1812 |
|
|
0 commit comments