aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/argaze/ArUcoMarkers/ArUcoOpticCalibrator.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/argaze/ArUcoMarkers/ArUcoOpticCalibrator.py b/src/argaze/ArUcoMarkers/ArUcoOpticCalibrator.py
index 257b877..f206c11 100644
--- a/src/argaze/ArUcoMarkers/ArUcoOpticCalibrator.py
+++ b/src/argaze/ArUcoMarkers/ArUcoOpticCalibrator.py
@@ -16,8 +16,15 @@ import numpy
import cv2
import cv2.aruco as aruco
-K0 = numpy.array([[1., 0., 0.], [0., 1., 0.], [0., 0., 0.]])
-"""Define default optic intrinsic parameters matrix."""
+def K0(focal_length: tuple, width: int, height: int) -> numpy.array:
+ """Define default optic intrinsic parameters matrix.
+
+ Parameters:
+ width: in pixel.
+ height: in pixel.
+ """
+
+ return numpy.array([[focal_length[0], 0., width/2], [0., focal_length[1], height/2], [0., 0., 1.]])
D0 = numpy.array([0.0, 0.0, 0.0, 0.0, 0.0])
"""Define default optic distorsion coefficients vector."""
@@ -32,7 +39,7 @@ class OpticParameters():
dimensions: numpy.array = field(default_factory=lambda : numpy.array([0, 0]))
"""Image dimensions in pixels from which the calibration have been done."""
- K: numpy.array = field(default_factory=lambda : K0)
+ K: numpy.array = field(default_factory=lambda : K0((0, 0), 0, 0))
"""Intrinsic parameters matrix (focal lengths and principal point)."""
D: numpy.array = field(default_factory=lambda : D0)