Skip to content

Free Motion Capture for Everyone πŸ’€βœ¨

TypeScript

Workign sesion with jon was nice

Endurance Idehen1f44071f1fa8
diff --git a/jon_scratch/opencv_camera.py b/jon_scratch/opencv_camera.py
index 23714a08..1104a3b8 100644
--- a/jon_scratch/opencv_camera.py
+++ b/jon_scratch/opencv_camera.py
@@ -49,7 +49,7 @@ class OpenCVCamera(TweakedModel):
logger.error('Could not connect to a camera at port# {}'.format(self.port_number))
return success
- # set camera stream paramters
+ # set camera stream parameters
self.opencv_video_capture_object.set(cv2.CAP_PROP_EXPOSURE, self.exposure)
self.opencv_video_capture_object.set(cv2.CAP_PROP_FRAME_WIDTH, self.resolution_width)
self.opencv_video_capture_object.set(cv2.CAP_PROP_FRAME_HEIGHT, self.resolution_height)
diff --git a/src/core_processor/board_detection/detect.py b/src/core_processor/board_detection/detect.py
index c2bc2fed..cfa31d01 100644
--- a/src/core_processor/board_detection/detect.py
+++ b/src/core_processor/board_detection/detect.py
@@ -9,15 +9,12 @@ from aiomultiprocess.types import Queue
from src.core_processor.processor import ImagePayload
-from rich import inspect
+aruco_dict = cv2.aruco.Dictionary_get(cv2.aruco.DICT_4X4_250)
+charuco_length = 7
+charuco_width = 5
-
-# aruco_dict = cv2.aruco.Dictionary_get(cv2.aruco.DICT_4X4_250)
-# charuco_length = 7
-# charuco_width = 5
-
-# board = cv2.aruco.CharucoBoard_create(charuco_length, charuco_width, 1, .8, aruco_dict)
-# num_charuco_corners = (charuco_length-1) * (charuco_width-1)
+board = cv2.aruco.CharucoBoard_create(charuco_length, charuco_width, 1, .8, aruco_dict)
+num_charuco_corners = (charuco_length-1) * (charuco_width-1)
class BoardDetection:
@@ -30,31 +27,23 @@ class BoardDetection:
async def process(self, queue: Queue):
logger = logging.getLogger(__name__)
while True:
- message = None
+ message: ImagePayload = ImagePayload(frames=[])
try:
message = queue.get(timeout=1) # type: ImagePayload
except Exception as e:
pass
- print('got message from the queue')
-
-
if not message:
continue
-
- frames = message.frames
- print(f'got image of shape {f.image.shape}')
-
- for f in frames:
- # charuco_corners, charuco_ids, aruco_square_corners, aruco_square_ids = self.detect_charuco_board(f.image)
- # cv2.polylines(f.image, np.int32([charuco_corners]), True, (0,100,255), 2)
+ for f in message.frames:
+ charuco_corners, charuco_ids, aruco_square_corners, aruco_square_ids = self.detect_charuco_board(f.image)
+ cv2.polylines(f.image, np.int32([charuco_corners]), True, (0,100,255), 2)
cv2.imshow(str(f.port_number), f.image)
exit_key = cv2.waitKey(1)
if exit_key == 27:
break
-
def detect_charuco_board(self, image):
"""
Charuco base pose estimation.
diff --git a/src/core_processor/processor.py b/src/core_processor/processor.py
index f1b2011c..8c141a75 100644
--- a/src/core_processor/processor.py
+++ b/src/core_processor/processor.py
@@ -1,5 +1,5 @@
import logging
-from typing import Dict, List, NamedTuple
+from typing import List, NamedTuple
import numpy as np
from aiomultiprocess import Process
@@ -7,7 +7,6 @@ from aiomultiprocess.types import Queue
from freemocap.prod.cam.detection.cam_singleton import get_or_create_cams
from jon_scratch.opencv_camera import OpenCVCamera
-from src.core_processor.app_events.app_queue import CameraFrameQueue
def create_opencv_cams():