arcjetCV 0.0.6.dev2__tar.gz → 0.0.7.dev2__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.
- {arcjetcv-0.0.6.dev2 → arcjetcv-0.0.7.dev2}/PKG-INFO +28 -76
- {arcjetcv-0.0.6.dev2 → arcjetcv-0.0.7.dev2}/README.md +27 -75
- {arcjetcv-0.0.6.dev2 → arcjetcv-0.0.7.dev2}/arcjetCV/__init__.py +2 -2
- arcjetcv-0.0.7.dev2/arcjetCV/calibration/calibrate_video.py +55 -0
- arcjetcv-0.0.7.dev2/arcjetCV/calibration/calibration_controller.py +891 -0
- arcjetcv-0.0.7.dev2/arcjetCV/calibration/calibration_main.py +16 -0
- arcjetcv-0.0.7.dev2/arcjetCV/calibration/calibration_model.py +178 -0
- arcjetcv-0.0.7.dev2/arcjetCV/calibration/calibration_view.py +322 -0
- arcjetcv-0.0.7.dev2/arcjetCV/calibration/detetct_example.py +48 -0
- arcjetcv-0.0.7.dev2/arcjetCV/calibration/rotated_pattern.png +0 -0
- arcjetcv-0.0.7.dev2/arcjetCV/chessboard_pattern.png +0 -0
- arcjetcv-0.0.6.dev2/arcjetCV/gui/arcjetCV_gui.py → arcjetcv-0.0.7.dev2/arcjetCV/gui/_arcjetCV_gui.py +11 -14
- arcjetcv-0.0.7.dev2/arcjetCV/gui/arcjetCV_gui.py +1188 -0
- {arcjetcv-0.0.6.dev2 → arcjetcv-0.0.7.dev2}/arcjetCV/gui/main.py +1 -1
- {arcjetcv-0.0.6.dev2 → arcjetcv-0.0.7.dev2}/arcjetCV/gui/main_window.py +244 -48
- arcjetcv-0.0.7.dev2/arcjetCV/segmentation/time/__init__.py +0 -0
- arcjetcv-0.0.7.dev2/arcjetCV/utils/__init__.py +0 -0
- {arcjetcv-0.0.6.dev2 → arcjetcv-0.0.7.dev2}/arcjetCV/utils/processor.py +145 -4
- {arcjetcv-0.0.6.dev2 → arcjetcv-0.0.7.dev2}/arcjetCV/utils/utils.py +2 -0
- {arcjetcv-0.0.6.dev2 → arcjetcv-0.0.7.dev2}/arcjetCV.egg-info/PKG-INFO +28 -76
- {arcjetcv-0.0.6.dev2 → arcjetcv-0.0.7.dev2}/arcjetCV.egg-info/SOURCES.txt +12 -0
- {arcjetcv-0.0.6.dev2 → arcjetcv-0.0.7.dev2}/setup.py +1 -1
- arcjetcv-0.0.7.dev2/tests/test_calibration_functions.py +214 -0
- arcjetcv-0.0.7.dev2/tests/test_calibration_gui.py +60 -0
- {arcjetcv-0.0.6.dev2 → arcjetcv-0.0.7.dev2}/tests/test_gui.py +75 -45
- arcjetcv-0.0.6.dev2/arcjetCV/segmentation/contour/__init__.py +0 -32
- {arcjetcv-0.0.6.dev2 → arcjetcv-0.0.7.dev2}/LICENSE +0 -0
- {arcjetcv-0.0.6.dev2/arcjetCV/gui → arcjetcv-0.0.7.dev2/arcjetCV/calibration}/__init__.py +0 -0
- {arcjetcv-0.0.6.dev2/arcjetCV → arcjetcv-0.0.7.dev2/arcjetCV/calibration}/chessboard_pattern.png +0 -0
- {arcjetcv-0.0.6.dev2/arcjetCV/segmentation → arcjetcv-0.0.7.dev2/arcjetCV/gui}/__init__.py +0 -0
- {arcjetcv-0.0.6.dev2 → arcjetcv-0.0.7.dev2}/arcjetCV/gui/custom_classes.py +0 -0
- {arcjetcv-0.0.6.dev2 → arcjetcv-0.0.7.dev2}/arcjetCV/gui/logo/arcjetCV_logo_.png +0 -0
- {arcjetcv-0.0.6.dev2 → arcjetcv-0.0.7.dev2}/arcjetCV/gui/logo/arcjetCV_logo_white.png +0 -0
- {arcjetcv-0.0.6.dev2/arcjetCV/segmentation/time → arcjetcv-0.0.7.dev2/arcjetCV/segmentation}/__init__.py +0 -0
- {arcjetcv-0.0.6.dev2/arcjetCV/utils → arcjetcv-0.0.7.dev2/arcjetCV/segmentation/contour}/__init__.py +0 -0
- {arcjetcv-0.0.6.dev2 → arcjetcv-0.0.7.dev2}/arcjetCV/segmentation/contour/cnn.py +0 -0
- {arcjetcv-0.0.6.dev2 → arcjetcv-0.0.7.dev2}/arcjetCV/segmentation/contour/contour.py +0 -0
- {arcjetcv-0.0.6.dev2 → arcjetcv-0.0.7.dev2}/arcjetCV/segmentation/time/time_segmentation.py +0 -0
- {arcjetcv-0.0.6.dev2 → arcjetcv-0.0.7.dev2}/arcjetCV/utils/logger.py +0 -0
- {arcjetcv-0.0.6.dev2 → arcjetcv-0.0.7.dev2}/arcjetCV/utils/output.py +0 -0
- {arcjetcv-0.0.6.dev2 → arcjetcv-0.0.7.dev2}/arcjetCV/utils/video.py +0 -0
- {arcjetcv-0.0.6.dev2 → arcjetcv-0.0.7.dev2}/arcjetCV.egg-info/dependency_links.txt +0 -0
- {arcjetcv-0.0.6.dev2 → arcjetcv-0.0.7.dev2}/arcjetCV.egg-info/entry_points.txt +0 -0
- {arcjetcv-0.0.6.dev2 → arcjetcv-0.0.7.dev2}/arcjetCV.egg-info/requires.txt +0 -0
- {arcjetcv-0.0.6.dev2 → arcjetcv-0.0.7.dev2}/arcjetCV.egg-info/top_level.txt +0 -0
- {arcjetcv-0.0.6.dev2 → arcjetcv-0.0.7.dev2}/setup.cfg +0 -0
- {arcjetcv-0.0.6.dev2 → arcjetcv-0.0.7.dev2}/tests/README.md +0 -0
- {arcjetcv-0.0.6.dev2 → arcjetcv-0.0.7.dev2}/tests/__init__.py +0 -0
- {arcjetcv-0.0.6.dev2 → arcjetcv-0.0.7.dev2}/tests/test_functions.py +0 -0
- {arcjetcv-0.0.6.dev2 → arcjetcv-0.0.7.dev2}/tests/test_obj_models.py +0 -0
- {arcjetcv-0.0.6.dev2 → arcjetcv-0.0.7.dev2}/tests/test_segmentation.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: arcjetCV
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.7.dev2
|
|
4
4
|
Summary: Package to process arcjet videos and segment the edge of the shock and of the sample
|
|
5
5
|
Home-page: https://github.com/magnus-haw/arcjetCV
|
|
6
6
|
Author: arcjetCV team
|
|
@@ -42,134 +42,86 @@ Dynamic: summary
|
|
|
42
42
|
-----
|
|
43
43
|
|
|
44
44
|
<div align="center">
|
|
45
|
-
<img src="https://
|
|
46
|
-
|
|
45
|
+
<img src="https://github.com/magnus-haw/arcjetCV/blob/main/arcjetCV/gui/logo/arcjetCV_logo_.png" alt="arcjetCV Logo" width="30%">
|
|
47
46
|
</div>
|
|
48
47
|
|
|
49
48
|
# arcjetCV
|
|
50
49
|
|
|
51
50
|
Package to process arcjet videos and segment the edge of the shock and of the sample.
|
|
52
51
|
|
|
53
|
-

|
|
54
53
|
|
|
55
54
|
## Installation
|
|
56
55
|
|
|
57
|
-
###
|
|
58
|
-
|
|
59
|
-
#### Prerequisites:
|
|
60
|
-
- Ensure you have **Python 3.8** or higher installed.
|
|
56
|
+
### Prerequisites
|
|
61
57
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
```bash
|
|
65
|
-
pip install arcjetCV
|
|
66
|
-
```
|
|
58
|
+
Before you start, ensure you have the following tools installed on your system:
|
|
67
59
|
|
|
68
|
-
This will install **arcjetCV** along with its dependencies.
|
|
69
60
|
|
|
70
|
-
|
|
71
|
-
|
|
61
|
+
1. **Miniconda or Anaconda:** Follow the respective installation guide for [Miniconda](https://docs.anaconda.com/free/miniconda/miniconda-install/) or [Anaconda](https://docs.anaconda.com/free/anaconda/install/index.html).
|
|
62
|
+
2. **(macOS only) Install Xcode Command Line Tools:**
|
|
72
63
|
|
|
73
|
-
|
|
74
|
-
xcode-select --install
|
|
75
|
-
```
|
|
64
|
+
Ensure that you have the Xcode Command Line Tools installed by running:
|
|
76
65
|
|
|
77
|
-
|
|
66
|
+
```bash
|
|
67
|
+
xcode-select --install
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Unix Users (Linux and macOS)
|
|
78
71
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
For **Ubuntu/Debian**-based distributions:
|
|
82
|
-
```bash
|
|
83
|
-
sudo apt-get install libxcb-cursor0
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
For **Fedora**:
|
|
87
|
-
```bash
|
|
88
|
-
sudo dnf install libxcb-cursor
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
For **Arch Linux**:
|
|
92
|
-
```bash
|
|
93
|
-
sudo pacman -S libxcb
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
### Conda Installation
|
|
97
|
-
|
|
98
|
-
#### Prerequisites:
|
|
99
|
-
- A valid **git** installation.
|
|
100
|
-
- Installation of **git-lfs** [(Git Large File Storage)](https://git-lfs.github.com/) for handling large files.
|
|
101
|
-
- **Miniconda** or **Anaconda** for environment and package management:
|
|
102
|
-
- [Miniconda](https://docs.anaconda.com/free/miniconda/miniconda-install/)
|
|
103
|
-
- [Anaconda](https://docs.anaconda.com/free/anaconda/install/index.html)
|
|
104
|
-
|
|
105
|
-
For users who prefer **conda** for managing environments, follow these steps:
|
|
106
|
-
|
|
107
|
-
1. Create a new conda environment and install arcjetCV:
|
|
72
|
+
The software can be installed by running:
|
|
108
73
|
|
|
109
74
|
```bash
|
|
110
75
|
conda create --name arcjetcv conda-forge::arcjetcv
|
|
111
|
-
conda activate arcjetcv
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
This will install **arcjetCV** along with all its dependencies in an isolated environment.
|
|
115
|
-
|
|
116
|
-
#### Note for macOS Users:
|
|
117
|
-
Make sure the Xcode Command Line Tools are installed:
|
|
118
|
-
|
|
119
|
-
```bash
|
|
120
|
-
xcode-select --install
|
|
121
76
|
```
|
|
122
77
|
|
|
123
78
|
### Windows Users and Developers
|
|
124
79
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
80
|
+
For local development of arcjetCV and for Windows users, these are the recommended installation steps:
|
|
81
|
+
|
|
82
|
+
1. **Install `git`:**
|
|
128
83
|
|
|
129
|
-
|
|
84
|
+
You can download and install it from [here](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git).
|
|
130
85
|
|
|
131
|
-
|
|
86
|
+
2. **Install `git lfs` (Git Large File Storage):**
|
|
132
87
|
|
|
133
|
-
|
|
88
|
+
You can download and install it from [here](https://git-lfs.github.com/).
|
|
134
89
|
|
|
135
|
-
|
|
90
|
+
3. **Clone the repository and install the package:**
|
|
136
91
|
|
|
137
92
|
```bash
|
|
138
93
|
git clone https://github.com/magnus-haw/arcjetCV.git
|
|
139
94
|
cd arcjetCV
|
|
140
95
|
conda env create -f env/arcjetCV_env_[cpu/gpu].yml
|
|
141
|
-
conda activate
|
|
142
|
-
python -m pip install -e .
|
|
96
|
+
conda activate arcjetCV
|
|
97
|
+
python -m pip install -e .
|
|
143
98
|
```
|
|
144
99
|
|
|
145
|
-
The
|
|
146
|
-
|
|
100
|
+
The -e flag stands for 'editable' and it means that any change to the local source code will have immediate effect on the arcjetCV python package and GUI.
|
|
147
101
|
|
|
148
102
|
## How to Run
|
|
149
103
|
|
|
150
104
|
You can now launch the GUI by running:
|
|
151
105
|
|
|
152
106
|
```bash
|
|
153
|
-
conda activate
|
|
107
|
+
conda activate arcjetCV
|
|
154
108
|
arcjetCV
|
|
155
109
|
```
|
|
156
110
|
|
|
157
|
-
|
|
111
|
+
or you can import arcjetCV's python API inside a python script, e.g. test.py:
|
|
158
112
|
|
|
159
113
|
```python
|
|
160
114
|
import arcjetCV as arcv
|
|
161
115
|
video = arcv.Video("tests/arcjet_test.mp4")
|
|
162
116
|
```
|
|
163
117
|
|
|
164
|
-
|
|
118
|
+
and then run it as:
|
|
165
119
|
|
|
166
120
|
```bash
|
|
167
|
-
conda activate
|
|
121
|
+
conda activate arcjetCV
|
|
168
122
|
python test.py
|
|
169
123
|
```
|
|
170
124
|
|
|
171
|
-
|
|
172
|
-
|
|
173
125
|
## Citing
|
|
174
126
|
|
|
175
127
|
If you use arcjetCV in your research, please use the following BibTeX entry to cite [our paper](https://arxiv.org/abs/2404.11492):
|
|
@@ -5,134 +5,86 @@
|
|
|
5
5
|
-----
|
|
6
6
|
|
|
7
7
|
<div align="center">
|
|
8
|
-
<img src="https://
|
|
9
|
-
|
|
8
|
+
<img src="https://github.com/magnus-haw/arcjetCV/blob/main/arcjetCV/gui/logo/arcjetCV_logo_.png" alt="arcjetCV Logo" width="30%">
|
|
10
9
|
</div>
|
|
11
10
|
|
|
12
11
|
# arcjetCV
|
|
13
12
|
|
|
14
13
|
Package to process arcjet videos and segment the edge of the shock and of the sample.
|
|
15
14
|
|
|
16
|
-

|
|
17
16
|
|
|
18
17
|
## Installation
|
|
19
18
|
|
|
20
|
-
###
|
|
21
|
-
|
|
22
|
-
#### Prerequisites:
|
|
23
|
-
- Ensure you have **Python 3.8** or higher installed.
|
|
19
|
+
### Prerequisites
|
|
24
20
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
pip install arcjetCV
|
|
29
|
-
```
|
|
21
|
+
Before you start, ensure you have the following tools installed on your system:
|
|
30
22
|
|
|
31
|
-
This will install **arcjetCV** along with its dependencies.
|
|
32
23
|
|
|
33
|
-
|
|
34
|
-
|
|
24
|
+
1. **Miniconda or Anaconda:** Follow the respective installation guide for [Miniconda](https://docs.anaconda.com/free/miniconda/miniconda-install/) or [Anaconda](https://docs.anaconda.com/free/anaconda/install/index.html).
|
|
25
|
+
2. **(macOS only) Install Xcode Command Line Tools:**
|
|
35
26
|
|
|
36
|
-
|
|
37
|
-
xcode-select --install
|
|
38
|
-
```
|
|
27
|
+
Ensure that you have the Xcode Command Line Tools installed by running:
|
|
39
28
|
|
|
40
|
-
|
|
29
|
+
```bash
|
|
30
|
+
xcode-select --install
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Unix Users (Linux and macOS)
|
|
41
34
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
For **Ubuntu/Debian**-based distributions:
|
|
45
|
-
```bash
|
|
46
|
-
sudo apt-get install libxcb-cursor0
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
For **Fedora**:
|
|
50
|
-
```bash
|
|
51
|
-
sudo dnf install libxcb-cursor
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
For **Arch Linux**:
|
|
55
|
-
```bash
|
|
56
|
-
sudo pacman -S libxcb
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
### Conda Installation
|
|
60
|
-
|
|
61
|
-
#### Prerequisites:
|
|
62
|
-
- A valid **git** installation.
|
|
63
|
-
- Installation of **git-lfs** [(Git Large File Storage)](https://git-lfs.github.com/) for handling large files.
|
|
64
|
-
- **Miniconda** or **Anaconda** for environment and package management:
|
|
65
|
-
- [Miniconda](https://docs.anaconda.com/free/miniconda/miniconda-install/)
|
|
66
|
-
- [Anaconda](https://docs.anaconda.com/free/anaconda/install/index.html)
|
|
67
|
-
|
|
68
|
-
For users who prefer **conda** for managing environments, follow these steps:
|
|
69
|
-
|
|
70
|
-
1. Create a new conda environment and install arcjetCV:
|
|
35
|
+
The software can be installed by running:
|
|
71
36
|
|
|
72
37
|
```bash
|
|
73
38
|
conda create --name arcjetcv conda-forge::arcjetcv
|
|
74
|
-
conda activate arcjetcv
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
This will install **arcjetCV** along with all its dependencies in an isolated environment.
|
|
78
|
-
|
|
79
|
-
#### Note for macOS Users:
|
|
80
|
-
Make sure the Xcode Command Line Tools are installed:
|
|
81
|
-
|
|
82
|
-
```bash
|
|
83
|
-
xcode-select --install
|
|
84
39
|
```
|
|
85
40
|
|
|
86
41
|
### Windows Users and Developers
|
|
87
42
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
43
|
+
For local development of arcjetCV and for Windows users, these are the recommended installation steps:
|
|
44
|
+
|
|
45
|
+
1. **Install `git`:**
|
|
91
46
|
|
|
92
|
-
|
|
47
|
+
You can download and install it from [here](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git).
|
|
93
48
|
|
|
94
|
-
|
|
49
|
+
2. **Install `git lfs` (Git Large File Storage):**
|
|
95
50
|
|
|
96
|
-
|
|
51
|
+
You can download and install it from [here](https://git-lfs.github.com/).
|
|
97
52
|
|
|
98
|
-
|
|
53
|
+
3. **Clone the repository and install the package:**
|
|
99
54
|
|
|
100
55
|
```bash
|
|
101
56
|
git clone https://github.com/magnus-haw/arcjetCV.git
|
|
102
57
|
cd arcjetCV
|
|
103
58
|
conda env create -f env/arcjetCV_env_[cpu/gpu].yml
|
|
104
|
-
conda activate
|
|
105
|
-
python -m pip install -e .
|
|
59
|
+
conda activate arcjetCV
|
|
60
|
+
python -m pip install -e .
|
|
106
61
|
```
|
|
107
62
|
|
|
108
|
-
The
|
|
109
|
-
|
|
63
|
+
The -e flag stands for 'editable' and it means that any change to the local source code will have immediate effect on the arcjetCV python package and GUI.
|
|
110
64
|
|
|
111
65
|
## How to Run
|
|
112
66
|
|
|
113
67
|
You can now launch the GUI by running:
|
|
114
68
|
|
|
115
69
|
```bash
|
|
116
|
-
conda activate
|
|
70
|
+
conda activate arcjetCV
|
|
117
71
|
arcjetCV
|
|
118
72
|
```
|
|
119
73
|
|
|
120
|
-
|
|
74
|
+
or you can import arcjetCV's python API inside a python script, e.g. test.py:
|
|
121
75
|
|
|
122
76
|
```python
|
|
123
77
|
import arcjetCV as arcv
|
|
124
78
|
video = arcv.Video("tests/arcjet_test.mp4")
|
|
125
79
|
```
|
|
126
80
|
|
|
127
|
-
|
|
81
|
+
and then run it as:
|
|
128
82
|
|
|
129
83
|
```bash
|
|
130
|
-
conda activate
|
|
84
|
+
conda activate arcjetCV
|
|
131
85
|
python test.py
|
|
132
86
|
```
|
|
133
87
|
|
|
134
|
-
|
|
135
|
-
|
|
136
88
|
## Citing
|
|
137
89
|
|
|
138
90
|
If you use arcjetCV in your research, please use the following BibTeX entry to cite [our paper](https://arxiv.org/abs/2404.11492):
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""Copyright © 2024 United States Government as represented by the Administrator of the National Aeronautics and Space Administration. All Rights Reserved.
|
|
2
2
|
Disclaimers
|
|
3
3
|
No Warranty: THE SUBJECT SOFTWARE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY OF ANY KIND, EITHER EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL CONFORM TO SPECIFICATIONS, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR FREEDOM FROM INFRINGEMENT, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL BE ERROR FREE, OR ANY WARRANTY THAT DOCUMENTATION, IF PROVIDED, WILL CONFORM TO THE SUBJECT SOFTWARE. THIS AGREEMENT DOES NOT, IN ANY MANNER, CONSTITUTE AN ENDORSEMENT BY GOVERNMENT AGENCY OR ANY PRIOR RECIPIENT OF ANY RESULTS, RESULTING DESIGNS, HARDWARE, SOFTWARE PRODUCTS OR ANY OTHER APPLICATIONS RESULTING FROM USE OF THE SUBJECT SOFTWARE. FURTHER, GOVERNMENT AGENCY DISCLAIMS ALL WARRANTIES AND LIABILITIES REGARDING THIRD-PARTY SOFTWARE, IF PRESENT IN THE ORIGINAL SOFTWARE, AND DISTRIBUTES IT "AS IS."
|
|
4
|
-
Waiver and Indemnity: RECIPIENT AGREES TO WAIVE ANY AND ALL CLAIMS AGAINST THE UNITED STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY PRIOR RECIPIENT. IF RECIPIENT'S USE OF THE SUBJECT SOFTWARE RESULTS IN ANY LIABILITIES, DEMANDS, DAMAGES, EXPENSES OR LOSSES ARISING FROM SUCH USE, INCLUDING ANY DAMAGES FROM PRODUCTS BASED ON, OR RESULTING FROM, RECIPIENT'S USE OF THE SUBJECT SOFTWARE, RECIPIENT SHALL INDEMNIFY AND HOLD HARMLESS THE UNITED STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY PRIOR RECIPIENT, TO THE EXTENT PERMITTED BY LAW. RECIPIENT'S SOLE REMEDY FOR ANY SUCH MATTER SHALL BE THE IMMEDIATE, UNILATERAL TERMINATION OF THIS AGREEMENT.
|
|
4
|
+
Waiver and Indemnity: RECIPIENT AGREES TO WAIVE ANY AND ALL CLAIMS AGAINST THE UNITED STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY PRIOR RECIPIENT. IF RECIPIENT'S USE OF THE SUBJECT SOFTWARE RESULTS IN ANY LIABILITIES, DEMANDS, DAMAGES, EXPENSES OR LOSSES ARISING FROM SUCH USE, INCLUDING ANY DAMAGES FROM PRODUCTS BASED ON, OR RESULTING FROM, RECIPIENT'S USE OF THE SUBJECT SOFTWARE, RECIPIENT SHALL INDEMNIFY AND HOLD HARMLESS THE UNITED STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY PRIOR RECIPIENT, TO THE EXTENT PERMITTED BY LAW. RECIPIENT'S SOLE REMEDY FOR ANY SUCH MATTER SHALL BE THE IMMEDIATE, UNILATERAL TERMINATION OF THIS AGREEMENT.
|
|
5
5
|
|
|
6
6
|
Root directory for the arcjetCV package.
|
|
7
7
|
"""
|
|
@@ -14,7 +14,7 @@ Root directory for the arcjetCV package.
|
|
|
14
14
|
# - git push origin main
|
|
15
15
|
# - git tag -a v$(python setup.py --version) -m 'INPUT DESCRIPTION'
|
|
16
16
|
# - gh release create v$(python setup.py --version) --target main
|
|
17
|
-
__version__ = "0.0.
|
|
17
|
+
__version__ = "0.0.7.dev1"
|
|
18
18
|
|
|
19
19
|
from arcjetCV.utils.video import Video, VideoMeta
|
|
20
20
|
from arcjetCV.utils.processor import ArcjetProcessor
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
def apply_calibration(frame, calibration_data):
|
|
2
|
+
"""
|
|
3
|
+
Apply calibration to a single frame using provided calibration data.
|
|
4
|
+
|
|
5
|
+
Args:
|
|
6
|
+
frame (numpy.ndarray): The input frame (image) to calibrate.
|
|
7
|
+
calibration_data (dict): A dictionary containing calibration data with keys:
|
|
8
|
+
- "camera_matrix": The intrinsic camera matrix.
|
|
9
|
+
- "dist_coeffs": The distortion coefficients.
|
|
10
|
+
- "rvec" (optional): The rotation vector for 3D transformations.
|
|
11
|
+
- "tvec" (optional): The translation vector for 3D transformations.
|
|
12
|
+
|
|
13
|
+
Returns:
|
|
14
|
+
numpy.ndarray: The calibrated frame (image).
|
|
15
|
+
"""
|
|
16
|
+
# Extract calibration data
|
|
17
|
+
camera_matrix = np.array(calibration_data["camera_matrix"])
|
|
18
|
+
dist_coeffs = np.array(calibration_data["dist_coeffs"])
|
|
19
|
+
|
|
20
|
+
# Undistort the frame
|
|
21
|
+
h, w = frame.shape[:2]
|
|
22
|
+
new_camera_matrix, _ = cv2.getOptimalNewCameraMatrix(
|
|
23
|
+
camera_matrix, dist_coeffs, (w, h), 1, (w, h)
|
|
24
|
+
)
|
|
25
|
+
undistorted_frame = cv2.undistort(frame, camera_matrix, dist_coeffs, None, new_camera_matrix)
|
|
26
|
+
|
|
27
|
+
# Apply 3D transformations if rvec and tvec are available
|
|
28
|
+
if "rvec" in calibration_data and "tvec" in calibration_data:
|
|
29
|
+
rvec = np.array(calibration_data["rvec"])
|
|
30
|
+
tvec = np.array(calibration_data["tvec"])
|
|
31
|
+
|
|
32
|
+
# Define points on the image plane
|
|
33
|
+
height, width = undistorted_frame.shape[:2]
|
|
34
|
+
object_points = np.array([
|
|
35
|
+
[0, 0, 0],
|
|
36
|
+
[width, 0, 0],
|
|
37
|
+
[width, height, 0],
|
|
38
|
+
[0, height, 0]
|
|
39
|
+
], dtype=np.float32)
|
|
40
|
+
|
|
41
|
+
# Project 3D points to the image plane
|
|
42
|
+
image_points, _ = cv2.projectPoints(object_points, rvec, tvec, new_camera_matrix, None)
|
|
43
|
+
|
|
44
|
+
# Compute the perspective transform
|
|
45
|
+
src_points = np.float32([[0, 0], [width, 0], [width, height], [0, height]])
|
|
46
|
+
dst_points = np.float32(image_points[:, 0, :])
|
|
47
|
+
perspective_transform = cv2.getPerspectiveTransform(src_points, dst_points)
|
|
48
|
+
|
|
49
|
+
# Apply the perspective transformation
|
|
50
|
+
calibrated_frame = cv2.warpPerspective(undistorted_frame, perspective_transform, (w, h))
|
|
51
|
+
else:
|
|
52
|
+
# If no 3D transformation data, return the undistorted frame
|
|
53
|
+
calibrated_frame = undistorted_frame
|
|
54
|
+
|
|
55
|
+
return calibrated_frame
|