Skip to content

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

TypeScript

calib pipeline starting to work :D

jonmatthisedea2c75e749
diff --git a/freemocap/freemocap_app/freemocap_app_state.py b/freemocap/freemocap_app/freemocap_app_state.py
index b41ca22c..33559023 100644
--- a/freemocap/freemocap_app/freemocap_app_state.py
+++ b/freemocap/freemocap_app/freemocap_app_state.py
@@ -60,18 +60,12 @@ class FreemocapAppState:
self.processing_camera_shms = SingleSlotCameraGroupSharedMemory.create(camera_configs=self.camera_configs,
read_only=True)
- def create_processing_server(self) -> BaseProcessingServer:
+ def create_processing_server(self) -> CalibrationProcessingServer:
if not self.frame_escape_shm:
raise ValueError("Cannot create image processing server without frame escape shared memory!")
self.pipeline_shutdown_event.clear()
- # if processing_server_type == ProcessingServerTypes.DUMMY:
- # return processing_server_type.value.create(
- # pipeline_config=DummyPipelineConfig.create(camera_configs=self.camera_configs),
- # camera_shm_dtos=self.get_camera_shm_dtos(),
- # shutdown_event=self.pipeline_shutdown_event,
- # )
return CalibrationProcessingServer.create(
pipeline_config=CalibrationPipelineConfig.create(camera_configs=self.camera_configs,
diff --git a/freemocap/pipelines/calibration_pipeline/__calibration_pipeline.py b/freemocap/pipelines/calibration_pipeline/__calibration_pipeline.py
index b59d033b..8b2641b3 100644
--- a/freemocap/pipelines/calibration_pipeline/__calibration_pipeline.py
+++ b/freemocap/pipelines/calibration_pipeline/__calibration_pipeline.py
@@ -13,11 +13,11 @@ from skellytracker.trackers.charuco_tracker import CharucoTrackerConfig
from skellytracker.trackers.charuco_tracker.charuco_annotator import CharucoImageAnnotator, CharucoAnnotatorConfig
from freemocap.pipelines.calibration_pipeline.calibration_aggregation_node import CalibrationAggregationNodeConfig, \
- CalibrationAggregationProcessNode, CalibrationAggregationLayerOutputData, CalibrationPipelineOutputData
+ CalibrationAggregationProcessNode, CalibrationPipelineOutputData
from freemocap.pipelines.calibration_pipeline.calibration_camera_node import CalibrationPipelineCameraNodeConfig, \
- CalibrationCameraNode, CalibrationCameraNodeOutputData
+ CalibrationCameraNode
from freemocap.pipelines.pipeline_abcs import BasePipelineConfig, BaseProcessingPipeline, BaseProcessingServer, \
- PipelineImageAnnotator, BasePipelineOutputData
+ PipelineImageAnnotator
logger = logging.getLogger(__name__)
@@ -36,8 +36,6 @@ class CalibrationPipelineConfig(BasePipelineConfig):
aggregation_node_config=CalibrationAggregationNodeConfig())
-
-
@dataclass
class CalibrationPipelineImageAnnotator(PipelineImageAnnotator):
camera_node_annotators: dict[CameraId, CharucoImageAnnotator]
@@ -48,10 +46,12 @@ class CalibrationPipelineImageAnnotator(PipelineImageAnnotator):
for camera_id, config in configs.items()}
)
- def annotate_images(self, multiframe_payload: MultiFramePayload, pipeline_output: CalibrationPipelineOutputData) -> MultiFramePayload:
+ def annotate_images(self, multiframe_payload: MultiFramePayload,
+ pipeline_output: CalibrationPipelineOutputData) -> MultiFramePayload:
for camera_id, annotator in self.camera_node_annotators.items():
- multiframe_payload = annotator.annotate_image(multiframe_payload.frames[camera_id],
- pipeline_output.camera_node_output[camera_id].charuco_observation)
+ multiframe_payload.frames[camera_id].image = annotator.annotate_image(
+ image=multiframe_payload.frames[camera_id].image,
+ latest_observation = pipeline_output.camera_node_output[camera_id].charuco_observation)
return multiframe_payload
diff --git a/freemocap/pipelines/pipeline_abcs.py b/freemocap/pipelines/pipeline_abcs.py
index e93b3137..b80c735b 100644
--- a/freemocap/pipelines/pipeline_abcs.py
+++ b/freemocap/pipelines/pipeline_abcs.py
@@ -280,8 +280,10 @@ class BaseProcessingPipeline(ABC):
def annotate_images(self, multiframe_payload: MultiFramePayload) -> MultiFramePayload:
pipeline_output = self.get_output_for_frame(target_frame_number=multiframe_payload.multi_frame_number)
- if pipeline_output is not None:
- return self.annotator.annotate_images(multiframe_payload, pipeline_output)
+ if pipeline_output is None:
+ return multiframe_payload
+ return self.annotator.annotate_images(multiframe_payload, pipeline_output)
+
def start(self):
diff --git a/uv.lock b/uv.lock
index b0722adb..b58836ae 100644
--- a/uv.lock
+++ b/uv.lock
@@ -1357,7 +1357,7 @@ wheels = [
[[package]]
name = "skellycam"
version = "2023.9.1086"
-source = { git = "https://github.com/freemocap/skellycam?branch=jon%2Fdevelopment#e72c6bd2e96f82bc41412f807d4af03016e31fc0" }
+source = { git = "https://github.com/freemocap/skellycam?branch=jon%2Fdevelopment#3c7d44daec1ecfcc211bdf4ccd09e60a12e25d18" }
dependencies = [
{ name = "fastapi" },
{ name = "httpx" },
@@ -1376,6 +1376,7 @@ dependencies = [
{ name = "pyside6" },
{ name = "scipy" },
{ name = "setproctitle" },
+ { name = "skellytracker" },
{ name = "tabulate" },
{ name = "tzlocal" },
{ name = "uvicorn" },