Merge pull request #733 from roboflow/fix/speed-estimation-issue-when-detections-empty
`fix/speed-estimation-issue-when-detections-empty`
This commit is contained in:
commit
536e0d86a8
|
|
@ -1,6 +1,6 @@
|
|||
supervision==0.18.0rc1
|
||||
tqdm
|
||||
tqdm==4.66.1
|
||||
requests
|
||||
ultralytics
|
||||
super-gradients
|
||||
inference
|
||||
ultralytics==8.0.237
|
||||
super-gradients==3.5.0
|
||||
inference==0.9.8
|
||||
|
|
|
|||
|
|
@ -29,6 +29,9 @@ class ViewTransformer:
|
|||
self.m = cv2.getPerspectiveTransform(source, target)
|
||||
|
||||
def transform_points(self, points: np.ndarray) -> np.ndarray:
|
||||
if points.size == 0:
|
||||
return points
|
||||
|
||||
reshaped_points = points.reshape(-1, 1, 2).astype(np.float32)
|
||||
transformed_points = cv2.perspectiveTransform(reshaped_points, self.m)
|
||||
return transformed_points.reshape(-1, 2)
|
||||
|
|
|
|||
Loading…
Reference in New Issue