arcjetCV 0.0.7.dev1__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.7.dev1 → arcjetcv-0.0.7.dev2}/PKG-INFO +1 -1
- 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.7.dev2/arcjetCV/utils/__init__.py +0 -0
- {arcjetcv-0.0.7.dev1 → arcjetcv-0.0.7.dev2}/arcjetCV.egg-info/PKG-INFO +1 -1
- {arcjetcv-0.0.7.dev1 → arcjetcv-0.0.7.dev2}/arcjetCV.egg-info/SOURCES.txt +9 -0
- {arcjetcv-0.0.7.dev1 → arcjetcv-0.0.7.dev2}/setup.py +1 -1
- {arcjetcv-0.0.7.dev1 → arcjetcv-0.0.7.dev2}/LICENSE +0 -0
- {arcjetcv-0.0.7.dev1 → arcjetcv-0.0.7.dev2}/README.md +0 -0
- {arcjetcv-0.0.7.dev1 → arcjetcv-0.0.7.dev2}/arcjetCV/__init__.py +0 -0
- {arcjetcv-0.0.7.dev1/arcjetCV/gui → arcjetcv-0.0.7.dev2/arcjetCV/calibration}/__init__.py +0 -0
- {arcjetcv-0.0.7.dev1/arcjetCV → arcjetcv-0.0.7.dev2/arcjetCV/calibration}/chessboard_pattern.png +0 -0
- {arcjetcv-0.0.7.dev1/arcjetCV/segmentation → arcjetcv-0.0.7.dev2/arcjetCV/gui}/__init__.py +0 -0
- {arcjetcv-0.0.7.dev1 → arcjetcv-0.0.7.dev2}/arcjetCV/gui/_arcjetCV_gui.py +0 -0
- {arcjetcv-0.0.7.dev1 → arcjetcv-0.0.7.dev2}/arcjetCV/gui/arcjetCV_gui.py +0 -0
- {arcjetcv-0.0.7.dev1 → arcjetcv-0.0.7.dev2}/arcjetCV/gui/custom_classes.py +0 -0
- {arcjetcv-0.0.7.dev1 → arcjetcv-0.0.7.dev2}/arcjetCV/gui/logo/arcjetCV_logo_.png +0 -0
- {arcjetcv-0.0.7.dev1 → arcjetcv-0.0.7.dev2}/arcjetCV/gui/logo/arcjetCV_logo_white.png +0 -0
- {arcjetcv-0.0.7.dev1 → arcjetcv-0.0.7.dev2}/arcjetCV/gui/main.py +0 -0
- {arcjetcv-0.0.7.dev1 → arcjetcv-0.0.7.dev2}/arcjetCV/gui/main_window.py +0 -0
- {arcjetcv-0.0.7.dev1/arcjetCV/segmentation/contour → arcjetcv-0.0.7.dev2/arcjetCV/segmentation}/__init__.py +0 -0
- {arcjetcv-0.0.7.dev1/arcjetCV/segmentation/time → arcjetcv-0.0.7.dev2/arcjetCV/segmentation/contour}/__init__.py +0 -0
- {arcjetcv-0.0.7.dev1 → arcjetcv-0.0.7.dev2}/arcjetCV/segmentation/contour/cnn.py +0 -0
- {arcjetcv-0.0.7.dev1 → arcjetcv-0.0.7.dev2}/arcjetCV/segmentation/contour/contour.py +0 -0
- {arcjetcv-0.0.7.dev1/arcjetCV/utils → arcjetcv-0.0.7.dev2/arcjetCV/segmentation/time}/__init__.py +0 -0
- {arcjetcv-0.0.7.dev1 → arcjetcv-0.0.7.dev2}/arcjetCV/segmentation/time/time_segmentation.py +0 -0
- {arcjetcv-0.0.7.dev1 → arcjetcv-0.0.7.dev2}/arcjetCV/utils/logger.py +0 -0
- {arcjetcv-0.0.7.dev1 → arcjetcv-0.0.7.dev2}/arcjetCV/utils/output.py +0 -0
- {arcjetcv-0.0.7.dev1 → arcjetcv-0.0.7.dev2}/arcjetCV/utils/processor.py +0 -0
- {arcjetcv-0.0.7.dev1 → arcjetcv-0.0.7.dev2}/arcjetCV/utils/utils.py +0 -0
- {arcjetcv-0.0.7.dev1 → arcjetcv-0.0.7.dev2}/arcjetCV/utils/video.py +0 -0
- {arcjetcv-0.0.7.dev1 → arcjetcv-0.0.7.dev2}/arcjetCV.egg-info/dependency_links.txt +0 -0
- {arcjetcv-0.0.7.dev1 → arcjetcv-0.0.7.dev2}/arcjetCV.egg-info/entry_points.txt +0 -0
- {arcjetcv-0.0.7.dev1 → arcjetcv-0.0.7.dev2}/arcjetCV.egg-info/requires.txt +0 -0
- {arcjetcv-0.0.7.dev1 → arcjetcv-0.0.7.dev2}/arcjetCV.egg-info/top_level.txt +0 -0
- {arcjetcv-0.0.7.dev1 → arcjetcv-0.0.7.dev2}/setup.cfg +0 -0
- {arcjetcv-0.0.7.dev1 → arcjetcv-0.0.7.dev2}/tests/README.md +0 -0
- {arcjetcv-0.0.7.dev1 → arcjetcv-0.0.7.dev2}/tests/__init__.py +0 -0
- {arcjetcv-0.0.7.dev1 → arcjetcv-0.0.7.dev2}/tests/test_calibration_functions.py +0 -0
- {arcjetcv-0.0.7.dev1 → arcjetcv-0.0.7.dev2}/tests/test_calibration_gui.py +0 -0
- {arcjetcv-0.0.7.dev1 → arcjetcv-0.0.7.dev2}/tests/test_functions.py +0 -0
- {arcjetcv-0.0.7.dev1 → arcjetcv-0.0.7.dev2}/tests/test_gui.py +0 -0
- {arcjetcv-0.0.7.dev1 → arcjetcv-0.0.7.dev2}/tests/test_obj_models.py +0 -0
- {arcjetcv-0.0.7.dev1 → arcjetcv-0.0.7.dev2}/tests/test_segmentation.py +0 -0
|
@@ -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
|