def test_random_dots(self):
     config_detector = pb.ConfigUchiyaMarker()
     config_detector.markerWidth = 5.0
     config_detector.markerHeight = 5.0
     pb.FactoryFiducial(np.uint8).random_dots(config_detector)
#!/usr/bin/env python3

import pyboof as pb
import numpy as np
import os

data_path = "../data/example/fiducial/random_dots/"

# Enable use of memory mapped files for MUCH faster conversion between some python and boofcv data types
pb.init_memmap()

# Load marker descriptions
defs = pb.load_random_dot_yaml(os.path.join(data_path, "descriptions.yaml"))

# Create the detector
config = pb.ConfigUchiyaMarker()
config.markerLength = defs.markerWidth
detector = pb.FactoryFiducial(np.uint8).random_dots(config)

# Load / learn all the markers. This can take a few seconds if there are a lot of markers
for marker in defs.markers:
    detector.add_marker(marker)

# Load the image and process it
gray_image = pb.load_single_band(os.path.join(data_path, "image02.jpg"), np.uint8)
detector.detect(gray_image)

# Print out the location of found markers
for i in range(detector.get_total()):
    print("=========== Found #{}".format(i))
    fid_to_cam = detector.get_fiducial_to_camera(i)