Beispiel #1
0
    for file_name,measur_circle in correct_circles:
        #Keep track of the number of balls measured
        num_balls+= len(measur_circle)   
        
        image = InputOutput.get_image(file_name)
        InputOutput.display_image(image,"Starting Image")

        image_hsv = cv2.cvtColor(image, cv2.COLOR_BGR2HSV) # convert to HSV for thresholding
        image_hsv = cv2.blur(image_hsv, (9,9)) # blur to reduce noise
 
        thresh = ImageProcessing.thresholdRed(image_hsv)
        InputOutput.display_image(thresh,"Thresholded")
        thresh = ImageProcessing.removeNoise(thresh)    
    
        #calc_circles = ImageProcessing.houghTransform(thresh)
        calc_circles = ImageProcessing.blob_circle_detection(thresh)
        if calc_circles == None:
            calc_circles = []
        #calc_circles = ImageProcessing.get_blob_centroid(image, thresh, 5)
         
        InputOutput.display_image_with_circles(image,"Result!",calc_circles)
        
        #evalueateSuccess by comparing the circle position with the most similar
        #red ball's measured circle.
        
        #Print basic file facts
        print ("")
        print ("file: " + file_name)
        print ("# of Balls in image: " + str(len(measur_circle)))
        print ("# of Balls detected: " + str(len(calc_circles)))