Network change
BIN
test/files/cam2/20260606_145014_cam2_right.jpg
Normal file
|
After Width: | Height: | Size: 296 KiB |
BIN
test/files/cam2/20260606_145223_cam2_right.jpg
Normal file
|
After Width: | Height: | Size: 285 KiB |
BIN
test/files/cam2/20260606_145249_cam2_right.jpg
Normal file
|
After Width: | Height: | Size: 289 KiB |
BIN
test/files/cam2/20260606_145310_cam2_right.jpg
Normal file
|
After Width: | Height: | Size: 291 KiB |
BIN
test/files/cam2/20260606_145331_cam2_right.jpg
Normal file
|
After Width: | Height: | Size: 290 KiB |
BIN
test/files/cam2/20260606_145404_cam2_right.jpg
Normal file
|
After Width: | Height: | Size: 294 KiB |
BIN
test/files/cam2/20260606_145415_cam2_right.jpg
Normal file
|
After Width: | Height: | Size: 294 KiB |
BIN
test/files/cam2/20260606_145444_cam2_right.jpg
Normal file
|
After Width: | Height: | Size: 298 KiB |
BIN
test/files/cam2/20260606_145528_cam2_right.jpg
Normal file
|
After Width: | Height: | Size: 291 KiB |
BIN
test/files/cam2/20260606_145542_cam2_right.jpg
Normal file
|
After Width: | Height: | Size: 290 KiB |
BIN
test/files/cam2/20260606_145605_cam2_right.jpg
Normal file
|
After Width: | Height: | Size: 293 KiB |
BIN
test/files/cam2/20260606_153702_cam2_right.jpg
Normal file
|
After Width: | Height: | Size: 291 KiB |
BIN
test/files/cam2/20260606_153744_cam2_right.jpg
Normal file
|
After Width: | Height: | Size: 287 KiB |
BIN
test/files/cam2/20260606_153808_cam2_right.jpg
Normal file
|
After Width: | Height: | Size: 280 KiB |
BIN
test/files/cam2/20260606_153845_cam2_right.jpg
Normal file
|
After Width: | Height: | Size: 299 KiB |
BIN
test/files/cam2/20260606_153855_cam2_right.jpg
Normal file
|
After Width: | Height: | Size: 299 KiB |
BIN
test/files/cam2/20260606_153918_cam2_right.jpg
Normal file
|
After Width: | Height: | Size: 305 KiB |
BIN
test/files/cam2/20260606_153928_cam2_right.jpg
Normal file
|
After Width: | Height: | Size: 300 KiB |
BIN
test/files/cam2/20260606_153949_cam2_right.jpg
Normal file
|
After Width: | Height: | Size: 300 KiB |
BIN
test/files/cam2/20260606_154021_cam2_right.jpg
Normal file
|
After Width: | Height: | Size: 304 KiB |
BIN
test/files/cam2/20260606_154050_cam2_right.jpg
Normal file
|
After Width: | Height: | Size: 302 KiB |
BIN
test/files/cam2/20260606_154108_cam2_right.jpg
Normal file
|
After Width: | Height: | Size: 303 KiB |
BIN
test/files/cam2/20260606_154127_cam2_right.jpg
Normal file
|
After Width: | Height: | Size: 305 KiB |
BIN
test/files/cam2/20260606_160853_cam2_right.jpg
Normal file
|
After Width: | Height: | Size: 274 KiB |
BIN
test/files/cam2/20260606_160926_cam2_right.jpg
Normal file
|
After Width: | Height: | Size: 255 KiB |
BIN
test/files/cam2/20260606_161001_cam2_right.jpg
Normal file
|
After Width: | Height: | Size: 280 KiB |
BIN
test/files/cam2/20260606_161052_cam2_right.jpg
Normal file
|
After Width: | Height: | Size: 219 KiB |
BIN
test/files/cam2/20260606_161119_cam2_right.jpg
Normal file
|
After Width: | Height: | Size: 222 KiB |
BIN
test/files/cam2/20260606_161144_cam2_right.jpg
Normal file
|
After Width: | Height: | Size: 224 KiB |
BIN
test/files/cam2/20260606_161207_cam2_right.jpg
Normal file
|
After Width: | Height: | Size: 228 KiB |
BIN
test/files/cam2/20260606_161237_cam2_right.jpg
Normal file
|
After Width: | Height: | Size: 227 KiB |
BIN
test/files/cam2/20260606_161259_cam2_right.jpg
Normal file
|
After Width: | Height: | Size: 188 KiB |
BIN
test/files/cam2/20260606_161325_cam2_right.jpg
Normal file
|
After Width: | Height: | Size: 272 KiB |
BIN
test/files/cam2/20260606_161352_cam2_right.jpg
Normal file
|
After Width: | Height: | Size: 277 KiB |
BIN
test/files/cam2/20260606_161422_cam2_right.jpg
Normal file
|
After Width: | Height: | Size: 267 KiB |
BIN
test/files/cam2/20260606_161449_cam2_right.jpg
Normal file
|
After Width: | Height: | Size: 272 KiB |
BIN
test/files/cam2/20260606_161525_cam2_right.jpg
Normal file
|
After Width: | Height: | Size: 268 KiB |
BIN
test/files/cam2/20260606_161552_cam2_right.jpg
Normal file
|
After Width: | Height: | Size: 254 KiB |
BIN
test/files/cam2/20260606_161627_cam2_right.jpg
Normal file
|
After Width: | Height: | Size: 175 KiB |
BIN
test/files/cam2/20260606_161650_cam2_right.jpg
Normal file
|
After Width: | Height: | Size: 254 KiB |
BIN
test/files/cam2/calibration_c922.npz
Normal file
99
test/files/cam2/callibriate.py
Normal file
@@ -0,0 +1,99 @@
|
||||
|
||||
import cv2
|
||||
import numpy as np
|
||||
import glob
|
||||
|
||||
#
|
||||
# Create calibration .npz from checkerboard images
|
||||
#
|
||||
|
||||
# Parameters
|
||||
CHECKERBOARD = (10, 7) # inner corners
|
||||
square_size = 25.0 / 1000.0 # 25 mm -> meters
|
||||
|
||||
# Prepare object points
|
||||
objp = np.zeros((CHECKERBOARD[0] * CHECKERBOARD[1], 3), np.float32)
|
||||
objp[:, :2] = np.mgrid[0:CHECKERBOARD[0], 0:CHECKERBOARD[1]].T.reshape(-1, 2)
|
||||
objp *= square_size
|
||||
|
||||
objpoints = [] # 3D points
|
||||
imgpoints = [] # 2D points
|
||||
|
||||
# Load images
|
||||
images = glob.glob("*.jpg")
|
||||
print("Found images:", len(images))
|
||||
|
||||
img_size = None
|
||||
|
||||
for fname in images:
|
||||
img = cv2.imread(fname)
|
||||
|
||||
print(f"Processing {fname}...")
|
||||
if img is None:
|
||||
print(f"Warning: could not read {fname}")
|
||||
continue
|
||||
|
||||
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
|
||||
|
||||
# Save image size once
|
||||
if img_size is None:
|
||||
img_size = gray.shape[::-1]
|
||||
|
||||
print(f" Gray")
|
||||
ret, corners = cv2.findChessboardCorners(
|
||||
gray,
|
||||
CHECKERBOARD,
|
||||
flags=cv2.CALIB_CB_ADAPTIVE_THRESH +
|
||||
cv2.CALIB_CB_NORMALIZE_IMAGE +
|
||||
cv2.CALIB_CB_FAST_CHECK
|
||||
)
|
||||
print(" Corners found")
|
||||
|
||||
if ret:
|
||||
corners2 = cv2.cornerSubPix(
|
||||
gray,
|
||||
corners,
|
||||
(11, 11),
|
||||
(-1, -1),
|
||||
(cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 30, 1e-6)
|
||||
)
|
||||
|
||||
objpoints.append(objp)
|
||||
imgpoints.append(corners2)
|
||||
|
||||
print(f"✅ Corners found in {fname}")
|
||||
else:
|
||||
print(f"❌ No corners found in {fname}")
|
||||
|
||||
print(f"\nTotal valid images: {len(objpoints)} / {len(images)}" )
|
||||
# Sanity checks
|
||||
if img_size is None:
|
||||
raise RuntimeError("No images were successfully loaded.")
|
||||
|
||||
if len(objpoints) == 0:
|
||||
raise RuntimeError("No chessboard corners detected in any image. Calibration failed.")
|
||||
|
||||
print("\n=== Sanity Checks Passed ===")
|
||||
# Calibration
|
||||
ret, K, D, rvecs, tvecs = cv2.calibrateCamera(
|
||||
objpoints,
|
||||
imgpoints,
|
||||
img_size,
|
||||
None,
|
||||
None
|
||||
)
|
||||
|
||||
|
||||
print("\n=== Calibration Results ===")
|
||||
print("RMS reprojection error:", ret)
|
||||
print("Camera matrix:\n", K)
|
||||
print("Distortion coefficients:\n", D)
|
||||
|
||||
# Save calibration
|
||||
np.savez(
|
||||
"calibration_XPro2_16mm.npz",
|
||||
camera_matrix=K,
|
||||
dist_coeffs=D
|
||||
)
|
||||
|
||||
print("\n✅ Calibration saved to calibration_XPro2_16mm.npz")
|
||||