Пример #1
0
    def _puck_detection(image, approx_radius, tolerance=0.1):
        min_radius = approx_radius * (1-tolerance)
        max_radius = approx_radius * (1+tolerance)

        detector = CircleDetector()
        detector.set_minimum_separation(100000)
        detector.set_minimum_radius(min_radius)
        detector.set_maximum_radius(max_radius)

        circles = detector.find_circles(image)
        return circles
Пример #2
0
    def _hole_detection(image, avg_barcode_radius):
        # For Unipuck, empty hole radius is about 1.1-1.3 x barcode radius
        MIN_FACTOR = 1.00
        MAX_FACTOR = 1.50

        # For Unipuck, separation between closest neighbours is about 3.7-3.9 x barcode radius
        SEPARATION_FACTOR = 3.6

        min_radius = MIN_FACTOR * avg_barcode_radius
        max_radius = MAX_FACTOR * avg_barcode_radius
        min_dist = SEPARATION_FACTOR * avg_barcode_radius

        detector = CircleDetector()
        detector.set_minimum_radius(min_radius)
        detector.set_maximum_radius(max_radius)
        detector.set_minimum_separation(min_dist)
        circles = detector.find_circles(image)

        return circles