- util: image_crop no round
- construct tracker object in constructor
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import cv2
|
||||
import sys
|
||||
import numpy as np
|
||||
import imutils as im
|
||||
|
||||
@@ -34,19 +33,18 @@ def bbox_center(bbox):
|
||||
return x, y
|
||||
|
||||
|
||||
def bbox_extend(bbox: cv2.typing.Rect, factor: float = 0):
|
||||
def bbox_extend(bbox: np.array, factor: float = 0):
|
||||
we2 = bbox[2]*factor/2
|
||||
he2 = bbox[3]*factor/2
|
||||
|
||||
return bbox_round((bbox[0]-we2, bbox[1]-he2, bbox[2]+2*we2, bbox[3]+2*he2))
|
||||
|
||||
|
||||
def image_crop(src, bbox: cv2.typing.Rect):
|
||||
bb = bbox_round(bbox)
|
||||
x = bb[0]
|
||||
y = bb[1]
|
||||
w = bb[2]
|
||||
h = bb[3]
|
||||
def image_crop(src, bbox: np.array):
|
||||
x = int(bbox[0])
|
||||
y = int(bbox[1])
|
||||
w = int(bbox[2])
|
||||
h = int(bbox[3])
|
||||
|
||||
dst = src[y:y+h, x:x+w]
|
||||
return dst
|
||||
|
||||
Reference in New Issue
Block a user