Skip to content

Commit

Permalink
cleaning glass
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlib committed Jan 5, 2024
1 parent df1eeb3 commit b4ee139
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 27 deletions.
29 changes: 4 additions & 25 deletions openptv_python/calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,27 +100,6 @@ def set_back_focal_distance(self, cc: float) -> None:
"""Set the back focal distance of the camera."""
self.cc = cc


# class Glass:
# """Glass data structure."""

# def __init__(self, vec_x=0.0, vec_y=0.0, vec_z=1.0):
# self.vec_x = vec_x
# self.vec_y = vec_y
# self.vec_z = vec_z

# def set_glass_vec(self, vec: np.ndarray) -> None:
# """Set the glass vector."""
# self.vec_x, self.vec_y, self.vec_z = vec

Glass_dtype = np.dtype(
[
("vec_x", np.float64),
("vec_y", np.float64),
("vec_z", np.float64),
]
)

def default_glass_vec() -> np.ndarray:
"""Return default glass vector."""
return vec_set(0.0, 0.0, 1.0)
Expand Down Expand Up @@ -174,7 +153,7 @@ def __init__(self, ext_par=None, int_par=None, glass_par=None, added_par=None, m
if int_par is None:
int_par = Interior()
if glass_par is None:
glass_par = default_glass_vec()
glass_par = np.array([0.0, 0.0, 1.0])
if added_par is None:
added_par = ap_52()
if mmlut is None:
Expand Down Expand Up @@ -418,7 +397,7 @@ def set_glass_vec(self, gvec: np.ndarray):
self.glass_par = gvec

def get_glass_vec(self) -> np.ndarray:
"""Return the glass vector, a 3-element array of Glass_dtype."""
"""Return the glass vector, a 3-element array of float."""
return self.glass_par

def set_added_par(self, listpar: np.ndarray | list):
Expand Down Expand Up @@ -518,8 +497,8 @@ def compare_glass(g1: np.ndarray, g2: np.ndarray) -> bool:
Args:
----
g1 (Glass_dtype): vector pointing from the 3D origin to the surface of the glass
g2 (Glass_dtype): another vector for comparison
g1 (float array): vector pointing from the 3D origin to the surface of the glass
g2 (float array): another vector for comparison
Returns
-------
Expand Down
3 changes: 1 addition & 2 deletions tests/test_multimedia_r_nlay.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from openptv_python.calibration import (
Calibration,
Exterior,
Glass_dtype,
Interior,
ap_52,
)
Expand All @@ -29,7 +28,7 @@ def test_multimedia_r_nlay(self):
)

test_I = Interior(0.0, 0.0, 100.0)
test_G = np.array([(0.0001, 0.00001, 1.0)], dtype=Glass_dtype).view(np.recarray)
test_G = np.array((0.0001, 0.00001, 1.0))
test_addp = ap_52(0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0)
test_cal = Calibration(
test_Ex, test_I, test_G, test_addp
Expand Down

0 comments on commit b4ee139

Please sign in to comment.