added position encoding (but not to a socket yet)
This commit is contained in:
parent
22ca17977e
commit
b4e623c59f
2 changed files with 9 additions and 4 deletions
|
@ -30,7 +30,6 @@ def main(websocket_addr):
|
|||
cap.set(3, 640)
|
||||
cap.set(4, 480)
|
||||
|
||||
frame_count = 0
|
||||
while cap.isOpened():
|
||||
ret, frame = cap.read()
|
||||
if not ret:
|
||||
|
@ -39,6 +38,8 @@ def main(websocket_addr):
|
|||
# Perform object detection
|
||||
results = model.predict(frame)
|
||||
|
||||
max_x1, max_y1, max_x2, max_y2 = 0
|
||||
|
||||
for r in results:
|
||||
boxes = r.boxes
|
||||
for box in boxes:
|
||||
|
@ -62,9 +63,13 @@ def main(websocket_addr):
|
|||
|
||||
cv2.putText(frame, classNames[cls], org, font, fontScale, color, thickness)
|
||||
|
||||
print(f"{frame_count}, {x1}:{y1}, {x2}:{y2}")
|
||||
if (x2-x1) * (y2 - y1):
|
||||
max_x1 = x1
|
||||
max_x2 = x2
|
||||
max_y1 = y1
|
||||
max_y2 = y2
|
||||
|
||||
frame_count += 1
|
||||
print(f"{max_x1}:{max_y1}, {max_x2}:{max_y2}")
|
||||
|
||||
cv2.imshow('Webcam', frame)
|
||||
if cv2.waitKey(1) == ord('q'):
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 4530cf45a81cbd605d3fae4a371847239b47cb6e
|
||||
Subproject commit 2278b4cd79c9ec0267198eba9f92b4e4ad4aeb78
|
Loading…
Reference in a new issue