stabilo 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. stabilo-1.0.0/LICENSE +21 -0
  2. stabilo-1.0.0/PKG-INFO +209 -0
  3. stabilo-1.0.0/README.md +151 -0
  4. stabilo-1.0.0/pyproject.toml +88 -0
  5. stabilo-1.0.0/setup.cfg +4 -0
  6. stabilo-1.0.0/stabilo/__init__.py +4 -0
  7. stabilo-1.0.0/stabilo/cfg/default.yaml +57 -0
  8. stabilo-1.0.0/stabilo/stabilo.py +595 -0
  9. stabilo-1.0.0/stabilo/thresholds/models/AKAZE/model_mask_False_clahe_False.txt +2 -0
  10. stabilo-1.0.0/stabilo/thresholds/models/AKAZE/model_mask_False_clahe_True.txt +2 -0
  11. stabilo-1.0.0/stabilo/thresholds/models/AKAZE/model_mask_True_clahe_False.txt +2 -0
  12. stabilo-1.0.0/stabilo/thresholds/models/AKAZE/model_mask_True_clahe_True.txt +2 -0
  13. stabilo-1.0.0/stabilo/thresholds/models/BRISK/model_mask_False_clahe_False.txt +2 -0
  14. stabilo-1.0.0/stabilo/thresholds/models/BRISK/model_mask_False_clahe_True.txt +2 -0
  15. stabilo-1.0.0/stabilo/thresholds/models/BRISK/model_mask_True_clahe_False.txt +2 -0
  16. stabilo-1.0.0/stabilo/thresholds/models/BRISK/model_mask_True_clahe_True.txt +2 -0
  17. stabilo-1.0.0/stabilo/thresholds/models/KAZE/model_mask_False_clahe_False.txt +2 -0
  18. stabilo-1.0.0/stabilo/thresholds/models/KAZE/model_mask_False_clahe_True.txt +2 -0
  19. stabilo-1.0.0/stabilo/thresholds/models/KAZE/model_mask_True_clahe_False.txt +2 -0
  20. stabilo-1.0.0/stabilo/thresholds/models/KAZE/model_mask_True_clahe_True.txt +2 -0
  21. stabilo-1.0.0/stabilo/utils.py +112 -0
  22. stabilo-1.0.0/stabilo.egg-info/PKG-INFO +209 -0
  23. stabilo-1.0.0/stabilo.egg-info/SOURCES.txt +25 -0
  24. stabilo-1.0.0/stabilo.egg-info/dependency_links.txt +1 -0
  25. stabilo-1.0.0/stabilo.egg-info/requires.txt +11 -0
  26. stabilo-1.0.0/stabilo.egg-info/top_level.txt +1 -0
  27. stabilo-1.0.0/tests/test_stabilizer.py +131 -0
stabilo-1.0.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Robert Fonod
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
stabilo-1.0.0/PKG-INFO ADDED
@@ -0,0 +1,209 @@
1
+ Metadata-Version: 2.1
2
+ Name: stabilo
3
+ Version: 1.0.0
4
+ Summary: Stabilizes video or extracted trajectories with respect to a selected reference frame in the video, with optional user-provided masks.
5
+ Author-email: Robert Fonod <robert.fonod@ieee.org>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2024 Robert Fonod
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+ Project-URL: Homepage, https://github.com/rfonod/stabilo/
28
+ Project-URL: Repository, https://github.com/rfonod/stabilo/
29
+ Project-URL: Changelog, https://github.com/rfonod/stabilo/releases
30
+ Project-URL: Issues, https://github.com/rfonod/stabilo/issues/
31
+ Keywords: stabilo,video-stabilization,object-stabilization,mask,reference-frame,computer-vision
32
+ Classifier: Development Status :: 5 - Production/Stable
33
+ Classifier: License :: OSI Approved :: MIT License
34
+ Classifier: Operating System :: OS Independent
35
+ Classifier: Programming Language :: Python :: 3
36
+ Classifier: Programming Language :: Python :: 3.9
37
+ Classifier: Programming Language :: Python :: 3.10
38
+ Classifier: Programming Language :: Python :: 3.11
39
+ Classifier: Programming Language :: Python :: 3.12
40
+ Classifier: Programming Language :: Python :: 3.13
41
+ Classifier: Intended Audience :: Developers
42
+ Classifier: Intended Audience :: Science/Research
43
+ Classifier: Topic :: Scientific/Engineering
44
+ Classifier: Topic :: Software Development
45
+ Classifier: Topic :: Multimedia :: Video
46
+ Requires-Python: >=3.9
47
+ Description-Content-Type: text/markdown
48
+ License-File: LICENSE
49
+ Requires-Dist: numpy<2.0,>=1.26.4
50
+ Requires-Dist: opencv-python>=4.6.0
51
+ Requires-Dist: pyyaml>=5.3.1
52
+ Requires-Dist: tqdm>=4.64.0
53
+ Provides-Extra: extras
54
+ Requires-Dist: matplotlib>=3.5.0; extra == "extras"
55
+ Provides-Extra: dev
56
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
57
+ Requires-Dist: matplotlib>=3.5.0; extra == "dev"
58
+
59
+ # Stabilo
60
+
61
+ [![PyPI Version](https://img.shields.io/pypi/v/stabilo)](https://pypi.org/project/stabilo/) [![GitHub Release](https://img.shields.io/github/v/release/rfonod/stabilo?include_prereleases)](https://github.com/rfonod/stabilo/releases) [![License](https://img.shields.io/github/license/rfonod/stabilo)](https://github.com/rfonod/stabilo/blob/main/LICENSE) [![DOI](https://zenodo.org/badge/816993640.svg)](https://zenodo.org/doi/10.5281/zenodo.12117092) [![Downloads](https://img.shields.io/pypi/dm/stabilo)](https://pypistats.org/packages/stabilo) [![Development Status](https://img.shields.io/badge/development-active-brightgreen)](https://github.com/rfonod/stabilo)
62
+
63
+ **Stabilo** is a specialized Python package for stabilizing video frames or tracked object trajectories in videos, using robust homography or affine transformations. Its core functionality focuses on aligning each frame or object track to a chosen reference frame, enabling precise stabilization that mitigates disturbances like camera movements. Key features include robust keypoint-based image registration and the option to integrate user-defined masks, which exclude dynamic regions (e.g., moving objects) to enhance stabilization accuracy. Integrating seamlessly with object detection and tracking algorithms, Stabilo is ideal for high-precision applications like urban traffic monitoring, as demonstrated in the [geo-trax](https://github.com/rfonod/geo-trax) 🚀 trajectory extraction framework. Extensive transformation and enhancement options, including multiple feature detectors and matchers, masking techniques, further expand its utility. The repository also includes valuable resources like utility scripts and example videos to demonstrate its capabilities.
64
+
65
+ ![Stabilization Visualization GIF](https://raw.githubusercontent.com/rfonod/stabilo/main/assets/stabilization_visualization.gif?raw=True)
66
+
67
+ ## Features
68
+
69
+ - **Video Stabilization**: Align (warp) all video frames to a custom (anchor) reference frame using homography or affine transformations.
70
+ - **Trajectory Stabilization**: Transform object trajectories (e.g., bounding boxes) to a common fixed reference frame using homography or affine transformations.
71
+ - **User-Defined Masks**: Allow users to specify custom masks to exclude regions of interest during stabilization.
72
+ - **Wide Range of Algorithms**: Includes support for various feature detectors (ORB, (R)SIFT, BRISK, (A)KAZE), matchers (BF, FLANN), RANSAC algorithms (MAGSAC++, DEGENSAC, ...), transformation types, and pre-processing options.
73
+ - **Customizable Parameters**: Fine-tune the stabilization by adjusting parameters such as the number of keypoints, RANSAC parameters, matching thresholds, downsampling factors, etc..
74
+ - **Visualization Tools**: Generate visualizations of the stabilization process, with frame-by-frame comparisons and trajectory transformations (see the above animation).
75
+ - **Threshold Analysis**: Analyze the relationship between detection thresholds and keypoint counts for BRISK, KAZE, and AKAZE to fairly benchmark with different detectors.
76
+ - **Benchmarking Campaigns**: Use [stabilo-optimize](https://github.com/rfonod/stabilo-optimize) 🎯 to establish benchmarking campaigns to optimize algorithm and hyperparameter selection for specific applications.
77
+
78
+ <details>
79
+ <summary><b>🚀 Planned Enhancements</b></summary>
80
+
81
+ - **Unit Tests**: Comprehensive unit test suite to ensure package stability and reliability.
82
+ - **Different Mask Types**: Inclusion of additional mask types (e.g., polygonal, circular) for enhanced precision in stabilization.
83
+ - **GPU Acceleration**: Integration of GPU acceleration to improve processing speed.
84
+ - **Documentation**: Detailed documentation covering the package’s functionality and usage.
85
+
86
+ </details>
87
+
88
+
89
+ ## Installation
90
+
91
+ First, create a **Python Virtual Environment** (Python >= 3.9) using e.g., [Miniconda3](https://docs.anaconda.com/free/miniconda/):
92
+ ```bash
93
+ conda create -n stabilo python=3.9 -y
94
+ conda activate stabilo
95
+ ```
96
+
97
+ Then, install the stabilo library using one of the following options:
98
+
99
+ ### Option 1: Install from PyPI
100
+ You can install the package from PyPI using pip:
101
+ ```sh
102
+ pip install stabilo
103
+ ```
104
+
105
+ ### Option 2: Install from Source
106
+ You can install the package directly from the repository:
107
+ ```sh
108
+ pip install git+https://github.com/rfonod/stabilo.git
109
+ ```
110
+
111
+ ### Option 3: Install from Local Source
112
+
113
+ You can also clone the repository and install the package from the local source:
114
+
115
+ ```sh
116
+ git clone https://github.com/rfonod/stabilo.git
117
+ cd stabilo
118
+ pip install .
119
+ ```
120
+
121
+ If you want the changes you make in the repo to be reflected in your install, use `pip install -e .` instead of `pip install .`.
122
+
123
+ ## Example Usage
124
+
125
+ ```python
126
+ from stabilo import Stabilizer
127
+
128
+ # Create an instance of the Stabilizer class with default parameters
129
+ stabilizer = Stabilizer()
130
+
131
+ # Set a reference frame with (optional) mask
132
+ stabilizer.set_ref_frame(ref_frame, ref_mask)
133
+
134
+ # Stabilize any frame with (optional) mask
135
+ stabilizer.stabilize(cur_frame, cur_mask)
136
+
137
+ # Get the stabilized (warped) frame
138
+ stabilized_frame = stabilizer.warp_cur_frame()
139
+
140
+ # Transform current masks (bounding boxes) if it was provided
141
+ stabilized_boxes = stabilizer.transform_cur_boxes()
142
+
143
+ # Transform any point (pixel coordinates) from the current frame to reference frame
144
+ cur_point = np.array([x, y, 1])
145
+ ref_point = stabilizer.get_cur_trans_matrix() @ cur_point
146
+ ```
147
+
148
+ ## Utility Scripts
149
+
150
+ Utility scripts are provided to demonstrate the functionality of the Stabilo package. These scripts can be found in the `scripts` directory.
151
+
152
+ #### Stabilization Examples
153
+
154
+ - `stabilize_video.py`: Implements video stabilization relative to a reference frame.
155
+ - `stabilize_boxes.py`: Implements object trajectory stabilization relative to a reference frame.
156
+
157
+ #### Threshold Analysis
158
+
159
+ - `find_threshold_models.py`: Computes regression models between detection thresholds and average keypoint counts for BRISK, KAZE, and AKAZE feature detectors.
160
+
161
+ ## Citing This Work
162
+
163
+ If you use this project in your academic research, commercial products, or any published material, please acknowledge its use by citing it.
164
+
165
+ 1. **Preferred Citation:** For research-related references, please cite the related paper once it is formally published. A preprint is currently available on [arXiv](https://arxiv.org/abs/2411.02136):
166
+
167
+ ```bibtex
168
+ @misc{fonod2024advanced,
169
+ title={Advanced computer vision for extracting georeferenced vehicle trajectories from drone imagery},
170
+ author={Robert Fonod and Haechan Cho and Hwasoo Yeo and Nikolas Geroliminis},
171
+ year={2024},
172
+ eprint={2411.02136},
173
+ archivePrefix={arXiv},
174
+ primaryClass={cs.CV},
175
+ url={https://arxiv.org/abs/2411.02136},
176
+ doi={https://doi.org/10.48550/arXiv.2411.02136}
177
+ }
178
+ ```
179
+
180
+ 2. **Repository Citation:** For direct use of the stabilo repository, please cite the software release version on Zenodo. You may refer to the DOI badge above for the correct version or use the BibTeX below:
181
+
182
+ ```bibtex
183
+ @software{fonod2024stabilo,
184
+ author = {Fonod, Robert},
185
+ license = {MIT},
186
+ month = nov,
187
+ title = {Stabilo: A Comprehensive Python Library for Video and Trajectory Stabilization with User-Defined Masks},
188
+ url = {https://github.com/rfonod/stabilo},
189
+ doi = {10.5281/zenodo.12117092},
190
+ version = {1.0.0},
191
+ year = {2024}
192
+ }
193
+ ```
194
+
195
+ To ensure accurate and consistent citations, a CITATION.cff file is included in this repository. GitHub automatically generates a formatted citation from this file, accessible in the "Cite this repository" option at the top right of this page.
196
+
197
+ Please select the correct citation based on your use:
198
+ - **Methodology:** For referencing the research framework and methodology, cite the journal paper (or preprint if unpublished).
199
+ - **Repository:** For direct use of the code, cite the Zenodo release of this GitHub repository.
200
+
201
+
202
+ ## Contributing
203
+
204
+ Contributions are welcome! If you encounter any issues or have suggestions for improvements, please open a [GitHub Issue](https://github.com/rfonod/stabilo/issues) or submit a pull request. Your contributions are greatly appreciated!
205
+
206
+
207
+ ## License
208
+
209
+ This project is licensed under the MIT License, an [OSI-approved](https://opensource.org/licenses/MIT) open-source license, which allows for both academic and commercial use. By citing this project, you help support its development and acknowledge the effort that went into creating it. For more details, see the [LICENSE](LICENSE) file. Thank you!
@@ -0,0 +1,151 @@
1
+ # Stabilo
2
+
3
+ [![PyPI Version](https://img.shields.io/pypi/v/stabilo)](https://pypi.org/project/stabilo/) [![GitHub Release](https://img.shields.io/github/v/release/rfonod/stabilo?include_prereleases)](https://github.com/rfonod/stabilo/releases) [![License](https://img.shields.io/github/license/rfonod/stabilo)](https://github.com/rfonod/stabilo/blob/main/LICENSE) [![DOI](https://zenodo.org/badge/816993640.svg)](https://zenodo.org/doi/10.5281/zenodo.12117092) [![Downloads](https://img.shields.io/pypi/dm/stabilo)](https://pypistats.org/packages/stabilo) [![Development Status](https://img.shields.io/badge/development-active-brightgreen)](https://github.com/rfonod/stabilo)
4
+
5
+ **Stabilo** is a specialized Python package for stabilizing video frames or tracked object trajectories in videos, using robust homography or affine transformations. Its core functionality focuses on aligning each frame or object track to a chosen reference frame, enabling precise stabilization that mitigates disturbances like camera movements. Key features include robust keypoint-based image registration and the option to integrate user-defined masks, which exclude dynamic regions (e.g., moving objects) to enhance stabilization accuracy. Integrating seamlessly with object detection and tracking algorithms, Stabilo is ideal for high-precision applications like urban traffic monitoring, as demonstrated in the [geo-trax](https://github.com/rfonod/geo-trax) 🚀 trajectory extraction framework. Extensive transformation and enhancement options, including multiple feature detectors and matchers, masking techniques, further expand its utility. The repository also includes valuable resources like utility scripts and example videos to demonstrate its capabilities.
6
+
7
+ ![Stabilization Visualization GIF](https://raw.githubusercontent.com/rfonod/stabilo/main/assets/stabilization_visualization.gif?raw=True)
8
+
9
+ ## Features
10
+
11
+ - **Video Stabilization**: Align (warp) all video frames to a custom (anchor) reference frame using homography or affine transformations.
12
+ - **Trajectory Stabilization**: Transform object trajectories (e.g., bounding boxes) to a common fixed reference frame using homography or affine transformations.
13
+ - **User-Defined Masks**: Allow users to specify custom masks to exclude regions of interest during stabilization.
14
+ - **Wide Range of Algorithms**: Includes support for various feature detectors (ORB, (R)SIFT, BRISK, (A)KAZE), matchers (BF, FLANN), RANSAC algorithms (MAGSAC++, DEGENSAC, ...), transformation types, and pre-processing options.
15
+ - **Customizable Parameters**: Fine-tune the stabilization by adjusting parameters such as the number of keypoints, RANSAC parameters, matching thresholds, downsampling factors, etc..
16
+ - **Visualization Tools**: Generate visualizations of the stabilization process, with frame-by-frame comparisons and trajectory transformations (see the above animation).
17
+ - **Threshold Analysis**: Analyze the relationship between detection thresholds and keypoint counts for BRISK, KAZE, and AKAZE to fairly benchmark with different detectors.
18
+ - **Benchmarking Campaigns**: Use [stabilo-optimize](https://github.com/rfonod/stabilo-optimize) 🎯 to establish benchmarking campaigns to optimize algorithm and hyperparameter selection for specific applications.
19
+
20
+ <details>
21
+ <summary><b>🚀 Planned Enhancements</b></summary>
22
+
23
+ - **Unit Tests**: Comprehensive unit test suite to ensure package stability and reliability.
24
+ - **Different Mask Types**: Inclusion of additional mask types (e.g., polygonal, circular) for enhanced precision in stabilization.
25
+ - **GPU Acceleration**: Integration of GPU acceleration to improve processing speed.
26
+ - **Documentation**: Detailed documentation covering the package’s functionality and usage.
27
+
28
+ </details>
29
+
30
+
31
+ ## Installation
32
+
33
+ First, create a **Python Virtual Environment** (Python >= 3.9) using e.g., [Miniconda3](https://docs.anaconda.com/free/miniconda/):
34
+ ```bash
35
+ conda create -n stabilo python=3.9 -y
36
+ conda activate stabilo
37
+ ```
38
+
39
+ Then, install the stabilo library using one of the following options:
40
+
41
+ ### Option 1: Install from PyPI
42
+ You can install the package from PyPI using pip:
43
+ ```sh
44
+ pip install stabilo
45
+ ```
46
+
47
+ ### Option 2: Install from Source
48
+ You can install the package directly from the repository:
49
+ ```sh
50
+ pip install git+https://github.com/rfonod/stabilo.git
51
+ ```
52
+
53
+ ### Option 3: Install from Local Source
54
+
55
+ You can also clone the repository and install the package from the local source:
56
+
57
+ ```sh
58
+ git clone https://github.com/rfonod/stabilo.git
59
+ cd stabilo
60
+ pip install .
61
+ ```
62
+
63
+ If you want the changes you make in the repo to be reflected in your install, use `pip install -e .` instead of `pip install .`.
64
+
65
+ ## Example Usage
66
+
67
+ ```python
68
+ from stabilo import Stabilizer
69
+
70
+ # Create an instance of the Stabilizer class with default parameters
71
+ stabilizer = Stabilizer()
72
+
73
+ # Set a reference frame with (optional) mask
74
+ stabilizer.set_ref_frame(ref_frame, ref_mask)
75
+
76
+ # Stabilize any frame with (optional) mask
77
+ stabilizer.stabilize(cur_frame, cur_mask)
78
+
79
+ # Get the stabilized (warped) frame
80
+ stabilized_frame = stabilizer.warp_cur_frame()
81
+
82
+ # Transform current masks (bounding boxes) if it was provided
83
+ stabilized_boxes = stabilizer.transform_cur_boxes()
84
+
85
+ # Transform any point (pixel coordinates) from the current frame to reference frame
86
+ cur_point = np.array([x, y, 1])
87
+ ref_point = stabilizer.get_cur_trans_matrix() @ cur_point
88
+ ```
89
+
90
+ ## Utility Scripts
91
+
92
+ Utility scripts are provided to demonstrate the functionality of the Stabilo package. These scripts can be found in the `scripts` directory.
93
+
94
+ #### Stabilization Examples
95
+
96
+ - `stabilize_video.py`: Implements video stabilization relative to a reference frame.
97
+ - `stabilize_boxes.py`: Implements object trajectory stabilization relative to a reference frame.
98
+
99
+ #### Threshold Analysis
100
+
101
+ - `find_threshold_models.py`: Computes regression models between detection thresholds and average keypoint counts for BRISK, KAZE, and AKAZE feature detectors.
102
+
103
+ ## Citing This Work
104
+
105
+ If you use this project in your academic research, commercial products, or any published material, please acknowledge its use by citing it.
106
+
107
+ 1. **Preferred Citation:** For research-related references, please cite the related paper once it is formally published. A preprint is currently available on [arXiv](https://arxiv.org/abs/2411.02136):
108
+
109
+ ```bibtex
110
+ @misc{fonod2024advanced,
111
+ title={Advanced computer vision for extracting georeferenced vehicle trajectories from drone imagery},
112
+ author={Robert Fonod and Haechan Cho and Hwasoo Yeo and Nikolas Geroliminis},
113
+ year={2024},
114
+ eprint={2411.02136},
115
+ archivePrefix={arXiv},
116
+ primaryClass={cs.CV},
117
+ url={https://arxiv.org/abs/2411.02136},
118
+ doi={https://doi.org/10.48550/arXiv.2411.02136}
119
+ }
120
+ ```
121
+
122
+ 2. **Repository Citation:** For direct use of the stabilo repository, please cite the software release version on Zenodo. You may refer to the DOI badge above for the correct version or use the BibTeX below:
123
+
124
+ ```bibtex
125
+ @software{fonod2024stabilo,
126
+ author = {Fonod, Robert},
127
+ license = {MIT},
128
+ month = nov,
129
+ title = {Stabilo: A Comprehensive Python Library for Video and Trajectory Stabilization with User-Defined Masks},
130
+ url = {https://github.com/rfonod/stabilo},
131
+ doi = {10.5281/zenodo.12117092},
132
+ version = {1.0.0},
133
+ year = {2024}
134
+ }
135
+ ```
136
+
137
+ To ensure accurate and consistent citations, a CITATION.cff file is included in this repository. GitHub automatically generates a formatted citation from this file, accessible in the "Cite this repository" option at the top right of this page.
138
+
139
+ Please select the correct citation based on your use:
140
+ - **Methodology:** For referencing the research framework and methodology, cite the journal paper (or preprint if unpublished).
141
+ - **Repository:** For direct use of the code, cite the Zenodo release of this GitHub repository.
142
+
143
+
144
+ ## Contributing
145
+
146
+ Contributions are welcome! If you encounter any issues or have suggestions for improvements, please open a [GitHub Issue](https://github.com/rfonod/stabilo/issues) or submit a pull request. Your contributions are greatly appreciated!
147
+
148
+
149
+ ## License
150
+
151
+ This project is licensed under the MIT License, an [OSI-approved](https://opensource.org/licenses/MIT) open-source license, which allows for both academic and commercial use. By citing this project, you help support its development and acknowledge the effort that went into creating it. For more details, see the [LICENSE](LICENSE) file. Thank you!
@@ -0,0 +1,88 @@
1
+ # ==============================================================
2
+ # Stabilo - MIT License
3
+ # ==============================================================
4
+ # Overview:
5
+ # This pyproject.toml file configures the build system and
6
+ # project metadata for the Stabilo package.
7
+ #
8
+ # Installation:
9
+ # To install the Stabilo package, use the following command:
10
+ # pip install stabilo
11
+ #
12
+ # For development purposes, enabling real-time updates without
13
+ # reinstallation, use one of the following commands:
14
+ # pip install -e .[dev]
15
+ # pip install -e '.[dev]' (for zsh shells)
16
+ #
17
+ # ==============================================================
18
+
19
+ [build-system]
20
+ requires = ["setuptools>=61.0", "wheel"]
21
+ build-backend = "setuptools.build_meta"
22
+
23
+ [project]
24
+ name = "stabilo"
25
+ dynamic = ["version"]
26
+ description = "Stabilizes video or extracted trajectories with respect to a selected reference frame in the video, with optional user-provided masks."
27
+ authors = [
28
+ { name = "Robert Fonod", email = "robert.fonod@ieee.org" },
29
+ ]
30
+ readme = "README.md"
31
+ license = { file = "LICENSE" }
32
+ requires-python = ">=3.9"
33
+ keywords = ["stabilo", "video-stabilization", "object-stabilization", "mask", "reference-frame", "computer-vision"]
34
+ classifiers = [
35
+ "Development Status :: 5 - Production/Stable",
36
+ "License :: OSI Approved :: MIT License",
37
+ "Operating System :: OS Independent",
38
+ "Programming Language :: Python :: 3",
39
+ "Programming Language :: Python :: 3.9",
40
+ "Programming Language :: Python :: 3.10",
41
+ "Programming Language :: Python :: 3.11",
42
+ "Programming Language :: Python :: 3.12",
43
+ "Programming Language :: Python :: 3.13",
44
+ "Intended Audience :: Developers",
45
+ "Intended Audience :: Science/Research",
46
+ "Topic :: Scientific/Engineering",
47
+ "Topic :: Software Development",
48
+ "Topic :: Multimedia :: Video",
49
+ ]
50
+
51
+ dependencies = [
52
+ "numpy>=1.26.4,<2.0",
53
+ "opencv-python>=4.6.0",
54
+ "pyyaml>=5.3.1",
55
+ "tqdm>=4.64.0",
56
+ ]
57
+
58
+ [project.optional-dependencies]
59
+ extras = [
60
+ "matplotlib>=3.5.0"
61
+ ]
62
+ dev = [
63
+ "pytest>=7.0.0",
64
+ "matplotlib>=3.5.0"
65
+ ]
66
+
67
+ [tool.setuptools]
68
+ packages = { find = { where = ["."], include = ["stabilo", "stabilo.*"] } }
69
+ package-data = { "stabilo" = ["**/*.yaml", "**/*.txt"] }
70
+
71
+ [tool.setuptools.dynamic]
72
+ version = { attr = "stabilo.__version__" }
73
+
74
+ [project.urls]
75
+ Homepage = "https://github.com/rfonod/stabilo/"
76
+ Repository = "https://github.com/rfonod/stabilo/"
77
+ Changelog = "https://github.com/rfonod/stabilo/releases"
78
+ Issues = "https://github.com/rfonod/stabilo/issues/"
79
+
80
+ [tool.ruff]
81
+ line-length = 120
82
+
83
+ [tool.ruff.lint]
84
+ select = ['E', 'F', 'W', 'A', "B", 'PLC', 'PLE', 'PLW', 'I']
85
+
86
+ [tool.ruff.format]
87
+ docstring-code-format = true
88
+ quote-style = "preserve"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,4 @@
1
+ from .stabilo import Stabilizer
2
+
3
+ __version__ = '1.0.0'
4
+ __all__ = ['Stabilizer', '__version__']
@@ -0,0 +1,57 @@
1
+ # This is the default configuration file (default.yaml) containing optimized parameters
2
+ # for the ORB detector, brute force (BF) matcher, ratio test, and projective transformation.
3
+ # This template serves as a starting point for users to customize according to their specific needs.
4
+ #
5
+ # The goal of this optimization was to balance high accuracy without compromising on speed,
6
+ # specifically tailored for high-altitude bird's-eye view (BeV) drone imagery analysis.
7
+ #
8
+ # The optimization involved a set of BeV drone scenes with associated vehicle masks captured
9
+ # from an altitude of approximately 150 meters. With the projective transformation fixed,
10
+ # we then optimized all the remaining parameters in a hierarchical manner.
11
+ #
12
+ # Details of the optimization process will be available soon at:
13
+ # https://github.com/rfonod/stabilo-optimize
14
+ #
15
+ # The detailed description of each parameter is explained in the stabilo.py module.
16
+
17
+
18
+ # Image pre-processing related
19
+ clahe: false # Contrast Limited Adaptive Histogram Equalization (CLAHE); [true, false]
20
+ downsample_ratio: 0.5 # Downsample ratio for image resizing; (0.0, 1.0]
21
+
22
+ # Feature detectors and descriptors related
23
+ detector_name: 'orb' # Feature detector name; ['orb', 'sift', 'rsift', 'brisk', 'kaze', 'akaze']
24
+ max_features: 2000 # Maximum number of features to detect; [0, inf)
25
+ ref_multiplier: 2.0 # Reference multiplier for the number of features; (0.0, inf)
26
+
27
+ # Feature matching and filtering related
28
+ matcher_name: 'bf' # Feature matcher name; ['bf', 'flann']
29
+ filter_type: 'ratio' # Filter type; ['none', 'ratio', 'distance']
30
+ filter_ratio: 0.9 # Ratio test threshold; (0.0, 1.0]
31
+
32
+ # Transformation matrix calculation related
33
+ transformation_type: 'projective' # Transformation type; ['projective', 'affine']
34
+ ransac_method: 38 # RANSAC method; [4: LMEDS, 8: RANSAC, 16: RHO, 32: DEGENSAC, 33: DEGENSAC (with different parameters), 35: LO-RANSAC, 36: GC-RANSAC, 37: PROSAC, 38: MAGSAC++]
35
+ ransac_epipolar_threshold: 2.0 # Epipolar threshold for RANSAC; (0.0, inf)
36
+ ransac_max_iter: 5000 # Maximum number of iterations for RANSAC; (0, inf]
37
+ ransac_confidence: 0.999999 # Confidence level for RANSAC; (0.0, 1.0]
38
+
39
+ # Mask related
40
+ mask_use: true # Use mask for feature matching; [true, false]
41
+ mask_margin_ratio: 0.15 # Margin ratio for mask generation; [0.0, 1.0]
42
+
43
+ # Default thresholds for BRISK, KAZE, and AKAZE (if threshold analysis not performed)
44
+ brisk_threshold: 130 # BRISK threshold; (0, 255]
45
+ kaze_threshold: 0.01 # KAZE threshold; (0.0, inf]
46
+ akaze_threshold: 0.01 # AKAZE threshold; (0.0, inf]
47
+
48
+ # Computation related
49
+ gpu: false # Use GPU for computation; [true, false]
50
+
51
+ # Miscellaneous
52
+ viz: false # Store features and matches for visualization; [true, false]
53
+ benchmark: false # Benchmark mode; [true, false]
54
+
55
+ # Debug related
56
+ min_good_match_count_warning: 20 # Minimum good match count warning; [0, inf]
57
+ min_inliers_match_count_warning: 10 # Minimum inliers match count warning; [0, inf]