Skip to content

Commit

Permalink
better AbstractFiducial.orientation description
Browse files Browse the repository at this point in the history
  • Loading branch information
bbean23 committed Apr 26, 2024
1 parent 62e77ae commit 2568e2d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 9 deletions.
28 changes: 24 additions & 4 deletions opencsp/common/lib/cv/AbstractFiducials.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import matplotlib.axes
import matplotlib.pyplot as plt
import numpy as np
import scipy.spatial

import opencsp.common.lib.geometry.Pxy as p2
import opencsp.common.lib.geometry.RegionXY as reg
Expand Down Expand Up @@ -46,10 +47,29 @@ def origin(self) -> p2.Pxy:

@property
@abstractmethod
def orientation(self) -> v3.Vxyz:
"""The orientation(s) of this instance, in radians. This is relative to
the source image, where x is positive to the right, y is positive down,
and z is positive in (away from the camera)."""
def orientation(self) -> scipy.spatial.transform.Rotation:
"""
The orientation of the normal vector(s) of this instance.
This is relative to the orthorectified source image, where x is positive
to the right, y is positive down, and z is positive in (away from the
camera).
This can be used to describe the forward transformation from the
camera's perspective. For example, an aruco marker whose origin is in
the center of the image and is facing towards the camera could have the
orientation::
Rotation.from_euler('y', np.pi)
If that same aruco marker was also placed upside down, then it's
orientation could be::
Rotation.from_euler(
'yz',
[ [np.pi, 0],
[0, np.pi] ]
)
"""

@property
@abstractmethod
Expand Down
5 changes: 3 additions & 2 deletions opencsp/common/lib/cv/fiducials/BcsFiducial.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import matplotlib.axes
import matplotlib.patches
import scipy.spatial

from opencsp.common.lib.cv.AbstractFiducials import AbstractFiducials
import opencsp.common.lib.geometry.LoopXY as loop
Expand Down Expand Up @@ -42,8 +43,8 @@ def origin(self) -> p2.Pxy:
return self.origin_px

@property
def orientation(self) -> v3.Vxyz:
return v3.Vxyz([0, 0, 0])
def orientation(self) -> scipy.spatial.transform.Rotation:
raise NotImplementedError("Orientation is not yet implemented for PointFiducials")

@property
def size(self) -> list[float]:
Expand Down
6 changes: 3 additions & 3 deletions opencsp/common/lib/cv/fiducials/PointFiducials.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import numpy as np
import scipy.spatial

from opencsp.common.lib.cv.AbstractFiducials import AbstractFiducials
import opencsp.common.lib.geometry.Vxyz as v3
Expand All @@ -23,9 +24,8 @@ def origin(self) -> p2.Pxy:
return self.points

@property
def orientation(self) -> v3.Vxyz:
# TODO untested
return np.zeros((3, self.points.x.size))
def orientation(self) -> scipy.spatial.transform.Rotation:
raise NotImplementedError("Orientation is not yet implemented for PointFiducials")

@property
def size(self) -> list[float]:
Expand Down

0 comments on commit 2568e2d

Please sign in to comment.