webcam working
This commit is contained in:
parent
e1da9a6dca
commit
7911245ff9
2 changed files with 30 additions and 10 deletions
|
@ -106,7 +106,8 @@ def run_pipeline(frame, node: dict, return_bbox: bool = False):
|
|||
best_box = box_cpu
|
||||
|
||||
bbox = None
|
||||
if detection and node.get("crop", False) and best_box is not None:
|
||||
# Modified bounding box calculation: always compute bbox if best_box exists
|
||||
if detection and best_box is not None:
|
||||
coords = best_box.xyxy[0]
|
||||
x1, y1, x2, y2 = map(int, coords)
|
||||
h, w = frame.shape[:2]
|
||||
|
@ -114,7 +115,8 @@ def run_pipeline(frame, node: dict, return_bbox: bool = False):
|
|||
x2, y2 = min(w, x2), min(h, y2)
|
||||
if x2 > x1 and y2 > y1:
|
||||
bbox = (x1, y1, x2, y2)
|
||||
frame = frame[y1:y2, x1:x2]
|
||||
if node.get("crop", False):
|
||||
frame = frame[y1:y2, x1:x2]
|
||||
|
||||
if detection is not None:
|
||||
for branch in node["branches"]:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue