updated to use jpeg decoding
This commit is contained in:
parent
4fa94a647d
commit
d7d5887fb1
2 changed files with 5 additions and 1 deletions
|
@ -2,6 +2,7 @@ import websockets
|
||||||
import asyncio
|
import asyncio
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from ultralytics import YOLO
|
from ultralytics import YOLO
|
||||||
|
import time
|
||||||
import cv2
|
import cv2
|
||||||
|
|
||||||
classNames = ["person", "bicycle", "car", "motorbike", "aeroplane", "bus", "train", "truck", "boat",
|
classNames = ["person", "bicycle", "car", "motorbike", "aeroplane", "bus", "train", "truck", "boat",
|
||||||
|
@ -28,6 +29,7 @@ async def handle_connection(websocket, path):
|
||||||
|
|
||||||
# frame = cv2.imdecode(nparr, cv2.IMREAD_COLOR)
|
# frame = cv2.imdecode(nparr, cv2.IMREAD_COLOR)
|
||||||
frame = cv2.cvtColor(nparr, cv2.COLOR_BGR2RGB)
|
frame = cv2.cvtColor(nparr, cv2.COLOR_BGR2RGB)
|
||||||
|
cv2.imshow("from_remote", frame)
|
||||||
|
|
||||||
# Perform object detection
|
# Perform object detection
|
||||||
results = model.track(frame, persist=True)
|
results = model.track(frame, persist=True)
|
||||||
|
@ -73,6 +75,8 @@ async def handle_connection(websocket, path):
|
||||||
|
|
||||||
ret = lines.encode('utf-8')
|
ret = lines.encode('utf-8')
|
||||||
|
|
||||||
|
cv2.waitKey(80)
|
||||||
|
|
||||||
await websocket.send(ret)
|
await websocket.send(ret)
|
||||||
|
|
||||||
except websockets.exceptions.ConnectionClosed:
|
except websockets.exceptions.ConnectionClosed:
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 66acd4698fcc997099ebc1ddc6f8e5ddd0e3579c
|
Subproject commit a3d8a6fd064c0a194dc0815e7f19c900937921d9
|
Loading…
Reference in a new issue