-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Passing tests with working self calibration based approaches. ready t…
…o merge!
- Loading branch information
Showing
6 changed files
with
98 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from cv2 import aruco | ||
import numpy as np | ||
|
||
from pyCamSet import calibrate_cameras, Ccube, load_CameraSet | ||
from pyCamSet.optimisation.standard_bundle_handler import SelfBundleHandler | ||
from pyCamSet.calibration.camera_calibrator import run_bundle_adjustment | ||
|
||
def test_calib_ccube(): | ||
target = Ccube(n_points=10, length=40, aruco_dict=aruco.DICT_6X6_1000, border_fraction=0.2) | ||
loc="tests/test_data/calibration_ccube" | ||
cams = calibrate_cameras(loc, target, | ||
# draw=True, | ||
# save=False, | ||
) | ||
param_handler = SelfBundleHandler( | ||
detection=cams.calibration_handler.detection, target=target, camset=cams, | ||
) | ||
param_handler.set_from_templated_camset(cams) | ||
_, final_cams = run_bundle_adjustment( | ||
param_handler=param_handler, | ||
threads = 16, | ||
) | ||
final_euclid = np.mean(np.linalg.norm(np.reshape( | ||
final_cams.calibration_result, (-1, 2) | ||
), axis=1)) | ||
assert (final_euclid < 0.50), "regression found in self calibration using a ccube" | ||
|
||
if __name__ == "__main__": | ||
test_calib_ccube() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
from pathlib import Path | ||
from matplotlib import pyplot as plt | ||
import cv2 | ||
import numpy as np | ||
|
||
from pyCamSet import calibrate_cameras, ChArUco, load_CameraSet | ||
from pyCamSet.optimisation.standard_bundle_handler import SelfBundleHandler | ||
from pyCamSet.calibration.camera_calibrator import run_stereo_calibration, run_bundle_adjustment | ||
|
||
# we want to load some n camera calibration model | ||
|
||
def test_self_calibration_charuco(): | ||
data_loc = Path("./tests/test_data/calibration_charuco") | ||
target = ChArUco(20, 20, 4) | ||
|
||
|
||
cams = calibrate_cameras(f_loc=data_loc, calibration_target=target, | ||
# draw=True, | ||
# save=False, | ||
) | ||
param_handler = SelfBundleHandler( | ||
detection=cams.calibration_handler.detection, target=target, camset=cams, | ||
) | ||
|
||
param_handler.set_from_templated_camset(cams) | ||
# final_cams = run_stereo_calibration( | ||
_, final_cams = run_bundle_adjustment( | ||
param_handler=param_handler, | ||
threads = 16, | ||
) | ||
final_euclid = np.mean(np.linalg.norm(np.reshape( | ||
final_cams.calibration_result, (-1, 2) | ||
), axis=1)) | ||
assert (final_euclid < 1.07), "regression found in self calibration using a charuco board" | ||
|
||
|
||
if __name__ == '__main__': | ||
test_self_calibration_charuco() | ||
|