Skip to content

Instantly share code, notes, and snippets.

@trickeydan
Created January 14, 2020 22:45
Show Gist options
  • Save trickeydan/aeb67c406a0e46007b618528a59e354a to your computer and use it in GitHub Desktop.
Save trickeydan/aeb67c406a0e46007b618528a59e354a to your computer and use it in GitHub Desktop.
Plot Zoloto Axes.
from pathlib import Path
from zoloto.cameras.camera import Camera
from zoloto.marker_dict import MarkerDict
import matplotlib.pyplot as plt
class DefaultCamera(Camera):
def get_marker_size(self, marker_id: int) -> int:
"""Get the size of a particular marker."""
return 10
if __name__ == "__main__":
plt.ion()
fig = plt.figure()
plt.axis([0, 1000, -5, 5])
i = 0
camera = DefaultCamera(
0,
marker_dict=MarkerDict.DICT_APRILTAG_36H11,
calibration_file=Path(__file__).parent.joinpath('C270.xml'),
)
while True:
markers = list(camera.process_frame())
if len(markers) == 1:
marker = markers[0]
print(marker.orientation, end="\r")
plt.scatter(i, marker.orientation.rot_x, c="red")
plt.scatter(i, marker.orientation.rot_y, c="green")
plt.scatter(i, marker.orientation.rot_z, c="blue")
i += 1
plt.show()
plt.pause(0.0001)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment