11
2- __version__ = '0.2.1'
2+ __version__ = '0.2.1.1 '
33
44import numpy as np
55
@@ -10,13 +10,13 @@ def bbox_to_points(bbox_xyxy):
1010 """Helper method to convert bounding box as list/tuple of [x1, y1, x2, y2] into points `ndarray` of shape (N, 2)
1111
1212 Args:
13- bbox_xyxy (list or tuple): bounding box as list/tuple of [x1, y1, x2, y2]
13+ bbox_xyxy (list or tuple or ndarray ): bounding box as list/tuple of [x1, y1, x2, y2]
1414
1515 Returns:
1616 ndarray of points
1717
1818 """
19- assert isinstance (bbox_xyxy , (list , tuple )) and len (bbox_xyxy ) == 4 , \
19+ assert isinstance (bbox_xyxy , (list , tuple , np . ndarray )) and len (bbox_xyxy ) == 4 , \
2020 "Argument bbox_xyxy should be a list/tuple of [x1, y1, x2, y2]"
2121
2222 return np .array ([
@@ -37,7 +37,7 @@ def xywh_to_xyxy(xywh):
3737 list [x1, y1, x2, y2]
3838
3939 """
40- assert isinstance (xywh , (list , tuple )) and len (xywh ) == 4 , \
40+ assert isinstance (xywh , (list , tuple , np . ndarray )) and len (xywh ) == 4 , \
4141 "Argument xywh should be a list/tuple of [x1, y1, width, height]"
4242 x1 , y1 = xywh [0 ], xywh [1 ]
4343 x2 = x1 + max (0 , xywh [2 ] - 1 )
@@ -55,7 +55,7 @@ def xyxy_to_xywh(xyxy):
5555 list [x1, y1, width, height]
5656
5757 """
58- assert isinstance (xyxy , (list , tuple )) and len (xyxy ) == 4 , \
58+ assert isinstance (xyxy , (list , tuple , np . ndarray )) and len (xyxy ) == 4 , \
5959 "Argument xyxy should be a list/tuple of [x1, y1, x2, y2]"
6060 x1 , y1 = xyxy [0 ], xyxy [1 ]
6161 w = xyxy [2 ] - x1 + 1
0 commit comments