# 3. non-max supprssion suppressed = Detector.non_max_suppression((SobelX, SobelY)) # Image.fromarray(np.uint8(suppressed), 'L').show() # 4. canny detection canny = Detector.canny_detector(np.uint8(suppressed) * 255) canny_image = Image.fromarray(np.uint8(canny) * 255, 'L').convert("RGB") # Image.fromarray(np.uint8(canny) * 255, 'L').show() # 5. Hough transformation vertical_lines = Detector.hough_lines(canny, 180, 452) horizontal_lines = Detector.hough_lines(canny, 90, 193) # output image Detector.drawLines(canny_image, vertical_lines[0], vertical_lines[1]) Detector.drawLines(canny_image, horizontal_lines[0], horizontal_lines[1]) canny_image.save(args.output_im) canny_gray = ImageOps.grayscale(canny_image) canny_gray.save(args.output_im) ##canny_img = np.uint8(canny_image)#canny_image.load() ##find blue line # 6. output detected answers to txt file answers = Detector.naive_grader(np.uint8(canny) * 255) #answers = Detector.origin_grader(np.uint8(image_gray)) #answers = Detector.hough_grader(np.uint8(canny_gray)) ##use edged graph to find location will sometimes cause the missing lines