def scan(self, img_path): detector = pb.FactoryFiducial(np.uint8).qrcode() #Load image in grayscale bcv_img = pb.load_single_band(img_path, np.uint8) detector.detect(bcv_img) if (len(detector.detections) > 0): print(detector.detections[0].message) return len(detector.detections) + len(detector.failures), len( detector.detections)
def test_qrcode(self): config_detector = pb.ConfigQrCode() pb.FactoryFiducial(np.uint8).qrcode(config_detector)
def test_square_grid(self): config_target = pb.ConfigGridDimen(5, 6, 0.30) config_detector = pb.ConfigSquareGrid() pb.FactoryFiducial(np.uint8).square_grid(config_target, config_detector)
def test_chessboardX(self): config_target = pb.ConfigGridDimen(5, 6, 0.30) config_detector = pb.ConfigChessboardX() pb.FactoryFiducial(np.uint8).chessboardX(config_target, config_detector)
def test_square_hamming(self): config_marker = pb.load_hamming_marker( pb.HammingDictionary.ARUCO_ORIGINAL) pb.FactoryFiducial(np.uint8).square_hamming(config_marker)
def test_square_binary(self): config_detector = pb.ConfigFiducialBinary() config_threshold = pb.ConfigThreshold.create_fixed(50.0) pb.FactoryFiducial(np.uint8).square_binary(config_detector, config_threshold)
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)
def __init__(self): self.detector = pb.FactoryFiducial(np.uint8).qrcode()
import pyboof as pb import numpy as np import os data_path = "../data/example/fiducial/image/examples/" # Load the camera parameters intrinsic = pb.CameraPinhole() intrinsic.load(os.path.join(data_path, "intrinsic.yaml")) configFiducial = pb.ConfigFiducialImage() configThreshold = pb.ConfigThreshold.create_local(pb.ThresholdType.LOCAL_MEAN, 10) print("Configuring detector") detector = pb.FactoryFiducial(np.uint8).square_image(configFiducial, configThreshold) detector.set_intrinsic(intrinsic) detector.add_pattern(pb.load_single_band( data_path + "../patterns/pentarose.png", np.uint8), side_length=4.0) detector.add_pattern(pb.load_single_band(data_path + "../patterns/yu.png", np.uint8), side_length=4.0) print("Detecting image") detector.detect( pb.load_single_band(os.path.join(data_path, "image00.jpg"), np.uint8)) print("Number Found = " + str(detector.get_total())) for i in range(detector.get_total()):
#!/usr/bin/env python3 import numpy as np import pyboof as pb # Detects all the QR Codes in the image and prints their message and location data_path = "../data/example/fiducial/qrcode/image03.jpg" detector = pb.FactoryFiducial(np.uint8).qrcode() image = pb.load_single_band(data_path, np.uint8) detector.detect(image) print("Detected a total of {} QR Codes".format(len(detector.detections))) for qr in detector.detections: print("Message: " + qr.message) print(" at: " + str(qr.bounds))
data_path = "../data/example/fiducial/square_hamming/aruco_25h7" # Load the camera parameters intrinsic = pb.CameraPinhole() intrinsic.load(os.path.join(data_path, "intrinsic.yaml")) # Load a pre-built dictionary config_marker = pb.load_hamming_marker(pb.HammingDictionary.ARUCO_MIP_25h7) # Tweak the detector. None class be passed in for the detector config_detector = pb.ConfigFiducialHammingDetector() config_detector.configThreshold.type = pb.ThresholdType.LOCAL_MEAN print("Creating the detector") detector = pb.FactoryFiducial(np.uint8).square_hamming(config_marker, config_detector) print("Detecting image") detector.detect( pb.load_single_band(os.path.join(data_path, "image01.jpg"), np.uint8)) print("Number Found = " + str(detector.get_total())) for i in range(detector.get_total()): print("=========== Found #" + str(i)) fid_to_cam = detector.get_fiducial_to_camera(i) print("Pattern ID = " + str(detector.get_id(i))) print("Image Location " + str(detector.get_center(i))) if detector.is_3d(): print("Rotation") print(" " + str(fid_to_cam.get_rotation()))
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) print("Pattern ID = "+str(detector.get_id(i))) print("Image Location " + str(detector.get_center(i)))
import pyboof as pb import numpy as np data_path = "../../../data/applet/fiducial/image/examples/" # Load the camera parameters intrinsic = pb.Intrinsic() intrinsic.load_xml(data_path + "intrinsic.xml") config = pb.ConfigFiducialImage() print "Configuring detector" detector = pb.FactoryFiducial(np.uint8).squareRobust(config, 6) detector.setIntrinsic(intrinsic) detector.addPattern( pb.load_single_band(data_path + "../patterns/chicken.png", np.uint8), 4.0) detector.addPattern( pb.load_single_band(data_path + "../patterns/yu.png", np.uint8), 4.0) print "Detecting image" detector.detect(pb.load_single_band(data_path + "image01.jpg", np.uint8)) print "Number Found = " + str(detector.totalFound()) for i in range(detector.totalFound()): print "=========== Found " + str(i) fid_to_cam = detector.getFiducialToCamera(i) # print fid_to_cam print "Rotation" print " " + str(fid_to_cam.get_rotation())