Skip to content

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

TypeScript

Reformat Camera Controller Group Box (#750)

philipqueen27b87edf0d1f
diff --git a/freemocap/core_processes/capture_volume_calibration/by_camera_reprojection_filtering.py b/freemocap/core_processes/capture_volume_calibration/by_camera_reprojection_filtering.py
index ca92243a..0aa2a2ca 100644
--- a/freemocap/core_processes/capture_volume_calibration/by_camera_reprojection_filtering.py
+++ b/freemocap/core_processes/capture_volume_calibration/by_camera_reprojection_filtering.py
@@ -15,12 +15,12 @@ logger = logging.getLogger(__name__)
def run_reprojection_error_filtering(
- image_data_numCams_numFrames_numTrackedPts_XYZ: np.ndarray,
- raw_skel3d_frame_marker_xyz: np.ndarray,
- skeleton_reprojection_error_cam_fr_mar: np.ndarray,
- skeleton_reprojection_error_fr_mar: np.ndarray,
- anipose_calibration_object,
- processing_parameters: ProcessingParameterModel,
+ image_data_numCams_numFrames_numTrackedPts_XYZ: np.ndarray,
+ raw_skel3d_frame_marker_xyz: np.ndarray,
+ skeleton_reprojection_error_cam_fr_mar: np.ndarray,
+ skeleton_reprojection_error_fr_mar: np.ndarray,
+ anipose_calibration_object,
+ processing_parameters: ProcessingParameterModel,
) -> np.ndarray:
"""
Runs reprojection error filtering on 3d data, saves the filtered 3d data and reprojection error data, and creates and saves a debug plot.
@@ -35,7 +35,7 @@ def run_reprojection_error_filtering(
:return: filtered 3d data
"""
if hasattr(
- processing_parameters.tracking_model_info, "num_tracked_points_body"
+ processing_parameters.tracking_model_info, "num_tracked_points_body"
): # we don't want to reproject hand and face data
num_tracked_points = processing_parameters.tracking_model_info.num_tracked_points_body
else:
@@ -67,25 +67,27 @@ def run_reprojection_error_filtering(
plot_reprojection_error(
raw_reprojection_error_frame_marker=skeleton_reprojection_error_fr_mar,
filtered_reprojection_error_frame_marker=reprojection_filtered_skeleton_reprojection_error_fr_mar,
- reprojection_error_threshold=float(np.nanpercentile(
- skeleton_reprojection_error_cam_fr_mar,
- processing_parameters.anipose_triangulate_3d_parameters_model.reprojection_error_confidence_cutoff,
- )),
+ reprojection_error_threshold=float(
+ np.nanpercentile(
+ skeleton_reprojection_error_cam_fr_mar,
+ processing_parameters.anipose_triangulate_3d_parameters_model.reprojection_error_confidence_cutoff,
+ )
+ ),
output_folder_path=processing_parameters.recording_info_model.raw_data_folder_path,
)
return reprojection_filtered_skel3d_frame_marker_xyz
def filter_by_reprojection_error(
- reprojection_error_camera_frame_marker: np.ndarray,
- reprojection_error_frame_marker: np.ndarray,
- reprojection_error_confidence_threshold: float,
- image_2d_data: np.ndarray,
- raw_skel3d_frame_marker_xyz: np.ndarray,
- anipose_calibration_object,
- num_tracked_points: int,
- use_triangulate_ransac: bool = False,
- minimum_cameras_to_reproject: int = 3,
+ reprojection_error_camera_frame_marker: np.ndarray,
+ reprojection_error_frame_marker: np.ndarray,
+ reprojection_error_confidence_threshold: float,
+ image_2d_data: np.ndarray,
+ raw_skel3d_frame_marker_xyz: np.ndarray,
+ anipose_calibration_object,
+ num_tracked_points: int,
+ use_triangulate_ransac: bool = False,
+ minimum_cameras_to_reproject: int = 3,
) -> Tuple[np.ndarray, np.ndarray, np.ndarray]:
total_cameras = image_2d_data.shape[0]
num_cameras_to_remove = 1
@@ -168,16 +170,16 @@ def _nan_data_above_threshold(unique_frame_marker_list: list, retriangulated_dat
def _get_data_to_reproject(
- num_cameras_to_remove: int,
- reprojection_error_threshold: float,
- reprojError_cam_frame_marker: np.ndarray,
- input_2d_data_camera_frame_marker_xy: np.ndarray,
+ num_cameras_to_remove: int,
+ reprojection_error_threshold: float,
+ reprojError_cam_frame_marker: np.ndarray,
+ input_2d_data_camera_frame_marker_xy: np.ndarray,
) -> tuple[np.ndarray, list]:
indices_above_threshold = np.nonzero(reprojError_cam_frame_marker > reprojection_error_threshold)
logger.debug(f"SHAPE OF INDICES ABOVE THRESHOLD: {indices_above_threshold[0].shape}")
total_frame_marker_combos = (
- input_2d_data_camera_frame_marker_xy.shape[1] * input_2d_data_camera_frame_marker_xy.shape[2]
+ input_2d_data_camera_frame_marker_xy.shape[1] * input_2d_data_camera_frame_marker_xy.shape[2]
)
unique_frame_marker_list = _get_unique_frame_marker_list(indices_above_threshold=indices_above_threshold)
logger.info(
@@ -201,15 +203,15 @@ def _get_data_to_reproject(
def _get_unique_frame_marker_list(
- indices_above_threshold: np.ndarray,
+ indices_above_threshold: np.ndarray,
) -> list:
return list(set(zip(indices_above_threshold[1], indices_above_threshold[2])))
def _get_camera_frame_marker_lists_to_reproject(
- reprojError_cam_frame_marker: np.ndarray,
- frame_marker_list: list,
- num_cameras_to_remove: int,
+ reprojError_cam_frame_marker: np.ndarray,
+ frame_marker_list: list,
+ num_cameras_to_remove: int,
) -> Tuple[list, list, list]:
"""
Generate the lists of cameras, frames, and markers to reproject based on the given input.
@@ -233,14 +235,14 @@ def _get_camera_frame_marker_lists_to_reproject(
def _set_unincluded_data_to_nans(
- input_2d_data: np.ndarray,
- frames_with_reprojection_error: list,
- markers_with_reprojection_error: list,
- cameras_to_remove: list[list[int]],
+ input_2d_data: np.ndarray,
+ frames_with_reprojection_error: list,
+ markers_with_reprojection_error: list,
+ cameras_to_remove: list[list[int]],
) -> np.ndarray:
data_to_reproject = input_2d_data.copy()
for list_of_cameras, frame, marker in zip(
- cameras_to_remove, frames_with_reprojection_error, markers_with_reprojection_error
+ cameras_to_remove, frames_with_reprojection_error, markers_with_reprojection_error
):
for camera in list_of_cameras:
data_to_reproject[camera, frame, marker, :] = np.nan
@@ -248,10 +250,10 @@ def _set_unincluded_data_to_nans(
def plot_reprojection_error(
- raw_reprojection_error_frame_marker: np.ndarray,
- filtered_reprojection_error_frame_marker: np.ndarray,
- reprojection_error_threshold: float,
- output_folder_path: Union[str, Path],
+ raw_reprojection_error_frame_marker: np.ndarray,
+ filtered_reprojection_error_frame_marker: np.ndarray,
+ reprojection_error_threshold: float,
+ output_folder_path: Union[str, Path],
) -> None:
title = "Mean Reprojection Error Per Frame"
file_name = "debug_reprojection_error_filtering.png"
diff --git a/freemocap/core_processes/capture_volume_calibration/save_3d_data_to_npy.py b/freemocap/core_processes/capture_volume_calibration/save_3d_data_to_npy.py
index 94476f2e..c82ffc2f 100644
--- a/freemocap/core_processes/capture_volume_calibration/save_3d_data_to_npy.py
+++ b/freemocap/core_processes/capture_volume_calibration/save_3d_data_to_npy.py
@@ -15,35 +15,35 @@ logger = logging.getLogger(__name__)
def save_3d_data_to_npy(
- data3d_numFrames_numTrackedPoints_XYZ: np.ndarray,
- data3d_numFrames_numTrackedPoints_reprojectionError: np.ndarray,
- data3d_numCams_numFrames_numTrackedPoints_reprojectionError: np.ndarray,
- path_to_folder_where_data_will_be_saved: Union[str, Path],
- processing_level: str,
- file_prefix: str = "",
+ data3d_numFrames_numTrackedPoints_XYZ: np.ndarray,
+ data3d_numFrames_numTrackedPoints_reprojectionError: np.ndarray,
+ data3d_numCams_numFrames_numTrackedPoints_reprojectionError: np.ndarray,
+ path_to_folder_where_data_will_be_saved: Union[str, Path],
+ processing_level: str,
+ file_prefix: str = "",
):
path_to_folder_where_data_will_be_saved = Path(path_to_folder_where_data_will_be_saved)
Path(path_to_folder_where_data_will_be_saved).mkdir(parents=True, exist_ok=True) # save spatial XYZ data
if processing_level == "raw":
data_3d_save_path = path_to_folder_where_data_will_be_saved / f"{file_prefix}_{RAW_3D_NPY_FILE_NAME}"
reprojection_error_save_path = (
- path_to_folder_where_data_will_be_saved / f"{file_prefix}_{REPROJECTION_ERROR_NPY_FILE_NAME}"
+ path_to_folder_where_data_will_be_saved / f"{file_prefix}_{REPROJECTION_ERROR_NPY_FILE_NAME}"
)
full_reprojection_error_save_path = (
- path_to_folder_where_data_will_be_saved / f"{file_prefix}_{FULL_REPROJECTION_ERROR_NPY_FILE_NAME}"
+ path_to_folder_where_data_will_be_saved / f"{file_prefix}_{FULL_REPROJECTION_ERROR_NPY_FILE_NAME}"
)
elif processing_level == "reprojection_filtered":
data_3d_save_path = (
- path_to_folder_where_data_will_be_saved
- / f"{REPROJECTION_FILTERED_PREFIX}{file_prefix}_{RAW_3D_NPY_FILE_NAME}"
+ path_to_folder_where_data_will_be_saved
+ / f"{REPROJECTION_FILTERED_PREFIX}{file_prefix}_{RAW_3D_NPY_FILE_NAME}"
)
reprojection_error_save_path = (
- path_to_folder_where_data_will_be_saved
- / f"{REPROJECTION_FILTERED_PREFIX}{file_prefix}_{REPROJECTION_ERROR_NPY_FILE_NAME}"
+ path_to_folder_where_data_will_be_saved
+ / f"{REPROJECTION_FILTERED_PREFIX}{file_prefix}_{REPROJECTION_ERROR_NPY_FILE_NAME}"
)
full_reprojection_error_save_path = (
- path_to_folder_where_data_will_be_saved
- / f"{REPROJECTION_FILTERED_PREFIX}{file_prefix}_{FULL_REPROJECTION_ERROR_NPY_FILE_NAME}"
+ path_to_folder_where_data_will_be_saved
+ / f"{REPROJECTION_FILTERED_PREFIX}{file_prefix}_{FULL_REPROJECTION_ERROR_NPY_FILE_NAME}"
)
else:
logger.exception(f"processing_level: {processing_level} not recognized")
diff --git a/freemocap/core_processes/process_motion_capture_videos/processing_pipeline_functions/image_tracking_pipeline_functions.py b/freemocap/core_processes/process_motion_capture_videos/processing_pipeline_functions/image_tracking_pipeline_functions.py
index 86d0baf5..0ef2b67d 100644
--- a/freemocap/core_processes/process_motion_capture_videos/processing_pipeline_functions/image_tracking_pipeline_functions.py
+++ b/freemocap/core_processes/process_motion_capture_videos/processing_pipeline_functions/image_tracking_pipeline_functions.py
@@ -24,10 +24,10 @@ logger = logging.getLogger(__name__)
def run_image_tracking_pipeline(
- processing_parameters: ProcessingParameterModel,
- kill_event: multiprocessing.Event,
- queue: multiprocessing.Queue,
- use_tqdm: bool,
+ processing_parameters: ProcessingParameterModel,
+ kill_event: multiprocessing.Event,
+ queue: multiprocessing.Queue,
+ use_tqdm: bool,
) -> np.ndarray:
if queue:
handler = DirectQueueHandler(queue)
@@ -56,7 +56,7 @@ def run_image_tracking_pipeline(
processing_parameters.recording_info_model.synchronized_videos_folder_path
),
output_data_folder_path=Path(processing_parameters.recording_info_model.output_data_folder_path)
- / RAW_DATA_FOLDER_NAME,
+ / RAW_DATA_FOLDER_NAME,
kill_event=kill_event,
use_tqdm=use_tqdm,
)
@@ -75,12 +75,12 @@ def run_image_tracking_pipeline(
def run_image_tracking(
- model_info: ModelInfo,
- tracking_params: BaseTrackingParams,
- synchronized_videos_folder_path: Path,
- output_data_folder_path: Path,
- kill_event: multiprocessing.Event = None,
- use_tqdm: bool = True,
+ model_info: ModelInfo,
+ tracking_params: BaseTrackingParams,
+ synchronized_videos_folder_path: Path,
+ output_data_folder_path: Path,
+ kill_event: multiprocessing.Event = None,
+ use_tqdm: bool = True,
):
if hasattr(tracking_params, "use_yolo_crop_method") and tracking_params.use_yolo_crop_method:
model_info.tracker_name = "YOLOMediapipeComboTracker"
diff --git a/freemocap/data_layer/data_saver/data_loader.py b/freemocap/data_layer/data_saver/data_loader.py
index 31bfd34f..87f2ad3d 100644
--- a/freemocap/data_layer/data_saver/data_loader.py
+++ b/freemocap/data_layer/data_saver/data_loader.py
@@ -33,12 +33,12 @@ mediapipe_model_info = MediapipeModelInfo()
class DataLoader:
def __init__(
- self,
- recording_folder_path: Union[str, Path],
- include_hands: bool = True,
- include_face: bool = True,
- include_com: bool = True,
- model_info: ModelInfo = mediapipe_model_info,
+ self,
+ recording_folder_path: Union[str, Path],
+ include_hands: bool = True,
+ include_face: bool = True,
+ include_com: bool = True,
+ model_info: ModelInfo = mediapipe_model_info,
):
self._recording_folder_path = Path(recording_folder_path)
self.include_hands = include_hands
@@ -68,9 +68,11 @@ class DataLoader:
if self.include_hands:
try:
self.right_hand_dataframe = self._load_dataframe(
- self._file_prefix + RIGHT_HAND_3D_DATAFRAME_CSV_FILE_NAME)
+ self._file_prefix + RIGHT_HAND_3D_DATAFRAME_CSV_FILE_NAME
+ )
self.left_hand_dataframe = self._load_dataframe(
- self._file_prefix + LEFT_HAND_3D_DATAFRAME_CSV_FILE_NAME)
+ self._file_prefix + LEFT_HAND_3D_DATAFRAME_CSV_FILE_NAME
+ )
except FileNotFoundError:
logger.warning("Unable to load hand data from file.")
self.right_hand_dataframe = None
@@ -128,12 +130,14 @@ class DataLoader:
"""
try:
self.center_of_mass_xyz = np.load(
- self._output_folder_path / CENTER_OF_MASS_FOLDER_NAME / (
- self._file_prefix + TOTAL_BODY_CENTER_OF_MASS_NPY_FILE_NAME)
+ self._output_folder_path
+ / CENTER_OF_MASS_FOLDER_NAME
+ / (self._file_prefix + TOTAL_BODY_CENTER_OF_MASS_NPY_FILE_NAME)
)
self.segment_center_of_mass_segment_xyz = np.load(
- self._output_folder_path / CENTER_OF_MASS_FOLDER_NAME / (
- self._file_prefix + SEGMENT_CENTER_OF_MASS_NPY_FILE_NAME)
+ self._output_folder_path
+ / CENTER_OF_MASS_FOLDER_NAME
+ / (self._file_prefix + SEGMENT_CENTER_OF_MASS_NPY_FILE_NAME)
)
except FileNotFoundError:
logger.warning("Unable to load center of mass data from file.")
@@ -210,7 +214,7 @@ class DataLoader:
raise ValueError("center of mass definitions are not provided.")
for segment_number, segment_name in enumerate(self._model_info.center_of_mass_definitions.keys()):
- com_data[f'com_{segment_name}'] = Point(
+ com_data[f"com_{segment_name}"] = Point(
x=self.segment_center_of_mass_segment_xyz[frame_number, segment_number, 0],
y=self.segment_center_of_mass_segment_xyz[frame_number, segment_number, 1],
z=self.segment_center_of_mass_segment_xyz[frame_number, segment_number, 2],
diff --git a/freemocap/data_layer/recording_models/recording_info_model.py b/freemocap/data_layer/recording_models/recording_info_model.py
index fcca3917..5c34650b 100644
--- a/freemocap/data_layer/recording_models/recording_info_model.py
+++ b/freemocap/data_layer/recording_models/recording_info_model.py
@@ -41,11 +41,11 @@ logger = logging.getLogger(__name__)
class RecordingInfoModel:
def __init__(self, recording_folder_path: Union[Path, str], active_tracker: str = "mediapipe"):
if any(
- [
- Path(recording_folder_path).name == SYNCHRONIZED_VIDEOS_FOLDER_NAME,
- Path(recording_folder_path).name == ANNOTATED_VIDEOS_FOLDER_NAME,
- Path(recording_folder_path).name == OUTPUT_DATA_FOLDER_NAME,
- ]
+ [
+ Path(recording_folder_path).name == SYNCHRONIZED_VIDEOS_FOLDER_NAME,
+ Path(recording_folder_path).name == ANNOTATED_VIDEOS_FOLDER_NAME,
+ Path(recording_folder_path).name == OUTPUT_DATA_FOLDER_NAME,
+ ]
):
recording_folder_path = Path(recording_folder_path).parent
@@ -133,10 +133,10 @@ class RecordingInfoModel:
@property
def raw_data_3d_npy_file_path(self):
raw_data_path = (
- Path(self._path)
- / OUTPUT_DATA_FOLDER_NAME
- / RAW_DATA_FOLDER_NAME
- / (self.file_prefix + RAW_3D_NPY_FILE_NAME)
+ Path(self._path)
+ / OUTPUT_DATA_FOLDER_NAME
+ / RAW_DATA_FOLDER_NAME
+ / (self.file_prefix + RAW_3D_NPY_FILE_NAME)
)
old_raw_data_path = Path(self._path) / OUTPUT_DATA_FOLDER_NAME / RAW_DATA_FOLDER_NAME / OLD_RAW_3D_NPY_FILE_NAME
if self.active_tracker == "mediapipe" and old_raw_data_path.exists() and not raw_data_path.exists():
@@ -147,18 +147,18 @@ class RecordingInfoModel:
@property
def reprojection_error_data_npy_file_path(self):
reprojection_error_path = (
- Path(self._path)
- / OUTPUT_DATA_FOLDER_NAME
- / RAW_DATA_FOLDER_NAME
- / (self.file_prefix + REPROJECTION_ERROR_NPY_FILE_NAME)
+ Path(self._path)
+ / OUTPUT_DATA_FOLDER_NAME
+ / RAW_DATA_FOLDER_NAME
+ / (self.file_prefix + REPROJECTION_ERROR_NPY_FILE_NAME)
)
raw_reprojection_error_path = (
- Path(self._path) / OUTPUT_DATA_FOLDER_NAME / RAW_DATA_FOLDER_NAME / OLD_REPROJECTION_ERROR_NPY_FILE_NAME
+ Path(self._path) / OUTPUT_DATA_FOLDER_NAME / RAW_DATA_FOLDER_NAME / OLD_REPROJECTION_ERROR_NPY_FILE_NAME
)
if (
- self.active_tracker == "mediapipe"
- and raw_reprojection_error_path.exists()
- and not reprojection_error_path.exists()
+ self.active_tracker == "mediapipe"
+ and raw_reprojection_error_path.exists()
+ and not reprojection_error_path.exists()
):
return str(raw_reprojection_error_path)
else:
@@ -167,16 +167,16 @@ class RecordingInfoModel:
@property
def total_body_center_of_mass_npy_file_path(self):
total_body_com_path = (
- Path(self._path)
- / OUTPUT_DATA_FOLDER_NAME
- / CENTER_OF_MASS_FOLDER_NAME
- / (self.file_prefix + TOTAL_BODY_CENTER_OF_MASS_NPY_FILE_NAME)
+ Path(self._path)
+ / OUTPUT_DATA_FOLDER_NAME
+ / CENTER_OF_MASS_FOLDER_NAME
+ / (self.file_prefix + TOTAL_BODY_CENTER_OF_MASS_NPY_FILE_NAME)
)
raw_total_body_com_path = (
- Path(self._path)
- / OUTPUT_DATA_FOLDER_NAME
- / CENTER_OF_MASS_FOLDER_NAME
- / OLD_TOTAL_BODY_CENTER_OF_MASS_NPY_FILE_NAME
+ Path(self._path)
+ / OUTPUT_DATA_FOLDER_NAME
+ / CENTER_OF_MASS_FOLDER_NAME
+ / OLD_TOTAL_BODY_CENTER_OF_MASS_NPY_FILE_NAME
)
if self.active_tracker == "mediapipe" and raw_total_body_com_path.exists() and not total_body_com_path.exists():
return str(raw_total_body_com_path)
diff --git a/freemocap/diagnostics/calibration/run_calibration.py b/freemocap/diagnostics/calibration/run_calibration.py
index 4f273fd9..1aa1c4bc 100644
--- a/freemocap/diagnostics/calibration/run_calibration.py
+++ b/freemocap/diagnostics/calibration/run_calibration.py
@@ -4,18 +4,14 @@ from pathlib import Path
import numpy as np
-from freemocap.core_processes.capture_volume_calibration.anipose_camera_calibration import \
- freemocap_anipose
-from freemocap.core_processes.capture_volume_calibration.charuco_stuff.charuco_board_definition import \
- charuco_7x5
-from freemocap.core_processes.capture_volume_calibration.run_anipose_capture_volume_calibration import \
- run_anipose_capture_volume_calibration
-from freemocap.core_processes.capture_volume_calibration.triangulate_3d_data import \
- triangulate_3d_data
-from freemocap.data_layer.recording_models.recording_info_model import \
- RecordingInfoModel
-from freemocap.diagnostics.calibration.calibration_utils import \
- get_charuco_2d_data
+from freemocap.core_processes.capture_volume_calibration.anipose_camera_calibration import freemocap_anipose
+from freemocap.core_processes.capture_volume_calibration.charuco_stuff.charuco_board_definition import charuco_7x5
+from freemocap.core_processes.capture_volume_calibration.run_anipose_capture_volume_calibration import (
+ run_anipose_capture_volume_calibration,
+)
+from freemocap.core_processes.capture_volume_calibration.triangulate_3d_data import triangulate_3d_data
+from freemocap.data_layer.recording_models.recording_info_model import RecordingInfoModel
+from freemocap.diagnostics.calibration.calibration_utils import get_charuco_2d_data
from freemocap.utilities.download_sample_data import download_test_data
# Configure logging
@@ -49,7 +45,7 @@ def setup_session():
logger.info("Calibrating")
board_info_path = (
- Path(SessionInfo.sample_session_folder_path) / "charuco_board_info.json"
+ Path(SessionInfo.sample_session_folder_path) / "charuco_board_info.json"
) # NOTE - I added this JSON to the sample data zip file to make it easier to get square size/height/width
with open(board_info_path, "r", encoding="utf-8") as fh:
board_info = json.load(fh)
diff --git a/freemocap/gui/qt/widgets/camera_controller_group_box.py b/freemocap/gui/qt/widgets/camera_controller_group_box.py
index 93a11232..b3698081 100644
--- a/freemocap/gui/qt/widgets/camera_controller_group_box.py
+++ b/freemocap/gui/qt/widgets/camera_controller_group_box.py
@@ -12,7 +12,8 @@ from PySide6.QtWidgets import (
QLabel,
QRadioButton,
QCheckBox,
- QComboBox, QFrame,
+ QComboBox,
+ QFrame,
)
from skellycam import SkellyCamControllerWidget, SkellyCamWidget
@@ -52,9 +53,14 @@ class CameraControllerGroupBox(QGroupBox):
self.setLayout(self._layout)
- self._layout.addLayout(self._make_record_button_layout())
+ create_calibration_recording_option_layout = self._create_calibration_recording_option_layout()
- self._layout.addLayout(self._make_options_layout())
+ vbox = QVBoxLayout()
+ vbox.addLayout(self._make_options_layout())
+ vbox.addLayout(self._create_mocap_recording_option_layout())
+ vbox.addLayout(create_calibration_recording_option_layout)
+
+ self._layout.addLayout(vbox)
self._calibration_videos_radio_button.toggled.connect(self._set_record_button_text)
self._annotate_charuco_checkbox.toggled.connect(self._on_annotate_charuco_checkbox_changed)
@@ -119,7 +125,7 @@ class CameraControllerGroupBox(QGroupBox):
self._mocap_videos_radio_button.setChecked(True)
hbox.addWidget(QLabel(" - "))
- self._auto_process_videos_checkbox = QCheckBox("Auto Process Videos on Save")
+ self._auto_process_videos_checkbox = QCheckBox("Auto Process Videos")
self._auto_process_videos_checkbox.setChecked(self.gui_state.auto_process_videos_on_save)
hbox.addWidget(self._auto_process_videos_checkbox)
@@ -163,16 +169,14 @@ class CameraControllerGroupBox(QGroupBox):
hbox_bottom.setAlignment(Qt.AlignmentFlag.AlignLeft)
# Add indentation spacing (adjust the width as needed)
indent_spacer = QLabel("")
- indent_spacer.setFixedWidth(180) # Adjust this value for more/less indentation
+ indent_spacer.setFixedWidth(80) # Adjust this value for more/less indentation
hbox_bottom.addWidget(indent_spacer)
self._annotate_charuco_checkbox = QCheckBox("Charuco Overlay (requires camera restart)")
self._annotate_charuco_checkbox.setChecked(self.gui_state.annotate_charuco_images)
self._skellycam_widget.annotate_images = self._annotate_charuco_checkbox.isChecked()
hbox_bottom.addWidget(self._annotate_charuco_checkbox)
- self._use_charuco_as_groundplane_checkbox = QCheckBox(
- "Use initial board position as origin"
- )
+ self._use_charuco_as_groundplane_checkbox = QCheckBox("Use initial board position as origin")
self._use_charuco_as_groundplane_checkbox.setChecked(self.gui_state.use_charuco_as_groundplane)
hbox_bottom.addWidget(self._use_charuco_as_groundplane_checkbox)
@@ -188,14 +192,11 @@ class CameraControllerGroupBox(QGroupBox):
"""Open the calibration documentation in the default web browser."""
QDesktopServices.openUrl(url)
- def _make_options_layout(self) -> QVBoxLayout:
- options_vbox = QVBoxLayout()
- options_vbox.addLayout(self._create_mocap_recording_option_layout())
+ def _make_options_layout(self) -> QHBoxLayout:
+ options_vbox = QHBoxLayout()
+
+ options_vbox.addLayout(self._make_record_button_layout())
- options_vbox.addLayout(self._create_calibration_recording_option_layout())
- # Add horizontal separator line
- separator = self._create_horizontal_separator()
- options_vbox.addWidget(separator)
options_vbox.addLayout(self._create_videos_will_save_to_layout())
return options_vbox
@@ -207,13 +208,15 @@ class CameraControllerGroupBox(QGroupBox):
separator.setFrameShadow(QFrame.Shadow.Sunken)
separator.setLineWidth(1)
# Optional: Add some styling to make it more visible or subtle
- separator.setStyleSheet("""
+ separator.setStyleSheet(
+ """
QFrame {
color: #d0d0d0;
margin-top: 5px;
margin-bottom: 5px;
}
- """)
+ """
+ )
return separator
def _make_record_button_layout(self) -> QVBoxLayout:
@@ -253,6 +256,7 @@ class CameraControllerGroupBox(QGroupBox):
self._recording_string_tag_line_edit = QLineEdit(parent=self)
self._recording_string_tag_line_edit.setPlaceholderText("(Optional)")
self._recording_string_tag_line_edit.setMaxLength(200)
+ self._recording_string_tag_line_edit.setAlignment(Qt.AlignmentFlag.AlignVCenter)
recording_string_tag_form_layout.addRow("Tag:", self._recording_string_tag_line_edit)
recording_name_hbox.addWidget(QLabel(" - "))
@@ -264,6 +268,7 @@ class CameraControllerGroupBox(QGroupBox):
full_path_key_label = QLabel("Full Path: ")
full_path_hbox.addWidget(full_path_key_label)
self._full_path_label = QLabel(recording_path_full)
+ self._full_path_label.setWordWrap(True)
self._full_path_label.setStyleSheet("font-family: monospace;")
full_path_hbox.addWidget(self._full_path_label)
@@ -324,6 +329,7 @@ class CameraControllerGroupBox(QGroupBox):
def _on_use_charuco_groundplane_checkbox_changed(self) -> None:
self.gui_state.use_charuco_as_groundplane = self._use_charuco_as_groundplane_checkbox.isChecked()
save_gui_state(gui_state=self.gui_state, file_pathstring=get_gui_state_json_path())
+ self.controller_group_box_calibration_updated.emit()
def _on_auto_process_videos_checkbox_changed(self) -> None:
self.gui_state.auto_process_videos_on_save = self._auto_process_videos_checkbox.isChecked()
@@ -356,3 +362,4 @@ class CameraControllerGroupBox(QGroupBox):
self.gui_state = load_gui_state(file_pathstring=get_gui_state_json_path())
self._board_dropdown.setCurrentText(self.gui_state.charuco_board_name)
self._charuco_square_size_line_edit.setText(str(self.gui_state.charuco_square_size))
+ self._use_charuco_as_groundplane_checkbox.setChecked(self.gui_state.use_charuco_as_groundplane)
diff --git a/freemocap/gui/qt/widgets/central_tab_widget.py b/freemocap/gui/qt/widgets/central_tab_widget.py
index 214b9ea1..5bf297ab 100644
--- a/freemocap/gui/qt/widgets/central_tab_widget.py
+++ b/freemocap/gui/qt/widgets/central_tab_widget.py
@@ -2,6 +2,7 @@ import logging
from PySide6.QtCore import Qt
from PySide6.QtWidgets import QVBoxLayout, QWidget, QLabel, QTabWidget
+
# from skelly_viewer import SkellyViewer
from skellycam import SkellyCamWidget
@@ -14,14 +15,14 @@ logger = logging.getLogger(__name__)
class CentralTabWidget(QTabWidget):
def __init__(
- self,
- skelly_cam_widget: SkellyCamWidget,
- camera_controller_widget: QWidget,
- welcome_to_freemocap_widget: HomeWidget,
- skelly_viewer_widget: QWidget,
- directory_view_widget: QWidget,
- active_recording_info_widget: QWidget,
- parent=None,
+ self,
+ skelly_cam_widget: SkellyCamWidget,
+ camera_controller_widget: QWidget,
+ welcome_to_freemocap_widget: HomeWidget,
+ skelly_viewer_widget: QWidget,
+ directory_view_widget: QWidget,
+ active_recording_info_widget: QWidget,
+ parent=None,
):
super().__init__(parent=parent)
self.parent = parent
@@ -69,7 +70,7 @@ class CentralTabWidget(QTabWidget):
self._camera_view_layout.addWidget(self._skelly_cam_widget)
lag_note_label = QLabel(
- "NOTE: If you experience lag in your camera views, decrease the resolution and/or use fewer cameras. The frames are likely being being recorded properly, its just the viewer that is lagging. A fix is incoming soon!"
+ "NOTE: If you experience lag in your camera views, decrease the resolution and/or use fewer cameras. The frames are likely being recorded properly, its just the viewer that is lagging. A fix is incoming soon!"
)
lag_note_label.setStyleSheet("font-size: 10px;")
lag_note_label.setWordWrap(True)
@@ -77,6 +78,7 @@ class CentralTabWidget(QTabWidget):
layout.addWidget(lag_note_label)
layout.setAlignment(Qt.AlignmentFlag.AlignBottom)
self._camera_view_layout.addLayout(layout)
+ self._camera_view_layout.setContentsMargins(20, 0, 20, 0)
def _create_skelly_viewer_tab(self, tab_widget: QTabWidget):
logger.debug("Creating export_data tab")
diff --git a/freemocap/gui/qt/widgets/control_panel/calibration_control_panel.py b/freemocap/gui/qt/widgets/control_panel/calibration_control_panel.py
index 7070df62..621feae2 100644
--- a/freemocap/gui/qt/widgets/control_panel/calibration_control_panel.py
+++ b/freemocap/gui/qt/widgets/control_panel/calibration_control_panel.py
@@ -41,11 +41,11 @@ class CalibrationControlPanel(QWidget):
control_panel_calibration_updated = Signal()
def __init__(
- self,
- get_active_recording_info: Callable[..., Union[RecordingInfoModel, Path]],
- kill_thread_event: threading.Event,
- gui_state: GuiState,
- parent: Optional[QObject] = None,
+ self,
+ get_active_recording_info: Callable[..., Union[RecordingInfoModel, Path]],
+ kill_thread_event: threading.Event,
+ gui_state: GuiState,
+ parent: Optional[QObject] = None,
):
super().__init__(parent=parent)
self.gui_state = gui_state
@@ -210,9 +210,12 @@ class CalibrationControlPanel(QWidget):
self._use_charuco_as_groundplane_checkbox.setToolTip(
"Set the Charuco board's coordinate system as the global origin"
)
- self._use_charuco_as_groundplane_checkbox.setChecked(True)
+ self._use_charuco_as_groundplane_checkbox.setChecked(False)
self._use_charuco_as_groundplane_checkbox.setEnabled(False)
self._use_charuco_as_groundplane_checkbox.setVisible(False)
+ self._use_charuco_as_groundplane_checkbox.stateChanged.connect(
+ self._on_use_charuco_groundplane_checkbox_changed
+ )
hbox2.addWidget(self._use_charuco_as_groundplane_checkbox)
@@ -343,7 +346,6 @@ class CalibrationControlPanel(QWidget):
charuco_square_size_layout.addStretch()
return charuco_square_size_layout
-
def _create_board_dropdown(self) -> QComboBox:
board_dropdown = QComboBox()
board_dropdown.setToolTip("Select the Charuco board to use for calibration")
@@ -368,21 +370,27 @@ class CalibrationControlPanel(QWidget):
save_gui_state(gui_state=self.gui_state, file_pathstring=get_gui_state_json_path())
self.control_panel_calibration_updated.emit()
+ def _on_use_charuco_groundplane_checkbox_changed(self):
+ self.gui_state.use_charuco_as_groundplane = self._use_charuco_as_groundplane_checkbox.isChecked()
+ save_gui_state(gui_state=self.gui_state, file_pathstring=get_gui_state_json_path())
+ self.control_panel_calibration_updated.emit()
+
@Slot()
def charuco_option_updated(self):
self.gui_state = load_gui_state(file_pathstring=get_gui_state_json_path())
self._board_dropdown.setCurrentText(self.gui_state.charuco_board_name)
self._charuco_square_size_line_edit.setText(str(self.gui_state.charuco_square_size))
+ self._use_charuco_as_groundplane_checkbox.setChecked(self.gui_state.use_charuco_as_groundplane)
@Slot(str)
def _log_calibration_progress_callbacks(self, message: str):
logger.info(message)
def calibrate_from_active_recording(
- self,
- charuco_square_size_mm: float = None,
- use_charuco_as_groundplane: bool = None,
- charuco_board_name: str = None,
+ self,
+ charuco_square_size_mm: float = None,
+ use_charuco_as_groundplane: bool = None,
+ charuco_board_name: str = None,
):
if not charuco_square_size_mm:
charuco_square_size_mm = float(self._charuco_square_size_line_edit.text())
diff --git a/freemocap/gui/qt/widgets/control_panel/process_mocap_data_panel/process_motion_capture_data_panel.py b/freemocap/gui/qt/widgets/control_panel/process_mocap_data_panel/process_motion_capture_data_panel.py
index 474dd5e5..fb0a2616 100644
--- a/freemocap/gui/qt/widgets/control_panel/process_mocap_data_panel/process_motion_capture_data_panel.py
+++ b/freemocap/gui/qt/widgets/control_panel/process_mocap_data_panel/process_motion_capture_data_panel.py
@@ -37,13 +37,13 @@ class ProcessMotionCaptureDataPanel(QWidget):
processing_finished_signal = Signal()
def __init__(
- self,
- recording_processing_parameters: ProcessingParameterModel,
- get_active_recording_info: Callable[..., RecordingInfoModel],
- kill_thread_event: threading.Event,
- log_update: Callable,
- gui_state: GuiState,
- parent=None,
+ self,
+ recording_processing_parameters: ProcessingParameterModel,
+ get_active_recording_info: Callable[..., RecordingInfoModel],
+ kill_thread_event: threading.Event,
+ log_update: Callable,
+ gui_state: GuiState,
+ parent=None,
):
super().__init__(parent=parent)
@@ -94,7 +94,7 @@ class ProcessMotionCaptureDataPanel(QWidget):
return self._process_motion_capture_data_button
def calibrate_from_active_recording(
- self, charuco_square_size_mm: float, use_charuco_as_groundplane: bool, charuco_board_name: str
+ self, charuco_square_size_mm: float, use_charuco_as_groundplane: bool, charuco_board_name: str
):
self._calibration_control_panel.calibrate_from_active_recording(
charuco_square_size_mm=charuco_square_size_mm,
@@ -107,9 +107,9 @@ class ProcessMotionCaptureDataPanel(QWidget):
self._calibration_control_panel.update_calibration_toml_path()
def _add_parameters_to_parameter_tree_widget(
- self,
- parameter_tree_widget: ParameterTree,
- session_processing_parameter_model: ProcessingParameterModel,
+ self,
+ parameter_tree_widget: ParameterTree,
+ session_processing_parameter_model: ProcessingParameterModel,
):
parameter_group = self._convert_session_processing_parameter_model_to_parameter_group(
session_processing_parameter_model
@@ -119,8 +119,8 @@ class ProcessMotionCaptureDataPanel(QWidget):
return parameter_group
def _convert_session_processing_parameter_model_to_parameter_group(
- self,
- session_processing_parameter_model: ProcessingParameterModel,
+ self,
+ session_processing_parameter_model: ProcessingParameterModel,
):
return Parameter.create(
name="Processing Parameters",
@@ -157,13 +157,13 @@ class ProcessMotionCaptureDataPanel(QWidget):
),
],
tip="Methods for cleaning up the data (e.g. filtering/smoothing, gap filling, etc ...)"
- "TODO - Add/expose more post processing methods here (e.g. gap filling, outlier removal, etc ...)",
+ "TODO - Add/expose more post processing methods here (e.g. gap filling, outlier removal, etc ...)",
),
],
)
def _create_session_parameter_model(
- self,
+ self,
) -> ProcessingParameterModel:
recording_processing_parameter_model = extract_parameter_model_from_parameter_tree(
parameter_object=self._parameter_group
@@ -241,8 +241,8 @@ class ProcessMotionCaptureDataPanel(QWidget):
# check if there is already a calibration toml in the recording folder, if not save this one there
if (
- len(list(Path(session_parameter_model.recording_info_model.path).glob("*.toml"))) == 0
- and Path(selected_camera_calibration_toml_path).exists()
+ len(list(Path(session_parameter_model.recording_info_model.path).glob("*.toml"))) == 0
+ and Path(selected_camera_calibration_toml_path).exists()
):
# copy the calibration toml to the recording folder (keeping the original filename)
logger.info(
@@ -250,8 +250,8 @@ class ProcessMotionCaptureDataPanel(QWidget):
)
Path(session_parameter_model.recording_info_model.path).mkdir(parents=True, exist_ok=True)
copied_toml_path = (
- Path(session_parameter_model.recording_info_model.path)
- / Path(selected_camera_calibration_toml_path).name
+ Path(session_parameter_model.recording_info_model.path)
+ / Path(selected_camera_calibration_toml_path).name
)
shutil.copyfile(selected_camera_calibration_toml_path, copied_toml_path)