Skip to content

Free Motion Capture for Everyone 💀✨

TypeScript

swap pyqt6 for pyside6 (#508)

jonmatthis28a2d2bd83b9
diff --git a/.flake8 b/.flake8
index 8792cf8e..49fdc581 100644
--- a/.flake8
+++ b/.flake8
@@ -4,6 +4,8 @@ exclude =
./freemocap/core_processes/export_data/blender_stuff/export_to_blender/methods/legacy/*
./freemocap/core_processes/capture_volume_calibration/anipose_camera_calibration/anipose_camera_calibrator.py
./freemocap/core_processes/capture_volume_calibration/anipose_camera_calibration/freemocap_anipose.py
+ ./experimental
+ ./freemocap/tests
./.nox
./.venv
./venv
diff --git a/.github/workflows/poetry_publish_to_pypi.yml b/.github/workflows/flit_publish_to_pypi.yml
similarity index 51%
rename from .github/workflows/poetry_publish_to_pypi.yml
rename to .github/workflows/flit_publish_to_pypi.yml
index 98e89c68..77aac739 100644
--- a/.github/workflows/poetry_publish_to_pypi.yml
+++ b/.github/workflows/flit_publish_to_pypi.yml
@@ -21,19 +21,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
- - name: Set up Python
- uses: actions/setup-python@v3
- with:
- python-version: '3.x'
- - name: Install dependencies
- run: |
- python -m pip install --upgrade pip
- pip install flit
- - name: Build package
- run: python -m flit build
- - name: Publish package to pypi
- uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
- with:
- user: __token__
- password: ${{ secrets.PYPI_TOKEN }}
\ No newline at end of file
+ - uses: actions/checkout@v3
+ - name: Set up Python
+ uses: actions/setup-python@v3
+ with:
+ python-version: '3.x'
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip
+ pip install flit
+ - name: Build package
+ run: python -m flit build
+ - name: Publish package to pypi
+ uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
+ with:
+ user: __token__
+ password: ${{ secrets.PYPI_TOKEN }}
\ No newline at end of file
diff --git a/.github/workflows/linting-flake8.yml b/.github/workflows/linting-flake8.yml
index 04287725..65be3db0 100755
--- a/.github/workflows/linting-flake8.yml
+++ b/.github/workflows/linting-flake8.yml
@@ -3,7 +3,7 @@ name: Linting Flake8
on:
pull_request:
branches: [ main, development ]
- paths:
+ paths:
- 'freemocap/**'
jobs:
diff --git a/.github/workflows/publish_to_pypi.yml b/.github/workflows/publish_to_pypi.yml
index e83921b7..d21101b8 100644
--- a/.github/workflows/publish_to_pypi.yml
+++ b/.github/workflows/publish_to_pypi.yml
@@ -1,9 +1,9 @@
name: Upload Python Package
on:
- push:
- branches:
- - missingno
+ push:
+ branches:
+ - missingno
jobs:
pypi-publish:
@@ -14,36 +14,36 @@ jobs:
# IMPORTANT: this permission is mandatory for trusted publishing - https://docs.pypi.org/trusted-publishers/using-a-publisher/
id-token: write
steps:
- - uses: actions/checkout@v3
- - name: Set up Python
- uses: actions/setup-python@v3
- with:
- python-version: '3.11'
+ - uses: actions/checkout@v3
+ - name: Set up Python
+ uses: actions/setup-python@v3
+ with:
+ python-version: '3.11'
- - name: Install LLVM
- run: sudo apt-get update && sudo apt-get install -y llvm
+ - name: Install LLVM
+ run: sudo apt-get update && sudo apt-get install -y llvm
- - name: Install Poetry
- run: |
- curl -sSL https://install.python-poetry.org | python3 -
+ - name: Install Poetry
+ run: |
+ curl -sSL https://install.python-poetry.org | python3 -
- - name: Cache Poetry dependencies
- uses: actions/cache@v2
- with:
- path: ~/.cache/pypoetry
- key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
- restore-keys: |
- ${{ runner.os }}-poetry-
+ - name: Cache Poetry dependencies
+ uses: actions/cache@v2
+ with:
+ path: ~/.cache/pypoetry
+ key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
+ restore-keys: |
+ ${{ runner.os }}-poetry-
- - name: Update dependencies
- run: poetry update
+ - name: Update dependencies
+ run: poetry update
- - name: Install dependencies
- run: poetry install
+ - name: Install dependencies
+ run: poetry install
- - name: Build package
- run: poetry build
+ - name: Build package
+ run: poetry build
- - name: Publish package to pypi
- uses: pypa/gh-action-pypi-publish@release/v1
+ - name: Publish package to pypi
+ uses: pypa/gh-action-pypi-publish@release/v1
diff --git a/.github/workflows/python-testing.yml b/.github/workflows/python-testing.yml
index 6c055e3c..95caaafe 100755
--- a/.github/workflows/python-testing.yml
+++ b/.github/workflows/python-testing.yml
@@ -3,7 +3,7 @@ name: Freemocap Tests
on:
pull_request:
branches: [ main, development ]
- paths:
+ paths:
- 'freemocap/**'
jobs:
diff --git a/.github/workflows/version-testing.yml b/.github/workflows/version-testing.yml
index 1177bc23..07ba1fa2 100755
--- a/.github/workflows/version-testing.yml
+++ b/.github/workflows/version-testing.yml
@@ -4,7 +4,7 @@ on:
workflow_dispatch:
pull_request:
branches: [ main ]
- paths:
+ paths:
- 'pyproject.toml'
jobs:
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
index e11e544c..3e4aedbc 100644
--- a/CODE_OF_CONDUCT.md
+++ b/CODE_OF_CONDUCT.md
@@ -1,7 +1,9 @@
# Code of Conduct
-
-In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to make participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
+In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to make
+participation in our project and our community a harassment-free experience for everyone, regardless of age, body size,
+disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race,
+religion, or sexual identity and orientation.
## Our Standards
@@ -23,5 +25,7 @@ Examples of unacceptable behavior by participants include:
## Conflict Resolution
-If conflicts arise within the community, we encourage participants to resolve them through respectful dialogue. If necessary, contact us at info at freemocap dot org and we will do our best to facilitate resolution by providing guidance and mediation.
+If conflicts arise within the community, we encourage participants to resolve them through respectful dialogue. If
+necessary, contact us at info at freemocap dot org and we will do our best to facilitate resolution by providing
+guidance and mediation.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index ec381a78..e22caf0d 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,4 +1,5 @@
# Contributing to Freemocap
+
We love your input! We want to make contributing to this project as easy and transparent as possible, whether it's:
- Reporting a bug
@@ -8,10 +9,14 @@ We love your input! We want to make contributing to this project as easy and tra
- Becoming a maintainer
## We Develop with Github
+
We use github to host code, to track issues and feature requests, as well as accept pull requests.
## We Use [Github Flow](https://docs.github.com/en/get-started/quickstart/github-flow), So All Code Changes Happen Through Pull Requests
-Pull requests are the best way to propose changes to the codebase (we use [Github Flow](https://docs.github.com/en/get-started/quickstart/github-flow)). We actively welcome your pull requests:
+
+Pull requests are the best way to propose changes to the codebase (we
+use [Github Flow](https://docs.github.com/en/get-started/quickstart/github-flow)). We actively welcome your pull
+requests:
1. Fork the repo and create your branch from `main`.
2. Download the development dependencies with `pip install -e '.[dev]'`.
@@ -22,30 +27,38 @@ Pull requests are the best way to propose changes to the codebase (we use [Githu
6. Issue that pull request!
## Any contributions you make will be under the AGPL Software License
-In short, when you submit code changes, your submissions are understood to be under the same [AGPL](LICENSE) that covers the project. Feel free to contact the maintainers to understand what that means.
+
+In short, when you submit code changes, your submissions are understood to be under the same [AGPL](LICENSE) that covers
+the project. Feel free to contact the maintainers to understand what that means.
## Report bugs using Github's [issues](https://github.com/freemocap/freemocap/issues)
-We use GitHub issues to track public bugs. Report a bug by [opening a new issue](https://github.com/freemocap/freemocap/issues/new); it's that easy!
+
+We use GitHub issues to track public bugs. Report a bug
+by [opening a new issue](https://github.com/freemocap/freemocap/issues/new); it's that easy!
## Write bug reports with detail, background, and sample code
+
[This is an example](http://stackoverflow.com/q/12488905/180626) of a "great" bug report.
**Great Bug Reports** tend to have:
- A quick summary and/or background
- Steps to reproduce
- - Be specific!
- - Include an uploaded ZIP of the freemocap data session you ran that produced the issue.
- - Give sample code if you can. [This stackoverflow question](http://stackoverflow.com/q/12488905/180626) demonstrates the user giving as much information as possible.
+ - Be specific!
+ - Include an uploaded ZIP of the freemocap data session you ran that produced the issue.
+ - Give sample code if you can. [This stackoverflow question](http://stackoverflow.com/q/12488905/180626)
+ demonstrates the user giving as much information as possible.
- What you expected would happen
- What actually happens
- Notes (possibly including why you think this might be happening, or stuff you tried that didn't work)
-People *love* thorough bug reports. The likelihood that the community and/or maintainers will help you with your issues stems from how well you can help them understand you. :)
+People *love* thorough bug reports. The likelihood that the community and/or maintainers will help you with your issues
+stems from how well you can help them understand you. :)
## Pull Request (PR) Guidelines
-> **DISCLAIMER:** These are the guidelines we expect all pull requests from contibuters to follow. If your PR does not follow these guidelines, we may ask you to make some changes before we can review it.
+> **DISCLAIMER:** These are the guidelines we expect all pull requests from contibuters to follow. If your PR does not
+> follow these guidelines, we may ask you to make some changes before we can review it.
- Any code that comes through a PR should be covered with tests
- Make sure the tests pass locally by running `pytest freemcap/tests`
@@ -53,16 +66,22 @@ People *love* thorough bug reports. The likelihood that the community and/or mai
- Any UI changes should include a small video of the working application with the change included
## Use a Consistent Coding Style
+
We use the [Black](https://black.readthedocs.io/en/stable/) autoformatter as the de-facto syntax style guide of choice.
### PyQT Style Guide
+
COMING SOON
### API Style Guide
+
COMING SOON
## License
+
By contributing, you agree that your contributions will be licensed under its [AGPL](LICENSE) License.
## References
-This document was adapted from the open-source contribution guidelines for [Facebook's Draft](https://github.com/facebook/draft-js/blob/main/CONTRIBUTING.md)
+
+This document was adapted from the open-source contribution guidelines
+for [Facebook's Draft](https://github.com/facebook/draft-js/blob/main/CONTRIBUTING.md)
diff --git a/README.md b/README.md
index 46711482..314c45c0 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,8 @@
</p>
<h3 align="center">The FreeMoCap Project</h3>
-<h4 align="center"> A free-and-open-source, hardware-and-software-agnostic, minimal-cost, research-grade, motion capture system and platform for decentralized scientific research, education, and training</h2>
+<h4 align="center"> A free-and-open-source, hardware-and-software-agnostic, minimal-cost, research-grade, motion capture
+system and platform for decentralized scientific research, education, and training</h2>
<p align="center">
@@ -45,75 +46,84 @@ https://user-images.githubusercontent.com/15314521/192062522-2a8d9305-f181-4869-
---
+
## QUICKSTART
1. Install software via [pip](https://pypi.org/project/freemocap/1.0.0rc0/):
+
```
pip install freemocap
```
2. Launch the GUI by entering the command:
+
```
freemocap
```
3. A GUI should pop up that looks like this
-<img width="1457" alt="image" src="https://github.com/freemocap/freemocap/assets/15314521/90ef7e7b-48f3-4f46-8d4a-5b5bcc3254b3">
+ <img width="1457" alt="image" src="https://github.com/freemocap/freemocap/assets/15314521/90ef7e7b-48f3-4f46-8d4a-5b5bcc3254b3">
-4. Have fun! It might break! Work in Progress lol
+4. Have fun! It might break! Work in Progress lol
5. [Join the Discord and let us know how it went!](https://discord.gg/nxv5dNTfKT)
-
## Install/run from source code (i.e. the code in this repo)
-> NOTE - these are super bare-bones install instructions just to show the new entry point - these instructions will be overhauled very soon (written 2023-03-14)
+> NOTE - these are super bare-bones install instructions just to show the new entry point - these instructions will be
+> overhauled very soon (written 2023-03-14)
Open an [Anaconda-enabled command prompt](https://www.anaconda.org) (or equivalent) and enter the following commands:
-1) Create a `Python3.8+` environment
+1) Create a `Python3.8+` environment
+
```bash
conda create -n freemocap-env python=3.9
```
2) Activate that newly created environment
+
```bash
conda activate freemocap-env
```
+
3) Clone the repository (pip install coming very soon!)
+
```bash
git clone https://github.com/freemocap/freemocap
```
4) Navigate into the newly cloned/downloaded `freemocap` folder
+
```bash
cd freemocap
```
5) Install the package via the `pyproject.toml` file
+
```bash
pip install -e .
```
6) Launch the GUI (via the `freemocap.__main__.py` entry point)
+
```bash
python -m freemocap
```
-A GUI should pop up!
-
+A GUI should pop up!
## Documentation and Knowledge Base (NOTE - no docs exist for the version of the GUI on the `main` branch yet - these docs refer to the `Alpha` release
Documentation for this software is currently pretty thin... but we're woking on it!
-Here's a YouTube video that covers a lot of relevant material (check the `chapters` for specific topics) - https://youtu.be/GxKmyKdnTy0
+Here's a YouTube video that covers a lot of relevant material (check the `chapters` for specific
+topics) - https://youtu.be/GxKmyKdnTy0
Our documentation lives here (for now) - https://freemocap.github.io/documentation
___
-
## For Developers
### Dev Setup
@@ -121,10 +131,13 @@ ___
After you've done the easy install instructions, you'll be able to run our repo commands
1. Run the "setup" command to set up your environment
+
```bash
task setup
```
+
2. Run the tests to ensure that everything works appropriate
+
```bash
task test
```
@@ -136,6 +149,7 @@ Please read our contribution doc: [CONTRIBUTING.md](CONTRIBUTING.md)
### Creating a new binary (may or may not work lol)
Create a new binary on your local system by running the below comand
+
```bash
task installer
```
@@ -152,7 +166,10 @@ Navigate to the `/dist/` directory and you'll see the new FreeMoCap Binary there
* [Endurance Idehen](https://github.com/endurance)
## License
+
This project is licensed under the APGL License - see the [LICENSE](LICENSE) file for details.
-If the AGPL does not work for your needs, we are happy to discuss terms to license this software to you with a different agreement at a price point that increases exponentially as you move [spiritually](https://www.gnu.org/philosophy/open-source-misses-the-point.en.html) away from the `AGPL`
+If the AGPL does not work for your needs, we are happy to discuss terms to license this software to you with a different
+agreement at a price point that increases exponentially as you
+move [spiritually](https://www.gnu.org/philosophy/open-source-misses-the-point.en.html) away from the `AGPL`
diff --git a/experimental/batch_process/batch_process.py b/experimental/batch_process/batch_process.py
index 488355c3..d10cbecb 100644
--- a/experimental/batch_process/batch_process.py
+++ b/experimental/batch_process/batch_process.py
@@ -2,8 +2,8 @@ import logging
from pathlib import Path
from typing import Optional, Union
-from freemocap.core_processes.process_motion_capture_videos.process_recording_folder import process_recording_folder
from freemocap.core_processes.export_data.blender_stuff.export_to_blender import export_to_blender
+from freemocap.core_processes.process_motion_capture_videos.process_recording_folder import process_recording_folder
from freemocap.data_layer.recording_models.post_processing_parameter_models import PostProcessingParameterModel
from freemocap.data_layer.recording_models.recording_info_model import RecordingInfoModel
from freemocap.system.paths_and_filenames.file_and_folder_names import RECORDING_PARAMETERS_JSON_FILE_NAME
@@ -12,9 +12,9 @@ from freemocap.utilities.save_dictionary_to_json import save_dictionary_to_json
def process_folder_of_session_folders(
- path_to_folder_of_session_folders: Union[str, Path],
- path_to_camera_calibration_toml: Optional[Union[str, Path]] = None,
- path_to_blender_executable: Optional[Union[str, Path]] = None,
+ path_to_folder_of_session_folders: Union[str, Path],
+ path_to_camera_calibration_toml: Optional[Union[str, Path]] = None,
+ path_to_blender_executable: Optional[Union[str, Path]] = None,
):
# list_of_session_folders = list(path_to_folder_of_session_folders.glob("ses*"))
list_of_session_folders = [f for f in path_to_folder_of_session_folders.iterdir() if f.is_dir()]
@@ -53,9 +53,9 @@ def process_folder_of_session_folders(
def process_recording_without_gui(
- recording_path: Union[str, Path],
- path_to_camera_calibration_toml: Optional[Union[str, Path]] = None,
- path_to_blender_executable: Optional[Union[str, Path]] = None,
+ recording_path: Union[str, Path],
+ path_to_camera_calibration_toml: Optional[Union[str, Path]] = None,
+ path_to_blender_executable: Optional[Union[str, Path]] = None,
):
rec = PostProcessingParameterModel()
diff --git a/experimental/batch_process/headless_calibration.py b/experimental/batch_process/headless_calibration.py
index 1f821e3c..4388bcba 100644
--- a/experimental/batch_process/headless_calibration.py
+++ b/experimental/batch_process/headless_calibration.py
@@ -10,16 +10,17 @@ from freemocap.core_processes.capture_volume_calibration.charuco_stuff.charuco_b
def headless_calibration(
- path_to_folder_of_calibration_videos: Path,
- charuco_board_object=CharucoBoardDefinition,
- charuco_square_size: Union[int, float] = 39,
- pin_camera_0_to_origin: bool = True,
+ path_to_folder_of_calibration_videos: Path,
+ charuco_board_object=CharucoBoardDefinition,
+ charuco_square_size: Union[int, float] = 39,
+ pin_camera_0_to_origin: bool = True,
):
anipose_camera_calibrator = AniposeCameraCalibrator(
charuco_board_object=charuco_board_object,
charuco_square_size=charuco_square_size,
calibration_videos_folder_path=path_to_folder_of_calibration_videos,
- progress_callback=lambda *args, **kwargs: None, # the empty callable is needed, otherwise calibration will cause an error
+ progress_callback=lambda *args, **kwargs: None,
+ # the empty callable is needed, otherwise calibration will cause an error
)
anipose_camera_calibrator.calibrate_camera_capture_volume(pin_camera_0_to_origin=pin_camera_0_to_origin)
diff --git a/experimental/directory_view.py b/experimental/directory_view.py
index ab32b29b..efe311b3 100644
--- a/experimental/directory_view.py
+++ b/experimental/directory_view.py
@@ -1,8 +1,8 @@
import sys
-from PyQt6.QtCore import QDir
-from PyQt6.QtGui import QFileSystemModel, QAction
-from PyQt6.QtWidgets import QTreeView, QFileIconProvider, QScroller, QApplication, QMenu
+from PySide6.QtCore import QDir
+from PySide6.QtGui import QFileSystemModel, QAction
+from PySide6.QtWidgets import QTreeView, QFileIconProvider, QScroller, QApplication, QMenu
class DirectoryViewer(QTreeView):
@@ -53,7 +53,7 @@ class DirectoryViewer(QTreeView):
self.setStyleSheet("QTreeView::item:selected {background: red;}")
# also color children of the active recording
- for index in self.get_children(index): # noqa (do we want to reassign the index value while we're looping?)
+ for index in self.get_children(index): # noqa (do we want to reassign the index value while we're looping?)
self.setStyleSheet("QTreeView::item:selected {background: pink;}")
# Keep the parent directory expanded
diff --git a/experimental/freemocap-ui/README.md b/experimental/freemocap-ui/README.md
index cabf3743..7bc629f5 100644
--- a/experimental/freemocap-ui/README.md
+++ b/experimental/freemocap-ui/README.md
@@ -1,4 +1,5 @@
-This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app), using the [Redux](https://redux.js.org/) and [Redux Toolkit](https://redux-toolkit.js.org/) template.
+This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app), using
+the [Redux](https://redux.js.org/) and [Redux Toolkit](https://redux-toolkit.js.org/) template.
## Available Scripts
@@ -15,7 +16,8 @@ You will also see any lint errors in the console.
### `npm test`
Launches the test runner in the interactive watch mode.<br />
-See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
+See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more
+information.
### `npm run build`
@@ -31,19 +33,24 @@ See the section about [deployment](https://facebook.github.io/create-react-app/d
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
-If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
+If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will
+remove the single build dependency from your project.
-Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
+Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right
+into your project so you have full control over them. All of the commands except `eject` will still work, but they will
+point to the copied scripts so you can tweak them. At this point you’re on your own.
-You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
+You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you
+shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t
+customize it when you are ready for it.
## Learn More
-You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
+You can learn more in
+the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
To learn React, check out the [React documentation](https://reactjs.org/).
-
## Relevant links
- https://web.dev/how-to-use-local-https/
diff --git a/experimental/freemocap-ui/config-overrides.js b/experimental/freemocap-ui/config-overrides.js
index 00d9dc67..dac99277 100644
--- a/experimental/freemocap-ui/config-overrides.js
+++ b/experimental/freemocap-ui/config-overrides.js
@@ -1,23 +1,23 @@
const webpack = require('webpack');
module.exports = function override(config) {
- const fallback = config.resolve.fallback || {};
- Object.assign(fallback, {
- "crypto": require.resolve("crypto-browserify"),
- "stream": require.resolve("stream-browserify"),
- "assert": require.resolve("assert"),
- "http": require.resolve("stream-http"),
- "https": require.resolve("https-browserify"),
- "os": require.resolve("os-browserify"),
- "url": require.resolve("url"),
- fs: false,
- path: false,
- })
- config.resolve.fallback = fallback;
- config.plugins = (config.plugins || []).concat([
- new webpack.ProvidePlugin({
- process: 'process/browser',
- Buffer: ['buffer', 'Buffer']
+ const fallback = config.resolve.fallback || {};
+ Object.assign(fallback, {
+ "crypto": require.resolve("crypto-browserify"),
+ "stream": require.resolve("stream-browserify"),
+ "assert": require.resolve("assert"),
+ "http": require.resolve("stream-http"),
+ "https": require.resolve("https-browserify"),
+ "os": require.resolve("os-browserify"),
+ "url": require.resolve("url"),
+ fs: false,
+ path: false,
})
- ])
- return config;
+ config.resolve.fallback = fallback;
+ config.plugins = (config.plugins || []).concat([
+ new webpack.ProvidePlugin({
+ process: 'process/browser',
+ Buffer: ['buffer', 'Buffer']
+ })
+ ])
+ return config;
}
\ No newline at end of file
diff --git a/experimental/freemocap-ui/public/index.html b/experimental/freemocap-ui/public/index.html
index 049d064f..e91e5be0 100644
--- a/experimental/freemocap-ui/public/index.html
+++ b/experimental/freemocap-ui/public/index.html
@@ -1,20 +1,20 @@
<!DOCTYPE html>
<html lang="en">
- <head>
- <meta charset="utf-8" />
- <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
- <meta name="viewport" content="width=device-width, initial-scale=1" />
- <meta name="theme-color" content="#000000" />
+<head>
+ <meta charset="utf-8"/>
+ <link href="%PUBLIC_URL%/favicon.ico" rel="icon"/>
+ <meta content="width=device-width, initial-scale=1" name="viewport"/>
+ <meta content="#000000" name="theme-color"/>
<meta
- name="description"
- content="Web site created using create-react-app"
+ content="Web site created using create-react-app"
+ name="description"
/>
- <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
+ <link href="%PUBLIC_URL%/logo192.png" rel="apple-touch-icon"/>
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
- <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
+ <link href="%PUBLIC_URL%/manifest.json" rel="manifest"/>
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
@@ -25,22 +25,22 @@
Learn how to configure a non-root public URL by running `npm calculate_center_of_mass build`.
-->
<title>React Redux App</title>
- </head>
- <body>
- <noscript>You need to enable JavaScript to run this app.</noscript>
- <div id="root"></div>
- <!--
- This HTML file is a template.
- If you open it directly in the browser, you will see an empty page.
+</head>
+<body>
+<noscript>You need to enable JavaScript to run this app.</noscript>
+<div id="root"></div>
+<!--
+ This HTML file is a template.
+ If you open it directly in the browser, you will see an empty page.
- You can add webfonts, meta tags, or analytics to this file.
- The build step will place the bundled scripts into the <body> tag.
+ You can add webfonts, meta tags, or analytics to this file.
+ The build step will place the bundled scripts into the <body> tag.
- To begin the development, calculate_center_of_mass `npm start` or `yarn start`.
- To create a production bundle, use `npm calculate_center_of_mass build` or `yarn build`.
- -->
- </body>
- <script type="text/javascript" src="https://unpkg.com/[email protected]/lib/opencv.js"></script>
+ To begin the development, calculate_center_of_mass `npm start` or `yarn start`.
+ To create a production bundle, use `npm calculate_center_of_mass build` or `yarn build`.
+-->
+</body>
+<script src="https://unpkg.com/[email protected]/lib/opencv.js" type="text/javascript"></script>
<!-- <script old_src="https://unpkg.com/opencv-javascript"></script>-->
</html>
diff --git a/experimental/freemocap-ui/src/App.css b/experimental/freemocap-ui/src/App.css
index 01cc5867..e65aaf89 100644
--- a/experimental/freemocap-ui/src/App.css
+++ b/experimental/freemocap-ui/src/App.css
@@ -1,39 +1,39 @@
.App {
- text-align: center;
+ text-align: center;
}
.App-logo {
- height: 40vmin;
- pointer-events: none;
+ height: 40vmin;
+ pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
- .App-logo {
- animation: App-logo-float infinite 3s ease-in-out;
- }
+ .App-logo {
+ animation: App-logo-float infinite 3s ease-in-out;
+ }
}
.App-header {
- min-height: 100vh;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- font-size: calc(10px + 2vmin);
+ min-height: 100vh;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ font-size: calc(10px + 2vmin);
}
.App-link {
- color: rgb(112, 76, 182);
+ color: rgb(112, 76, 182);
}
@keyframes App-logo-float {
- 0% {
- transform: translateY(0);
- }
- 50% {
- transform: translateY(10px);
- }
- 100% {
- transform: translateY(0px);
- }
+ 0% {
+ transform: translateY(0);
+ }
+ 50% {
+ transform: translateY(10px);
+ }
+ 100% {
+ transform: translateY(0px);
+ }
}
diff --git a/experimental/freemocap-ui/src/App.test.tsx b/experimental/freemocap-ui/src/App.test.tsx
index 3de36791..c7d5a9c0 100644
--- a/experimental/freemocap-ui/src/App.test.tsx
+++ b/experimental/freemocap-ui/src/App.test.tsx
@@ -5,11 +5,11 @@ import {store} from './app/store';
import App from './App';
test('renders learn react link', () => {
- const { getByText } = render(
- <Provider store={store}>
- <App />
- </Provider>
- );
+ const {getByText} = render(
+ <Provider store={store}>
+ <App/>
+ </Provider>
+ );
- expect(getByText(/learn/i)).toBeInTheDocument();
+ expect(getByText(/learn/i)).toBeInTheDocument();
});
diff --git a/experimental/freemocap-ui/src/App.tsx b/experimental/freemocap-ui/src/App.tsx
index ca294b90..97d166ff 100644
--- a/experimental/freemocap-ui/src/App.tsx
+++ b/experimental/freemocap-ui/src/App.tsx
@@ -2,11 +2,11 @@ import React from 'react';
import {Paperbase} from "./layout/Paperbase";
function App() {
- return (
- <React.Fragment>
- <Paperbase />
- </React.Fragment>
- );
+ return (
+ <React.Fragment>
+ <Paperbase/>
+ </React.Fragment>
+ );
}
export default App;
diff --git a/experimental/freemocap-ui/src/app/store.ts b/experimental/freemocap-ui/src/app/store.ts
index 3c87d330..a7845aec 100644
--- a/experimental/freemocap-ui/src/app/store.ts
+++ b/experimental/freemocap-ui/src/app/store.ts
@@ -2,16 +2,16 @@ import {Action, configureStore, ThunkAction} from '@reduxjs/toolkit';
import counterReducer from '../features/counter/counterSlice';
export const store = configureStore({
- reducer: {
- counter: counterReducer,
- },
+ reducer: {
+ counter: counterReducer,
+ },
});
export type AppDispatch = typeof store.dispatch;
export type RootState = ReturnType<typeof store.getState>;
export type AppThunk<ReturnType = void> = ThunkAction<
- ReturnType,
- RootState,
- unknown,
- Action<string>
+ ReturnType,
+ RootState,
+ unknown,
+ Action<string>
>;
diff --git a/experimental/freemocap-ui/src/components/start-stop-process.tsx b/experimental/freemocap-ui/src/components/start-stop-process.tsx
index 445c358f..f69e63dc 100644
--- a/experimental/freemocap-ui/src/components/start-stop-process.tsx
+++ b/experimental/freemocap-ui/src/components/start-stop-process.tsx
@@ -3,34 +3,36 @@ import React, {useEffect, useState} from "react"
import {RecorderManager, StreamByDeviceId} from "../services/recorder";
interface Props {
- streams?: StreamByDeviceId;
+ streams?: StreamByDeviceId;
}
export const StartStopProcess = (props: Props) => {
- const [manager, setManager] = useState<RecorderManager>();
- useEffect(() => {
- if (!props.streams) { return; }
- const manager = new RecorderManager(props.streams);
- manager.registerDataHandler();
- setManager(manager);
- }, [props.streams]);
-
-
- return (
- <Box display={'flex'}>
-
- <Box mr={2}>
- <Button variant={'contained'} onClick={manager?.start}>Start Capture</Button>
- </Box>
-
- <Box mr={2}>
- <Button variant={'contained'} onClick={manager?.stop}>Stop Capture</Button>
- </Box>
-
- <Box mr={2}>
- <Button variant={'contained'} onClick={manager?.process}>Process Recording</Button>
- </Box>
- </Box>
-
- )
+ const [manager, setManager] = useState<RecorderManager>();
+ useEffect(() => {
+ if (!props.streams) {
+ return;
+ }
+ const manager = new RecorderManager(props.streams);
+ manager.registerDataHandler();
+ setManager(manager);
+ }, [props.streams]);
+
+
+ return (
+ <Box display={'flex'}>
+
+ <Box mr={2}>
+ <Button variant={'contained'} onClick={manager?.start}>Start Capture</Button>
+ </Box>
+
+ <Box mr={2}>
+ <Button variant={'contained'} onClick={manager?.stop}>Stop Capture</Button>
+ </Box>
+
+ <Box mr={2}>
+ <Button variant={'contained'} onClick={manager?.process}>Process Recording</Button>
+ </Box>
+ </Box>
+
+ )
}
\ No newline at end of file
diff --git a/experimental/freemocap-ui/src/components/webcam/LivePreview.tsx b/experimental/freemocap-ui/src/components/webcam/LivePreview.tsx
index 7e13d160..01010269 100644
--- a/experimental/freemocap-ui/src/components/webcam/LivePreview.tsx
+++ b/experimental/freemocap-ui/src/components/webcam/LivePreview.tsx
@@ -1,23 +1,23 @@
import React from "react";
interface Props {
- stream: MediaStream
+ stream: MediaStream
}
-export function LiveStreamPreview({ stream }) {
- let videoPreviewRef = React.useRef<HTMLVideoElement>();
+export function LiveStreamPreview({stream}) {
+ let videoPreviewRef = React.useRef<HTMLVideoElement>();
- React.useEffect(() => {
- if (videoPreviewRef.current && stream) {
- // @ts-ignore
- videoPreviewRef.current.srcObject = stream;
- }
- }, [stream]);
+ React.useEffect(() => {
+ if (videoPreviewRef.current && stream) {
+ // @ts-ignore
+ videoPreviewRef.current.srcObject = stream;
+ }
+ }, [stream]);
- if (!stream) {
- return null;
- }
+ if (!stream) {
+ return null;
+ }
- // @ts-ignore
- return <video ref={videoPreviewRef} width={800} height={600} autoPlay />;
+ // @ts-ignore
+ return <video ref={videoPreviewRef} width={800} height={600} autoPlay/>;
}
diff --git a/experimental/freemocap-ui/src/components/webcam/webcam-capture.tsx b/experimental/freemocap-ui/src/components/webcam/webcam-capture.tsx
index 95217baf..c0101539 100644
--- a/experimental/freemocap-ui/src/components/webcam/webcam-capture.tsx
+++ b/experimental/freemocap-ui/src/components/webcam/webcam-capture.tsx
@@ -4,35 +4,35 @@ import {Capture} from "../../services/Capture";
import {Button} from "@mui/material";
interface Props {
- device: MediaDeviceInfo
+ device: MediaDeviceInfo
}
export const WebcamCapture = (props: Props) => {
- const {device} = props
- const videoRef = React.useRef<HTMLVideoElement>(null);
- const stream = useDeviceStream(device)
- // const { sendMessage, getWebSocket } = useWebSocket("ws://localhost:8080/ws/hello_world")
- const [capture, setCapture] = useState<Capture>()
- useEffect(() => {
- const {current} = videoRef
- if (current) {
- // @ts-ignore
- current.srcObject = stream
- const capture = new Capture(videoRef)
- setCapture(capture)
- }
- }, [stream, videoRef])
+ const {device} = props
+ const videoRef = React.useRef<HTMLVideoElement>(null);
+ const stream = useDeviceStream(device)
+ // const { sendMessage, getWebSocket } = useWebSocket("ws://localhost:8080/ws/hello_world")
+ const [capture, setCapture] = useState<Capture>()
+ useEffect(() => {
+ const {current} = videoRef
+ if (current) {
+ // @ts-ignore
+ current.srcObject = stream
+ const capture = new Capture(videoRef)
+ setCapture(capture)
+ }
+ }, [stream, videoRef])
- if (!stream) {
- return null
- }
- return (
- <>
- <video ref={videoRef} height={600} width={800} autoPlay />
- <canvas id={"canvasOutput"} />
- <Button onClick={() => {
- capture?.processVideo()
- }}>Start Capture</Button>
- </>
- );
+ if (!stream) {
+ return null
+ }
+ return (
+ <>
+ <video ref={videoRef} height={600} width={800} autoPlay/>
+ <canvas id={"canvasOutput"}/>
+ <Button onClick={() => {
+ capture?.processVideo()
+ }}>Start Capture</Button>
+ </>
+ );
};
\ No newline at end of file
diff --git a/experimental/freemocap-ui/src/components/webcam/webcam.tsx b/experimental/freemocap-ui/src/components/webcam/webcam.tsx
index caf49329..ce42a3e0 100644
--- a/experimental/freemocap-ui/src/components/webcam/webcam.tsx
+++ b/experimental/freemocap-ui/src/components/webcam/webcam.tsx
@@ -1,5 +1,5 @@
import {default as Webcam} from 'react-webcam';
export const SomeWebcam = () => {
- return <Webcam />
+ return <Webcam/>
}
\ No newline at end of file
diff --git a/experimental/freemocap-ui/src/features/camera/cameraSlice.tsx b/experimental/freemocap-ui/src/features/camera/cameraSlice.tsx
index 2b37002f..f53922f2 100644
--- a/experimental/freemocap-ui/src/features/camera/cameraSlice.tsx
+++ b/experimental/freemocap-ui/src/features/camera/cameraSlice.tsx
@@ -9,16 +9,16 @@ export class AppCameraState {
// }
export const cameraSlice = createSlice({
- name: 'counter',
- initialState: new AppCameraState(),
- reducers: {
- increment: (state) => {
+ name: 'counter',
+ initialState: new AppCameraState(),
+ reducers: {
+ increment: (state) => {
+ },
+ decrement: (state) => {
+ },
+ incrementByAmount: (state, action: PayloadAction<number>) => {
+ },
},
- decrement: (state) => {
- },
- incrementByAmount: (state, action: PayloadAction<number>) => {
- },
- },
})
// Action creators are generated for each case reducer function
diff --git a/experimental/freemocap-ui/src/features/counter/Counter.module.css b/experimental/freemocap-ui/src/features/counter/Counter.module.css
index 025bb729..7595976a 100644
--- a/experimental/freemocap-ui/src/features/counter/Counter.module.css
+++ b/experimental/freemocap-ui/src/features/counter/Counter.module.css
@@ -1,79 +1,79 @@
.row {
- display: flex;
- align-items: center;
- justify-content: center;
+ display: flex;
+ align-items: center;
+ justify-content: center;
}
.row > button {
- margin-left: 4px;
- margin-right: 8px;
+ margin-left: 4px;
+ margin-right: 8px;
}
.row:not(:last-child) {
- margin-bottom: 16px;
+ margin-bottom: 16px;
}
.value {
- font-size: 78px;
- padding-left: 16px;
- padding-right: 16px;
- margin-top: 2px;
- font-family: 'Courier New', Courier, monospace;
+ font-size: 78px;
+ padding-left: 16px;
+ padding-right: 16px;
+ margin-top: 2px;
+ font-family: 'Courier New', Courier, monospace;
}
.button {
- appearance: none;
- background: none;
- font-size: 32px;
- padding-left: 12px;
- padding-right: 12px;
- outline: none;
- border: 2px solid transparent;
- color: rgb(112, 76, 182);
- padding-bottom: 4px;
- cursor: pointer;
- background-color: rgba(112, 76, 182, 0.1);
- border-radius: 2px;
- transition: all 0.15s;
+ appearance: none;
+ background: none;
+ font-size: 32px;
+ padding-left: 12px;
+ padding-right: 12px;
+ outline: none;
+ border: 2px solid transparent;
+ color: rgb(112, 76, 182);
+ padding-bottom: 4px;
+ cursor: pointer;
+ background-color: rgba(112, 76, 182, 0.1);
+ border-radius: 2px;
+ transition: all 0.15s;
}
.textbox {
- font-size: 32px;
- padding: 2px;
- width: 64px;
- text-align: center;
- margin-right: 4px;
+ font-size: 32px;
+ padding: 2px;
+ width: 64px;
+ text-align: center;
+ margin-right: 4px;
}
.button:hover,
.button:focus {
- border: 2px solid rgba(112, 76, 182, 0.4);
+ border: 2px solid rgba(112, 76, 182, 0.4);
}
.button:active {
- background-color: rgba(112, 76, 182, 0.2);
+ background-color: rgba(112, 76, 182, 0.2);
}
.asyncButton {
- composes: button;
- position: relative;
+ composes: button;
+ position: relative;
}
.asyncButton:after {
- content: '';
- background-color: rgba(112, 76, 182, 0.15);
- display: block;
- position: absolute;
- width: 100%;
- height: 100%;
- left: 0;
- top: 0;
- opacity: 0;
- transition: width 1s linear, opacity 0.5s ease 1s;
+ content: '';
+ background-color: rgba(112, 76, 182, 0.15);
+ display: block;
+ position: absolute;
+ width: 100%;
+ height: 100%;
+ left: 0;
+ top: 0;
+ opacity: 0;
+ transition: width 1s linear, opacity 0.5s ease 1s;
}
.asyncButton:active:after {
- width: 0%;
- opacity: 1;
- transition: 0s;
+ width: 0%;
+ opacity: 1;
+ transition: 0s;
}
diff --git a/experimental/freemocap-ui/src/features/counter/Counter.tsx b/experimental/freemocap-ui/src/features/counter/Counter.tsx
index 297369e7..82709f02 100644
--- a/experimental/freemocap-ui/src/features/counter/Counter.tsx
+++ b/experimental/freemocap-ui/src/features/counter/Counter.tsx
@@ -5,57 +5,57 @@ import {decrement, increment, incrementAsync, incrementByAmount, incrementIfOdd,
import styles from './Counter.module.css';
export function Counter() {
- const count = useAppSelector(selectCount);
- const dispatch = useAppDispatch();
- const [incrementAmount, setIncrementAmount] = useState('2');
+ const count = useAppSelector(selectCount);
+ const dispatch = useAppDispatch();
+ const [incrementAmount, setIncrementAmount] = useState('2');
- const incrementValue = Number(incrementAmount) || 0;
+ const incrementValue = Number(incrementAmount) || 0;
- return (
- <div>
- <div className={styles.row}>
- <button
- className={styles.button}
- aria-label="Decrement value"
- onClick={() => dispatch(decrement())}
- >
- -
- </button>
- <span className={styles.value}>{count}</span>
- <button
- className={styles.button}
- aria-label="Increment value"
- onClick={() => dispatch(increment())}
- >
- +
- </button>
- </div>
- <div className={styles.row}>
- <input
- className={styles.textbox}
- aria-label="Set increment amount"
- value={incrementAmount}
- onChange={(e) => setIncrementAmount(e.target.value)}
- />
- <button
- className={styles.button}
- onClick={() => dispatch(incrementByAmount(incrementValue))}
- >
- Add Amount
- </button>
- <button
- className={styles.asyncButton}
- onClick={() => dispatch(incrementAsync(incrementValue))}
- >
- Add Async
- </button>
- <button
- className={styles.button}
- onClick={() => dispatch(incrementIfOdd(incrementValue))}
- >
- Add If Odd
- </button>
- </div>
- </div>
- );
+ return (
+ <div>
+ <div className={styles.row}>
+ <button
+ className={styles.button}
+ aria-label="Decrement value"
+ onClick={() => dispatch(decrement())}
+ >
+ -
+ </button>
+ <span className={styles.value}>{count}</span>
+ <button
+ className={styles.button}
+ aria-label="Increment value"
+ onClick={() => dispatch(increment())}
+ >
+ +
+ </button>
+ </div>
+ <div className={styles.row}>
+ <input
+ className={styles.textbox}
+ aria-label="Set increment amount"
+ value={incrementAmount}
+ onChange={(e) => setIncrementAmount(e.target.value)}
+ />
+ <button
+ className={styles.button}
+ onClick={() => dispatch(incrementByAmount(incrementValue))}
+ >
+ Add Amount
+ </button>
+ <button
+ className={styles.asyncButton}
+ onClick={() => dispatch(incrementAsync(incrementValue))}
+ >
+ Add Async
+ </button>
+ <button
+ className={styles.button}
+ onClick={() => dispatch(incrementIfOdd(incrementValue))}
+ >
+ Add If Odd
+ </button>
+ </div>
+ </div>
+ );
}
diff --git a/experimental/freemocap-ui/src/features/counter/counterAPI.ts b/experimental/freemocap-ui/src/features/counter/counterAPI.ts
index 0a9cdd31..68cf0431 100644
--- a/experimental/freemocap-ui/src/features/counter/counterAPI.ts
+++ b/experimental/freemocap-ui/src/features/counter/counterAPI.ts
@@ -1,6 +1,6 @@
// A mock function to mimic making an async request for data
export function fetchCount(amount = 1) {
- return new Promise<{ data: number }>((resolve) =>
- setTimeout(() => resolve({ data: amount }), 500)
- );
+ return new Promise<{ data: number }>((resolve) =>
+ setTimeout(() => resolve({data: amount}), 500)
+ );
}
diff --git a/experimental/freemocap-ui/src/features/counter/counterSlice.spec.ts b/experimental/freemocap-ui/src/features/counter/counterSlice.spec.ts
index e7f964a5..463b6a09 100644
--- a/experimental/freemocap-ui/src/features/counter/counterSlice.spec.ts
+++ b/experimental/freemocap-ui/src/features/counter/counterSlice.spec.ts
@@ -1,29 +1,29 @@
import counterReducer, {CounterState, decrement, increment, incrementByAmount,} from './counterSlice';
describe('counter reducer', () => {
- const initialState: CounterState = {
- value: 3,
- status: 'idle',
- };
- it('should handle initial state', () => {
- expect(counterReducer(undefined, { type: 'unknown' })).toEqual({
- value: 0,
- status: 'idle',
+ const initialState: CounterState = {
+ value: 3,
+ status: 'idle',
+ };
+ it('should handle initial state', () => {
+ expect(counterReducer(undefined, {type: 'unknown'})).toEqual({
+ value: 0,
+ status: 'idle',
+ });
});
- });
- it('should handle increment', () => {
- const actual = counterReducer(initialState, increment());
- expect(actual.value).toEqual(4);
- });
+ it('should handle increment', () => {
+ const actual = counterReducer(initialState, increment());
+ expect(actual.value).toEqual(4);
+ });
- it('should handle decrement', () => {
- const actual = counterReducer(initialState, decrement());
- expect(actual.value).toEqual(2);
- });
+ it('should handle decrement', () => {
+ const actual = counterReducer(initialState, decrement());
+ expect(actual.value).toEqual(2);
+ });
- it('should handle incrementByAmount', () => {
- const actual = counterReducer(initialState, incrementByAmount(2));
- expect(actual.value).toEqual(5);
- });
+ it('should handle incrementByAmount', () => {
+ const actual = counterReducer(initialState, incrementByAmount(2));
+ expect(actual.value).toEqual(5);
+ });
});
diff --git a/experimental/freemocap-ui/src/features/counter/counterSlice.ts b/experimental/freemocap-ui/src/features/counter/counterSlice.ts
index 15a028fc..a8439d2c 100644
--- a/experimental/freemocap-ui/src/features/counter/counterSlice.ts
+++ b/experimental/freemocap-ui/src/features/counter/counterSlice.ts
@@ -3,13 +3,13 @@ import {AppThunk, RootState} from '../../app/store';
import {fetchCount} from './counterAPI';
export interface CounterState {
- value: number;
- status: 'idle' | 'loading' | 'failed';
+ value: number;
+ status: 'idle' | 'loading' | 'failed';
}
const initialState: CounterState = {
- value: 0,
- status: 'idle',
+ value: 0,
+ status: 'idle',
};
// The function below is called a thunk and allows us to perform async logic. It
@@ -18,49 +18,49 @@ const initialState: CounterState = {
// code can then be executed and other actions can be dispatched. Thunks are
// typically used to make async requests.
export const incrementAsync = createAsyncThunk(
- 'counter/fetchCount',
- async (amount: number) => {
- const response = await fetchCount(amount);
- // The value we return becomes the `fulfilled` action payload
- return response.data;
- }
+ 'counter/fetchCount',
+ async (amount: number) => {
+ const response = await fetchCount(amount);
+ // The value we return becomes the `fulfilled` action payload
+ return response.data;
+ }
);
export const counterSlice = createSlice({
- name: 'counter',
- initialState,
- // The `reducers` field lets us define reducers and generate associated actions
- reducers: {
- increment: (state) => {
- // Redux Toolkit allows us to write "mutating" logic in reducers. It
- // doesn't actually mutate the state because it uses the Immer library,
- // which detects changes to a "draft state" and produces a brand new
- // immutable state based off those changes
- state.value += 1;
+ name: 'counter',
+ initialState,
+ // The `reducers` field lets us define reducers and generate associated actions
+ reducers: {
+ increment: (state) => {
+ // Redux Toolkit allows us to write "mutating" logic in reducers. It
+ // doesn't actually mutate the state because it uses the Immer library,
+ // which detects changes to a "draft state" and produces a brand new
+ // immutable state based off those changes
+ state.value += 1;
+ },
+ decrement: (state) => {
+ state.value -= 1;
+ },
+ // Use the PayloadAction type to declare the contents of `action.payload`
+ incrementByAmount: (state, action: PayloadAction<number>) => {
+ state.value += action.payload;
+ },
},
- decrement: (state) => {
- state.value -= 1;
+ // The `extraReducers` field lets the slice handle actions defined elsewhere,
+ // including actions generated by createAsyncThunk or in other slices.
+ extraReducers: (builder) => {
+ builder
+ .addCase(incrementAsync.pending, (state) => {
+ state.status = 'loading';
+ })
+ .addCase(incrementAsync.fulfilled, (state, action) => {
+ state.status = 'idle';
+ state.value += action.payload;
+ });
},
- // Use the PayloadAction type to declare the contents of `action.payload`
- incrementByAmount: (state, action: PayloadAction<number>) => {
- state.value += action.payload;
- },
- },
- // The `extraReducers` field lets the slice handle actions defined elsewhere,
- // including actions generated by createAsyncThunk or in other slices.
- extraReducers: (builder) => {
- builder
- .addCase(incrementAsync.pending, (state) => {
- state.status = 'loading';
- })
- .addCase(incrementAsync.fulfilled, (state, action) => {
- state.status = 'idle';
- state.value += action.payload;
- });
- },
});
-export const { increment, decrement, incrementByAmount } = counterSlice.actions;
+export const {increment, decrement, incrementByAmount} = counterSlice.actions;
// The function below is called a selector and allows us to select a value from
// the state. Selectors can also be defined inline where they're used instead of
@@ -70,13 +70,13 @@ export const selectCount = (state: RootState) => state.counter.value;
// We can also write thunks by hand, which may contain both sync and async logic.
// Here's an example of conditionally dispatching actions based on current state.
export const incrementIfOdd = (amount: number): AppThunk => (
- dispatch,
- getState
+ dispatch,
+ getState
) => {
- const currentValue = selectCount(getState());
- if (currentValue % 2 === 1) {
- dispatch(incrementByAmount(amount));
- }
+ const currentValue = selectCount(getState());
+ if (currentValue % 2 === 1) {
+ dispatch(incrementByAmount(amount));
+ }
};
export default counterSlice.reducer;
diff --git a/experimental/freemocap-ui/src/hooks/use-device-stream.ts b/experimental/freemocap-ui/src/hooks/use-device-stream.ts
index 05cd766b..874fd6e1 100644
--- a/experimental/freemocap-ui/src/hooks/use-device-stream.ts
+++ b/experimental/freemocap-ui/src/hooks/use-device-stream.ts
@@ -1,12 +1,12 @@
import {useAsync} from "react-use";
export const useDeviceStream = (device: MediaDeviceInfo) => {
- const {value} = useAsync(async () => {
- return await navigator.mediaDevices.getUserMedia({
- video: {
- deviceId: device.deviceId
- },
- })
- }, [device])
- return value
+ const {value} = useAsync(async () => {
+ return await navigator.mediaDevices.getUserMedia({
+ video: {
+ deviceId: device.deviceId
+ },
+ })
+ }, [device])
+ return value
}
\ No newline at end of file
diff --git a/experimental/freemocap-ui/src/hooks/use-frame-capture.tsx b/experimental/freemocap-ui/src/hooks/use-frame-capture.tsx
index e3f8701f..070c9f06 100644
--- a/experimental/freemocap-ui/src/hooks/use-frame-capture.tsx
+++ b/experimental/freemocap-ui/src/hooks/use-frame-capture.tsx
@@ -2,23 +2,23 @@ import {useEffect, useState} from "react";
import {CaptureType, FrameCapture, OnMessageHandler} from "../services/frame-capture";
export const useFrameCapture = (webcam_id: string, captureType: CaptureType, onMessage?: OnMessageHandler): [FrameCapture, string] => {
- const [frameCapture,] = useState(() => new FrameCapture(webcam_id, captureType));
- const [data, setDataUrl] = useState<string>("");
- useEffect(() => {
- frameCapture.start_frame_capture(async (ev: MessageEvent<Blob>, data_url: string) => {
- setDataUrl(data_url);
- if (onMessage) {
- await onMessage(ev, data_url);
- }
- });
- return () => {
- frameCapture.cleanup()
- }
- }, [webcam_id]);
+ const [frameCapture,] = useState(() => new FrameCapture(webcam_id, captureType));
+ const [data, setDataUrl] = useState<string>("");
+ useEffect(() => {
+ frameCapture.start_frame_capture(async (ev: MessageEvent<Blob>, data_url: string) => {
+ setDataUrl(data_url);
+ if (onMessage) {
+ await onMessage(ev, data_url);
+ }
+ });
+ return () => {
+ frameCapture.cleanup()
+ }
+ }, [webcam_id]);
- window.onbeforeunload = () => {
- frameCapture.cleanup()
- }
+ window.onbeforeunload = () => {
+ frameCapture.cleanup()
+ }
- return [frameCapture, data];
+ return [frameCapture, data];
}
\ No newline at end of file
diff --git a/experimental/freemocap-ui/src/index.css b/experimental/freemocap-ui/src/index.css
index ec2585e8..da92873c 100644
--- a/experimental/freemocap-ui/src/index.css
+++ b/experimental/freemocap-ui/src/index.css
@@ -1,13 +1,13 @@
body {
- margin: 0;
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
+ margin: 0;
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
}
code {
- font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
+ font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}
diff --git a/experimental/freemocap-ui/src/index.tsx b/experimental/freemocap-ui/src/index.tsx
index 44fee373..256cc1d2 100644
--- a/experimental/freemocap-ui/src/index.tsx
+++ b/experimental/freemocap-ui/src/index.tsx
@@ -7,12 +7,12 @@ import {Provider} from 'react-redux';
import * as serviceWorker from './serviceWorker';
ReactDOM.render(
- <React.StrictMode>
- <Provider store={store}>
- <App />
- </Provider>
- </React.StrictMode>,
- document.getElementById('root')
+ <React.StrictMode>
+ <Provider store={store}>
+ <App/>
+ </Provider>
+ </React.StrictMode>,
+ document.getElementById('root')
);
// If you want your app to work offline and load faster, you can change
diff --git a/experimental/freemocap-ui/src/layout/Copyright.tsx b/experimental/freemocap-ui/src/layout/Copyright.tsx
index fdb9468b..aebd8897 100644
--- a/experimental/freemocap-ui/src/layout/Copyright.tsx
+++ b/experimental/freemocap-ui/src/layout/Copyright.tsx
@@ -2,14 +2,14 @@ import Typography from "@mui/material/Typography";
import Link from "@mui/material/Link";
import * as React from "react";
-export const Copyright = function() {
- return (
- <Typography variant="body2" color="text.secondary" align="center">
- {'Copyright © '}
- <Link color="inherit" href="https://mui.com/">
- FreeMoCap
- </Link>{' '}
- {new Date().getFullYear()}.
- </Typography>
- );
+export const Copyright = function () {
+ return (
+ <Typography variant="body2" color="text.secondary" align="center">
+ {'Copyright © '}
+ <Link color="inherit" href="https://mui.com/">
+ FreeMoCap
+ </Link>{' '}
+ {new Date().getFullYear()}.
+ </Typography>
+ );
}
diff --git a/experimental/freemocap-ui/src/layout/Header.tsx b/experimental/freemocap-ui/src/layout/Header.tsx
index 862689ae..c1d6171f 100644
--- a/experimental/freemocap-ui/src/layout/Header.tsx
+++ b/experimental/freemocap-ui/src/layout/Header.tsx
@@ -9,51 +9,51 @@ import Typography from '@mui/material/Typography';
const lightColor = 'rgba(255, 255, 255, 0.7)';
interface HeaderProps {
- onDrawerToggle: () => void;
- title: string;
+ onDrawerToggle: () => void;
+ title: string;
}
export const Header = function (props: HeaderProps) {
- const {onDrawerToggle} = props;
+ const {onDrawerToggle} = props;
- return (
- <React.Fragment>
- <AppBar color="primary" position="sticky" elevation={0}>
- <Toolbar>
- <Grid container spacing={1} alignItems="center">
- <Grid sx={{display: {sm: 'none', xs: 'block'}}} item>
- <IconButton
- color="inherit"
- aria-label="open drawer"
- onClick={onDrawerToggle}
- edge="start"
- >
- <MenuIcon />
- </IconButton>
- </Grid>
- <Grid item xs />
- <Grid item>
- </Grid>
- </Grid>
- </Toolbar>
- </AppBar>
- <AppBar
- component="div"
- color="primary"
- position="static"
- elevation={0}
- sx={{zIndex: 0}}
- >
- <Toolbar>
- <Grid container alignItems="center" spacing={1}>
- <Grid item xs>
- <Typography color="inherit" variant="h5" component="h1">
- {props.title}
- </Typography>
- </Grid>
- </Grid>
- </Toolbar>
- </AppBar>
- </React.Fragment>
- );
+ return (
+ <React.Fragment>
+ <AppBar color="primary" position="sticky" elevation={0}>
+ <Toolbar>
+ <Grid container spacing={1} alignItems="center">
+ <Grid sx={{display: {sm: 'none', xs: 'block'}}} item>
+ <IconButton
+ color="inherit"
+ aria-label="open drawer"
+ onClick={onDrawerToggle}
+ edge="start"
+ >
+ <MenuIcon/>
+ </IconButton>
+ </Grid>
+ <Grid item xs/>
+ <Grid item>
+ </Grid>
+ </Grid>
+ </Toolbar>
+ </AppBar>
+ <AppBar
+ component="div"
+ color="primary"
+ position="static"
+ elevation={0}
+ sx={{zIndex: 0}}
+ >
+ <Toolbar>
+ <Grid container alignItems="center" spacing={1}>
+ <Grid item xs>
+ <Typography color="inherit" variant="h5" component="h1">
+ {props.title}
+ </Typography>
+ </Grid>
+ </Grid>
+ </Toolbar>
+ </AppBar>
+ </React.Fragment>
+ );
}
\ No newline at end of file
diff --git a/experimental/freemocap-ui/src/layout/Navigator.tsx b/experimental/freemocap-ui/src/layout/Navigator.tsx
index 3ef255b4..711918ce 100644
--- a/experimental/freemocap-ui/src/layout/Navigator.tsx
+++ b/experimental/freemocap-ui/src/layout/Navigator.tsx
@@ -11,74 +11,74 @@ import HomeIcon from '@mui/icons-material/Home';
import {useNavigate} from "react-router";
const categories = [
- {
- id: 'Interact',
- children: [
- {
- id: 'Session',
- route: "/session"
- },
- {
- id: 'Setup and Preview',
- route: "/setup_and_preview"
- },
- {
- id: 'Show Cameras',
- route: "/show_cameras"
- },
- ],
- },
+ {
+ id: 'Interact',
+ children: [
+ {
+ id: 'Session',
+ route: "/session"
+ },
+ {
+ id: 'Setup and Preview',
+ route: "/setup_and_preview"
+ },
+ {
+ id: 'Show Cameras',
+ route: "/show_cameras"
+ },
+ ],
+ },
];
const item = {
- py: '2px',
- px: 3,
- color: 'rgba(255, 255, 255, 0.7)',
- '&:hover, &:focus': {
- bgcolor: 'rgba(255, 255, 255, 0.08)',
- },
+ py: '2px',
+ px: 3,
+ color: 'rgba(255, 255, 255, 0.7)',
+ '&:hover, &:focus': {
+ bgcolor: 'rgba(255, 255, 255, 0.08)',
+ },
};
const itemCategory = {
- boxShadow: '0 -1px 0 rgb(255,255,255,0.1) inset',
- py: 1.5,
- px: 3,
+ boxShadow: '0 -1px 0 rgb(255,255,255,0.1) inset',
+ py: 1.5,
+ px: 3,
};
export const Navigator = function (props: DrawerProps) {
- const {...other} = props;
- const navigate = useNavigate();
- return (
- <Drawer variant="permanent" {...other}>
- <List disablePadding>
- <ListItem sx={{...item, ...itemCategory, fontSize: 22, color: '#fff'}}>
- freemocap
- </ListItem>
- <ListItem sx={{...item, ...itemCategory}}>
- <ListItemIcon>
- <HomeIcon />
- </ListItemIcon>
- <ListItemText>Overview</ListItemText>
- </ListItem>
- {categories.map(({id, children}) => (
- <Box key={id} sx={{bgcolor: '#101F33'}}>
- <ListItem sx={{py: 2, px: 3}}>
- <ListItemText sx={{color: '#fff'}}>{id}</ListItemText>
- </ListItem>
- {children.map(({id: childId, route}) => (
- <ListItem disablePadding key={childId}>
- <ListItemButton selected={false} sx={item} onClick={() => {
- navigate(route)
- }}>
- {/*<ListItemIcon>{icon}</ListItemIcon>*/}
- <ListItemText>{childId}</ListItemText>
- </ListItemButton>
- </ListItem>
- ))}
- <Divider sx={{mt: 2}} />
- </Box>
- ))}
- </List>
- </Drawer>
- );
+ const {...other} = props;
+ const navigate = useNavigate();
+ return (
+ <Drawer variant="permanent" {...other}>
+ <List disablePadding>
+ <ListItem sx={{...item, ...itemCategory, fontSize: 22, color: '#fff'}}>
+ freemocap
+ </ListItem>
+ <ListItem sx={{...item, ...itemCategory}}>
+ <ListItemIcon>
+ <HomeIcon/>
+ </ListItemIcon>
+ <ListItemText>Overview</ListItemText>
+ </ListItem>
+ {categories.map(({id, children}) => (
+ <Box key={id} sx={{bgcolor: '#101F33'}}>
+ <ListItem sx={{py: 2, px: 3}}>
+ <ListItemText sx={{color: '#fff'}}>{id}</ListItemText>
+ </ListItem>
+ {children.map(({id: childId, route}) => (
+ <ListItem disablePadding key={childId}>
+ <ListItemButton selected={false} sx={item} onClick={() => {
+ navigate(route)
+ }}>
+ {/*<ListItemIcon>{icon}</ListItemIcon>*/}
+ <ListItemText>{childId}</ListItemText>
+ </ListItemButton>
+ </ListItem>
+ ))}
+ <Divider sx={{mt: 2}}/>
+ </Box>
+ ))}
+ </List>
+ </Drawer>
+ );
}
\ No newline at end of file
diff --git a/experimental/freemocap-ui/src/layout/Paperbase.tsx b/experimental/freemocap-ui/src/layout/Paperbase.tsx
index e044ee73..50d631b0 100644
--- a/experimental/freemocap-ui/src/layout/Paperbase.tsx
+++ b/experimental/freemocap-ui/src/layout/Paperbase.tsx
@@ -9,190 +9,190 @@ import {BrowserRouter} from 'react-router-dom';
import {CssBaseline} from "@mui/material";
let theme = createTheme({
- palette: {
- primary: {
- light: '#63ccff',
- main: '#009be5',
- dark: '#006db3',
+ palette: {
+ primary: {
+ light: '#63ccff',
+ main: '#009be5',
+ dark: '#006db3',
+ },
},
- },
- typography: {
- h5: {
- fontWeight: 500,
- fontSize: 26,
- letterSpacing: 0.5,
+ typography: {
+ h5: {
+ fontWeight: 500,
+ fontSize: 26,
+ letterSpacing: 0.5,
+ },
},
- },
- shape: {
- borderRadius: 8,
- },
- components: {
- MuiTab: {
- defaultProps: {
- disableRipple: true,
- },
+ shape: {
+ borderRadius: 8,
+ },
+ components: {
+ MuiTab: {
+ defaultProps: {
+ disableRipple: true,
+ },
+ },
},
- },
- mixins: {
- toolbar: {
- minHeight: 48,
+ mixins: {
+ toolbar: {
+ minHeight: 48,
+ },
},
- },
});
theme = {
- ...theme,
- components: {
- MuiDrawer: {
- styleOverrides: {
- paper: {
- backgroundColor: '#081627',
+ ...theme,
+ components: {
+ MuiDrawer: {
+ styleOverrides: {
+ paper: {
+ backgroundColor: '#081627',
+ },
+ },
},
- },
- },
- MuiButton: {
- styleOverrides: {
- root: {
- textTransform: 'none',
+ MuiButton: {
+ styleOverrides: {
+ root: {
+ textTransform: 'none',
+ },
+ contained: {
+ boxShadow: 'none',
+ '&:active': {
+ boxShadow: 'none',
+ },
+ },
+ },
},
- contained: {
- boxShadow: 'none',
- '&:active': {
- boxShadow: 'none',
- },
+ MuiTabs: {
+ styleOverrides: {
+ root: {
+ marginLeft: theme.spacing(1),
+ },
+ indicator: {
+ height: 3,
+ borderTopLeftRadius: 3,
+ borderTopRightRadius: 3,
+ backgroundColor: theme.palette.common.white,
+ },
+ },
},
- },
- },
- MuiTabs: {
- styleOverrides: {
- root: {
- marginLeft: theme.spacing(1),
+ MuiTab: {
+ styleOverrides: {
+ root: {
+ textTransform: 'none',
+ margin: '0 16px',
+ minWidth: 0,
+ padding: 0,
+ [theme.breakpoints.up('md')]: {
+ padding: 0,
+ minWidth: 0,
+ },
+ },
+ },
},
- indicator: {
- height: 3,
- borderTopLeftRadius: 3,
- borderTopRightRadius: 3,
- backgroundColor: theme.palette.common.white,
+ MuiIconButton: {
+ styleOverrides: {
+ root: {
+ padding: theme.spacing(1),
+ },
+ },
},
- },
- },
- MuiTab: {
- styleOverrides: {
- root: {
- textTransform: 'none',
- margin: '0 16px',
- minWidth: 0,
- padding: 0,
- [theme.breakpoints.up('md')]: {
- padding: 0,
- minWidth: 0,
- },
+ MuiTooltip: {
+ styleOverrides: {
+ tooltip: {
+ borderRadius: 4,
+ },
+ },
},
- },
- },
- MuiIconButton: {
- styleOverrides: {
- root: {
- padding: theme.spacing(1),
+ MuiDivider: {
+ styleOverrides: {
+ root: {
+ backgroundColor: 'rgb(255,255,255,0.15)',
+ },
+ },
},
- },
- },
- MuiTooltip: {
- styleOverrides: {
- tooltip: {
- borderRadius: 4,
+ MuiListItemButton: {
+ styleOverrides: {
+ root: {
+ '&.Mui-selected': {
+ color: '#4fc3f7',
+ },
+ },
+ },
},
- },
- },
- MuiDivider: {
- styleOverrides: {
- root: {
- backgroundColor: 'rgb(255,255,255,0.15)',
+ MuiListItemText: {
+ styleOverrides: {
+ primary: {
+ fontSize: 14,
+ fontWeight: theme.typography.fontWeightMedium,
+ },
+ },
},
- },
- },
- MuiListItemButton: {
- styleOverrides: {
- root: {
- '&.Mui-selected': {
- color: '#4fc3f7',
- },
+ MuiListItemIcon: {
+ styleOverrides: {
+ root: {
+ color: 'inherit',
+ minWidth: 'auto',
+ marginRight: theme.spacing(2),
+ '& svg': {
+ fontSize: 20,
+ },
+ },
+ },
},
- },
- },
- MuiListItemText: {
- styleOverrides: {
- primary: {
- fontSize: 14,
- fontWeight: theme.typography.fontWeightMedium,
- },
- },
- },
- MuiListItemIcon: {
- styleOverrides: {
- root: {
- color: 'inherit',
- minWidth: 'auto',
- marginRight: theme.spacing(2),
- '& svg': {
- fontSize: 20,
- },
- },
- },
- },
- MuiAvatar: {
- styleOverrides: {
- root: {
- width: 32,
- height: 32,
+ MuiAvatar: {
+ styleOverrides: {
+ root: {
+ width: 32,
+ height: 32,
+ },
+ },
},
- },
},
- },
};
const drawerWidth = 256;
export const Paperbase = function () {
- const [mobileOpen, setMobileOpen] = React.useState(false);
- const isSmUp = useMediaQuery(theme.breakpoints.up('sm'));
+ const [mobileOpen, setMobileOpen] = React.useState(false);
+ const isSmUp = useMediaQuery(theme.breakpoints.up('sm'));
- const handleDrawerToggle = () => {
- setMobileOpen(!mobileOpen);
- };
+ const handleDrawerToggle = () => {
+ setMobileOpen(!mobileOpen);
+ };
- return (
- <ThemeProvider theme={theme}>
- <CssBaseline />
- <BrowserRouter>
- <Box sx={{display: 'flex', minHeight: '100vh'}}>
- <Box
- component="nav"
- sx={{width: {sm: drawerWidth}, flexShrink: {sm: 0}}}
- >
- {isSmUp ? null : (
- <Navigator
- PaperProps={{style: {width: drawerWidth}}}
- variant="temporary"
- open={mobileOpen}
- onClose={handleDrawerToggle}
- />
- )}
- <Navigator
- PaperProps={{style: {width: drawerWidth}}}
- sx={{display: {sm: 'block', xs: 'none'}}}
- />
- </Box>
- <Box sx={{flex: 1, display: 'flex', flexDirection: 'column'}}>
- <Box component="main" sx={{flex: 1, bgcolor: '#eaeff1'}}>
- <BaseContent />
- </Box>
- <Box component="footer" sx={{p: 2, bgcolor: '#eaeff1'}}>
- <Copyright />
- </Box>
- </Box>
- </Box>
- </BrowserRouter>
- </ThemeProvider>
- );
+ return (
+ <ThemeProvider theme={theme}>
+ <CssBaseline/>
+ <BrowserRouter>
+ <Box sx={{display: 'flex', minHeight: '100vh'}}>
+ <Box
+ component="nav"
+ sx={{width: {sm: drawerWidth}, flexShrink: {sm: 0}}}
+ >
+ {isSmUp ? null : (
+ <Navigator
+ PaperProps={{style: {width: drawerWidth}}}
+ variant="temporary"
+ open={mobileOpen}
+ onClose={handleDrawerToggle}
+ />
+ )}
+ <Navigator
+ PaperProps={{style: {width: drawerWidth}}}
+ sx={{display: {sm: 'block', xs: 'none'}}}
+ />
+ </Box>
+ <Box sx={{flex: 1, display: 'flex', flexDirection: 'column'}}>
+ <Box component="main" sx={{flex: 1, bgcolor: '#eaeff1'}}>
+ <BaseContent/>
+ </Box>
+ <Box component="footer" sx={{p: 2, bgcolor: '#eaeff1'}}>
+ <Copyright/>
+ </Box>
+ </Box>
+ </Box>
+ </BrowserRouter>
+ </ThemeProvider>
+ );
}
\ No newline at end of file
diff --git a/experimental/freemocap-ui/src/layout/content/BaseContent.tsx b/experimental/freemocap-ui/src/layout/content/BaseContent.tsx
index c42b1272..518f1b66 100644
--- a/experimental/freemocap-ui/src/layout/content/BaseContent.tsx
+++ b/experimental/freemocap-ui/src/layout/content/BaseContent.tsx
@@ -4,12 +4,13 @@ import Box from "@mui/material/Box";
import {Router} from "../routing/router";
export const BaseContent = () => {
- return (
- <React.Fragment>
- <Header title={"Something"} onDrawerToggle={() => {}} />
- <Box sx={{ py: 6, px: 4, flex: 1, bgcolor: '#eaeff1' }}>
- <Router />
- </Box>
- </React.Fragment>
- )
+ return (
+ <React.Fragment>
+ <Header title={"Something"} onDrawerToggle={() => {
+ }}/>
+ <Box sx={{py: 6, px: 4, flex: 1, bgcolor: '#eaeff1'}}>
+ <Router/>
+ </Box>
+ </React.Fragment>
+ )
}
\ No newline at end of file
diff --git a/experimental/freemocap-ui/src/layout/content/BasePaper.tsx b/experimental/freemocap-ui/src/layout/content/BasePaper.tsx
index c4e4e04a..219d8795 100644
--- a/experimental/freemocap-ui/src/layout/content/BasePaper.tsx
+++ b/experimental/freemocap-ui/src/layout/content/BasePaper.tsx
@@ -2,10 +2,10 @@ import {Paper} from "@mui/material";
import React from "react";
export const BasePaper = (props) => {
- const { children, ...rest} = props;
- return (
- <Paper sx={{ maxWidth: 936, margin: 'auto', overflow: 'hidden', ...rest }}>
- {props.children}
- </Paper>
- )
+ const {children, ...rest} = props;
+ return (
+ <Paper sx={{maxWidth: 936, margin: 'auto', overflow: 'hidden', ...rest}}>
+ {props.children}
+ </Paper>
+ )
}
\ No newline at end of file
diff --git a/experimental/freemocap-ui/src/layout/content/Content.tsx b/experimental/freemocap-ui/src/layout/content/Content.tsx
index c9cc962f..69dfd01b 100644
--- a/experimental/freemocap-ui/src/layout/content/Content.tsx
+++ b/experimental/freemocap-ui/src/layout/content/Content.tsx
@@ -11,47 +11,47 @@ import IconButton from '@mui/material/IconButton';
import SearchIcon from '@mui/icons-material/Search';
import RefreshIcon from '@mui/icons-material/Refresh';
-export const Content = function() {
- return (
- <Paper sx={{ maxWidth: 936, margin: 'auto', overflow: 'hidden' }}>
- <AppBar
- position="static"
- color="default"
- elevation={0}
- sx={{ borderBottom: '1px solid rgba(0, 0, 0, 0.12)' }}
- >
- <Toolbar>
- <Grid container spacing={2} alignItems="center">
- <Grid item>
- <SearchIcon color="inherit" sx={{ display: 'block' }} />
- </Grid>
- <Grid item xs>
- <TextField
- fullWidth
- placeholder="Search by email address, phone number, or user UID"
- InputProps={{
- disableUnderline: true,
- sx: { fontSize: 'default' },
- }}
- variant="standard"
- />
- </Grid>
- <Grid item>
- <Button variant="contained" sx={{ mr: 1 }}>
- Add user
- </Button>
- <Tooltip title="Reload">
- <IconButton>
- <RefreshIcon color="inherit" sx={{ display: 'block' }} />
- </IconButton>
- </Tooltip>
- </Grid>
- </Grid>
- </Toolbar>
- </AppBar>
- <Typography sx={{ my: 5, mx: 2 }} color="text.secondary" align="center">
- No users for this project yet
- </Typography>
- </Paper>
- );
+export const Content = function () {
+ return (
+ <Paper sx={{maxWidth: 936, margin: 'auto', overflow: 'hidden'}}>
+ <AppBar
+ position="static"
+ color="default"
+ elevation={0}
+ sx={{borderBottom: '1px solid rgba(0, 0, 0, 0.12)'}}
+ >
+ <Toolbar>
+ <Grid container spacing={2} alignItems="center">
+ <Grid item>
+ <SearchIcon color="inherit" sx={{display: 'block'}}/>
+ </Grid>
+ <Grid item xs>
+ <TextField
+ fullWidth
+ placeholder="Search by email address, phone number, or user UID"
+ InputProps={{
+ disableUnderline: true,
+ sx: {fontSize: 'default'},
+ }}
+ variant="standard"
+ />
+ </Grid>
+ <Grid item>
+ <Button variant="contained" sx={{mr: 1}}>
+ Add user
+ </Button>
+ <Tooltip title="Reload">
+ <IconButton>
+ <RefreshIcon color="inherit" sx={{display: 'block'}}/>
+ </IconButton>
+ </Tooltip>
+ </Grid>
+ </Grid>
+ </Toolbar>
+ </AppBar>
+ <Typography sx={{my: 5, mx: 2}} color="text.secondary" align="center">
+ No users for this project yet
+ </Typography>
+ </Paper>
+ );
}
\ No newline at end of file
diff --git a/experimental/freemocap-ui/src/layout/routing/router.tsx b/experimental/freemocap-ui/src/layout/routing/router.tsx
index 5df6b723..ec3d791f 100644
--- a/experimental/freemocap-ui/src/layout/routing/router.tsx
+++ b/experimental/freemocap-ui/src/layout/routing/router.tsx
@@ -7,13 +7,13 @@ import {SessionWorkflow} from "../../views/SessionWorkflow";
export const Router = () => {
- return (
- <Routes>
- <Route path={'/'} element={<React.Fragment />} />
- <Route path={'/session'} element={<SessionWorkflow />} />
- <Route path={'/session/setup_and_preview/:sessionId'} element={<SetupAndPreviewView />} />
- <Route path={'/show_cameras'} element={<WebcamStreamCapture />} />
- <Route path={'/config'} element={<ConfigView />} />
- </Routes>
- )
+ return (
+ <Routes>
+ <Route path={'/'} element={<React.Fragment/>}/>
+ <Route path={'/session'} element={<SessionWorkflow/>}/>
+ <Route path={'/session/setup_and_preview/:sessionId'} element={<SetupAndPreviewView/>}/>
+ <Route path={'/show_cameras'} element={<WebcamStreamCapture/>}/>
+ <Route path={'/config'} element={<ConfigView/>}/>
+ </Routes>
+ )
}
\ No newline at end of file
diff --git a/experimental/freemocap-ui/src/logo.svg b/experimental/freemocap-ui/src/logo.svg
index 84667388..fafa6b21 100644
--- a/experimental/freemocap-ui/src/logo.svg
+++ b/experimental/freemocap-ui/src/logo.svg
@@ -1 +1,7 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><g fill="#764ABC"><path d="M65.6 65.4c2.9-.3 5.1-2.8 5-5.8-.1-3-2.6-5.4-5.6-5.4h-.2c-3.1.1-5.5 2.7-5.4 5.8.1 1.5.7 2.8 1.6 3.7-3.4 6.7-8.6 11.6-16.4 15.7-5.3 2.8-10.8 3.8-16.3 3.1-4.5-.6-8-2.6-10.2-5.9-3.2-4.9-3.5-10.2-.8-15.5 1.9-3.8 4.9-6.6 6.8-8-.4-1.3-1-3.5-1.3-5.1-14.5 10.5-13 24.7-8.6 31.4 3.3 5 10 8.1 17.4 8.1 2 0 4-.2 6-.7 12.8-2.5 22.5-10.1 28-21.4z"/><path d="M83.2 53c-7.6-8.9-18.8-13.8-31.6-13.8H50c-.9-1.8-2.8-3-4.9-3h-.2c-3.1.1-5.5 2.7-5.4 5.8.1 3 2.6 5.4 5.6 5.4h.2c2.2-.1 4.1-1.5 4.9-3.4H52c7.6 0 14.8 2.2 21.3 6.5 5 3.3 8.6 7.6 10.6 12.8 1.7 4.2 1.6 8.3-.2 11.8-2.8 5.3-7.5 8.2-13.7 8.2-4 0-7.8-1.2-9.8-2.1-1.1 1-3.1 2.6-4.5 3.6 4.3 2 8.7 3.1 12.9 3.1 9.6 0 16.7-5.3 19.4-10.6 2.9-5.8 2.7-15.8-4.8-24.3z"/><path d="M32.4 67.1c.1 3 2.6 5.4 5.6 5.4h.2c3.1-.1 5.5-2.7 5.4-5.8-.1-3-2.6-5.4-5.6-5.4h-.2c-.2 0-.5 0-.7.1-4.1-6.8-5.8-14.2-5.2-22.2.4-6 2.4-11.2 5.9-15.5 2.9-3.7 8.5-5.5 12.3-5.6 10.6-.2 15.1 13 15.4 18.3 1.3.3 3.5 1 5 1.5-1.2-16.2-11.2-24.6-20.8-24.6-9 0-17.3 6.5-20.6 16.1-4.6 12.8-1.6 25.1 4 34.8-.5.7-.8 1.8-.7 2.9z"/></g></svg>
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
+ <g fill="#764ABC">
+ <path d="M65.6 65.4c2.9-.3 5.1-2.8 5-5.8-.1-3-2.6-5.4-5.6-5.4h-.2c-3.1.1-5.5 2.7-5.4 5.8.1 1.5.7 2.8 1.6 3.7-3.4 6.7-8.6 11.6-16.4 15.7-5.3 2.8-10.8 3.8-16.3 3.1-4.5-.6-8-2.6-10.2-5.9-3.2-4.9-3.5-10.2-.8-15.5 1.9-3.8 4.9-6.6 6.8-8-.4-1.3-1-3.5-1.3-5.1-14.5 10.5-13 24.7-8.6 31.4 3.3 5 10 8.1 17.4 8.1 2 0 4-.2 6-.7 12.8-2.5 22.5-10.1 28-21.4z"/>
+ <path d="M83.2 53c-7.6-8.9-18.8-13.8-31.6-13.8H50c-.9-1.8-2.8-3-4.9-3h-.2c-3.1.1-5.5 2.7-5.4 5.8.1 3 2.6 5.4 5.6 5.4h.2c2.2-.1 4.1-1.5 4.9-3.4H52c7.6 0 14.8 2.2 21.3 6.5 5 3.3 8.6 7.6 10.6 12.8 1.7 4.2 1.6 8.3-.2 11.8-2.8 5.3-7.5 8.2-13.7 8.2-4 0-7.8-1.2-9.8-2.1-1.1 1-3.1 2.6-4.5 3.6 4.3 2 8.7 3.1 12.9 3.1 9.6 0 16.7-5.3 19.4-10.6 2.9-5.8 2.7-15.8-4.8-24.3z"/>
+ <path d="M32.4 67.1c.1 3 2.6 5.4 5.6 5.4h.2c3.1-.1 5.5-2.7 5.4-5.8-.1-3-2.6-5.4-5.6-5.4h-.2c-.2 0-.5 0-.7.1-4.1-6.8-5.8-14.2-5.2-22.2.4-6 2.4-11.2 5.9-15.5 2.9-3.7 8.5-5.5 12.3-5.6 10.6-.2 15.1 13 15.4 18.3 1.3.3 3.5 1 5 1.5-1.2-16.2-11.2-24.6-20.8-24.6-9 0-17.3 6.5-20.6 16.1-4.6 12.8-1.6 25.1 4 34.8-.5.7-.8 1.8-.7 2.9z"/>
+ </g>
+</svg>
diff --git a/experimental/freemocap-ui/src/serviceWorker.ts b/experimental/freemocap-ui/src/serviceWorker.ts
index b72854a3..c440630f 100644
--- a/experimental/freemocap-ui/src/serviceWorker.ts
+++ b/experimental/freemocap-ui/src/serviceWorker.ts
@@ -11,136 +11,136 @@
// opt-in, read https://bit.ly/CRA-PWA
const isLocalhost = Boolean(
- window.location.hostname === 'localhost' ||
+ window.location.hostname === 'localhost' ||
// [::1] is the IPv6 localhost address.
window.location.hostname === '[::1]' ||
// 127.0.0.0/8 are considered localhost for IPv4.
window.location.hostname.match(
- /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
+ /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
)
);
type Config = {
- onSuccess?: (registration: ServiceWorkerRegistration) => void;
- onUpdate?: (registration: ServiceWorkerRegistration) => void;
+ onSuccess?: (registration: ServiceWorkerRegistration) => void;
+ onUpdate?: (registration: ServiceWorkerRegistration) => void;
};
export function register(config?: Config) {
- if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
- // The URL constructor is available in all browsers that support SW.
- const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);
- if (publicUrl.origin !== window.location.origin) {
- // Our service worker won't work if PUBLIC_URL is on a different origin
- // from what our page is served on. This might happen if a CDN is used to
- // serve assets; see https://github.com/facebook/create-react-app/issues/2374
- return;
- }
+ if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
+ // The URL constructor is available in all browsers that support SW.
+ const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);
+ if (publicUrl.origin !== window.location.origin) {
+ // Our service worker won't work if PUBLIC_URL is on a different origin
+ // from what our page is served on. This might happen if a CDN is used to
+ // serve assets; see https://github.com/facebook/create-react-app/issues/2374
+ return;
+ }
- window.addEventListener('load', () => {
- const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
+ window.addEventListener('load', () => {
+ const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
- if (isLocalhost) {
- // This is running on localhost. Let's check if a service worker still exists or not.
- checkValidServiceWorker(swUrl, config);
+ if (isLocalhost) {
+ // This is running on localhost. Let's check if a service worker still exists or not.
+ checkValidServiceWorker(swUrl, config);
- // Add some additional logging to localhost, pointing developers to the
- // service worker/PWA documentation.
- navigator.serviceWorker.ready.then(() => {
- console.log(
- 'This web app is being served cache-first by a service ' +
- 'worker. To learn more, visit https://bit.ly/CRA-PWA'
- );
+ // Add some additional logging to localhost, pointing developers to the
+ // service worker/PWA documentation.
+ navigator.serviceWorker.ready.then(() => {
+ console.log(
+ 'This web app is being served cache-first by a service ' +
+ 'worker. To learn more, visit https://bit.ly/CRA-PWA'
+ );
+ });
+ } else {
+ // Is not localhost. Just register service worker
+ registerValidSW(swUrl, config);
+ }
});
- } else {
- // Is not localhost. Just register service worker
- registerValidSW(swUrl, config);
- }
- });
- }
+ }
}
function registerValidSW(swUrl: string, config?: Config) {
- navigator.serviceWorker
- .register(swUrl)
- .then((registration) => {
- registration.onupdatefound = () => {
- const installingWorker = registration.installing;
- if (installingWorker == null) {
- return;
- }
- installingWorker.onstatechange = () => {
- if (installingWorker.state === 'installed') {
- if (navigator.serviceWorker.controller) {
- // At this point, the updated precached content has been fetched,
- // but the previous service worker will still serve the older
- // content until all client tabs are closed.
- console.log(
- 'New content is available and will be used when all ' +
- 'tabs for this page are closed. See https://bit.ly/CRA-PWA.'
- );
+ navigator.serviceWorker
+ .register(swUrl)
+ .then((registration) => {
+ registration.onupdatefound = () => {
+ const installingWorker = registration.installing;
+ if (installingWorker == null) {
+ return;
+ }
+ installingWorker.onstatechange = () => {
+ if (installingWorker.state === 'installed') {
+ if (navigator.serviceWorker.controller) {
+ // At this point, the updated precached content has been fetched,
+ // but the previous service worker will still serve the older
+ // content until all client tabs are closed.
+ console.log(
+ 'New content is available and will be used when all ' +
+ 'tabs for this page are closed. See https://bit.ly/CRA-PWA.'
+ );
- // Execute callback
- if (config && config.onUpdate) {
- config.onUpdate(registration);
- }
- } else {
- // At this point, everything has been precached.
- // It's the perfect time to display a
- // "Content is cached for offline use." message.
- console.log('Content is cached for offline use.');
+ // Execute callback
+ if (config && config.onUpdate) {
+ config.onUpdate(registration);
+ }
+ } else {
+ // At this point, everything has been precached.
+ // It's the perfect time to display a
+ // "Content is cached for offline use." message.
+ console.log('Content is cached for offline use.');
- // Execute callback
- if (config && config.onSuccess) {
- config.onSuccess(registration);
- }
- }
- }
- };
- };
- })
- .catch((error) => {
- console.error('Error during service worker registration:', error);
- });
+ // Execute callback
+ if (config && config.onSuccess) {
+ config.onSuccess(registration);
+ }
+ }
+ }
+ };
+ };
+ })
+ .catch((error) => {
+ console.error('Error during service worker registration:', error);
+ });
}
function checkValidServiceWorker(swUrl: string, config?: Config) {
- // Check if the service worker can be found. If it can't reload the page.
- fetch(swUrl, {
- headers: { 'Service-Worker': 'script' },
- })
- .then((response) => {
- // Ensure service worker exists, and that we really are getting a JS file.
- const contentType = response.headers.get('content-type');
- if (
- response.status === 404 ||
- (contentType != null && contentType.indexOf('javascript') === -1)
- ) {
- // No service worker found. Probably a different app. Reload the page.
- navigator.serviceWorker.ready.then((registration) => {
- registration.unregister().then(() => {
- window.location.reload();
- });
- });
- } else {
- // Service worker found. Proceed as normal.
- registerValidSW(swUrl, config);
- }
+ // Check if the service worker can be found. If it can't reload the page.
+ fetch(swUrl, {
+ headers: {'Service-Worker': 'script'},
})
- .catch(() => {
- console.log(
- 'No internet connection found. App is running in offline mode.'
- );
- });
+ .then((response) => {
+ // Ensure service worker exists, and that we really are getting a JS file.
+ const contentType = response.headers.get('content-type');
+ if (
+ response.status === 404 ||
+ (contentType != null && contentType.indexOf('javascript') === -1)
+ ) {
+ // No service worker found. Probably a different app. Reload the page.
+ navigator.serviceWorker.ready.then((registration) => {
+ registration.unregister().then(() => {
+ window.location.reload();
+ });
+ });
+ } else {
+ // Service worker found. Proceed as normal.
+ registerValidSW(swUrl, config);
+ }
+ })
+ .catch(() => {
+ console.log(
+ 'No internet connection found. App is running in offline mode.'
+ );
+ });
}
export function unregister() {
- if ('serviceWorker' in navigator) {
- navigator.serviceWorker.ready
- .then((registration) => {
- registration.unregister();
- })
- .catch((error) => {
- console.error(error.message);
- });
- }
+ if ('serviceWorker' in navigator) {
+ navigator.serviceWorker.ready
+ .then((registration) => {
+ registration.unregister();
+ })
+ .catch((error) => {
+ console.error(error.message);
+ });
+ }
}
diff --git a/experimental/freemocap-ui/src/services/Capture.tsx b/experimental/freemocap-ui/src/services/Capture.tsx
index 25332248..c203aba9 100644
--- a/experimental/freemocap-ui/src/services/Capture.tsx
+++ b/experimental/freemocap-ui/src/services/Capture.tsx
@@ -1,24 +1,24 @@
import cv from "@techstark/opencv-js";
export class Capture {
- private FPS = 60;
- private _cap: cv.VideoCapture;
- private _ws: WebSocket;
+ private FPS = 60;
+ private _cap: cv.VideoCapture;
+ private _ws: WebSocket;
- constructor(videoElement: any) {
- const {height, width, current} = videoElement
- console.log(height, width, current)
- this._cap = new cv.VideoCapture(current);
- this._ws = new WebSocket("ws://localhost:8080/ws/hello_world")
- }
+ constructor(videoElement: any) {
+ const {height, width, current} = videoElement
+ console.log(height, width, current)
+ this._cap = new cv.VideoCapture(current);
+ this._ws = new WebSocket("ws://localhost:8080/ws/hello_world")
+ }
- processVideo = () => {
- setInterval(() => {
- const image = new cv.Mat(600, 800, cv.CV_8UC4)
- this._cap.read(image);
- // cv.imshow('canvasOutput', image);
- this._ws.send(image.data)
- image.delete()
- }, 10)
- }
+ processVideo = () => {
+ setInterval(() => {
+ const image = new cv.Mat(600, 800, cv.CV_8UC4)
+ this._cap.read(image);
+ // cv.imshow('canvasOutput', image);
+ this._ws.send(image.data)
+ image.delete()
+ }, 10)
+ }
}
\ No newline at end of file
diff --git a/experimental/freemocap-ui/src/services/Record.ts b/experimental/freemocap-ui/src/services/Record.ts
index 1198214f..ac97eec0 100644
--- a/experimental/freemocap-ui/src/services/Record.ts
+++ b/experimental/freemocap-ui/src/services/Record.ts
@@ -1,19 +1,19 @@
export interface Chunk {
- frameData: Blob,
- timestamp: number,
+ frameData: Blob,
+ timestamp: number,
}
export class Record {
- public static recordStream = (recordedChunks: [Chunk]) => {
- return (e) => {
- if (e.data.size > 0) {
- recordedChunks.push({
- frameData: e.data,
- timestamp: Date.now()
- } as Chunk);
- console.log(recordedChunks)
- }
+ public static recordStream = (recordedChunks: [Chunk]) => {
+ return (e) => {
+ if (e.data.size > 0) {
+ recordedChunks.push({
+ frameData: e.data,
+ timestamp: Date.now()
+ } as Chunk);
+ console.log(recordedChunks)
+ }
+ }
}
- }
}
diff --git a/experimental/freemocap-ui/src/services/cam.ts b/experimental/freemocap-ui/src/services/cam.ts
index 7cbd652e..0253be90 100644
--- a/experimental/freemocap-ui/src/services/cam.ts
+++ b/experimental/freemocap-ui/src/services/cam.ts
@@ -1,6 +1,6 @@
export class BrowserCam {
- public async findAllCameras() {
- const devices = await navigator.mediaDevices.enumerateDevices();
- return devices.filter(({ kind }) => kind === "videoinput");
- }
+ public async findAllCameras() {
+ const devices = await navigator.mediaDevices.enumerateDevices();
+ return devices.filter(({kind}) => kind === "videoinput");
+ }
}
\ No newline at end of file
diff --git a/experimental/freemocap-ui/src/services/download.ts b/experimental/freemocap-ui/src/services/download.ts
index b0a335ea..c4141c32 100644
--- a/experimental/freemocap-ui/src/services/download.ts
+++ b/experimental/freemocap-ui/src/services/download.ts
@@ -1,13 +1,11 @@
-
-
export const download = (inputBlob: Blob, outputFileName) => {
- const url = URL.createObjectURL(inputBlob);
- const a = document.createElement("a");
- document.body.appendChild(a);
- // @ts-ignore
- a.style = "display: none";
- a.href = url;
- a.download = outputFileName;
- a.click();
- window.URL.revokeObjectURL(url);
+ const url = URL.createObjectURL(inputBlob);
+ const a = document.createElement("a");
+ document.body.appendChild(a);
+ // @ts-ignore
+ a.style = "display: none";
+ a.href = url;
+ a.download = outputFileName;
+ a.click();
+ window.URL.revokeObjectURL(url);
}
\ No newline at end of file
diff --git a/experimental/freemocap-ui/src/services/frame-capture.tsx b/experimental/freemocap-ui/src/services/frame-capture.tsx
index 2f45d094..bc2e26e4 100644
--- a/experimental/freemocap-ui/src/services/frame-capture.tsx
+++ b/experimental/freemocap-ui/src/services/frame-capture.tsx
@@ -1,62 +1,62 @@
export type OnMessageHandler = (ev: MessageEvent<Blob>, data_url: string) => Promise<void>;
export enum CaptureType {
- BoardDetection = "board_detection", SkeletonDetection = "skeleton_detection", Preview = "preview"
+ BoardDetection = "board_detection", SkeletonDetection = "skeleton_detection", Preview = "preview"
}
export class FrameCapture {
- private _ws_connection!: WebSocket;
- private readonly _host: string;
- private readonly _base_host: string = "ws://localhost:8080/ws";
- private readonly _revokeQueue: string[] = [];
-
- constructor(
- private readonly _webcamId: string,
- private readonly _captureType: CaptureType = CaptureType.BoardDetection,
- ) {
- this._host = `${this._base_host}/${this._captureType}/${this._webcamId}`
- }
-
- public get isConnectionClosed(): boolean {
- return this._ws_connection.readyState === this._ws_connection.CLOSED;
- }
-
- public start_frame_capture(onMessageHandler: OnMessageHandler) {
- this._ws_connection = new WebSocket(this._host);
-
- this._ws_connection.onopen = async () => {
- this._check_and_revoke();
+ private _ws_connection!: WebSocket;
+ private readonly _host: string;
+ private readonly _base_host: string = "ws://localhost:8080/ws";
+ private readonly _revokeQueue: string[] = [];
+
+ constructor(
+ private readonly _webcamId: string,
+ private readonly _captureType: CaptureType = CaptureType.BoardDetection,
+ ) {
+ this._host = `${this._base_host}/${this._captureType}/${this._webcamId}`
}
- this._ws_connection.onmessage = async (ev: MessageEvent<Blob>) => {
- const new_data_url = URL.createObjectURL(ev.data);
- await onMessageHandler(ev, new_data_url);
- this._revokeQueue.push(new_data_url);
+ public get isConnectionClosed(): boolean {
+ return this._ws_connection.readyState === this._ws_connection.CLOSED;
}
- this._ws_connection.onclose = async () => {
- this._full_revoke();
+ public start_frame_capture(onMessageHandler: OnMessageHandler) {
+ this._ws_connection = new WebSocket(this._host);
+
+ this._ws_connection.onopen = async () => {
+ this._check_and_revoke();
+ }
+
+ this._ws_connection.onmessage = async (ev: MessageEvent<Blob>) => {
+ const new_data_url = URL.createObjectURL(ev.data);
+ await onMessageHandler(ev, new_data_url);
+ this._revokeQueue.push(new_data_url);
+ }
+
+ this._ws_connection.onclose = async () => {
+ this._full_revoke();
+ }
}
- }
-
- public cleanup() {
- this._ws_connection.close();
- }
-
- private _check_and_revoke() {
- if (this._revokeQueue.length > 100) {
- const first50Images = this._revokeQueue.splice(0, 50);
- first50Images.forEach((imgUrl) => {
- URL.revokeObjectURL(imgUrl);
- })
+
+ public cleanup() {
+ this._ws_connection.close();
}
- }
- private _full_revoke() {
- this._revokeQueue.forEach((imgUrl) => {
- URL.revokeObjectURL(imgUrl);
- });
- }
+ private _check_and_revoke() {
+ if (this._revokeQueue.length > 100) {
+ const first50Images = this._revokeQueue.splice(0, 50);
+ first50Images.forEach((imgUrl) => {
+ URL.revokeObjectURL(imgUrl);
+ })
+ }
+ }
+
+ private _full_revoke() {
+ this._revokeQueue.forEach((imgUrl) => {
+ URL.revokeObjectURL(imgUrl);
+ });
+ }
}
diff --git a/experimental/freemocap-ui/src/services/image_send_worker.ts b/experimental/freemocap-ui/src/services/image_send_worker.ts
index d70f20ae..8aec2434 100644
--- a/experimental/freemocap-ui/src/services/image_send_worker.ts
+++ b/experimental/freemocap-ui/src/services/image_send_worker.ts
@@ -1,16 +1,16 @@
const webSocket = new WebSocket("ws://localhost:8080/ws/hello_world")
export const sendImageByRef = (camRef) => {
- const imageSrc = camRef.current.getScreenshot({
- height: 1080,
- width: 1920,
- });
- webSocket.send(imageSrc)
+ const imageSrc = camRef.current.getScreenshot({
+ height: 1080,
+ width: 1920,
+ });
+ webSocket.send(imageSrc)
}
export const sendImageByDevice = async (device: MediaDeviceInfo) => {
- // const stream = await navigator.mediaDevices.getUserMedia({ video: { deviceId: device.deviceId}})
- // if (webSocket.readyState === WebSocket.OPEN) {
- // webSocket.send(frame)
- // }
+ // const stream = await navigator.mediaDevices.getUserMedia({ video: { deviceId: device.deviceId}})
+ // if (webSocket.readyState === WebSocket.OPEN) {
+ // webSocket.send(frame)
+ // }
}
\ No newline at end of file
diff --git a/experimental/freemocap-ui/src/services/recorder.ts b/experimental/freemocap-ui/src/services/recorder.ts
index cd914b05..e0842c9b 100644
--- a/experimental/freemocap-ui/src/services/recorder.ts
+++ b/experimental/freemocap-ui/src/services/recorder.ts
@@ -6,63 +6,63 @@ export type RecorderByDeviceId = Record<DeviceId, MediaRecorder>;
export type StreamDataByDeviceId = Record<DeviceId, Blob[]>;
export class RecorderManager {
- private _recordedData: StreamDataByDeviceId = {};
- private readonly _recorders: RecorderByDeviceId;
- private readonly _deviceIds: Array<DeviceId>;
- private readonly _timesliceInMs: number;
+ private _recordedData: StreamDataByDeviceId = {};
+ private readonly _recorders: RecorderByDeviceId;
+ private readonly _deviceIds: Array<DeviceId>;
+ private readonly _timesliceInMs: number;
- constructor(streams: StreamByDeviceId, timesliceInMS: number = 500) {
- this._timesliceInMs = timesliceInMS;
- this._deviceIds = (Object.keys(streams) as Array<DeviceId>);
- this._recorders = this._deviceIds.reduce((prev, curDeviceId) => {
- return {
- ...prev,
- [curDeviceId]: new MediaRecorder(streams[curDeviceId])
- }
- }, {});
- this._init_recorded_data();
- }
+ constructor(streams: StreamByDeviceId, timesliceInMS: number = 500) {
+ this._timesliceInMs = timesliceInMS;
+ this._deviceIds = (Object.keys(streams) as Array<DeviceId>);
+ this._recorders = this._deviceIds.reduce((prev, curDeviceId) => {
+ return {
+ ...prev,
+ [curDeviceId]: new MediaRecorder(streams[curDeviceId])
+ }
+ }, {});
+ this._init_recorded_data();
+ }
- private _init_recorded_data() {
- const deviceIds = this._deviceIds;
- deviceIds.forEach(deviceId => {
- this._recordedData[deviceId] = [];
- });
- }
+ public registerDataHandler = () => {
+ const deviceIds = this._deviceIds;
+ deviceIds.forEach(deviceId => {
+ const recorder = this._recorders[deviceId];
+ recorder.ondataavailable = (event) => {
+ this._recordedData[deviceId].push(event.data)
+ }
+ })
+ }
- public registerDataHandler = () => {
- const deviceIds = this._deviceIds;
- deviceIds.forEach(deviceId => {
- const recorder = this._recorders[deviceId];
- recorder.ondataavailable = (event) => {
- this._recordedData[deviceId].push(event.data)
- }
- })
- }
+ public start = () => {
+ const deviceIds = this._deviceIds;
+ deviceIds.forEach(deviceId => {
+ const recorder = this._recorders[deviceId];
+ recorder.start(this._timesliceInMs)
+ })
+ }
- public start = () => {
- const deviceIds = this._deviceIds;
- deviceIds.forEach(deviceId => {
- const recorder = this._recorders[deviceId];
- recorder.start(this._timesliceInMs)
- })
- }
+ public stop = () => {
+ const deviceIds = this._deviceIds;
+ deviceIds.forEach(deviceId => {
+ const recorder = this._recorders[deviceId];
+ recorder.stop()
+ });
+ }
- public stop = () => {
- const deviceIds = this._deviceIds;
- deviceIds.forEach(deviceId => {
- const recorder = this._recorders[deviceId];
- recorder.stop()
- });
- }
+ public process = async () => {
+ const deviceIds = this._deviceIds;
+ for (const deviceId of deviceIds) {
+ const blobChunks = this._recordedData[deviceId];
+ const combinedBlob = new Blob(blobChunks, {type: "video/webm"});
+ await axios.post('http://localhost:8080/camera/upload', combinedBlob);
+ }
+ }
- public process = async () => {
- const deviceIds = this._deviceIds;
- for (const deviceId of deviceIds) {
- const blobChunks = this._recordedData[deviceId];
- const combinedBlob = new Blob(blobChunks, {type: "video/webm"});
- await axios.post('http://localhost:8080/camera/upload', combinedBlob);
+ private _init_recorded_data() {
+ const deviceIds = this._deviceIds;
+ deviceIds.forEach(deviceId => {
+ this._recordedData[deviceId] = [];
+ });
}
- }
}
diff --git a/experimental/freemocap-ui/src/services/supported_recorder.ts b/experimental/freemocap-ui/src/services/supported_recorder.ts
index 63cf7203..867fb817 100644
--- a/experimental/freemocap-ui/src/services/supported_recorder.ts
+++ b/experimental/freemocap-ui/src/services/supported_recorder.ts
@@ -1,6 +1,7 @@
export function supported() {
- console.log("Uncomment me to do useful stuff")
+ console.log("Uncomment me to do useful stuff")
}
+
// function getSupportedMimeTypes(media, types, codecs) {
// const isSupported = MediaRecorder.isTypeSupported;
// const supported = [];
diff --git a/experimental/freemocap-ui/src/views/Capture.tsx b/experimental/freemocap-ui/src/views/Capture.tsx
index 5a98ec09..8201dcbc 100644
--- a/experimental/freemocap-ui/src/views/Capture.tsx
+++ b/experimental/freemocap-ui/src/views/Capture.tsx
@@ -7,45 +7,45 @@ import {BrowserCam} from "../services/cam";
import {StreamByDeviceId} from "../services/recorder";
class ViewState {
- public deviceInfos: MediaDeviceInfo[] = [];
- public streams!: StreamByDeviceId;
+ public deviceInfos: MediaDeviceInfo[] = [];
+ public streams!: StreamByDeviceId;
}
export const WebcamStreamCapture = () => {
- const [devices, setDevices] = useState<ViewState>(() => new ViewState());
- // grab all devices
- useAsync(async () => {
- const cam = new BrowserCam();
- const devices = await cam.findAllCameras();
- setDevices(prev => {
- return {
- ...prev,
- deviceInfos: devices
- };
- });
- }, []);
+ const [devices, setDevices] = useState<ViewState>(() => new ViewState());
+ // grab all devices
+ useAsync(async () => {
+ const cam = new BrowserCam();
+ const devices = await cam.findAllCameras();
+ setDevices(prev => {
+ return {
+ ...prev,
+ deviceInfos: devices
+ };
+ });
+ }, []);
- return (
- <Box>
- <Box>
- {devices.deviceInfos.map(dev => {
- return (
- <Webcam audio={false} videoConstraints={{deviceId: dev.deviceId}} onUserMedia={stream => {
- setDevices(prev => {
- return {
- ...prev,
- streams: {
- ...prev.streams,
- [dev.deviceId]: stream
- }
- };
- });
- }} />
- )
- })}
- </Box>
- {devices.streams ? <StartStopProcess streams={devices.streams} /> : <></>}
+ return (
+ <Box>
+ <Box>
+ {devices.deviceInfos.map(dev => {
+ return (
+ <Webcam audio={false} videoConstraints={{deviceId: dev.deviceId}} onUserMedia={stream => {
+ setDevices(prev => {
+ return {
+ ...prev,
+ streams: {
+ ...prev.streams,
+ [dev.deviceId]: stream
+ }
+ };
+ });
+ }}/>
+ )
+ })}
+ </Box>
+ {devices.streams ? <StartStopProcess streams={devices.streams}/> : <></>}
- </Box>
- );
+ </Box>
+ );
};
diff --git a/experimental/freemocap-ui/src/views/Config.tsx b/experimental/freemocap-ui/src/views/Config.tsx
index 503071ec..86638582 100644
--- a/experimental/freemocap-ui/src/views/Config.tsx
+++ b/experimental/freemocap-ui/src/views/Config.tsx
@@ -4,23 +4,23 @@ import {useAsync} from "react-use";
import {BrowserCam} from "../services/cam";
export const ConfigView = () => {
- const [Container] = [Box, Box];
- const [devices, setDevices] = React.useState<MediaDeviceInfo[]>([]);
- useAsync(async () => {
- const cam = new BrowserCam();
- const deviceInfos = await cam.findAllCameras();
- setDevices(deviceInfos)
- });
- const devicesWithNames = devices.filter(x => x.label);
- return (
- <Container>
- <Typography>Configuration</Typography>
- {devicesWithNames
- .map(device => {
- return (
- <Typography>Webcam {device.label}</Typography>
- )
- })}
- </Container>
- )
+ const [Container] = [Box, Box];
+ const [devices, setDevices] = React.useState<MediaDeviceInfo[]>([]);
+ useAsync(async () => {
+ const cam = new BrowserCam();
+ const deviceInfos = await cam.findAllCameras();
+ setDevices(deviceInfos)
+ });
+ const devicesWithNames = devices.filter(x => x.label);
+ return (
+ <Container>
+ <Typography>Configuration</Typography>
+ {devicesWithNames
+ .map(device => {
+ return (
+ <Typography>Webcam {device.label}</Typography>
+ )
+ })}
+ </Container>
+ )
}
\ No newline at end of file
diff --git a/experimental/freemocap-ui/src/views/SessionWorkflow.tsx b/experimental/freemocap-ui/src/views/SessionWorkflow.tsx
index 3425ce9d..87c78c0e 100644
--- a/experimental/freemocap-ui/src/views/SessionWorkflow.tsx
+++ b/experimental/freemocap-ui/src/views/SessionWorkflow.tsx
@@ -6,36 +6,36 @@ import {useNavigate} from "react-router";
import axios from "axios";
interface SessionResponse {
- session_id: string
- session_path: string
+ session_id: string
+ session_path: string
}
export const SessionWorkflow = () => {
- const navigate = useNavigate();
- const [IconButtonContainer] = [Box];
+ const navigate = useNavigate();
+ const [IconButtonContainer] = [Box];
- const createSession = async () => {
- const response = await axios.post('http://localhost:8080/session/create/', {})
- const sessionResponse = response.data as SessionResponse;
- return sessionResponse;
- }
- return (
- <Box>
- <IconButtonContainer
- sx={{
- cursor: 'pointer'
- }}
- display={'flex'} flexDirection={'row'} alignItems={'center'} onClick={async () => {
- const sessionResponse = await createSession();
- const sessionId = sessionResponse.session_id;
- navigate(`/session/setup_and_preview/${sessionId}`)
- }}>
- <IconButton>
- <AddRoundedIcon />
- </IconButton>
- Create New Session
- </IconButtonContainer>
+ const createSession = async () => {
+ const response = await axios.post('http://localhost:8080/session/create/', {})
+ const sessionResponse = response.data as SessionResponse;
+ return sessionResponse;
+ }
+ return (
+ <Box>
+ <IconButtonContainer
+ sx={{
+ cursor: 'pointer'
+ }}
+ display={'flex'} flexDirection={'row'} alignItems={'center'} onClick={async () => {
+ const sessionResponse = await createSession();
+ const sessionId = sessionResponse.session_id;
+ navigate(`/session/setup_and_preview/${sessionId}`)
+ }}>
+ <IconButton>
+ <AddRoundedIcon/>
+ </IconButton>
+ Create New Session
+ </IconButtonContainer>
- </Box>
- )
+ </Box>
+ )
}
\ No newline at end of file
diff --git a/experimental/freemocap-ui/src/views/ShowCameras.tsx b/experimental/freemocap-ui/src/views/ShowCameras.tsx
index 96cf1841..cde1520c 100644
--- a/experimental/freemocap-ui/src/views/ShowCameras.tsx
+++ b/experimental/freemocap-ui/src/views/ShowCameras.tsx
@@ -1,9 +1,9 @@
import {Box} from "@mui/material";
export const ShowCameras = () => {
- return (
- <Box>
+ return (
+ <Box>
- </Box>
- )
+ </Box>
+ )
}
\ No newline at end of file
diff --git a/experimental/freemocap-ui/src/views/UserConfig.tsx b/experimental/freemocap-ui/src/views/UserConfig.tsx
index 3cefead9..276dd9c8 100644
--- a/experimental/freemocap-ui/src/views/UserConfig.tsx
+++ b/experimental/freemocap-ui/src/views/UserConfig.tsx
@@ -1,10 +1,9 @@
-
interface Props {
- recordingSessionLocation: string;
+ recordingSessionLocation: string;
}
export const UserConfig = (
- props: Props
+ props: Props
) => {
- return null;
+ return null;
}
\ No newline at end of file
diff --git a/experimental/freemocap-ui/src/views/prod/ConfigForm.tsx b/experimental/freemocap-ui/src/views/prod/ConfigForm.tsx
index 1376077a..fa528bcb 100644
--- a/experimental/freemocap-ui/src/views/prod/ConfigForm.tsx
+++ b/experimental/freemocap-ui/src/views/prod/ConfigForm.tsx
@@ -3,40 +3,40 @@ import {Box} from "@mui/system";
import {default as NumberFormat} from 'react-number-format';
const ExposureNumberField = () => {
- // TODO: -13 -> -1 (inclusive)
- return (
- <NumberFormat customInput={TextField} />
- );
+ // TODO: -13 -> -1 (inclusive)
+ return (
+ <NumberFormat customInput={TextField}/>
+ );
}
interface Props {
- onSubmit: () => void
+ onSubmit: () => void
}
export const ConfigForm = (props: Props) => {
- const { onSubmit } = props;
- return (
- <Box>
-
- <Box>
- <Typography>Exposure</Typography>
- <ExposureNumberField />
- </Box>
-
- <Box>
- <Typography>Resolution Width</Typography>
- <NumberFormat customInput={TextField} />
-
- <Typography>Resolution Height</Typography>
- <NumberFormat customInput={TextField} />
- </Box>
-
- <Box>
- <Typography>Image Rotation Degree</Typography>
- <NumberFormat customInput={TextField} />
- </Box>
-
- <Button onClick={onSubmit}>Save Camera Settings</Button>
- </Box>
- )
+ const {onSubmit} = props;
+ return (
+ <Box>
+
+ <Box>
+ <Typography>Exposure</Typography>
+ <ExposureNumberField/>
+ </Box>
+
+ <Box>
+ <Typography>Resolution Width</Typography>
+ <NumberFormat customInput={TextField}/>
+
+ <Typography>Resolution Height</Typography>
+ <NumberFormat customInput={TextField}/>
+ </Box>
+
+ <Box>
+ <Typography>Image Rotation Degree</Typography>
+ <NumberFormat customInput={TextField}/>
+ </Box>
+
+ <Button onClick={onSubmit}>Save Camera Settings</Button>
+ </Box>
+ )
}
\ No newline at end of file
diff --git a/experimental/freemocap-ui/src/views/prod/SetupAndPreviewCamera.tsx b/experimental/freemocap-ui/src/views/prod/SetupAndPreviewCamera.tsx
index a59c82e8..f7b96cf0 100644
--- a/experimental/freemocap-ui/src/views/prod/SetupAndPreviewCamera.tsx
+++ b/experimental/freemocap-ui/src/views/prod/SetupAndPreviewCamera.tsx
@@ -5,24 +5,24 @@ import React from "react";
import {ConfigForm} from "./ConfigForm";
interface Props {
- webcamId: string;
- onSubmit: () => void;
+ webcamId: string;
+ onSubmit: () => void;
}
export const SetupAndPreviewCamera = (props: Props) => {
- const { webcamId, onSubmit } = props;
- const [frameCapture, data] = useFrameCapture(webcamId, CaptureType.Preview);
- if (!data) {
- return null;
- }
+ const {webcamId, onSubmit} = props;
+ const [frameCapture, data] = useFrameCapture(webcamId, CaptureType.Preview);
+ if (!data) {
+ return null;
+ }
- return (
- <Box>
- <Box display={'flex'} flexDirection={'column'} width={400}>
- <Button>Preview in CV2</Button>
- {!frameCapture.isConnectionClosed && <img src={data} alt={"video start"} />}
- </Box>
- <ConfigForm onSubmit={onSubmit}/>
- </Box>
- )
+ return (
+ <Box>
+ <Box display={'flex'} flexDirection={'column'} width={400}>
+ <Button>Preview in CV2</Button>
+ {!frameCapture.isConnectionClosed && <img src={data} alt={"video start"}/>}
+ </Box>
+ <ConfigForm onSubmit={onSubmit}/>
+ </Box>
+ )
}
\ No newline at end of file
diff --git a/experimental/freemocap-ui/src/views/prod/SetupAndPreviewView.tsx b/experimental/freemocap-ui/src/views/prod/SetupAndPreviewView.tsx
index 0b3c26bf..8bbcd9df 100644
--- a/experimental/freemocap-ui/src/views/prod/SetupAndPreviewView.tsx
+++ b/experimental/freemocap-ui/src/views/prod/SetupAndPreviewView.tsx
@@ -5,27 +5,27 @@ import axios from "axios";
import {WebcamCapture} from "../../components/webcam/webcam-capture";
export const usePythonCameraDetection = () => {
- const [webcamIds, setWebcamIds] = useState();
- const response = useAsync(async () => {
- const response = await axios.get('http://localhost:8080/camera/detect');
- const webcamIds = response.data.cameras_found_list.map(x => x.webcam_id);
- setWebcamIds(webcamIds)
- }, [])
- return [webcamIds, response];
+ const [webcamIds, setWebcamIds] = useState();
+ const response = useAsync(async () => {
+ const response = await axios.get('http://localhost:8080/camera/detect');
+ const webcamIds = response.data.cameras_found_list.map(x => x.webcam_id);
+ setWebcamIds(webcamIds)
+ }, [])
+ return [webcamIds, response];
}
export const SetupAndPreviewView = () => {
- const [devices, setDevices] = useState<MediaDeviceInfo[]>();
- useAsync(async () => {
- const devices = await navigator.mediaDevices.enumerateDevices()
- const videoDevices = devices.filter(({ kind }) => kind.toLowerCase() === "videoinput")
- setDevices(videoDevices)
- }, [])
- return (
- <Box>
- {devices?.map(dev => {
- return <WebcamCapture device={dev} />
- })}
- </Box>
- )
+ const [devices, setDevices] = useState<MediaDeviceInfo[]>();
+ useAsync(async () => {
+ const devices = await navigator.mediaDevices.enumerateDevices()
+ const videoDevices = devices.filter(({kind}) => kind.toLowerCase() === "videoinput")
+ setDevices(videoDevices)
+ }, [])
+ return (
+ <Box>
+ {devices?.map(dev => {
+ return <WebcamCapture device={dev}/>
+ })}
+ </Box>
+ )
}
\ No newline at end of file
diff --git a/experimental/freemocap-ui/src/views/sessionWizard/SessionWizard.tsx b/experimental/freemocap-ui/src/views/sessionWizard/SessionWizard.tsx
index da902e6e..d94e9bff 100644
--- a/experimental/freemocap-ui/src/views/sessionWizard/SessionWizard.tsx
+++ b/experimental/freemocap-ui/src/views/sessionWizard/SessionWizard.tsx
@@ -7,58 +7,58 @@ import {useAsync} from "react-use";
import {useParams} from "react-router";
interface Props {
- webcamIds: string[];
+ webcamIds: string[];
}
export const SessionWizard = (props: Props) => {
- // generate steps within the step wizard
- const {webcamIds} = props
- const { sessionId } = useParams();
- return (
- <Wizard>
- {webcamIds.map(webcamId => {
- return <CamStep webcamId={webcamId} />
- })}
- <IMShowPreviewCamera sessionId={sessionId}/>
- </Wizard>
- )
+ // generate steps within the step wizard
+ const {webcamIds} = props
+ const {sessionId} = useParams();
+ return (
+ <Wizard>
+ {webcamIds.map(webcamId => {
+ return <CamStep webcamId={webcamId}/>
+ })}
+ <IMShowPreviewCamera sessionId={sessionId}/>
+ </Wizard>
+ )
}
interface CamStepProps {
- webcamId: string
+ webcamId: string
}
export const CamStep = (props: CamStepProps) => {
- const {webcamId} = props
- const {handleStep, previousStep, nextStep, stepCount, isLastStep} = useWizard();
+ const {webcamId} = props
+ const {handleStep, previousStep, nextStep, stepCount, isLastStep} = useWizard();
- return (
- <Box>
- <Typography>Step {stepCount}</Typography>
- <Typography>Camera {webcamId}</Typography>
- <SetupAndPreviewCamera webcamId={webcamId} onSubmit={nextStep} />
- </Box>
- )
+ return (
+ <Box>
+ <Typography>Step {stepCount}</Typography>
+ <Typography>Camera {webcamId}</Typography>
+ <SetupAndPreviewCamera webcamId={webcamId} onSubmit={nextStep}/>
+ </Box>
+ )
}
interface PreviewCameraProps {
- sessionId: string | undefined
+ sessionId: string | undefined
}
export const IMShowPreviewCamera = (props: PreviewCameraProps) => {
- const {handleStep, previousStep, nextStep, stepCount, isLastStep} = useWizard();
- useAsync(async () => {
- await axios.post('http://localhost:8080/camera/show_cameras', {
- session_id: props.sessionId
- });
- }, []);
- return (
- <Box>
- <Typography>External Windows should pop up showing the images from your webcams all together.</Typography>
- <Typography>If you are ready to record, and the configuration seems correct, please continue.</Typography>
- <Typography>If not, please go to the previous steps and change the configuration</Typography>
- <Button onClick={previousStep}>No, I want to go back</Button>
- <Button onClick={nextStep}>Yes, Im ready to calibrate</Button>
- </Box>
- )
+ const {handleStep, previousStep, nextStep, stepCount, isLastStep} = useWizard();
+ useAsync(async () => {
+ await axios.post('http://localhost:8080/camera/show_cameras', {
+ session_id: props.sessionId
+ });
+ }, []);
+ return (
+ <Box>
+ <Typography>External Windows should pop up showing the images from your webcams all together.</Typography>
+ <Typography>If you are ready to record, and the configuration seems correct, please continue.</Typography>
+ <Typography>If not, please go to the previous steps and change the configuration</Typography>
+ <Button onClick={previousStep}>No, I want to go back</Button>
+ <Button onClick={nextStep}>Yes, Im ready to calibrate</Button>
+ </Box>
+ )
}
diff --git a/experimental/python_scratch/qt_drag_and_drop.py b/experimental/python_scratch/qt_drag_and_drop.py
index 73a8c51a..dd1ef92d 100644
--- a/experimental/python_scratch/qt_drag_and_drop.py
+++ b/experimental/python_scratch/qt_drag_and_drop.py
@@ -2,7 +2,7 @@
import sys
-from PyQt6.QtWidgets import QMainWindow, QApplication
+from PySide6.QtWidgets import QMainWindow, QApplication
class MainWidget(QMainWindow):
diff --git a/experimental/react_fastapi/api/__init__.py b/experimental/react_fastapi/api/__init__.py
new file mode 100644
index 00000000..139597f9
--- /dev/null
+++ b/experimental/react_fastapi/api/__init__.py
@@ -0,0 +1,2 @@
+
+
diff --git a/experimental/react_fastapi/api/app_factory.py b/experimental/react_fastapi/api/app_factory.py
new file mode 100644
index 00000000..b3fa9d55
--- /dev/null
+++ b/experimental/react_fastapi/api/app_factory.py
@@ -0,0 +1,21 @@
+import uvicorn
+from fastapi import FastAPI
+
+from src.api.middleware.cors import cors
+from src.api.routes import enabled_routers
+
+
+def create_app(*args, **kwargs):
+ _app = FastAPI()
+
+ cors(_app)
+
+ for router in enabled_routers:
+ _app.include_router(router)
+
+ return _app
+
+
+if __name__ == "__main__":
+ script_app = create_app()
+ uvicorn.run(script_app, host="127.0.0.1", port=8080, log_level="info")
diff --git a/experimental/react_fastapi/api/globals.py b/experimental/react_fastapi/api/globals.py
new file mode 100644
index 00000000..ba061d96
--- /dev/null
+++ b/experimental/react_fastapi/api/globals.py
@@ -0,0 +1 @@
+# TODO: The globals that are saved here will be replaced by different solutions upcoming
diff --git a/experimental/react_fastapi/api/middleware/cors.py b/experimental/react_fastapi/api/middleware/cors.py
new file mode 100644
index 00000000..a19890ab
--- /dev/null
+++ b/experimental/react_fastapi/api/middleware/cors.py
@@ -0,0 +1,11 @@
+from fastapi.middleware.cors import CORSMiddleware
+
+
+def cors(app):
+ app.add_middleware(
+ CORSMiddleware,
+ allow_origins=["*"],
+ allow_credentials=True,
+ allow_methods=["*"],
+ allow_headers=["*"],
+ )
diff --git a/experimental/react_fastapi/api/models/__init__.py b/experimental/react_fastapi/api/models/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/experimental/react_fastapi/api/routes/__init__.py b/experimental/react_fastapi/api/routes/__init__.py
new file mode 100644
index 00000000..299ceb02
--- /dev/null
+++ b/experimental/react_fastapi/api/routes/__init__.py
@@ -0,0 +1,16 @@
+from src.api.routes.camera.cam_data_ws import cam_ws_router
+from src.api.routes.camera.camera_route import camera_router
+from src.api.routes.health.health_check_route import healthcheck_router
+from src.api.routes.home.home import home_router
+from src.api.routes.session.session_router import session_router
+from src.api.routes.startup.startup import startup_router
+
+# REGISTER NEW ROUTES HERE
+enabled_routers = [
+ healthcheck_router,
+ camera_router,
+ cam_ws_router,
+ startup_router,
+ home_router,
+ session_router,
+]
diff --git a/experimental/react_fastapi/api/routes/camera/__init__.py b/experimental/react_fastapi/api/routes/camera/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/experimental/react_fastapi/api/routes/camera/cam_data_ws.py b/experimental/react_fastapi/api/routes/camera/cam_data_ws.py
new file mode 100644
index 00000000..2860f516
--- /dev/null
+++ b/experimental/react_fastapi/api/routes/camera/cam_data_ws.py
@@ -0,0 +1,33 @@
+import logging
+import time
+
+import cv2
+import numpy as np
+from fastapi import APIRouter, WebSocket
+from src.cameras.capture.dataclasses.frame_payload import FramePayload
+
+logger = logging.getLogger(__name__)
+
+cam_ws_router = APIRouter()
+
+
+async def websocket_send(web_socket: WebSocket, input_payload: FramePayload):
+ if not input_payload.success:
+ return
+ success, frame = cv2.imencode(".png", input_payload.image)
+ if not success:
+ return
+ await web_socket.send_bytes(frame.tobytes())
+
+
+@cam_ws_router.websocket("/ws/hello_world")
+async def preview_webcam(web_socket: WebSocket):
+ await web_socket.accept()
+ while True:
+ last_read = time.perf_counter()
+ byte_data = await web_socket.receive_bytes()
+ time_since = time.perf_counter()
+ print(f"Per Frame Time: {time_since - last_read:.4f}")
+ buffer = np.frombuffer(byte_data, dtype="uint8").reshape((600, 800, 4))
+ buffer = cv2.cvtColor(buffer, cv2.COLOR_BGR2RGB)
+ print(f"image shape: {buffer.shape}")
diff --git a/experimental/react_fastapi/api/routes/camera/camera_route.py b/experimental/react_fastapi/api/routes/camera/camera_route.py
new file mode 100644
index 00000000..f1728bf3
--- /dev/null
+++ b/experimental/react_fastapi/api/routes/camera/camera_route.py
@@ -0,0 +1,81 @@
+import logging
+
+import cv2
+from fastapi import APIRouter
+from pydantic import BaseModel
+from src.api.services.user_config import UserConfigService, WebcamConfigModel
+from src.cameras.detection.cam_singleton import get_or_create_cams
+from src.cameras.multicam_manager.cv_camera_manager import OpenCVCameraManager
+
+camera_router = APIRouter()
+
+logger = logging.getLogger(__name__)
+
+
+class CameraPreviewModel(BaseModel):
+ session_id: str = None
+
+
+@camera_router.post("/camera/config/{session_id}")
+async def config_cam(webcam_config_model: WebcamConfigModel, session_id):
+ s = UserConfigService()
+ return s.save_webcam_config_to_disk(webcam_config_model, session_id)
+
+
+@camera_router.post("/camera/show_camera/{webcam_id}")
+async def show_camera(
+ webcam_id: str, camera_preview_model: CameraPreviewModel = CameraPreviewModel()
+):
+ cv_cam_manager = OpenCVCameraManager(session_id=camera_preview_model.session_id)
+ with cv_cam_manager.start_capture_session_single_cam(
+ webcam_id
+ ) as connected_camera_and_writer:
+ should_continue = True
+ this_camera = connected_camera_and_writer.cv_camera
+ cv2_window_name = "(ESC to close) PREVIEWING camera_" + webcam_id
+ while should_continue:
+ if not this_camera.new_frame_ready:
+ continue
+ cv2.imshow(cv2_window_name, this_camera.latest_frame.image)
+ # exit loop when user presses ESC key
+ exit_key = cv2.waitKey(1)
+ if exit_key == 27:
+ logger.info("ESC has been pressed.")
+ should_continue = False
+ cv2.destroyWindow(cv2_window_name)
+
+
+@camera_router.post("/camera/show_cameras")
+async def cv2_imshow_all_camera(
+ camera_preview_model: CameraPreviewModel = CameraPreviewModel(),
+):
+ cv_cam_manager = OpenCVCameraManager(session_id=camera_preview_model.session_id)
+ with cv_cam_manager.start_capture_session_all_cams() as connected_cameras_dict:
+ logger.info(f"Available cameras: {connected_cameras_dict}")
+ should_continue = True
+ while should_continue:
+ for this_webcam_id, this_open_cv_camera in connected_cameras_dict.items():
+ exit_key = cv2.waitKey(1)
+ if exit_key == 27:
+ logger.info("ESC has been pressed.")
+ should_continue = False
+ cv2.destroyWindow(cv2_window_name)
+ if not this_open_cv_camera.new_frame_ready:
+ continue
+ cv2_window_name = "(ESC to close) PREVIEWING camera_" + this_webcam_id
+ cv2.imshow(cv2_window_name, this_open_cv_camera.latest_frame.image)
+ exit_key = cv2.waitKey(1)
+ if exit_key == 27:
+ logger.info("ESC has been pressed.")
+ should_continue = False
+ cv2.destroyWindow(cv2_window_name)
+
+
+@camera_router.get("/camera/detect")
+async def get_cameras():
+ return get_or_create_cams()
+
+
+@camera_router.get("/camera/redetect")
+async def redetect_cameras():
+ return get_or_create_cams(always_create=True)
diff --git a/experimental/react_fastapi/api/routes/health/__init__.py b/experimental/react_fastapi/api/routes/health/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/experimental/react_fastapi/api/routes/health/health_check_route.py b/experimental/react_fastapi/api/routes/health/health_check_route.py
new file mode 100644
index 00000000..d4477efd
--- /dev/null
+++ b/experimental/react_fastapi/api/routes/health/health_check_route.py
@@ -0,0 +1,16 @@
+from fastapi import APIRouter
+from pydantic import BaseModel
+
+healthcheck_router = APIRouter()
+
+
+class HealthCheckResponse(BaseModel):
+ message: str = "OK"
+
+
+@healthcheck_router.get("/health")
+def route():
+ try:
+ return HealthCheckResponse()
+ except:
+ raise ValueError("Unhealthy")
diff --git a/experimental/react_fastapi/api/routes/home/home.py b/experimental/react_fastapi/api/routes/home/home.py
new file mode 100644
index 00000000..090c895f
--- /dev/null
+++ b/experimental/react_fastapi/api/routes/home/home.py
@@ -0,0 +1,10 @@
+from fastapi import APIRouter
+
+home_router = APIRouter()
+
+
+@home_router.get("/")
+async def hello():
+ response_string = "hello :D"
+ print(f"response string: {response_string}")
+ return response_string
diff --git a/experimental/react_fastapi/api/routes/session/session_router.py b/experimental/react_fastapi/api/routes/session/session_router.py
new file mode 100644
index 00000000..fa70caaa
--- /dev/null
+++ b/experimental/react_fastapi/api/routes/session/session_router.py
@@ -0,0 +1,211 @@
+import logging
+import traceback
+from typing import Optional, Union
+
+from fastapi import APIRouter
+from jon_scratch.pupil_calibration_pipeline.qt_gl_laser_skeleton_visualizer import (
+ QtGlLaserSkeletonVisualizer,
+)
+from pydantic import BaseModel
+from src.cameras.launch_camera_frame_loop import launch_camera_frame_loop
+from src.cameras.multicam_manager.cv_camera_manager import OpenCVCameraManager
+from src.config.home_dir import (
+ create_session_id,
+ get_session_folder_path,
+ get_most_recent_session_id,
+ create_session_folder,
+)
+from src.core_processor.mediapipe_skeleton_detector.mediapipe_skeleton_detector import (
+ MediaPipeSkeletonDetector,
+)
+from src.pipelines.calibration_pipeline.calibration_pipeline_orchestrator import (
+ CalibrationPipelineOrchestrator,
+)
+from src.pipelines.session_pipeline.session_pipeline_orchestrator import (
+ SessionPipelineOrchestrator,
+ load_mediapipe3d_skeleton_data,
+ load_mediapipe2d_data,
+)
+
+logger = logging.getLogger(__name__)
+
+session_router = APIRouter()
+
+
+class TweakedPydanticBaseModel(BaseModel):
+ class Config:
+ arbitrary_types_allowed = True
+
+
+class SessionCreateModel(BaseModel):
+ user_session_tag_str: Optional[str]
+
+
+class SessionResponse(BaseModel):
+ session_id: str
+ session_path: str
+
+
+class SessionCalibrateModel(TweakedPydanticBaseModel):
+ """
+ session_id: str, ID for the session we're calibrating
+ charuco_square_size:Union[int, float], the size of one of the black squares on the charuco board (preferably) in milimeters
+ """
+
+ session_id: str = None
+ webcam_configs_dict: dict = None
+ opencv_camera_manager: OpenCVCameraManager = None
+ charuco_square_size: Union[int, float] = 39
+
+
+class SessionRecordModel(TweakedPydanticBaseModel):
+ session_id: str = None
+ webcam_configs_dict: dict = None
+
+
+class SessionIdModel(BaseModel):
+ """ """
+
+ session_id: str = None
+
+
+@session_router.post("/session/create")
+async def create_session(
+ session_create_model: SessionCreateModel = SessionCreateModel(),
+) -> SessionResponse:
+ session_id = create_session_id()
+ if session_create_model.user_session_tag_str is not None:
+ session_id = session_id + session_create_model.user_session_tag_str
+
+ create_session_folder(session_id)
+
+ return SessionResponse(
+ session_id=session_id, session_path=get_session_folder_path(session_id)
+ )
+
+
+@session_router.post("/session/calibrate")
+def calibrate_session(
+ session_calibrate_model: SessionCalibrateModel = SessionCalibrateModel(),
+):
+ """calibate capture volume - record synchronized videos (from all available camras wtih default parameters for now) and process with Anipose to produce a camera calibration (saved as a `.toml` file in the session folder"""
+
+ session_id = session_calibrate_model.session_id
+ if session_id is None or session_id == "string":
+ session_id = get_most_recent_session_id()
+
+ calibration_orchestrator = CalibrationPipelineOrchestrator(session_id)
+
+ # calibration_orchestrator.record_videos(show_visualizer_gui=False,
+ # save_video_in_frame_loop=False,
+ # show_camera_views_in_windows=True,
+ # )
+
+ launch_camera_frame_loop(
+ session_id=session_id,
+ webcam_configs_dict=session_calibrate_model.webcam_configs_dict,
+ show_camera_views_in_windows=True,
+ calibration_videos_bool=True,
+ detect_charuco_in_image=True,
+ )
+
+ try:
+ calibration_orchestrator.run_anipose_camera_calibration(
+ charuco_square_size=session_calibrate_model.charuco_square_size,
+ pin_camera_0_to_origin=True,
+ )
+ except:
+ logger.error("Printing Traceback")
+ traceback.print_exc()
+
+ return calibration_orchestrator
+
+
+@session_router.post("/session/record")
+def record_session(session_record_model: SessionRecordModel = SessionRecordModel()):
+ launch_camera_frame_loop(
+ session_id=session_record_model.session_id,
+ webcam_configs_dict=session_record_model.webcam_configs_dict,
+ show_camera_views_in_windows=True,
+ calibration_videos_bool=False,
+ detect_charuco_in_image=True,
+ )
+
+
+@session_router.post("/session/mediapipe_track_skeletons_offline")
+def mediapipe_track_2D_skeletons_offline(
+ session_id_model: SessionIdModel = SessionIdModel(),
+):
+ if session_id_model.session_id is None or session_id_model.session_id == "string":
+ this_session_id = get_most_recent_session_id()
+ logger.info(f"loading most recent session:{this_session_id}")
+ else:
+ this_session_id = session_id_model.session_id
+
+ logger.info(
+ f"tracking 2D mediapipe skeletons in videos from session: {this_session_id}"
+ )
+ mediapipe_skeleton_detector = MediaPipeSkeletonDetector(this_session_id)
+ mediapipe_skeleton_detector.process_session_folder()
+
+
+@session_router.post("/session/reconstruct_mediapipe3d_offline")
+def mediapipe_reconstruct_3D_skeletons_offline(session_id_model: SessionIdModel = None):
+ if session_id_model is None or session_id_model.session_id == "string":
+ session_id = get_most_recent_session_id()
+ else:
+ session_id = session_id_model.session_id
+
+ this_session_orchestrator = SessionPipelineOrchestrator(session_id=session_id)
+ this_session_orchestrator.anipose_camera_calibration_object = (
+ CalibrationPipelineOrchestrator().load_calibration_from_session_id(session_id)
+ )
+ this_session_orchestrator.mediapipe2d_numCams_numFrames_numTrackedPoints_XY = (
+ load_mediapipe2d_data(session_id)
+ )
+ this_session_orchestrator.reconstruct3d_from_2d_data_offline()
+
+
+@session_router.post("/session/visualize_offline")
+def visualize_session_offline(session_id_model: SessionIdModel = None):
+ if session_id_model is None or session_id_model.session_id == "string":
+ session_id = get_most_recent_session_id()
+ else:
+ session_id = session_id_model.session_id
+
+ mediapipe3d_data_payload = load_mediapipe3d_skeleton_data(session_id)
+
+ mediapipe3d_skeleton_nFrames_nTrajectories_xyz = (
+ mediapipe3d_data_payload.data3d_numFrames_numTrackedPoints_XYZ
+ )
+ mediapipe3d_skeleton_nFrames_nTrajectories_reprojectionError = (
+ mediapipe3d_data_payload.data3d_numFrames_numTrackedPoint_reprojectionError
+ )
+
+ qt_gl_laser_skeleton = QtGlLaserSkeletonVisualizer(
+ mediapipe_skel_fr_mar_xyz=mediapipe3d_skeleton_nFrames_nTrajectories_xyz
+ )
+ qt_gl_laser_skeleton.start_animation()
+
+
+if __name__ == "__main__":
+ # # create_session
+ # session_id_in = create_session_id('session_router_as_main')
+ # session_id_model = SessionIdModel(session_id=session_id_in)
+ #
+ # # # #calibrate_session
+ # session_calibrate_model_in = SessionCalibrateModel(session_id=session_id_in,
+ # charuco_square_size=39)
+ # calibrate_session(session_calibrate_model_in)
+ #
+ # # # record new session
+ # session_record_model_in = SessionRecordModel(session_id=session_id_in,)
+ # record_session(session_record_model_in)
+ #
+ # # #process_
+ # mediapipe_track_2D_skeletons_offline()
+ #
+ # mediapipe_reconstruct_3D_skeletons_offline()
+
+ # #visualize with PyQt/OpenGL
+ visualize_session_offline()
diff --git a/experimental/react_fastapi/api/routes/startup/startup.py b/experimental/react_fastapi/api/routes/startup/startup.py
new file mode 100644
index 00000000..d259fec3
--- /dev/null
+++ b/experimental/react_fastapi/api/routes/startup/startup.py
@@ -0,0 +1,10 @@
+from fastapi import APIRouter
+
+from src.config.data_paths import create_home_data_directory
+
+startup_router = APIRouter()
+
+
+@startup_router.on_event("startup")
+async def handle_startup():
+ create_home_data_directory()
diff --git a/experimental/react_fastapi/api/services/__init__.py b/experimental/react_fastapi/api/services/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/experimental/react_fastapi/api/services/board_detect_service.py b/experimental/react_fastapi/api/services/board_detect_service.py
new file mode 100644
index 00000000..4077396d
--- /dev/null
+++ b/experimental/react_fastapi/api/services/board_detect_service.py
@@ -0,0 +1,10 @@
+from typing import NamedTuple
+
+
+class ImageResponse(NamedTuple):
+ image: bytes
+ webcam_id: str
+
+
+class BoardDetectService:
+ pass
diff --git a/experimental/react_fastapi/api/services/mediapipe_detect_service.py b/experimental/react_fastapi/api/services/mediapipe_detect_service.py
new file mode 100644
index 00000000..c6ad76bd
--- /dev/null
+++ b/experimental/react_fastapi/api/services/mediapipe_detect_service.py
@@ -0,0 +1,2 @@
+class MediapipeSkeletonDetectionService:
+ pass
diff --git a/experimental/react_fastapi/api/services/user_config.py b/experimental/react_fastapi/api/services/user_config.py
new file mode 100644
index 00000000..64e48e7e
--- /dev/null
+++ b/experimental/react_fastapi/api/services/user_config.py
@@ -0,0 +1,54 @@
+import logging
+from pathlib import Path
+
+from pydantic import BaseModel
+from src.config.home_dir import get_session_folder_path
+
+logger = logging.getLogger(__name__)
+
+
+class WebcamConfigModel(BaseModel):
+ webcam_id: str
+ exposure: int = -6
+ resolution_width: int = 1280
+ resolution_height: int = 720
+
+
+def get_camera_name(camera_id: str):
+ return "camera_" + camera_id
+
+
+class UserConfigService:
+ """take things like WebcamConfigModel and save it to a text file or whatever"""
+
+ def save_webcam_config_to_disk(
+ self, webcam_config_model: WebcamConfigModel, session_id: str
+ ):
+ webcam_config_json = webcam_config_model.json()
+ camera_name = get_camera_name(webcam_config_model.webcam_id)
+ json_file_name = camera_name + "_config.json"
+ session_path = get_session_folder_path(session_id)
+ webcam_config_json_path = Path(session_path) / json_file_name
+ with open(webcam_config_json_path, "w") as outfile:
+ outfile.write(str(webcam_config_json))
+ return webcam_config_json
+
+ def webcam_config_by_id(self, webcam_id: str, session_id: str) -> WebcamConfigModel:
+ if session_id is None:
+ return WebcamConfigModel(webcam_id=webcam_id)
+ session_path = get_session_folder_path(session_id)
+ camera_name = get_camera_name(webcam_id)
+ print(f"webcam id (again): {webcam_id}")
+ print(f"camera name: {camera_name}")
+ json_file_name = camera_name + "_config.json"
+ webcam_config_json_path = Path(session_path) / json_file_name
+
+ try:
+ webcam_config_model = WebcamConfigModel.parse_file(webcam_config_json_path)
+ logger.info(f"loading webcam_config from: {webcam_config_json_path}")
+ return webcam_config_model
+ except FileNotFoundError:
+ logger.info(
+ f"No webcam config file found for this camera, using default camera parameters"
+ )
+ return WebcamConfigModel(webcam_id=webcam_id)
diff --git a/experimental/tool_bar.py b/experimental/tool_bar.py
index fbca8f58..a8b5c3d3 100644
--- a/experimental/tool_bar.py
+++ b/experimental/tool_bar.py
@@ -1,5 +1,5 @@
-from PyQt6.QtCore import Qt
-from PyQt6.QtWidgets import QToolBar, QWidget
+from PySide6.QtCore import Qt
+from PySide6.QtWidgets import QToolBar, QWidget
from freemocap.gui.qt.widgets.control_panel.calibration_control_panel import CalibrationControlPanel
from freemocap.gui.qt.widgets.control_panel.process_mocap_data_panel.process_motion_capture_data_panel import (
@@ -9,12 +9,12 @@ from freemocap.gui.qt.widgets.control_panel.process_mocap_data_panel.process_mot
class ToolBar(QToolBar):
def __init__(
- self,
- calibration_control_panel: CalibrationControlPanel,
- process_motion_capture_data_panel: ProcessMotionCaptureDataPanel,
- visualize_data_widget: QWidget,
- directory_view_widget: QWidget,
- parent=None,
+ self,
+ calibration_control_panel: CalibrationControlPanel,
+ process_motion_capture_data_panel: ProcessMotionCaptureDataPanel,
+ visualize_data_widget: QWidget,
+ directory_view_widget: QWidget,
+ parent=None,
):
super().__init__(parent=parent)
diff --git a/freemocap/__init__.py b/freemocap/__init__.py
index 746ab3fd..35706938 100644
--- a/freemocap/__init__.py
+++ b/freemocap/__init__.py
@@ -9,7 +9,6 @@ __package_name__ = "freemocap"
__repo_url__ = f"https://github.com/freemocap/{__package_name__}/"
__repo_issues_url__ = f"{__repo_url__}issues"
-
from freemocap.system.logging.configure_logging import configure_logging, LogLevel
configure_logging(LogLevel.TRACE)
diff --git a/freemocap/__main__.py b/freemocap/__main__.py
index f20ed8c2..b2023c82 100644
--- a/freemocap/__main__.py
+++ b/freemocap/__main__.py
@@ -3,7 +3,6 @@ import sys
from multiprocessing import freeze_support
from pathlib import Path
-
try:
from freemocap.gui.qt.freemocap_main import qt_gui_main
except Exception:
diff --git a/freemocap/assets/logo/freemocap-logo-black-border.svg b/freemocap/assets/logo/freemocap-logo-black-border.svg
index 33450edb..37fb2b1d 100644
--- a/freemocap/assets/logo/freemocap-logo-black-border.svg
+++ b/freemocap/assets/logo/freemocap-logo-black-border.svg
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.3.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
-<svg version="1.1"
- id="svg8" inkscape:version="1.0.2 (e86c8708, 2021-01-15)" sodipodi:docname="fmc-logo-border-2.svg"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+<svg xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1"
+ id="svg8"
+ inkscape:version="1.0.2 (e86c8708, 2021-01-15)"
+ sodipodi:docname="fmc-logo-border-2.svg" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px"
viewBox="0 0 461.4 584.5"
style="enable-background:new 0 0 461.4 584.5;" xml:space="preserve">
<style type="text/css">
@@ -14,19 +14,27 @@
.st3{opacity:0.15;fill:#365D5F;enable-background:new ;}
.st4{fill:#D95157;}
</style>
-<sodipodi:namedview bordercolor="#666666" borderopacity="1.0" id="base" inkscape:current-layer="layer1" inkscape:cx="372.3481" inkscape:cy="440.11451" inkscape:document-rotation="0" inkscape:document-units="mm" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:window-height="921" inkscape:window-maximized="0" inkscape:window-width="1348" inkscape:window-x="144" inkscape:window-y="25" inkscape:zoom="0.65138101" pagecolor="#ffffff" showgrid="false">
+ <sodipodi:namedview bordercolor="#666666" borderopacity="1.0" id="base" inkscape:current-layer="layer1"
+ inkscape:cx="372.3481" inkscape:cy="440.11451" inkscape:document-rotation="0"
+ inkscape:document-units="mm" inkscape:pageopacity="0.0" inkscape:pageshadow="2"
+ inkscape:window-height="921" inkscape:window-maximized="0" inkscape:window-width="1348"
+ inkscape:window-x="144" inkscape:window-y="25" inkscape:zoom="0.65138101" pagecolor="#ffffff"
+ showgrid="false">
</sodipodi:namedview>
-<g id="layer2" transform="translate(6.5984788,6.6389071)" inkscape:groupmode="layer" inkscape:label="Layer 2" class="st0">
+ <g id="layer2" transform="translate(6.5984788,6.6389071)" inkscape:groupmode="layer" inkscape:label="Layer 2"
+ class="st0">
<ellipse id="path962" cx="171.3" cy="282.5" rx="146.1" ry="160.4"/>
</g>
-<g id="layer1" transform="translate(-32.625961,-40.2606)" inkscape:groupmode="layer" inkscape:label="Layer 1">
+ <g id="layer1" transform="translate(-32.625961,-40.2606)" inkscape:groupmode="layer" inkscape:label="Layer 1">
- <image style="display:none;overflow:visible;enable-background:new ;" width="1668" height="2224" id="image843" xlink:href="16530232.png" transform="matrix(0.3849 0 0 0.3691 -49.7662 -67.5522)">
+ <image style="display:none;overflow:visible;enable-background:new ;" width="1668" height="2224" id="image843"
+ xlink:href="16530232.png" transform="matrix(0.3849 0 0 0.3691 -49.7662 -67.5522)">
</image>
- <image style="display:none;overflow:visible;enable-background:new ;" width="1668" height="2224" id="image865" xlink:href="16530236.png" transform="matrix(0.4143 0 0 0.3995 -66.2662 -100.5522)">
+ <image style="display:none;overflow:visible;enable-background:new ;" width="1668" height="2224" id="image865"
+ xlink:href="16530236.png" transform="matrix(0.4143 0 0 0.3995 -66.2662 -100.5522)">
</image>
- <path id="path853" class="st1" d="M167.8,601.5c-3.5-0.8-5.5-1.7-9.6-4.6c-4.1-2.8-6.6-5.5-9.4-10.2c-5-8.3-7.4-17.6-7.9-30.1
+ <path id="path853" class="st1" d="M167.8,601.5c-3.5-0.8-5.5-1.7-9.6-4.6c-4.1-2.8-6.6-5.5-9.4-10.2c-5-8.3-7.4-17.6-7.9-30.1
l-0.3-6.8l-1.6-3.7c-0.9-2-2.9-6.6-4.4-10.2c-1.6-3.6-3.4-8-4.1-9.8c-2-5.7-4.7-14.2-4.7-14.9c0-1.9,5.3-4.6,7.4-3.7
c1.4,0.6,1.9,1.6,1.5,3c-0.7,2.3-0.2,8.4,0.9,11.2c0.6,1.5,2.6,4.6,3.1,4.6c0.5,0,0.4-2.7-0.1-4.8c-0.8-3.5-1.4-9.2-1.1-10.4
c0.6-2,4.2-3.3,6.4-2.4c1.1,0.5,1.1,0.8,0.3,2.7c-1,2.1-1,10.7,0,13.1c0.7,1.7,1.6,2.5,2,1.8c0.1-0.2,0.3-2.6,0.4-5.4
@@ -83,8 +91,9 @@
c4.3,2.3,7.1,2.9,12.7,3C98.6,337.8,99,337.7,103.6,335.9L103.6,335.9z M64.4,320.2c-0.1-0.1-0.3,0-0.3,0.2c0,0.3,0.1,0.4,0.3,0.2
C64.6,320.5,64.6,320.3,64.4,320.2L64.4,320.2z M63.8,305.8c0-0.1-0.1-0.2-0.2-0.2c-0.1,0-0.2,0.1-0.2,0.2s0.1,0.2,0.2,0.2
C63.7,306,63.8,305.9,63.8,305.8z"/>
- <g id="path959">
- <path id="path966" sodipodi:nodetypes="csssssscssssssssscscccccsssssssscccssccccsscssssssssccssccscssscccsssscc" d="
+ <g id="path959">
+ <path id="path966" sodipodi:nodetypes="csssssscssssssssscscccccsssssssscccssccccsscssssssssccssccscssscccsssscc"
+ d="
M241.9,40.7c-21.9,1.4-41.7,4.7-60.9,10.1c-7.6,2.2-22.2,7.2-29.9,10.2c-7.7,3-17.8,8.2-25.2,12.7c-26.1,15.7-48.9,38.5-64.3,64.5
c-11.8,19.8-20.8,44.8-25,68.5c-2.4,13.7-3.3,22.4-3.4,36.3c-0.1,6.3-0.4,14.6-0.4,15c-0.6,7.4,0.2,14.6,3,28.4
c1.4,7.1,3.5,20.6,4.1,26c0.7,6.6,0.7,9.9,0.3,26.8c-0.3,13.3-0.1,17.3,0.7,22.5c0.5,3.3,0.8,5.6,1.8,9.4
@@ -101,7 +110,7 @@
c24.8-15.8,44.8-38.7,60.2-67.9c13.4-25.5,21.4-53.7,23.8-83.6v0c0.7-8.9,0.8-22.8,0-31.6c-1.2-13.2-3.6-26.3-7.1-37.6
c-6.6-21-13-34.7-23.2-48.5c-19.2-25.9-48.1-47.9-81.1-62.5c-32-14.2-66.5-22.4-103.9-24.9C268.8,40.1,251.3,40.1,241.9,40.7
L241.9,40.7z"/>
- <path id="path968" class="st2" d="M167.8,601.5c-3.5-0.8-5.5-1.7-9.6-4.6c-4.1-2.8-6.6-5.5-9.4-10.2c-5-8.3-7.4-17.6-7.9-30.1
+ <path id="path968" class="st2" d="M167.8,601.5c-3.5-0.8-5.5-1.7-9.6-4.6c-4.1-2.8-6.6-5.5-9.4-10.2c-5-8.3-7.4-17.6-7.9-30.1
l-0.3-6.8l-1.6-3.7c-0.9-2-2.9-6.6-4.4-10.2c-1.6-3.6-3.4-8-4.1-9.8c-2-5.7-4.7-14.2-4.7-14.9c0-1.9,5.3-4.6,7.4-3.7
c1.4,0.6,1.9,1.6,1.5,3c-0.7,2.3-0.2,8.4,0.9,11.2c0.6,1.5,2.6,4.6,3.1,4.6c0.5,0,0.4-2.7-0.1-4.8c-0.8-3.5-1.4-9.2-1.1-10.4
c0.6-2,4.2-3.3,6.4-2.4c1.1,0.5,1.1,0.8,0.3,2.7c-1,2.1-1,10.7,0,13.1c0.7,1.7,1.6,2.5,2,1.8c0.1-0.2,0.3-2.6,0.4-5.4
@@ -158,7 +167,7 @@
c1.2,1.2,3,2.5,5.6,3.9c4.3,2.3,7.1,2.9,12.7,3C98.6,337.8,99,337.7,103.6,335.9L103.6,335.9z M64.4,320.2c-0.1-0.1-0.3,0-0.3,0.2
c0,0.3,0.1,0.4,0.3,0.2C64.6,320.5,64.6,320.3,64.4,320.2L64.4,320.2z M63.8,305.8c0-0.1-0.1-0.2-0.2-0.2c-0.1,0-0.2,0.1-0.2,0.2
s0.1,0.2,0.2,0.2C63.7,306,63.8,305.9,63.8,305.8z"/>
- <path id="path988" class="st3" d="M167.8,601.5c-3.5-0.8-5.5-1.7-9.6-4.6c-4.1-2.8-6.6-5.5-9.4-10.2c-5-8.3-7.4-17.6-7.9-30.1
+ <path id="path988" class="st3" d="M167.8,601.5c-3.5-0.8-5.5-1.7-9.6-4.6c-4.1-2.8-6.6-5.5-9.4-10.2c-5-8.3-7.4-17.6-7.9-30.1
l-0.3-6.8l-1.6-3.7c-0.9-2-2.9-6.6-4.4-10.2c-1.6-3.6-3.4-8-4.1-9.8c-2-5.7-4.7-14.2-4.7-14.9c0-1.9,5.3-4.6,7.4-3.7
c1.4,0.6,1.9,1.6,1.5,3c-0.7,2.3-0.2,8.4,0.9,11.2c0.6,1.5,2.6,4.6,3.1,4.6c0.5,0,0.4-2.7-0.1-4.8c-0.8-3.5-1.4-9.2-1.1-10.4
c0.6-2,4.2-3.3,6.4-2.4c1.1,0.5,1.1,0.8,0.3,2.7c-1,2.1-1,10.7,0,13.1c0.7,1.7,1.6,2.5,2,1.8c0.1-0.2,0.3-2.6,0.4-5.4
@@ -216,7 +225,7 @@
c0,0.3,0.1,0.4,0.3,0.2C64.6,320.5,64.6,320.3,64.4,320.2L64.4,320.2z M63.8,305.8c0-0.1-0.1-0.2-0.2-0.2c-0.1,0-0.2,0.1-0.2,0.2
s0.1,0.2,0.2,0.2C63.7,306,63.8,305.9,63.8,305.8z"/>
</g>
- <path id="path869" class="st4" d="M237,432.3c-0.2-0.5-1.3-6.3-2.5-12.9c-1.2-6.6-3-17-4.2-23.2c-2.5-13.7-12.2-67.3-15-82.9
+ <path id="path869" class="st4" d="M237,432.3c-0.2-0.5-1.3-6.3-2.5-12.9c-1.2-6.6-3-17-4.2-23.2c-2.5-13.7-12.2-67.3-15-82.9
c-0.7-3.8-1.4-7.1-1.6-7.3c-0.2-0.2-2.4-0.8-4.8-1.5c-15.3-3.9-40.4-10.8-42.2-11.6c-0.9-0.4-1.2-0.9-1.2-1.6
c0-0.5-0.1-1.2-0.3-1.4c-0.5-0.7,0.2-1.3,3.2-2.6c3.8-1.7,22.1-8.7,33.5-13c5-1.8,9.3-3.5,9.6-3.8c0.3-0.3,0.7-3.6,1-9.7
c0.3-5.1,0.9-15.4,1.3-22.9c0.4-7.5,1.3-21.9,1.9-32c0.6-10.1,1.5-25.7,2.1-34.8s1.1-19.1,1.3-22.4c0.2-3.3,0.4-6.3,0.7-6.7
diff --git a/freemocap/core_processes/capture_volume_calibration/anipose_camera_calibration/freemocap_anipose.py b/freemocap/core_processes/capture_volume_calibration/anipose_camera_calibration/freemocap_anipose.py
index 8942c6ed..edbbd589 100644
--- a/freemocap/core_processes/capture_volume_calibration/anipose_camera_calibration/freemocap_anipose.py
+++ b/freemocap/core_processes/capture_volume_calibration/anipose_camera_calibration/freemocap_anipose.py
@@ -12,21 +12,15 @@ from copy import copy
import cv2
import numpy as np
import toml
-from aniposelib.boards import (
- extract_points,
- extract_rtvecs,
- get_video_params,
- merge_rows,
- CharucoBoard
-)
+from aniposelib.boards import extract_points, extract_rtvecs, get_video_params, merge_rows, CharucoBoard
from aniposelib.utils import get_rtvec, make_M
from numba import jit
from scipy import optimize
from scipy import signal
-from scipy.sparse import dok_matrix
-from scipy.linalg import inv as inverse
from scipy.cluster.hierarchy import linkage, fcluster
from scipy.cluster.vq import whiten
+from scipy.linalg import inv as inverse
+from scipy.sparse import dok_matrix
from tqdm import trange
numba_logger = logging.getLogger("numba")
@@ -193,6 +187,7 @@ def transform_points(points, rvecs, tvecs):
return rotated + tvecs
+
def get_connections(xs, cam_names=None, both=True):
n_cams = xs.shape[0]
n_points = xs.shape[1]
@@ -206,12 +201,12 @@ def get_connections(xs, cam_names=None, both=True):
ixs = np.where(~np.isnan(xs[:, rnum, 0]))[0]
keys = [cam_names[ix] for ix in ixs]
for i in range(len(keys)):
- for j in range(i+1, len(keys)):
+ for j in range(i + 1, len(keys)):
a = keys[i]
b = keys[j]
- connections[(a,b)] += 1
+ connections[(a, b)] += 1
if both:
- connections[(b,a)] += 1
+ connections[(b, a)] += 1
return connections
@@ -230,16 +225,20 @@ def get_calibration_graph(rtvecs, cam_names=None):
graph = defaultdict(list)
- for edgenum in range(n_cams-1):
+ for edgenum in range(n_cams - 1):
if len(edges) == 0:
component_names = dict()
- for k,v in list(components.items()):
+ for k, v in list(components.items()):
component_names[cam_names[k]] = v
- raise ValueError("""
+ raise ValueError(
+ """
Could not build calibration graph.
Some group of cameras could not be paired by simultaneous calibration board detections.
Check which cameras have different group numbers below to see the missing edges.
-{}""".format(component_names))
+{}""".format(
+ component_names
+ )
+ )
(a, b), weight = max(edges, key=lambda x: x[1])
graph[a].append(b)
@@ -252,12 +251,13 @@ Check which cameras have different group numbers below to see the missing edges.
components[k] = replace
for e in edges.copy():
- (a,b), w = e
+ (a, b), w = e
if components[a] == components[b]:
edges.remove(e)
return graph
+
def find_calibration_pairs(graph, source=None):
pairs = []
explored = set()
@@ -275,18 +275,20 @@ def find_calibration_pairs(graph, source=None):
for new in graph[item]:
if new not in explored:
q.append(new)
- pairs.append( (item, new) )
+ pairs.append((item, new))
return pairs
+
def compute_camera_matrices(rtvecs, pairs):
extrinsics = dict()
source = pairs[0][0]
extrinsics[source] = np.identity(4)
- for (a,b) in pairs:
+ for a, b in pairs:
ext = get_transform(rtvecs, b, a)
extrinsics[b] = np.matmul(ext, extrinsics[a])
return extrinsics
+
def get_transform(rtvecs, left, right):
L = []
for dix in range(rtvecs.shape[1]):
@@ -305,19 +307,21 @@ def get_transform(rtvecs, left, right):
M_mean = mean_transform_robust(L, M_mean, error=0.1)
return M_mean
+
def get_most_common(vals):
- Z = linkage(whiten(vals), 'ward')
- n_clust = max(len(vals)/10, 3)
- clusts = fcluster(Z, t=n_clust, criterion='maxclust')
+ Z = linkage(whiten(vals), "ward")
+ n_clust = max(len(vals) / 10, 3)
+ clusts = fcluster(Z, t=n_clust, criterion="maxclust")
cc = Counter(clusts[clusts >= 0])
most = cc.most_common(n=1)
top = most[0][0]
good = clusts == top
return good
+
def select_matrices(Ms):
Ms = np.array(Ms)
- rvecs = [cv2.Rodrigues(M[:3,:3])[0][:, 0] for M in Ms]
+ rvecs = [cv2.Rodrigues(M[:3, :3])[0][:, 0] for M in Ms]
tvecs = np.array([M[:3, 3] for M in Ms])
best = get_most_common(np.hstack([rvecs, tvecs]))
Ms_best = Ms[best]
@@ -325,7 +329,7 @@ def select_matrices(Ms):
def mean_transform(M_list):
- rvecs = [cv2.Rodrigues(M[:3,:3])[0][:, 0] for M in M_list]
+ rvecs = [cv2.Rodrigues(M[:3, :3])[0][:, 0] for M in M_list]
tvecs = [M[:3, 3] for M in M_list]
rvec = np.mean(rvecs, axis=0)
@@ -333,18 +337,20 @@ def mean_transform(M_list):
return make_M(rvec, tvec)
+
def mean_transform_robust(M_list, approx=None, error=0.3):
if approx is None:
M_list_robust = M_list
else:
M_list_robust = []
for M in M_list:
- rot_error = (M - approx)[:3,:3]
+ rot_error = (M - approx)[:3, :3]
m = np.max(np.abs(rot_error))
if m < error:
M_list_robust.append(M)
return mean_transform(M_list_robust)
+
def get_initial_extrinsics(rtvecs, cam_names=None):
graph = get_calibration_graph(rtvecs, cam_names)
pairs = find_calibration_pairs(graph, source=0)
@@ -1933,16 +1939,19 @@ class CameraGroup:
for cam in self.cameras:
cam.resize_camera(scale)
+
class AniposeCharucoBoard(CharucoBoard):
- def __init__(self,
- squaresX,
- squaresY,
- square_length,
- marker_length,
- marker_bits=4,
- dict_size=50,
- aruco_dict=None,
- manually_verify=False):
+ def __init__(
+ self,
+ squaresX,
+ squaresY,
+ square_length,
+ marker_length,
+ marker_bits=4,
+ dict_size=50,
+ aruco_dict=None,
+ manually_verify=False,
+ ):
self.squaresX = squaresX
self.squaresY = squaresY
self.square_length = square_length
@@ -1965,7 +1974,7 @@ class AniposeCharucoBoard(CharucoBoard):
(4, 1000): cv2.aruco.DICT_4X4_1000,
(5, 1000): cv2.aruco.DICT_5X5_1000,
(6, 1000): cv2.aruco.DICT_6X6_1000,
- (7, 1000): cv2.aruco.DICT_7X7_1000
+ (7, 1000): cv2.aruco.DICT_7X7_1000,
}
dkey = (marker_bits, dict_size)
@@ -1973,15 +1982,15 @@ class AniposeCharucoBoard(CharucoBoard):
self.board = cv2.aruco.CharucoBoard(
size=[squaresX, squaresY],
- squareLength=square_length,
+ squareLength=square_length,
markerLength=marker_length,
- dictionary=self.dictionary)
+ dictionary=self.dictionary,
+ )
total_size = (squaresX - 1) * (squaresY - 1)
objp = np.zeros((total_size, 3), np.float64)
- objp[:, :2] = np.mgrid[0:(squaresX - 1), 0:(squaresY - 1)].T.reshape(
- -1, 2)
+ objp[:, :2] = np.mgrid[0 : (squaresX - 1), 0 : (squaresY - 1)].T.reshape(-1, 2)
objp *= square_length
self.objPoints = objp
@@ -2002,12 +2011,10 @@ class AniposeCharucoBoard(CharucoBoard):
params.adaptiveThreshConstant = 0
try:
- corners, ids, rejectedImgPoints = cv2.aruco.detectMarkers(
- gray, self.dictionary, parameters=params)
+ corners, ids, rejectedImgPoints = cv2.aruco.detectMarkers(gray, self.dictionary, parameters=params)
except Exception:
ids = None
-
if ids is None:
return [], []
@@ -2018,18 +2025,15 @@ class AniposeCharucoBoard(CharucoBoard):
D = camera.get_distortions()
if refine:
- detectedCorners, detectedIds, rejectedCorners, recoveredIdxs = \
- cv2.aruco.refineDetectedMarkers(gray, self.board, corners, ids,
- rejectedImgPoints,
- K, D,
- parameters=params)
+ detectedCorners, detectedIds, rejectedCorners, recoveredIdxs = cv2.aruco.refineDetectedMarkers(
+ gray, self.board, corners, ids, rejectedImgPoints, K, D, parameters=params
+ )
else:
detectedCorners, detectedIds = corners, ids
return detectedCorners, detectedIds
-
- def detect_image(self, image, camera=None):
+ def detect_image(self, image, camera=None):
if len(image.shape) == 3:
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
else:
@@ -2037,39 +2041,66 @@ class AniposeCharucoBoard(CharucoBoard):
corners, ids = self.detect_markers(image, camera, refine=True)
if len(corners) > 0:
- ret, detectedCorners, detectedIds = cv2.aruco.interpolateCornersCharuco(
- corners, ids, gray, self.board)
+ ret, detectedCorners, detectedIds = cv2.aruco.interpolateCornersCharuco(corners, ids, gray, self.board)
if detectedIds is None:
detectedCorners = detectedIds = np.float64([])
else:
detectedCorners = detectedIds = np.float64([])
- if len(detectedCorners) > 0 \
- and self.manually_verify \
- and not self.manually_verify_board_detection(gray, detectedCorners, detectedIds):
+ if (
+ len(detectedCorners) > 0
+ and self.manually_verify
+ and not self.manually_verify_board_detection(gray, detectedCorners, detectedIds)
+ ):
detectedCorners = detectedIds = np.float64([])
return detectedCorners, detectedIds
-
- def manually_verify_board_detection(self, image, corners, ids=None):
+ def manually_verify_board_detection(self, image, corners, ids=None):
height, width = image.shape[:2]
image = cv2.aruco.drawDetectedCornersCharuco(image, corners, ids)
- cv2.putText(image, '(a) Accept (d) Reject', (int(width/1.35), int(height/16)), cv2.FONT_HERSHEY_SIMPLEX, 0.5, 255, 1, cv2.LINE_AA)
- cv2.imshow('verify_detection', image)
+ cv2.putText(
+ image,
+ "(a) Accept (d) Reject",
+ (int(width / 1.35), int(height / 16)),
+ cv2.FONT_HERSHEY_SIMPLEX,
+ 0.5,
+ 255,
+ 1,
+ cv2.LINE_AA,
+ )
+ cv2.imshow("verify_detection", image)
while 1:
key = cv2.waitKey(0) & 0xFF
- if key == ord('a'):
- cv2.putText(image, 'Accepted!', (int(width/2.5), int(height/1.05)), cv2.FONT_HERSHEY_SIMPLEX, 1, 255, 2, cv2.LINE_AA)
- cv2.imshow('verify_detection', image)
+ if key == ord("a"):
+ cv2.putText(
+ image,
+ "Accepted!",
+ (int(width / 2.5), int(height / 1.05)),
+ cv2.FONT_HERSHEY_SIMPLEX,
+ 1,
+ 255,
+ 2,
+ cv2.LINE_AA,
+ )
+ cv2.imshow("verify_detection", image)
cv2.waitKey(100)
return True
- elif key == ord('d'):
- cv2.putText(image, 'Rejected!', (int(width/2.5), int(height/1.05)), cv2.FONT_HERSHEY_SIMPLEX, 1, 255, 2, cv2.LINE_AA)
- cv2.imshow('verify_detection', image)
+ elif key == ord("d"):
+ cv2.putText(
+ image,
+ "Rejected!",
+ (int(width / 2.5), int(height / 1.05)),
+ cv2.FONT_HERSHEY_SIMPLEX,
+ 1,
+ 255,
+ 2,
+ cv2.LINE_AA,
+ )
+ cv2.imshow("verify_detection", image)
cv2.waitKey(100)
return False
-
+
def estimate_pose_points(self, camera, corners, ids):
if corners is None or ids is None or len(corners) < 5:
return None, None
@@ -2080,7 +2111,6 @@ class AniposeCharucoBoard(CharucoBoard):
K = camera.get_camera_matrix()
D = camera.get_distortions()
- ret, rvec, tvec = cv2.aruco.estimatePoseCharucoBoard(
- corners, ids, self.board, K, D, None, None)
+ ret, rvec, tvec = cv2.aruco.estimatePoseCharucoBoard(corners, ids, self.board, K, D, None, None)
return rvec, tvec
diff --git a/freemocap/core_processes/detecting_things_in_2d_images/mediapipe_stuff/data_models/mediapipe_skeleton_names_and_connections.py b/freemocap/core_processes/detecting_things_in_2d_images/mediapipe_stuff/data_models/mediapipe_skeleton_names_and_connections.py
index 5f104200..572ff38d 100644
--- a/freemocap/core_processes/detecting_things_in_2d_images/mediapipe_stuff/data_models/mediapipe_skeleton_names_and_connections.py
+++ b/freemocap/core_processes/detecting_things_in_2d_images/mediapipe_stuff/data_models/mediapipe_skeleton_names_and_connections.py
@@ -1,11 +1,9 @@
from mediapipe.python.solutions import holistic as mp_holistic
-
mediapipe_body_connections = [connection for connection in mp_holistic.POSE_CONNECTIONS]
mediapipe_hand_connections = [connection for connection in mp_holistic.HAND_CONNECTIONS]
-
mediapipe_face_connections = [connection for connection in mp_holistic.FACEMESH_CONTOURS]
mediapipe_body_landmark_names = [landmark.name.lower() for landmark in mp_holistic.PoseLandmark]
@@ -13,7 +11,6 @@ NUMBER_OF_MEDIAPIPE_BODY_MARKERS = len(mediapipe_body_landmark_names)
mediapipe_hand_landmark_names = [landmark.name.lower() for landmark in mp_holistic.HandLandmark]
-
mediapipe_face_landmark_names = [
"right_eye",
"left_eye",
diff --git a/freemocap/core_processes/export_data/blender_stuff/export_to_blender/export_to_blender.py b/freemocap/core_processes/export_data/blender_stuff/export_to_blender/export_to_blender.py
index 8e170466..efea5ebf 100644
--- a/freemocap/core_processes/export_data/blender_stuff/export_to_blender/export_to_blender.py
+++ b/freemocap/core_processes/export_data/blender_stuff/export_to_blender/export_to_blender.py
@@ -2,16 +2,21 @@ import logging
from pathlib import Path
from typing import Union
-from freemocap.core_processes.export_data.blender_stuff.export_to_blender.methods.ajc_addon.run_ajc_addon_main import \
- run_ajc_blender_addon_subprocess
-from freemocap.core_processes.export_data.blender_stuff.export_to_blender.methods.legacy.run_alpha_megascript import \
- run_alpha_megascript
-from freemocap.core_processes.export_data.blender_stuff.export_to_blender.methods.legacy.run_cgtinker_method import \
- run_cgtinker_method
-from freemocap.core_processes.export_data.blender_stuff.export_to_blender.methods.legacy.run_megascript_take2 import \
- run_blender_megascript_take2
-from freemocap.core_processes.export_data.blender_stuff.get_best_guess_of_blender_path import \
- get_best_guess_of_blender_path
+from freemocap.core_processes.export_data.blender_stuff.export_to_blender.methods.ajc_addon.run_ajc_addon_main import (
+ run_ajc_blender_addon_subprocess,
+)
+from freemocap.core_processes.export_data.blender_stuff.export_to_blender.methods.legacy.run_alpha_megascript import (
+ run_alpha_megascript,
+)
+from freemocap.core_processes.export_data.blender_stuff.export_to_blender.methods.legacy.run_cgtinker_method import (
+ run_cgtinker_method,
+)
+from freemocap.core_processes.export_data.blender_stuff.export_to_blender.methods.legacy.run_megascript_take2 import (
+ run_blender_megascript_take2,
+)
+from freemocap.core_processes.export_data.blender_stuff.get_best_guess_of_blender_path import (
+ get_best_guess_of_blender_path,
+)
logger = logging.getLogger(__name__)
diff --git a/freemocap/core_processes/export_data/blender_stuff/export_to_blender/methods/ajc_addon/install/bpy_install_addon.py b/freemocap/core_processes/export_data/blender_stuff/export_to_blender/methods/ajc_addon/install/bpy_install_addon.py
index 698129eb..e86311e8 100644
--- a/freemocap/core_processes/export_data/blender_stuff/export_to_blender/methods/ajc_addon/install/bpy_install_addon.py
+++ b/freemocap/core_processes/export_data/blender_stuff/export_to_blender/methods/ajc_addon/install/bpy_install_addon.py
@@ -1,7 +1,7 @@
import os
-from pathlib import Path
import shutil
import tempfile
+from pathlib import Path
from typing import Union
INSTALL_ADDON_SCRIPT_PATH = __file__
diff --git a/freemocap/core_processes/export_data/blender_stuff/export_to_blender/methods/ajc_addon/install/install_ajc_addon.py b/freemocap/core_processes/export_data/blender_stuff/export_to_blender/methods/ajc_addon/install/install_ajc_addon.py
index 4ecf42b8..72c86606 100644
--- a/freemocap/core_processes/export_data/blender_stuff/export_to_blender/methods/ajc_addon/install/install_ajc_addon.py
+++ b/freemocap/core_processes/export_data/blender_stuff/export_to_blender/methods/ajc_addon/install/install_ajc_addon.py
@@ -5,8 +5,9 @@ from pathlib import Path
from ajc27_freemocap_blender_addon.run_as_main import ajc27_run_as_main_function
-from freemocap.core_processes.export_data.blender_stuff.export_to_blender.methods.ajc_addon.install.bpy_install_addon import \
- INSTALL_ADDON_SCRIPT_PATH
+from freemocap.core_processes.export_data.blender_stuff.export_to_blender.methods.ajc_addon.install.bpy_install_addon import (
+ INSTALL_ADDON_SCRIPT_PATH,
+)
FREEMOCAP_BLENDER_ADDON_PACKAGE_NAME = "ajc27_freemocap_blender_addon"
@@ -14,15 +15,14 @@ FREEMOCAP_BLENDER_ADDON_PACKAGE_NAME = "ajc27_freemocap_blender_addon"
def get_package_path(package_name: str):
try:
package_dist = distribution(package_name)
- package_path = package_dist.locate_file('')
+ package_path = package_dist.locate_file("")
return package_path
except Exception:
print(f"{package_name} not found.")
return None
-def install_ajc_addon(blender_exe_path: str,
- ajc_addon_main_file_path: str):
+def install_ajc_addon(blender_exe_path: str, ajc_addon_main_file_path: str):
addon_root_directory = Path(ajc_addon_main_file_path).parent
addon_name = Path(addon_root_directory).name
@@ -34,20 +34,22 @@ def install_ajc_addon(blender_exe_path: str,
INSTALL_ADDON_SCRIPT_PATH,
"--",
addon_root_directory,
- addon_name
+ addon_name,
]
# use CLI to install the addon passing in the addon name and zip file path
subprocess.run(subprocess_command)
if __name__ == "__main__":
- from freemocap.core_processes.export_data.blender_stuff.get_best_guess_of_blender_path import \
- get_best_guess_of_blender_path
+ from freemocap.core_processes.export_data.blender_stuff.get_best_guess_of_blender_path import (
+ get_best_guess_of_blender_path,
+ )
+
ajc_addon_main_file_path = inspect.getfile(ajc27_run_as_main_function)
blender_path_in = get_best_guess_of_blender_path()
- install_ajc_addon(blender_exe_path=blender_path_in,
- ajc_addon_main_file_path=inspect.getfile(ajc27_run_as_main_function)
- )
+ install_ajc_addon(
+ blender_exe_path=blender_path_in, ajc_addon_main_file_path=inspect.getfile(ajc27_run_as_main_function)
+ )
print("Done!")
diff --git a/freemocap/core_processes/export_data/blender_stuff/export_to_blender/methods/ajc_addon/run_ajc_addon_main.py b/freemocap/core_processes/export_data/blender_stuff/export_to_blender/methods/ajc_addon/run_ajc_addon_main.py
index 6ba082c1..be627b26 100644
--- a/freemocap/core_processes/export_data/blender_stuff/export_to_blender/methods/ajc_addon/run_ajc_addon_main.py
+++ b/freemocap/core_processes/export_data/blender_stuff/export_to_blender/methods/ajc_addon/run_ajc_addon_main.py
@@ -6,10 +6,12 @@ from typing import Union, List
from ajc27_freemocap_blender_addon.run_as_main import ajc27_run_as_main_function
-from freemocap.core_processes.export_data.blender_stuff.export_to_blender.methods.ajc_addon.get_numpy_path import \
- get_numpy_path
-from freemocap.core_processes.export_data.blender_stuff.export_to_blender.methods.ajc_addon.install.install_ajc_addon import \
- install_ajc_addon
+from freemocap.core_processes.export_data.blender_stuff.export_to_blender.methods.ajc_addon.get_numpy_path import (
+ get_numpy_path,
+)
+from freemocap.core_processes.export_data.blender_stuff.export_to_blender.methods.ajc_addon.install.install_ajc_addon import (
+ install_ajc_addon,
+)
from freemocap.core_processes.export_data.blender_stuff.export_to_blender.methods.ajc_addon.run_simple import run_simple
logger = logging.getLogger(__name__)
@@ -30,9 +32,9 @@ def run_subprocess(command_list: List[str], append_to_python_path: List[str] = N
def run_ajc_blender_addon_subprocess(
- recording_folder_path: Union[str, Path],
- blender_file_path: Union[str, Path],
- blender_exe_path: Union[str, Path],
+ recording_folder_path: Union[str, Path],
+ blender_file_path: Union[str, Path],
+ blender_exe_path: Union[str, Path],
):
ajc_addon_main_file_path = inspect.getfile(ajc27_run_as_main_function)
logger.info(f"Running ajc27_freemocap_blender_addon as a subprocess using script at : {ajc_addon_main_file_path}")
@@ -42,8 +44,7 @@ def run_ajc_blender_addon_subprocess(
# path_to_blenders_numpy = get_blenders_numpy(blender_exe_path=blender_exe_path)
# blender_numpy_root = str(Path(path_to_blenders_numpy).parent.parent)
- install_ajc_addon(blender_exe_path=blender_exe_path,
- ajc_addon_main_file_path=ajc_addon_main_file_path)
+ install_ajc_addon(blender_exe_path=blender_exe_path, ajc_addon_main_file_path=ajc_addon_main_file_path)
try:
blender_exe_path = Path(blender_exe_path)
if not blender_exe_path.exists():
@@ -61,13 +62,13 @@ def run_ajc_blender_addon_subprocess(
"--",
str(recording_folder_path),
str(blender_file_path),
-
]
logger.info(f"Starting `blender` sub-process with this command: \n {command_list}")
- blender_process = run_subprocess(command_list=command_list,
- append_to_python_path=[addon_root_directory]) # , blender_numpy_root])
+ blender_process = run_subprocess(
+ command_list=command_list, append_to_python_path=[addon_root_directory]
+ ) # , blender_numpy_root])
while True:
output = blender_process.stdout.readline()
@@ -84,13 +85,15 @@ def run_ajc_blender_addon_subprocess(
def get_blenders_numpy(blender_exe_path: Union[str, Path]) -> str:
import subprocess
+
get_numpy_script_path = inspect.getfile(get_numpy_path)
- command = [str(blender_exe_path),
- "--background",
- "--python",
- get_numpy_script_path,
- ]
+ command = [
+ str(blender_exe_path),
+ "--background",
+ "--python",
+ get_numpy_script_path,
+ ]
subprocess_result = subprocess.run(command, capture_output=True, text=True)
all_output = subprocess_result.stdout
numpy_path = None
@@ -105,8 +108,9 @@ def get_blenders_numpy(blender_exe_path: Union[str, Path]) -> str:
if __name__ == "__main__":
- from freemocap.core_processes.export_data.blender_stuff.get_best_guess_of_blender_path import \
- get_best_guess_of_blender_path
+ from freemocap.core_processes.export_data.blender_stuff.get_best_guess_of_blender_path import (
+ get_best_guess_of_blender_path,
+ )
recording_path_in = r"C:\Users\jonma\freemocap_data\recording_sessions\steen_pantsOn_gait"
blender_file_path_in = str(Path(recording_path_in) / (str(Path(recording_path_in).stem) + ".blend"))
diff --git a/freemocap/core_processes/export_data/blender_stuff/export_to_blender/methods/ajc_addon/run_simple.py b/freemocap/core_processes/export_data/blender_stuff/export_to_blender/methods/ajc_addon/run_simple.py
index cd78c241..cde4f2ca 100644
--- a/freemocap/core_processes/export_data/blender_stuff/export_to_blender/methods/ajc_addon/run_simple.py
+++ b/freemocap/core_processes/export_data/blender_stuff/export_to_blender/methods/ajc_addon/run_simple.py
@@ -4,8 +4,7 @@ import sys
def run_simple(recording_path_input: str, blender_file_save_path_input: str):
from ajc27_freemocap_blender_addon.run_as_main import ajc27_run_as_main_function
- ajc27_run_as_main_function(recording_path=str(recording_path_input),
- save_path=str(blender_file_save_path_input))
+ ajc27_run_as_main_function(recording_path=str(recording_path_input), save_path=str(blender_file_save_path_input))
if __name__ == "__main__":
@@ -15,7 +14,6 @@ if __name__ == "__main__":
argv = argv[argv.index("--") + 1:]
recording_path_input = str(argv[0])
blender_file_save_path_input = str(argv[1])
- run_simple(recording_path_input=recording_path_input,
- blender_file_save_path_input=blender_file_save_path_input)
+ run_simple(recording_path_input=recording_path_input, blender_file_save_path_input=blender_file_save_path_input)
print("\n\n\nDone!\n\n\n")
diff --git a/freemocap/core_processes/export_data/blender_stuff/export_to_blender/methods/legacy/alpha_freemocap_blender_megascript.py b/freemocap/core_processes/export_data/blender_stuff/export_to_blender/methods/legacy/alpha_freemocap_blender_megascript.py
index a989b6b5..4ecb7dc3 100644
--- a/freemocap/core_processes/export_data/blender_stuff/export_to_blender/methods/legacy/alpha_freemocap_blender_megascript.py
+++ b/freemocap/core_processes/export_data/blender_stuff/export_to_blender/methods/legacy/alpha_freemocap_blender_megascript.py
@@ -11,6 +11,7 @@ print(" - Starting (alpha) blender megascript - ")
bpy.ops.preferences.addon_enable(module="io_import_images_as_planes")
bpy.ops.preferences.addon_enable(module="rigify")
+
#######################################################################
diff --git a/freemocap/core_processes/export_data/blender_stuff/export_to_blender/methods/legacy/freemocap_blender_megascript_take2.py b/freemocap/core_processes/export_data/blender_stuff/export_to_blender/methods/legacy/freemocap_blender_megascript_take2.py
index f9f855d9..77d67d86 100644
--- a/freemocap/core_processes/export_data/blender_stuff/export_to_blender/methods/legacy/freemocap_blender_megascript_take2.py
+++ b/freemocap/core_processes/export_data/blender_stuff/export_to_blender/methods/legacy/freemocap_blender_megascript_take2.py
@@ -1192,7 +1192,6 @@ BODY_SEGMENT_NAMES = [
"left_foot",
]
-
FULL_BODY_CENTER_OF_MASS_NAME = (
"_full_body_center_of_mass" # leading underscore to make it easier to find in the outliner
)
diff --git a/freemocap/core_processes/export_data/blender_stuff/export_to_blender/methods/legacy/run_alpha_megascript.py b/freemocap/core_processes/export_data/blender_stuff/export_to_blender/methods/legacy/run_alpha_megascript.py
index 9d3e013f..43542cc4 100644
--- a/freemocap/core_processes/export_data/blender_stuff/export_to_blender/methods/legacy/run_alpha_megascript.py
+++ b/freemocap/core_processes/export_data/blender_stuff/export_to_blender/methods/legacy/run_alpha_megascript.py
@@ -1,8 +1,8 @@
+import logging
import subprocess
from pathlib import Path
from typing import Union
-import logging
logger = logging.getLogger(__name__)
diff --git a/freemocap/core_processes/export_data/blender_stuff/export_to_blender/methods/legacy/run_cgtinker_method.py b/freemocap/core_processes/export_data/blender_stuff/export_to_blender/methods/legacy/run_cgtinker_method.py
index 8ce85037..6b09baeb 100644
--- a/freemocap/core_processes/export_data/blender_stuff/export_to_blender/methods/legacy/run_cgtinker_method.py
+++ b/freemocap/core_processes/export_data/blender_stuff/export_to_blender/methods/legacy/run_cgtinker_method.py
@@ -1,8 +1,8 @@
+import logging
import subprocess
from pathlib import Path
from typing import Union
-import logging
logger = logging.getLogger(__name__)
diff --git a/freemocap/core_processes/export_data/blender_stuff/export_to_blender/methods/legacy/run_megascript_take2.py b/freemocap/core_processes/export_data/blender_stuff/export_to_blender/methods/legacy/run_megascript_take2.py
index 8d443c49..ae859a20 100644
--- a/freemocap/core_processes/export_data/blender_stuff/export_to_blender/methods/legacy/run_megascript_take2.py
+++ b/freemocap/core_processes/export_data/blender_stuff/export_to_blender/methods/legacy/run_megascript_take2.py
@@ -17,16 +17,16 @@ logger = logging.getLogger(__name__)
def run_blender_megascript_take2(
- recording_folder_path: Union[str, Path],
- blender_file_path: Union[str, Path],
- blender_exe_path: Union[str, Path],
+ recording_folder_path: Union[str, Path],
+ blender_file_path: Union[str, Path],
+ blender_exe_path: Union[str, Path],
):
path_to_this_py_file = Path(__file__).parent.resolve()
freemocap_blender_megascript_path = path_to_this_py_file / "freemocap_blender_megascript_take2.py"
if not (
- Path(recording_folder_path) / OUTPUT_DATA_FOLDER_NAME / "mediapipe_names_and_connections_dict.json"
+ Path(recording_folder_path) / OUTPUT_DATA_FOLDER_NAME / "mediapipe_names_and_connections_dict.json"
).is_file():
save_dictionary_to_json(
save_path=str(Path(recording_folder_path) / OUTPUT_DATA_FOLDER_NAME),
diff --git a/freemocap/core_processes/export_data/blender_stuff/get_best_guess_of_blender_path.py b/freemocap/core_processes/export_data/blender_stuff/get_best_guess_of_blender_path.py
index 160b48ce..b555ad74 100644
--- a/freemocap/core_processes/export_data/blender_stuff/get_best_guess_of_blender_path.py
+++ b/freemocap/core_processes/export_data/blender_stuff/get_best_guess_of_blender_path.py
@@ -3,7 +3,6 @@ import platform
from pathlib import Path
from typing import Union
-
logger = logging.getLogger(__name__)
diff --git a/freemocap/core_processes/export_data/generate_jupyter_notebook/generate_jupyter_notebook.py b/freemocap/core_processes/export_data/generate_jupyter_notebook/generate_jupyter_notebook.py
index f7157f50..5930edae 100644
--- a/freemocap/core_processes/export_data/generate_jupyter_notebook/generate_jupyter_notebook.py
+++ b/freemocap/core_processes/export_data/generate_jupyter_notebook/generate_jupyter_notebook.py
@@ -1,5 +1,5 @@
-import logging
import json
+import logging
from pathlib import Path
from typing import Union
diff --git a/freemocap/core_processes/post_process_skeleton_data/post_process_skeleton.py b/freemocap/core_processes/post_process_skeleton_data/post_process_skeleton.py
index 7dfe51c8..a54ec387 100644
--- a/freemocap/core_processes/post_process_skeleton_data/post_process_skeleton.py
+++ b/freemocap/core_processes/post_process_skeleton_data/post_process_skeleton.py
@@ -1,9 +1,8 @@
+import logging
+from pathlib import Path
from typing import Union
import numpy as np
-from pathlib import Path
-import logging
-
from skellyforge.freemocap_utils.config import default_settings
from skellyforge.freemocap_utils.constants import (
TASK_FILTERING,
diff --git a/freemocap/core_processes/process_motion_capture_videos/process_recording_folder.py b/freemocap/core_processes/process_motion_capture_videos/process_recording_folder.py
index f0436987..2aa2de1c 100644
--- a/freemocap/core_processes/process_motion_capture_videos/process_recording_folder.py
+++ b/freemocap/core_processes/process_motion_capture_videos/process_recording_folder.py
@@ -254,7 +254,8 @@ def process_recording_folder(
dictionary=mediapipe_names_and_connections_dict,
)
- # TODO - move this data output method *above* the sloppy stuff above and deprecate the sloppy stuff (gracefully enough not to bork hypothetical users' workflows)
+ # TODO - move this data output method *above* the sloppy stuff above and deprecate the sloppy stuff
+ # (gracefully enough not to bork hypothetical users' workflows)
DataSaver(recording_folder_path=rec.recording_info_model.path).save_all()
logger.info(f"Done processing {rec.recording_info_model.path}")
diff --git a/freemocap/core_processes/process_motion_capture_videos/process_recording_headless.py b/freemocap/core_processes/process_motion_capture_videos/process_recording_headless.py
index 3498c3e6..0803d6c9 100644
--- a/freemocap/core_processes/process_motion_capture_videos/process_recording_headless.py
+++ b/freemocap/core_processes/process_motion_capture_videos/process_recording_headless.py
@@ -2,10 +2,12 @@ import logging
from pathlib import Path
from typing import Optional, Union
+from freemocap.core_processes.export_data.blender_stuff.export_to_blender.export_to_blender import export_to_blender
+from freemocap.core_processes.export_data.blender_stuff.get_best_guess_of_blender_path import (
+ get_best_guess_of_blender_path,
+)
from freemocap.core_processes.process_motion_capture_videos.process_recording_folder import process_recording_folder
from freemocap.data_layer.generate_jupyter_notebook.generate_jupyter_notebook import generate_jupyter_notebook
-from freemocap.core_processes.export_data.blender_stuff.export_to_blender.export_to_blender import export_to_blender
-from freemocap.core_processes.export_data.blender_stuff.get_best_guess_of_blender_path import get_best_guess_of_blender_path
from freemocap.data_layer.recording_models.post_processing_parameter_models import PostProcessingParameterModel
from freemocap.data_layer.recording_models.recording_info_model import RecordingInfoModel
from freemocap.system.paths_and_filenames.file_and_folder_names import RECORDING_PARAMETERS_JSON_FILE_NAME
diff --git a/freemocap/data_layer/generate_jupyter_notebook/generate_jupyter_notebook.py b/freemocap/data_layer/generate_jupyter_notebook/generate_jupyter_notebook.py
index f7157f50..5930edae 100644
--- a/freemocap/data_layer/generate_jupyter_notebook/generate_jupyter_notebook.py
+++ b/freemocap/data_layer/generate_jupyter_notebook/generate_jupyter_notebook.py
@@ -1,5 +1,5 @@
-import logging
import json
+import logging
from pathlib import Path
from typing import Union
diff --git a/freemocap/gui/qt/actions_and_menus/actions.py b/freemocap/gui/qt/actions_and_menus/actions.py
index 29f0712a..5a4302bb 100644
--- a/freemocap/gui/qt/actions_and_menus/actions.py
+++ b/freemocap/gui/qt/actions_and_menus/actions.py
@@ -1,8 +1,10 @@
-from PyQt6.QtCore import QUrl
-from PyQt6.QtGui import QAction, QDesktopServices
+from PySide6.QtCore import QUrl
+from PySide6.QtGui import QAction, QDesktopServices
-from freemocap.system.paths_and_filenames.file_and_folder_names import FIGSHARE_SAMPLE_ZIP_FILE_URL, \
- FIGSHARE_TEST_ZIP_FILE_URL
+from freemocap.system.paths_and_filenames.file_and_folder_names import (
+ FIGSHARE_SAMPLE_ZIP_FILE_URL,
+ FIGSHARE_TEST_ZIP_FILE_URL,
+)
CREATE_NEW_RECORDING_ACTION_NAME = "New Recording"
LOAD_MOST_RECENT_RECORDING_ACTION_NAME = "Load Most Recent Recording"
@@ -46,11 +48,13 @@ class Actions:
self.download_sample_data_action = QAction(DOWNLOAD_SAMPLE_DATA_ACTION_NAME, parent=freemocap_main_window)
self.download_sample_data_action.triggered.connect(
- lambda: freemocap_main_window.download_data(download_url=FIGSHARE_SAMPLE_ZIP_FILE_URL))
+ lambda: freemocap_main_window.download_data(download_url=FIGSHARE_SAMPLE_ZIP_FILE_URL)
+ )
self.download_test_data_action = QAction(DOWNLOAD_TEST_DATA_ACTION_NAME, parent=freemocap_main_window)
self.download_test_data_action.triggered.connect(
- lambda: freemocap_main_window.download_data(download_url=FIGSHARE_TEST_ZIP_FILE_URL))
+ lambda: freemocap_main_window.download_data(download_url=FIGSHARE_TEST_ZIP_FILE_URL)
+ )
self.reset_to_defaults_action = QAction(RESET_TO_DEFAULTS_ACTION_NAME, parent=freemocap_main_window)
self.reset_to_defaults_action.triggered.connect(freemocap_main_window.reset_to_default_gui_settings)
diff --git a/freemocap/gui/qt/actions_and_menus/menu_bar.py b/freemocap/gui/qt/actions_and_menus/menu_bar.py
index 06901d57..00c51c72 100644
--- a/freemocap/gui/qt/actions_and_menus/menu_bar.py
+++ b/freemocap/gui/qt/actions_and_menus/menu_bar.py
@@ -1,4 +1,4 @@
-from PyQt6.QtWidgets import QMainWindow, QMenuBar
+from PySide6.QtWidgets import QMainWindow, QMenuBar
from freemocap.gui.qt.actions_and_menus.actions import Actions
@@ -60,7 +60,7 @@ class MenuBar(QMenuBar):
if __name__ == "__main__":
import sys
- from PyQt6.QtWidgets import QApplication, QLabel
+ from PySide6.QtWidgets import QApplication, QLabel
app = QApplication(sys.argv)
_main_window = QMainWindow()
diff --git a/freemocap/gui/qt/freemocap_main.py b/freemocap/gui/qt/freemocap_main.py
index 66a4fdbb..46cadd86 100644
--- a/freemocap/gui/qt/freemocap_main.py
+++ b/freemocap/gui/qt/freemocap_main.py
@@ -3,8 +3,8 @@ import signal
import sys
from pathlib import Path
-from PyQt6.QtCore import QTimer
-from PyQt6.QtWidgets import QApplication
+from PySide6.QtCore import QTimer
+from PySide6.QtWidgets import QApplication
from freemocap.gui.qt.main_window.freemocap_main_window import MainWindow, EXIT_CODE_REBOOT
diff --git a/freemocap/gui/qt/main_window/freemocap_main_window.py b/freemocap/gui/qt/main_window/freemocap_main_window.py
index 4263c0af..aa937aef 100644
--- a/freemocap/gui/qt/main_window/freemocap_main_window.py
+++ b/freemocap/gui/qt/main_window/freemocap_main_window.py
@@ -4,9 +4,9 @@ import shutil
from pathlib import Path
from typing import Union, List, Callable
-from PyQt6.QtCore import Qt, pyqtSlot
-from PyQt6.QtGui import QIcon
-from PyQt6.QtWidgets import (
+from PySide6.QtCore import Qt, Slot
+from PySide6.QtGui import QIcon
+from PySide6.QtWidgets import (
QApplication,
QDockWidget,
QMainWindow,
@@ -22,8 +22,9 @@ from skellycam import (
from tqdm import tqdm
from freemocap.core_processes.export_data.blender_stuff.export_to_blender.export_to_blender import export_to_blender
-from freemocap.core_processes.export_data.blender_stuff.get_best_guess_of_blender_path import \
- get_best_guess_of_blender_path
+from freemocap.core_processes.export_data.blender_stuff.get_best_guess_of_blender_path import (
+ get_best_guess_of_blender_path,
+)
from freemocap.data_layer.generate_jupyter_notebook.generate_jupyter_notebook import (
generate_jupyter_notebook,
)
@@ -65,6 +66,7 @@ from freemocap.gui.qt.widgets.import_videos_wizard import ImportVideosWizard
from freemocap.gui.qt.widgets.log_view_widget import LogViewWidget
from freemocap.gui.qt.widgets.welcome_screen_dialog import WelcomeScreenDialog
from freemocap.gui.qt.workers.download_sample_data_thread_worker import DownloadDataThreadWorker
+
# reboot GUI method based on this - https://stackoverflow.com/a/56563926/14662833
from freemocap.system.open_file import open_file
from freemocap.system.paths_and_filenames.file_and_folder_names import (
@@ -88,10 +90,10 @@ logger = logging.getLogger(__name__)
class MainWindow(QMainWindow):
def __init__(
- self,
- freemocap_data_folder_path: Union[str, Path],
- pipedream_pings: PipedreamPings,
- parent=None,
+ self,
+ freemocap_data_folder_path: Union[str, Path],
+ pipedream_pings: PipedreamPings,
+ parent=None,
):
super().__init__(parent=parent)
self._log_view_widget = LogViewWidget(parent=self) # start this first so it will grab the setup logs
@@ -186,8 +188,8 @@ class MainWindow(QMainWindow):
self._active_recording_info_widget.set_active_recording(recording_folder_path=folder_path)
if (
- self._controller_group_box.auto_process_videos_checked
- and self._controller_group_box.mocap_videos_radio_button_checked
+ self._controller_group_box.auto_process_videos_checked
+ and self._controller_group_box.mocap_videos_radio_button_checked
):
logger.info("'Auto process videos' checkbox is checked - triggering 'Process Motion Capture Data' button")
self._process_motion_capture_data_panel.process_motion_capture_data_button.click()
@@ -345,8 +347,8 @@ class MainWindow(QMainWindow):
)
if (
- self._controller_group_box.auto_open_in_blender_checked
- # or self._visualization_control_panel.open_in_blender_automatically_box_is_checked
+ self._controller_group_box.auto_open_in_blender_checked
+ # or self._visualization_control_panel.open_in_blender_automatically_box_is_checked
):
if Path(self._active_recording_info_widget.active_recording_info.blender_file_path).exists():
open_file(self._active_recording_info_widget.active_recording_info.blender_file_path)
@@ -495,21 +497,18 @@ class MainWindow(QMainWindow):
self._welcome_screen_dialog.exec()
- def download_data(self,
- download_url: str):
+ def download_data(self, download_url: str):
logger.info("Downloading sample data")
self.download_data_thread_worker = DownloadDataThreadWorker(dowload_url=download_url)
self.download_data_thread_worker.start()
self.download_data_thread_worker.finished.connect(self._handle_download_data_finished)
- @pyqtSlot(str)
+ @Slot(str)
def _handle_download_data_finished(self, downloaded_data_path: str):
logger.info("Setting downloaded data as active recording... ")
- self._active_recording_info_widget.set_active_recording(
- recording_folder_path=downloaded_data_path
- )
+ self._active_recording_info_widget.set_active_recording(recording_folder_path=downloaded_data_path)
- @pyqtSlot(list, str, bool)
+ @Slot(list, str, bool)
def _handle_import_videos(self, video_paths: List[str], folder_to_save_videos: str, synchronization_bool: bool):
folder_to_save_videos = Path(folder_to_save_videos)
folder_to_save_videos.mkdir(parents=True, exist_ok=True)
@@ -520,12 +519,12 @@ class MainWindow(QMainWindow):
if not synchronization_bool:
for video_path in tqdm(
- video_paths,
- desc="Importing videos...",
- colour=[255, 128, 0],
- unit="video",
- unit_scale=True,
- leave=False,
+ video_paths,
+ desc="Importing videos...",
+ colour=[255, 128, 0],
+ unit="video",
+ unit_scale=True,
+ leave=False,
):
if not Path(video_path).exists():
logger.error(f"{video_path} does not exist!")
diff --git a/freemocap/gui/qt/style_sheet/css_file_watcher.py b/freemocap/gui/qt/style_sheet/css_file_watcher.py
index a3279cb2..3e8580c4 100644
--- a/freemocap/gui/qt/style_sheet/css_file_watcher.py
+++ b/freemocap/gui/qt/style_sheet/css_file_watcher.py
@@ -2,8 +2,8 @@ import logging
from pathlib import Path
from typing import Union
-from PyQt6 import QtCore
-from PyQt6.QtCore import pyqtSlot, QFileSystemWatcher
+from PySide6 import QtCore
+from PySide6.QtCore import Slot, QFileSystemWatcher
logger = logging.getLogger(__name__)
@@ -15,7 +15,7 @@ class CSSFileWatcher(QFileSystemWatcher):
self.parent = parent
self.fileChanged.connect(self.file_changed)
- @pyqtSlot(str)
+ @Slot(str)
def file_changed(self, path: str):
logger.info(f"CSS file changed: {path} - updating MainWindow stylesheet")
diff --git a/freemocap/gui/qt/style_sheet/qt_style_sheet.css b/freemocap/gui/qt/style_sheet/qt_style_sheet.css
index 481f8dd2..0149b9f9 100644
--- a/freemocap/gui/qt/style_sheet/qt_style_sheet.css
+++ b/freemocap/gui/qt/style_sheet/qt_style_sheet.css
@@ -1,180 +1,219 @@
* {
- font-family: "Dosis", sans-serif;
- font-size: 14px;
- color: #333333; }
+ font-family: "Dosis", sans-serif;
+ font-size: 14px;
+ color: #333333;
+}
QObject {
- color: #1d1d1f;
- background-color: #f5f5f7; }
+ color: #1d1d1f;
+ background-color: #f5f5f7;
+}
QGroupBox {
- border: 1px solid #bdbdbd;
- border-radius: 4px;
- margin-top: 10px;
- font-weight: bold;
- background-color: #f5f5f5; }
+ border: 1px solid #bdbdbd;
+ border-radius: 4px;
+ margin-top: 10px;
+ font-weight: bold;
+ background-color: #f5f5f5;
+}
QStatusBar {
- color: #1d1d1f; }
+ color: #1d1d1f;
+}
QMainWindow {
- background-color: #e0e0e0; }
+ background-color: #e0e0e0;
+}
QTabWidget::pane {
- border: 1px solid #f5f5f7;
- background: #eeeeee;
- padding: 5px; }
+ border: 1px solid #f5f5f7;
+ background: #eeeeee;
+ padding: 5px;
+}
QTabWidget::pane::selection {
- border-top: 1px solid #333333; }
+ border-top: 1px solid #333333;
+}
QTabBar::tab {
- border: 1px solid #1d1d1f;
- padding: 5px;
- padding-right: 15px;
- padding-left: 15px;
- color: #1d1d1f;
- border-top-left-radius: 20px;
- border-top-right-radius: 5px;
- background: #f5f5f7;
- margin-bottom: -5px;
- font-weight: bolder;
- font-size: 16px; }
+ border: 1px solid #1d1d1f;
+ padding: 5px;
+ padding-right: 15px;
+ padding-left: 15px;
+ color: #1d1d1f;
+ border-top-left-radius: 20px;
+ border-top-right-radius: 5px;
+ background: #f5f5f7;
+ margin-bottom: -5px;
+ font-weight: bolder;
+ font-size: 16px;
+}
QTabBar::tab:selected,
QTabBar::tab:hover {
- background: #424242;
- color: #f5f5f7;
- border-color: #1d1d1f; }
+ background: #424242;
+ color: #f5f5f7;
+ border-color: #1d1d1f;
+}
QPushButton {
- border-radius: 10px;
- color: #1d1d1f;
- border: 2px solid #67bcc0;
- background-color: #dbeef0;
- color: #1d1d1f;
- padding: 5px; }
+ border-radius: 10px;
+ color: #1d1d1f;
+ border: 2px solid #67bcc0;
+ background-color: #dbeef0;
+ color: #1d1d1f;
+ padding: 5px;
+}
QPushButton:disabled {
- background-color: #eeeeee;
- border: 2px solid #9e9e9e;
- color: #333333; }
+ background-color: #eeeeee;
+ border: 2px solid #9e9e9e;
+ color: #333333;
+}
QPushButton:hover {
- border: 2px solid #1d1d1f;
- background-color: #67bcc0; }
+ border: 2px solid #1d1d1f;
+ background-color: #67bcc0;
+}
QPushButton:pressed {
- background-color: #53d4dc; }
+ background-color: #53d4dc;
+}
QPushButton:pressed {
- background-color: #53d4dc; }
+ background-color: #53d4dc;
+}
QPushButton#start_recording_button {
- font-size: 16px;
- background-color: #ce7076;
- border: 2px solid #333333;
- padding: 10px;
- border-radius: 10px;
- width: 250px; }
+ font-size: 16px;
+ background-color: #ce7076;
+ border: 2px solid #333333;
+ padding: 10px;
+ border-radius: 10px;
+ width: 250px;
+}
QPushButton#start_recording_button:hover {
- border: 2px solid #cb2c34; }
+ border: 2px solid #cb2c34;
+}
QPushButton#start_recording_button:disabled {
- background-color: #8c7474;
- color: #555555; }
+ background-color: #8c7474;
+ color: #555555;
+}
QPushButton#stop_recording_button {
- font-size: 14px;
- background-color: #eeeeee; }
+ font-size: 14px;
+ background-color: #eeeeee;
+}
QPushButton#stop_recording_button:enabled {
- border: 3px solid #d95158;
- background-color: #eeeeee; }
+ border: 3px solid #d95158;
+ background-color: #eeeeee;
+}
QPushButton#stop_recording_button:hover {
- border: 3px solid #1d1d1f;
- background-color: #eeeeee; }
+ border: 3px solid #1d1d1f;
+ background-color: #eeeeee;
+}
QPushButton#stop_recording_button:disabled {
- color: #555555; }
+ color: #555555;
+}
QPushButton#process_motion_capture_button,
QPushButton#export_to_blender_button {
- font-size: 18px;
- background-color: #67bcc0;
- border: 2px solid #333333; }
+ font-size: 18px;
+ background-color: #67bcc0;
+ border: 2px solid #333333;
+}
QPushButton#process_motion_capture_button:hover,
QPushButton#export_to_blender_button:hover {
- border: 2px solid #398588; }
+ border: 2px solid #398588;
+}
WelcomeScreenButton {
- border: 2px solid #333333;
- background-color: #67bcc0;
- color: #1d1d1f;
- font-size: 24px;
- border-radius: 20px;
- padding: 10px;
- min-height: auto; }
+ border: 2px solid #333333;
+ background-color: #67bcc0;
+ color: #1d1d1f;
+ font-size: 24px;
+ border-radius: 20px;
+ padding: 10px;
+ min-height: auto;
+}
WelcomeScreenButton:hover {
- border: 2px solid #398588; }
+ border: 2px solid #398588;
+}
WelcomeScreenButton[recommended_next=true] {
- background-color: #d95158;
- color: #f5f5f7; }
+ background-color: #d95158;
+ color: #f5f5f7;
+}
WelcomeScreenButton[recommended_next=true]:hover {
- border: 2px solid #a1232a; }
+ border: 2px solid #a1232a;
+}
QLabel {
- font-size: 14px;
- color: #333333; }
- QTreeView QLabel {
- color: #1d1d1f; }
+ font-size: 14px;
+ color: #333333;
+}
+
+QTreeView QLabel {
+ color: #1d1d1f;
+}
QLabel:disabled {
- color: #e0e0e0; }
+ color: #e0e0e0;
+}
QLineEdit {
- border: 1px solid #333333;
- border-radius: 4px;
- padding: 0 8px;
- color: #333333;
- background-color: #f5f5f7; }
+ border: 1px solid #333333;
+ border-radius: 4px;
+ padding: 0 8px;
+ color: #333333;
+ background-color: #f5f5f7;
+}
QLineEdit:disabled {
- border: 1px solid #bdbdbd;
- color: #333333;
- background-color: #e0e0e0; }
+ border: 1px solid #bdbdbd;
+ color: #333333;
+ background-color: #e0e0e0;
+}
QTreeView {
- background-color: #eeeeee;
- color: #1d1d1f;
- font-family: "Roboto", sans-serif;
- font-size: 12px; }
+ background-color: #eeeeee;
+ color: #1d1d1f;
+ font-family: "Roboto", sans-serif;
+ font-size: 12px;
+}
QTreeView::item:has-children {
- background-color: #e0e0e0;
- color: #1d1d1f;
- border-bottom: 1px solid #bdbdbd; }
+ background-color: #e0e0e0;
+ color: #1d1d1f;
+ border-bottom: 1px solid #bdbdbd;
+}
QTreeView::item:selected,
QTreeView::item:hover {
- background-color: #f6e0f5;
- color: #333333; }
+ background-color: #f6e0f5;
+ color: #333333;
+}
LogViewWidget {
- background-color: #263238;
- color: #f5f5f7;
- font-family: "Roboto", sans-serif;
- font-size: 12px;
- padding: 8px; }
+ background-color: #263238;
+ color: #f5f5f7;
+ font-family: "Roboto", sans-serif;
+ font-size: 12px;
+ padding: 8px;
+}
QDialog {
- background-color: #f5f5f5; }
+ background-color: #f5f5f5;
+}
QListWidget {
- background-color: #f5f5f5; }
+ background-color: #f5f5f5;
+}
diff --git a/freemocap/gui/qt/style_sheet/qt_style_sheet.scss b/freemocap/gui/qt/style_sheet/qt_style_sheet.scss
index e2872585..e5ce6926 100644
--- a/freemocap/gui/qt/style_sheet/qt_style_sheet.scss
+++ b/freemocap/gui/qt/style_sheet/qt_style_sheet.scss
@@ -24,214 +24,223 @@ $divider-color: #bdbdbd;
$disabled-line-edit: #e0e0e0;
* {
- font-family: "Dosis", sans-serif;
- font-size: 14px;
- color: $dark-charcoal;
+ font-family: "Dosis", sans-serif;
+ font-size: 14px;
+ color: $dark-charcoal;
}
QObject {
- color: $plain-black;
- background-color: $plain-white;
+ color: $plain-black;
+ background-color: $plain-white;
}
QGroupBox {
- border: 1px solid $divider-color;
- border-radius: 4px;
- margin-top: 10px;
- font-weight: bold;
- background-color: $accent-background;
+ border: 1px solid $divider-color;
+ border-radius: 4px;
+ margin-top: 10px;
+ font-weight: bold;
+ background-color: $accent-background;
}
QStatusBar {
- color: $plain-black;
+ color: $plain-black;
}
QMainWindow {
- background-color: $dark-background;
+ background-color: $dark-background;
}
QTabWidget::pane {
- border: 1px solid $plain-white;
- background: $background;
- padding: 5px;
+ border: 1px solid $plain-white;
+ background: $background;
+ padding: 5px;
}
+
QTabWidget::pane::selection {
- border-top: 1px solid $dark-charcoal;
+ border-top: 1px solid $dark-charcoal;
}
+
QTabBar::tab {
- border: 1px solid $plain-black;
- padding: 5px;
- padding-right: 15px;
- padding-left: 15px;
- color: $plain-black;
- border-top-left-radius: 20px;
- border-top-right-radius: 5px;
- background: $plain-white;
- margin-bottom: -5px;
- font-weight: bolder;
- font-size: 16px;
+ border: 1px solid $plain-black;
+ padding: 5px;
+ padding-right: 15px;
+ padding-left: 15px;
+ color: $plain-black;
+ border-top-left-radius: 20px;
+ border-top-right-radius: 5px;
+ background: $plain-white;
+ margin-bottom: -5px;
+ font-weight: bolder;
+ font-size: 16px;
}
QTabBar::tab:selected,
QTabBar::tab:hover {
- background: $active-element;
- color: $plain-white;
- border-color: $plain-black;
+ background: $active-element;
+ color: $plain-white;
+ border-color: $plain-black;
}
QPushButton {
- border-radius: 10px;
- color: $plain-black;
- border: 2px solid $primary-button;
- background-color: #dbeef0;
- color: $plain-black;
- padding: 5px;
+ border-radius: 10px;
+ color: $plain-black;
+ border: 2px solid $primary-button;
+ background-color: #dbeef0;
+ color: $plain-black;
+ padding: 5px;
}
QPushButton:disabled {
- background-color: $background;
- border: 2px solid $disabled-button;
- color: $dark-charcoal;
+ background-color: $background;
+ border: 2px solid $disabled-button;
+ color: $dark-charcoal;
}
QPushButton:hover {
- border: 2px solid $plain-black;
- background-color: $primary-button;
+ border: 2px solid $plain-black;
+ background-color: $primary-button;
}
QPushButton:pressed {
- background-color: darken($secondary-button, 20%);
+ background-color: darken($secondary-button, 20%);
}
QPushButton:pressed {
- background-color: darken($secondary-button, 20%);
+ background-color: darken($secondary-button, 20%);
}
QPushButton#start_recording_button {
- font-size: 16px;
- background-color: $recording-button-red;
- border: 2px solid $dark-charcoal;
- padding: 10px;
- border-radius: 10px;
- width:250px;
+ font-size: 16px;
+ background-color: $recording-button-red;
+ border: 2px solid $dark-charcoal;
+ padding: 10px;
+ border-radius: 10px;
+ width: 250px;
}
+
QPushButton#start_recording_button:hover {
- border: 2px solid darken($laser-red, 10%);
+ border: 2px solid darken($laser-red, 10%);
}
+
QPushButton#start_recording_button:disabled {
- background-color: $disabled-laser-red;
- color: $disabled-text;
+ background-color: $disabled-laser-red;
+ color: $disabled-text;
}
QPushButton#stop_recording_button {
- font-size: 14px;
- background-color: $background;
+ font-size: 14px;
+ background-color: $background;
}
+
QPushButton#stop_recording_button:enabled {
- border: 3px solid $laser-red;
- background-color: $background;
+ border: 3px solid $laser-red;
+ background-color: $background;
}
+
QPushButton#stop_recording_button:hover {
- border: 3px solid $plain-black;
- background-color: $background;
+ border: 3px solid $plain-black;
+ background-color: $background;
}
+
QPushButton#stop_recording_button:disabled {
- color: $disabled-text;
+ color: $disabled-text;
}
+
QPushButton#process_motion_capture_button,
QPushButton#export_to_blender_button {
- font-size: 18px;
- background-color: $primary-button;
- border: 2px solid $dark-charcoal;
+ font-size: 18px;
+ background-color: $primary-button;
+ border: 2px solid $dark-charcoal;
}
QPushButton#process_motion_capture_button:hover,
QPushButton#export_to_blender_button:hover {
- border: 2px solid darken($primary-button, 20%);
+ border: 2px solid darken($primary-button, 20%);
}
WelcomeScreenButton {
- border: 2px solid $dark-charcoal;
- background-color: $primary-button;
- color: $plain-black;
- font-size: 24px;
- border-radius: 20px;
- padding: 10px;
- min-height: auto;
+ border: 2px solid $dark-charcoal;
+ background-color: $primary-button;
+ color: $plain-black;
+ font-size: 24px;
+ border-radius: 20px;
+ padding: 10px;
+ min-height: auto;
}
WelcomeScreenButton:hover {
- border: 2px solid darken($primary-button, 20%);
+ border: 2px solid darken($primary-button, 20%);
}
WelcomeScreenButton[recommended_next = true] {
- background-color: $laser-red;
- color: $plain-white;
+ background-color: $laser-red;
+ color: $plain-white;
}
WelcomeScreenButton[recommended_next = true]:hover {
- border: 2px solid darken($laser-red, 20%);
+ border: 2px solid darken($laser-red, 20%);
}
QLabel {
- font-size: 14px;
- color: $dark-charcoal;
-
+ font-size: 14px;
+ color: $dark-charcoal;
+
- QTreeView & {
- color: $plain-black;
+ QTreeView & {
+ color: $plain-black;
}
}
QLabel:disabled {
- color: $dark-background
+ color: $dark-background
}
QLineEdit {
- border: 1px solid $dark-charcoal;
- border-radius: 4px;
- padding: 0 8px;
- color: $dark-charcoal;
- background-color: $plain-white;
+ border: 1px solid $dark-charcoal;
+ border-radius: 4px;
+ padding: 0 8px;
+ color: $dark-charcoal;
+ background-color: $plain-white;
}
+
QLineEdit:disabled {
- border: 1px solid $divider-color;
- color: $dark-charcoal;
- background-color: $disabled-line-edit;
+ border: 1px solid $divider-color;
+ color: $dark-charcoal;
+ background-color: $disabled-line-edit;
}
QTreeView {
- background-color: $tree-primary;
- color: $plain-black;
- font-family: "Roboto", sans-serif;
- font-size: 12px;
+ background-color: $tree-primary;
+ color: $plain-black;
+ font-family: "Roboto", sans-serif;
+ font-size: 12px;
}
QTreeView::item:has-children {
- background-color: $tree-secondary;
- color: $plain-black;
- border-bottom: 1px solid $divider-color;
+ background-color: $tree-secondary;
+ color: $plain-black;
+ border-bottom: 1px solid $divider-color;
}
QTreeView::item:selected,
-QTreeView::item:hover{
- background-color: $tree-selected;
- color: $dark-charcoal;
+QTreeView::item:hover {
+ background-color: $tree-selected;
+ color: $dark-charcoal;
}
LogViewWidget {
- background-color: $terminal-background;
- color: $plain-white;
- font-family: "Roboto", sans-serif;
- font-size: 12px;
- padding: 8px;
+ background-color: $terminal-background;
+ color: $plain-white;
+ font-family: "Roboto", sans-serif;
+ font-size: 12px;
+ padding: 8px;
}
QDialog {
- background-color: $accent-background;
+ background-color: $accent-background;
}
QListWidget {
- background-color: $accent-background;
+ background-color: $accent-background;
}
diff --git a/freemocap/gui/qt/style_sheet/scss_file_watcher.py b/freemocap/gui/qt/style_sheet/scss_file_watcher.py
index d882af8a..6a865dcc 100644
--- a/freemocap/gui/qt/style_sheet/scss_file_watcher.py
+++ b/freemocap/gui/qt/style_sheet/scss_file_watcher.py
@@ -2,8 +2,8 @@ import logging
from pathlib import Path
from typing import Union
-from PyQt6 import QtCore
-from PyQt6.QtCore import pyqtSlot, QFileSystemWatcher
+from PySide6 import QtCore
+from PySide6.QtCore import Slot, QFileSystemWatcher
from freemocap.gui.qt.style_sheet.compile_scss_to_css import compile_scss_to_css
@@ -19,7 +19,7 @@ class SCSSFileWatcher(QFileSystemWatcher):
self.path_to_css_file = str(path_to_css_file)
self.fileChanged.connect(self.file_changed)
- @pyqtSlot(str)
+ @Slot(str)
def file_changed(self, path: str):
logger.info(f"SCSS file changed: {path} - running compile_scss_to_css")
diff --git a/freemocap/gui/qt/style_sheet/set_css_style_sheet.py b/freemocap/gui/qt/style_sheet/set_css_style_sheet.py
index 0d37f7b6..600b66bb 100644
--- a/freemocap/gui/qt/style_sheet/set_css_style_sheet.py
+++ b/freemocap/gui/qt/style_sheet/set_css_style_sheet.py
@@ -1,7 +1,7 @@
from pathlib import Path
from typing import Union
-from PyQt6.QtWidgets import QWidget
+from PySide6.QtWidgets import QWidget
def apply_css_style_sheet(qt_widget: QWidget, path_to_css_file: Union[str, Path]):
diff --git a/freemocap/gui/qt/utilities/get_qt_app.py b/freemocap/gui/qt/utilities/get_qt_app.py
index 0035bd5e..ab0bba7a 100644
--- a/freemocap/gui/qt/utilities/get_qt_app.py
+++ b/freemocap/gui/qt/utilities/get_qt_app.py
@@ -1,4 +1,4 @@
-from PyQt6.QtWidgets import QApplication
+from PySide6.QtWidgets import QApplication
from pyqtgraph import mkQApp
APP = None
diff --git a/freemocap/gui/qt/utilities/save_and_load_gui_state.py b/freemocap/gui/qt/utilities/save_and_load_gui_state.py
index dd938d81..f6283b76 100644
--- a/freemocap/gui/qt/utilities/save_and_load_gui_state.py
+++ b/freemocap/gui/qt/utilities/save_and_load_gui_state.py
@@ -1,4 +1,5 @@
import json
+
from pydantic import BaseModel
diff --git a/freemocap/gui/qt/widgets/active_recording_widget.py b/freemocap/gui/qt/widgets/active_recording_widget.py
index 4ee2f8b1..44a96e0a 100644
--- a/freemocap/gui/qt/widgets/active_recording_widget.py
+++ b/freemocap/gui/qt/widgets/active_recording_widget.py
@@ -2,8 +2,8 @@ import logging
from pathlib import Path
from typing import Union
-from PyQt6.QtCore import pyqtSignal, QFileSystemWatcher
-from PyQt6.QtWidgets import QApplication, QVBoxLayout, QWidget
+from PySide6.QtCore import Signal, QFileSystemWatcher
+from PySide6.QtWidgets import QApplication, QVBoxLayout, QWidget
from pyqtgraph.parametertree import Parameter, ParameterTree
from freemocap.data_layer.recording_models.recording_info_model import (
@@ -15,7 +15,7 @@ logger = logging.getLogger(__name__)
class ActiveRecordingInfoWidget(QWidget):
- new_active_recording_selected_signal = pyqtSignal(RecordingInfoModel)
+ new_active_recording_selected_signal = Signal(RecordingInfoModel)
def __init__(
self,
diff --git a/freemocap/gui/qt/widgets/camera_controller_group_box.py b/freemocap/gui/qt/widgets/camera_controller_group_box.py
index 8aa758f6..a8b9513f 100644
--- a/freemocap/gui/qt/widgets/camera_controller_group_box.py
+++ b/freemocap/gui/qt/widgets/camera_controller_group_box.py
@@ -1,7 +1,8 @@
import logging
from pathlib import Path
-from PyQt6.QtCore import Qt
-from PyQt6.QtWidgets import (
+
+from PySide6.QtCore import Qt
+from PySide6.QtWidgets import (
QGroupBox,
QVBoxLayout,
QHBoxLayout,
diff --git a/freemocap/gui/qt/widgets/central_tab_widget.py b/freemocap/gui/qt/widgets/central_tab_widget.py
index 71d7af03..e27d26a6 100644
--- a/freemocap/gui/qt/widgets/central_tab_widget.py
+++ b/freemocap/gui/qt/widgets/central_tab_widget.py
@@ -1,7 +1,7 @@
import logging
-from PyQt6.QtCore import Qt
-from PyQt6.QtWidgets import QTabWidget, QVBoxLayout, QWidget, QLabel
+from PySide6.QtCore import Qt
+from PySide6.QtWidgets import QVBoxLayout, QWidget, QLabel, QTabWidget
# from skelly_viewer import SkellyViewer
from skellycam import SkellyCamWidget
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 63d0a509..4ee6a83b 100644
--- a/freemocap/gui/qt/widgets/control_panel/calibration_control_panel.py
+++ b/freemocap/gui/qt/widgets/control_panel/calibration_control_panel.py
@@ -3,9 +3,9 @@ import os
import threading
from typing import Callable
-from PyQt6.QtCore import Qt
-from PyQt6.QtGui import QDoubleValidator
-from PyQt6.QtWidgets import (
+from PySide6.QtCore import Qt
+from PySide6.QtGui import QDoubleValidator
+from PySide6.QtWidgets import (
QFileDialog,
QFormLayout,
QLabel,
@@ -22,7 +22,6 @@ from freemocap.gui.qt.utilities.save_and_load_gui_state import GuiState, save_gu
from freemocap.gui.qt.workers.anipose_calibration_thread_worker import (
AniposeCalibrationThreadWorker,
)
-
from freemocap.system.paths_and_filenames.path_getters import (
get_gui_state_json_path,
get_last_successful_calibration_toml_path,
@@ -302,7 +301,7 @@ class CalibrationControlPanel(QWidget):
if __name__ == "__main__":
- from PyQt6.QtWidgets import QApplication
+ from PySide6.QtWidgets import QApplication
import sys
app = QApplication(sys.argv)
diff --git a/freemocap/gui/qt/widgets/control_panel/control_panel_dock_widget.py b/freemocap/gui/qt/widgets/control_panel/control_panel_dock_widget.py
index 2f51280c..60632880 100644
--- a/freemocap/gui/qt/widgets/control_panel/control_panel_dock_widget.py
+++ b/freemocap/gui/qt/widgets/control_panel/control_panel_dock_widget.py
@@ -1,5 +1,5 @@
-from PyQt6.QtCore import Qt
-from PyQt6.QtWidgets import (
+from PySide6.QtCore import Qt
+from PySide6.QtWidgets import (
QDockWidget,
QVBoxLayout,
QWidget,
diff --git a/freemocap/gui/qt/widgets/control_panel/export_data_control_panel.py b/freemocap/gui/qt/widgets/control_panel/export_data_control_panel.py
index 1e541022..f77251c7 100644
--- a/freemocap/gui/qt/widgets/control_panel/export_data_control_panel.py
+++ b/freemocap/gui/qt/widgets/control_panel/export_data_control_panel.py
@@ -2,8 +2,8 @@ import logging
from pathlib import Path
from typing import Union
-from PyQt6.QtCore import Qt
-from PyQt6.QtWidgets import (
+from PySide6.QtCore import Qt
+from PySide6.QtWidgets import (
QGroupBox,
QVBoxLayout,
QPushButton,
@@ -49,7 +49,9 @@ class VisualizationControlPanel(QWidget):
self._use_ajc27_method_radio_button.setChecked(True)
groupbox.layout().addWidget(self._use_ajc27_method_radio_button)
- self._use_alpha_megascript_take2_method_radio_button = QRadioButton("Use `alpha_megascript_take2` method (Legacy)")
+ self._use_alpha_megascript_take2_method_radio_button = QRadioButton(
+ "Use `alpha_megascript_take2` method (Legacy)"
+ )
groupbox.layout().addWidget(self._use_alpha_megascript_take2_method_radio_button)
#
# self._use_alpha_megascript_method_radio_button = QRadioButton("Use `alpha_megascript` method (Deprecated)")
diff --git a/freemocap/gui/qt/widgets/control_panel/process_mocap_data_panel/parameter_groups/create_parameter_groups.py b/freemocap/gui/qt/widgets/control_panel/process_mocap_data_panel/parameter_groups/create_parameter_groups.py
index 4ccceaaa..7d38f632 100644
--- a/freemocap/gui/qt/widgets/control_panel/process_mocap_data_panel/parameter_groups/create_parameter_groups.py
+++ b/freemocap/gui/qt/widgets/control_panel/process_mocap_data_panel/parameter_groups/create_parameter_groups.py
@@ -8,7 +8,6 @@ from freemocap.data_layer.recording_models.post_processing_parameter_models impo
ButterworthFilterParametersModel,
)
-
BUTTERWORTH_ORDER = "Order"
BUTTERWORTH_CUTOFF_FREQUENCY = "Cutoff Frequency"
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 58970c16..56c21f5b 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
@@ -4,9 +4,9 @@ import threading
from pathlib import Path
from typing import Callable
-from PyQt6.QtCore import pyqtSignal, pyqtSlot, Qt
-from PyQt6.QtGui import QFont
-from PyQt6.QtWidgets import QPushButton, QVBoxLayout, QWidget, QGroupBox
+from PySide6.QtCore import Signal, Slot, Qt
+from PySide6.QtGui import QFont
+from PySide6.QtWidgets import QPushButton, QVBoxLayout, QWidget, QGroupBox
from pyqtgraph.parametertree import Parameter, ParameterTree
from freemocap.data_layer.recording_models.post_processing_parameter_models import (
@@ -32,7 +32,7 @@ logger = logging.getLogger(__name__)
class ProcessMotionCaptureDataPanel(QWidget):
- processing_finished_signal = pyqtSignal()
+ processing_finished_signal = Signal()
def __init__(
self,
@@ -251,14 +251,14 @@ class ProcessMotionCaptureDataPanel(QWidget):
self._process_motion_capture_data_thread_worker.finished.connect(self._handle_finished_signal)
- @pyqtSlot()
+ @Slot()
def _handle_finished_signal(self):
logger.debug("Process motion capture data process finished.")
self.processing_finished_signal.emit()
if __name__ == "__main__":
- from PyQt6.QtWidgets import QApplication
+ from PySide6.QtWidgets import QApplication
import sys
app = QApplication(sys.argv)
diff --git a/freemocap/gui/qt/widgets/control_panel_dock_widget.py b/freemocap/gui/qt/widgets/control_panel_dock_widget.py
index 126ed2db..9aab3c8e 100644
--- a/freemocap/gui/qt/widgets/control_panel_dock_widget.py
+++ b/freemocap/gui/qt/widgets/control_panel_dock_widget.py
@@ -1,5 +1,5 @@
-from PyQt6.QtCore import Qt
-from PyQt6.QtWidgets import (
+from PySide6.QtCore import Qt
+from PySide6.QtWidgets import (
QDockWidget,
QLabel,
QSplitter,
diff --git a/freemocap/gui/qt/widgets/directory_view_widget.py b/freemocap/gui/qt/widgets/directory_view_widget.py
index a3b5f96c..8a53e575 100644
--- a/freemocap/gui/qt/widgets/directory_view_widget.py
+++ b/freemocap/gui/qt/widgets/directory_view_widget.py
@@ -3,9 +3,8 @@ from copy import copy
from pathlib import Path
from typing import Union, Callable
-from PyQt6.QtCore import pyqtSignal, Qt
-from PyQt6.QtGui import QFileSystemModel
-from PyQt6.QtWidgets import QLabel, QMenu, QTreeView, QVBoxLayout, QWidget, QPushButton
+from PySide6.QtCore import Signal, Qt
+from PySide6.QtWidgets import QLabel, QMenu, QTreeView, QVBoxLayout, QWidget, QPushButton, QFileSystemModel
from qtpy import QtGui
from freemocap.system.open_file import open_file
@@ -15,7 +14,7 @@ logger = logging.getLogger(__name__)
class DirectoryViewWidget(QWidget):
- new_active_recording_selected_signal = pyqtSignal(str)
+ new_active_recording_selected_signal = Signal(str)
def __init__(self, top_level_folder_path: Union[str, Path], get_active_recording_info_callable: Callable):
self._root_folder = None
@@ -141,7 +140,7 @@ class DirectoryViewWidget(QWidget):
if __name__ == "__main__":
import sys
- from PyQt6.QtWidgets import QApplication
+ from PySide6.QtWidgets import QApplication
app = QApplication(sys.argv)
directory_view_widget = DirectoryViewWidget(top_level_folder_path=Path.home())
diff --git a/freemocap/gui/qt/widgets/home_widget.py b/freemocap/gui/qt/widgets/home_widget.py
index ae6b02b9..2ed497e0 100644
--- a/freemocap/gui/qt/widgets/home_widget.py
+++ b/freemocap/gui/qt/widgets/home_widget.py
@@ -2,8 +2,8 @@ import logging
from typing import Union
import requests
-from PyQt6.QtCore import Qt
-from PyQt6.QtWidgets import (
+from PySide6.QtCore import Qt
+from PySide6.QtWidgets import (
QCheckBox,
QLabel,
QPushButton,
@@ -22,7 +22,6 @@ from freemocap.gui.qt.actions_and_menus.actions import (
)
from freemocap.gui.qt.utilities.save_and_load_gui_state import GuiState, save_gui_state
from freemocap.gui.qt.widgets.logo_svg_widget import LogoSvgWidget
-
from freemocap.system.paths_and_filenames.file_and_folder_names import PATH_TO_FREEMOCAP_LOGO_SVG
from freemocap.system.paths_and_filenames.path_getters import get_gui_state_json_path
diff --git a/freemocap/gui/qt/widgets/import_videos_wizard.py b/freemocap/gui/qt/widgets/import_videos_wizard.py
index fb32c5e2..01a8bc96 100644
--- a/freemocap/gui/qt/widgets/import_videos_wizard.py
+++ b/freemocap/gui/qt/widgets/import_videos_wizard.py
@@ -1,12 +1,11 @@
import logging
-from pathlib import Path
import threading
+from pathlib import Path
from typing import Union
-from skelly_synchronize import create_audio_debug_plots, create_brightness_debug_plots
-from PyQt6.QtCore import pyqtSignal
-from PyQt6.QtGui import QFileSystemModel, QDoubleValidator
-from PyQt6.QtWidgets import (
+from PySide6.QtCore import Signal
+from PySide6.QtGui import QDoubleValidator
+from PySide6.QtWidgets import (
QVBoxLayout,
QHBoxLayout,
QListWidget,
@@ -20,23 +19,23 @@ from PyQt6.QtWidgets import (
QButtonGroup,
QRadioButton,
QWidget,
+ QFileSystemModel,
)
+from skelly_synchronize import create_audio_debug_plots, create_brightness_debug_plots
from freemocap.gui.qt.workers.synchronize_videos_thread_worker import SynchronizeVideosThreadWorker
-
-from freemocap.utilities.get_video_paths import get_video_paths
from freemocap.system.open_file import open_file
from freemocap.system.paths_and_filenames.file_and_folder_names import SYNCHRONIZED_VIDEOS_FOLDER_NAME
from freemocap.system.paths_and_filenames.path_getters import get_recording_session_folder_path
+from freemocap.utilities.get_video_paths import get_video_paths
no_files_found_string = "No '.mp4' video files found! \n \n Note - We only look for `.mp4` files (for now). If your videos are a different format, convert them to `mp4` via online tools like `www.cloudconvert.com`, or softwares like `HandBrake`, `ffmpeg` or any video editing software"
-
logger = logging.getLogger(__name__)
class ImportVideosWizard(QDialog):
- folder_to_save_videos_to_selected = pyqtSignal(list, str, bool)
+ folder_to_save_videos_to_selected = Signal(list, str, bool)
def __init__(self, import_videos_path: Union[str, Path], kill_thread_event: threading.Event, parent=None):
super().__init__(parent=parent)
@@ -226,7 +225,7 @@ class ImportVideosWizard(QDialog):
if __name__ == "__main__":
- # from PyQt6.QtWidgets import QApplication
+ # from PySide6.QtWidgets import QApplication
# import sys
#
# app = QApplication(sys.argv)
diff --git a/freemocap/gui/qt/widgets/jupyter_console_widget.py b/freemocap/gui/qt/widgets/jupyter_console_widget.py
index 7cb02ca4..36e6d917 100644
--- a/freemocap/gui/qt/widgets/jupyter_console_widget.py
+++ b/freemocap/gui/qt/widgets/jupyter_console_widget.py
@@ -1,6 +1,6 @@
import logging
-from PyQt6.QtWidgets import QVBoxLayout, QWidget
+from PySide6.QtWidgets import QVBoxLayout, QWidget
from qtconsole.manager import QtKernelManager
from qtconsole.rich_jupyter_widget import RichJupyterWidget
@@ -82,7 +82,7 @@ if __name__ == "__main__":
configure_logging()
logger.info("Hello world!")
- from PyQt6.QtWidgets import QApplication
+ from PySide6.QtWidgets import QApplication
app = QApplication([])
diff --git a/freemocap/gui/qt/widgets/log_view_widget.py b/freemocap/gui/qt/widgets/log_view_widget.py
index 09e8cd1b..82db81e8 100644
--- a/freemocap/gui/qt/widgets/log_view_widget.py
+++ b/freemocap/gui/qt/widgets/log_view_widget.py
@@ -4,9 +4,9 @@ import threading
from logging.handlers import QueueHandler
from queue import Queue
-from PyQt6 import QtCore
-from PyQt6.QtCore import QThread
-from PyQt6.QtWidgets import QApplication, QPlainTextEdit
+from PySide6 import QtCore
+from PySide6.QtCore import QThread
+from PySide6.QtWidgets import QApplication, QPlainTextEdit
from freemocap.gui.qt.utilities.colors import get_next_color, rgb_color_generator
from freemocap.system.logging.configure_logging import log_view_logging_format_string
@@ -28,7 +28,7 @@ code_path_colors = {}
class LoggingQueueListener(QThread):
- log_message_signal = QtCore.pyqtSignal(object)
+ log_message_signal = QtCore.Signal(object)
def __init__(self, logging_queue: Queue, exit_event: threading.Event, parent=None):
super().__init__(parent)
diff --git a/freemocap/gui/qt/widgets/logo_svg_widget.py b/freemocap/gui/qt/widgets/logo_svg_widget.py
index 9e2f6d46..aeab04e9 100644
--- a/freemocap/gui/qt/widgets/logo_svg_widget.py
+++ b/freemocap/gui/qt/widgets/logo_svg_widget.py
@@ -1,6 +1,6 @@
-from PyQt6.QtSvgWidgets import QSvgWidget
-from PyQt6.QtWidgets import QSizePolicy
-from PyQt6.QtCore import Qt
+from PySide6.QtCore import Qt
+from PySide6.QtSvgWidgets import QSvgWidget
+from PySide6.QtWidgets import QSizePolicy
class LogoSvgWidget(QSvgWidget):
diff --git a/freemocap/gui/qt/widgets/welcome_screen_dialog.py b/freemocap/gui/qt/widgets/welcome_screen_dialog.py
index 690aaa68..738a1200 100644
--- a/freemocap/gui/qt/widgets/welcome_screen_dialog.py
+++ b/freemocap/gui/qt/widgets/welcome_screen_dialog.py
@@ -1,10 +1,11 @@
import threading
-from PyQt6.QtCore import Qt
-from PyQt6.QtWidgets import QVBoxLayout, QDialog, QCheckBox, QPushButton, QLabel, QHBoxLayout, QFrame
+
+from PySide6.QtCore import Qt
+from PySide6.QtWidgets import QVBoxLayout, QDialog, QCheckBox, QPushButton, QLabel, QHBoxLayout, QFrame
from freemocap.gui.qt.utilities.save_and_load_gui_state import GuiState, save_gui_state
-from freemocap.system.paths_and_filenames.path_getters import get_gui_state_json_path
from freemocap.system.paths_and_filenames.file_and_folder_names import SPARKLES_EMOJI_STRING
+from freemocap.system.paths_and_filenames.path_getters import get_gui_state_json_path
class WelcomeScreenDialog(QDialog):
diff --git a/freemocap/gui/qt/workers/anipose_calibration_thread_worker.py b/freemocap/gui/qt/workers/anipose_calibration_thread_worker.py
index b2615bd1..8fa33a53 100644
--- a/freemocap/gui/qt/workers/anipose_calibration_thread_worker.py
+++ b/freemocap/gui/qt/workers/anipose_calibration_thread_worker.py
@@ -3,7 +3,7 @@ import threading
from pathlib import Path
from typing import Union
-from PyQt6.QtCore import pyqtSignal, QThread
+from PySide6.QtCore import Signal, QThread
from freemocap.core_processes.capture_volume_calibration.charuco_stuff.charuco_board_definition import (
CharucoBoardDefinition,
@@ -16,8 +16,8 @@ logger = logging.getLogger(__name__)
class AniposeCalibrationThreadWorker(QThread):
- finished = pyqtSignal()
- in_progress = pyqtSignal(str)
+ finished = Signal()
+ in_progress = Signal(str)
def __init__(
self,
diff --git a/freemocap/gui/qt/workers/download_sample_data_thread_worker.py b/freemocap/gui/qt/workers/download_sample_data_thread_worker.py
index 61de28b0..71774b84 100644
--- a/freemocap/gui/qt/workers/download_sample_data_thread_worker.py
+++ b/freemocap/gui/qt/workers/download_sample_data_thread_worker.py
@@ -1,7 +1,7 @@
import logging
from pathlib import Path
-from PyQt6.QtCore import pyqtSignal, QThread
+from PySide6.QtCore import Signal, QThread
from freemocap.utilities.download_sample_data import download_sample_data
@@ -9,12 +9,10 @@ logger = logging.getLogger(__name__)
class DownloadDataThreadWorker(QThread):
- finished = pyqtSignal(str)
- in_progress = pyqtSignal(str)
+ finished = Signal(str)
+ in_progress = Signal(str)
- def __init__(self,
- dowload_url: str,
- parent=None):
+ def __init__(self, dowload_url: str, parent=None):
super().__init__(parent=parent)
logger.info("Initializing download sample data thread worker")
self.download_url = dowload_url
@@ -31,7 +29,7 @@ class DownloadDataThreadWorker(QThread):
logger.error(f"Could not find downloaded data at {downloaded_data_path}")
raise FileNotFoundError(f"Could not find downloaded data at {downloaded_data_path}")
- except Exception as e: # noqa
+ except Exception as e: # noqa
logger.exception(e)
logger.error(f"Error downloading sample data from {self._dowload_url}")
raise e
diff --git a/freemocap/gui/qt/workers/process_motion_capture_data_thread_worker.py b/freemocap/gui/qt/workers/process_motion_capture_data_thread_worker.py
index 9874779c..56fe5c87 100644
--- a/freemocap/gui/qt/workers/process_motion_capture_data_thread_worker.py
+++ b/freemocap/gui/qt/workers/process_motion_capture_data_thread_worker.py
@@ -3,10 +3,9 @@ import multiprocessing
import time
from pathlib import Path
-from PyQt6.QtCore import pyqtSignal, QThread
+from PySide6.QtCore import Signal, QThread
from freemocap.core_processes.process_motion_capture_videos.process_recording_folder import process_recording_folder
-
from freemocap.data_layer.recording_models.post_processing_parameter_models import PostProcessingParameterModel
from freemocap.system.paths_and_filenames.file_and_folder_names import RECORDING_PARAMETERS_JSON_FILE_NAME
from freemocap.utilities.save_dictionary_to_json import save_dictionary_to_json
@@ -15,8 +14,8 @@ logger = logging.getLogger(__name__)
class ProcessMotionCaptureDataThreadWorker(QThread):
- finished = pyqtSignal()
- in_progress = pyqtSignal(object)
+ finished = Signal()
+ in_progress = Signal(object)
def __init__(
self, post_processing_parameters: PostProcessingParameterModel, kill_event: multiprocessing.Event, parent=None
diff --git a/freemocap/gui/qt/workers/synchronize_videos_thread_worker.py b/freemocap/gui/qt/workers/synchronize_videos_thread_worker.py
index 2ec8beeb..37e9aa1c 100644
--- a/freemocap/gui/qt/workers/synchronize_videos_thread_worker.py
+++ b/freemocap/gui/qt/workers/synchronize_videos_thread_worker.py
@@ -2,16 +2,15 @@ import logging
import threading
from pathlib import Path
-from PyQt6.QtCore import pyqtSignal, QThread
-
+from PySide6.QtCore import Signal, QThread
from skelly_synchronize.skelly_synchronize import synchronize_videos_from_audio, synchronize_videos_from_brightness
logger = logging.getLogger(__name__)
class SynchronizeVideosThreadWorker(QThread):
- finished = pyqtSignal()
- in_progress = pyqtSignal(str)
+ finished = Signal()
+ in_progress = Signal(str)
def __init__(
self,
diff --git a/freemocap/system/logging/configure_logging.py b/freemocap/system/logging/configure_logging.py
index 1090cb4a..ee280973 100644
--- a/freemocap/system/logging/configure_logging.py
+++ b/freemocap/system/logging/configure_logging.py
@@ -7,9 +7,8 @@ from logging.config import dictConfig
from skellycam.system.environment.default_paths import get_log_file_path
# Suppress some annoying log messages
-logging.getLogger('tzlocal').setLevel(logging.WARNING)
-logging.getLogger('matplotlib').setLevel(logging.WARNING)
-
+logging.getLogger("tzlocal").setLevel(logging.WARNING)
+logging.getLogger("matplotlib").setLevel(logging.WARNING)
log_view_logging_format_string = "[%(asctime)s.%(msecs)04d] [%(levelname)4s] [%(name)s] [Process:%(process)d Thread:%(thread)d] ::::: [%(name)s:%(funcName)s():%(lineno)s] |||| %(message)s."
@@ -51,12 +50,8 @@ class CustomFormatter(logging.Formatter):
else:
raise TypeError("Invalid type for 'created'")
- date_format_with_microseconds = (
- "%Y-%m-%dT%H:%M:%S.%f" # Including microseconds with %f
- )
- return datetime.strftime(
- datetime.fromtimestamp(timestamp), date_format_with_microseconds
- )
+ date_format_with_microseconds = "%Y-%m-%dT%H:%M:%S.%f" # Including microseconds with %f
+ return datetime.strftime(datetime.fromtimestamp(timestamp), date_format_with_microseconds)
class LoggerBuilder:
@@ -69,9 +64,7 @@ class LoggerBuilder:
)
def __init__(self, level: LogLevel):
- self.default_logging_formatter = CustomFormatter(
- fmt=self.format_string, datefmt="%Y-%m-%dT%H:%M:%S"
- )
+ self.default_logging_formatter = CustomFormatter(fmt=self.format_string, datefmt="%Y-%m-%dT%H:%M:%S")
dictConfig(self.DEFAULT_LOGGING)
self._set_logging_level(level)
@@ -129,6 +122,7 @@ class LoggerBuilder:
logging.getLogger("").handlers.append(handler)
else:
from skellycam import logger
+
logger.info("Logging already configured")
@@ -140,11 +134,7 @@ def ensure_min_brightness(value, threshold=50):
def ensure_not_grey(r, g, b, threshold_diff=100):
"""Ensure that the color isn't desaturated grey by making one color component dominant."""
max_val = max(r, g, b)
- if (
- abs(r - g) < threshold_diff
- and abs(r - b) < threshold_diff
- and abs(g - b) < threshold_diff
- ):
+ if abs(r - g) < threshold_diff and abs(r - b) < threshold_diff and abs(g - b) < threshold_diff:
if max_val == r:
r = 255
elif max_val == g:
@@ -200,23 +190,17 @@ def log_test_messages(logger):
for iter in range(1, 10):
wait_time = iter / 10
print(f"Testing timestamps (round: {iter}:")
- logger.info(
- "Starting 1 sec timer (Δt should probably be near 0, unless you've got other stuff going on)"
- )
+ logger.info("Starting 1 sec timer (Δt should probably be near 0, unless you've got other stuff going on)")
tic = time.perf_counter_ns()
time.sleep(wait_time)
toc = time.perf_counter_ns()
elapsed_time = (toc - tic) / 1e9
- logger.info(
- f"Done {wait_time} sec timer - elapsed time:{elapsed_time} (Δt should be ~{wait_time}s)"
- )
+ logger.info(f"Done {wait_time} sec timer - elapsed time:{elapsed_time} (Δt should be ~{wait_time}s)")
if __name__ == "__main__":
-
from skellycam import logger
+
configure_logging(LogLevel.TRACE) # Setting the root logger level to TRACE
log_test_messages(logger)
- logger.success(
- "Logging setup and tests completed. Check the console output and the log file."
- )
+ logger.success("Logging setup and tests completed. Check the console output and the log file.")
diff --git a/freemocap/system/paths_and_filenames/path_getters.py b/freemocap/system/paths_and_filenames/path_getters.py
index 0b8a188a..4adb0b5f 100644
--- a/freemocap/system/paths_and_filenames/path_getters.py
+++ b/freemocap/system/paths_and_filenames/path_getters.py
@@ -5,7 +5,6 @@ from typing import Union
import toml
-
from freemocap.system.paths_and_filenames.file_and_folder_names import (
LOGS_INFO_AND_SETTINGS_FOLDER_NAME,
LOG_FILE_FOLDER_NAME,
diff --git a/poetry_pyproject.toml b/poetry_pyproject.toml
index e87a3c5c..d360199f 100644
--- a/poetry_pyproject.toml
+++ b/poetry_pyproject.toml
@@ -14,19 +14,19 @@ Issues = "https://github.com/freemocap/freemocap/issues"
Community_Discord = "https://discord.gg/uTvkkJnSff"
[tool.poetry.dependencies]
-python = ">=3.9,<3.12"
+python = ">=3.9,<3.12"
skellycam = "2023.9.1086"
-skelly_viewer = "2023.5.1019 "
-skellyforge = "2023.9.1004 "
+skelly_viewer = "2023.5.1019"
+skellyforge = "2023.9.1004"
skelly_synchronize = "2023.10.1027"
mediapipe = "^0.10.7"
-opencv-contrib-python="4.8.*"
-toml="0.10.2"
-aniposelib="0.4.3"
-libsass="0.21.0"
-ipykernel="6.23.1"
-plotly="^5.17.1"
-pydantic="1.*"
+opencv-contrib-python = "4.8.*"
+toml = "0.10.2"
+aniposelib = "0.4.3"
+libsass = "0.21.0"
+ipykernel = "6.23.1"
+plotly = "^5.17.1"
+pydantic = "1.*"
packaging = "^23.2"
ajc27-freemocap-blender-addon = "^0.2.14"
numpy = "^1.23.5"
diff --git a/pyproject.toml b/pyproject.toml
index a48b2fa0..4a671803 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -68,11 +68,13 @@ keywords = [
#dynamic = ["dependencies"]
dependencies = [
- "skellycam==2023.12.1087",
- "skelly_viewer",
- "skellyforge",
- "skelly_synchronize>=2023.9.1026",
- "mediapipe",
+
+ "skellycam==2023.12.1090",
+ "skelly-viewer==2023.12.1020",
+ "skellyforge==2023.12.1005",
+ "skelly_synchronize==2023.12.1029",
+ "ajc27_freemocap_blender_addon==0.2.14",
+ "mediapipe~=0.10.0",
"opencv-contrib-python==4.8.*",
"toml==0.10.2",
"aniposelib==0.4.3",
@@ -80,9 +82,8 @@ dependencies = [
"ipykernel==6.23.1",
"plotly==5.14.1",
"pydantic==1.*",
- "pyqt6==6.6.*",
- "packaging",
- "ajc27_freemocap_blender_addon"
+ "PySide6==6.6.*",
+ "packaging===23.2",
]
requires-python = ">=3.9,<3.12"