arcjetCV 0.0.6.dev2__py3-none-any.whl → 0.0.7.dev2__py3-none-any.whl
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/__init__.py +2 -2
- arcjetCV/calibration/__init__.py +0 -0
- arcjetCV/calibration/calibrate_video.py +55 -0
- arcjetCV/calibration/calibration_controller.py +891 -0
- arcjetCV/calibration/calibration_main.py +16 -0
- arcjetCV/calibration/calibration_model.py +178 -0
- arcjetCV/calibration/calibration_view.py +322 -0
- arcjetCV/calibration/chessboard_pattern.png +0 -0
- arcjetCV/calibration/detetct_example.py +48 -0
- arcjetCV/calibration/rotated_pattern.png +0 -0
- arcjetCV/gui/_arcjetCV_gui.py +846 -0
- arcjetCV/gui/arcjetCV_gui.py +955 -616
- arcjetCV/gui/main.py +1 -1
- arcjetCV/gui/main_window.py +244 -48
- arcjetCV/segmentation/contour/__init__.py +0 -32
- arcjetCV/utils/processor.py +145 -4
- arcjetCV/utils/utils.py +2 -0
- {arcjetcv-0.0.6.dev2.dist-info → arcjetcv-0.0.7.dev2.dist-info}/METADATA +28 -76
- arcjetcv-0.0.7.dev2.dist-info/RECORD +45 -0
- tests/test_calibration_functions.py +214 -0
- tests/test_calibration_gui.py +60 -0
- tests/test_gui.py +75 -45
- arcjetcv-0.0.6.dev2.dist-info/RECORD +0 -33
- {arcjetcv-0.0.6.dev2.dist-info → arcjetcv-0.0.7.dev2.dist-info}/LICENSE +0 -0
- {arcjetcv-0.0.6.dev2.dist-info → arcjetcv-0.0.7.dev2.dist-info}/WHEEL +0 -0
- {arcjetcv-0.0.6.dev2.dist-info → arcjetcv-0.0.7.dev2.dist-info}/entry_points.txt +0 -0
- {arcjetcv-0.0.6.dev2.dist-info → arcjetcv-0.0.7.dev2.dist-info}/top_level.txt +0 -0
arcjetCV/__init__.py
CHANGED
|
@@ -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
|
|
File without changes
|
|
@@ -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
|