You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
685 B
Python
30 lines
685 B
Python
# import the necessary packages
|
|
import cv2
|
|
|
|
import utils
|
|
import cv_maze
|
|
|
|
import argparse
|
|
|
|
# construct the argument parser and parse the arguments
|
|
ap = argparse.ArgumentParser()
|
|
ap.add_argument("-i", "--image", required=True, help="path to input image containing AprilTag")
|
|
args = vars(ap.parse_args())
|
|
|
|
# load the input image and convert it to grayscale
|
|
print("[INFO] loading image...")
|
|
|
|
image = cv2.imread(args["image"])
|
|
utils.display_image("Image", image)
|
|
|
|
path = cv_maze.solve_maze(image)
|
|
|
|
# draw the path on the original image
|
|
|
|
for i in range(len(path) - 1):
|
|
cv2.line(image, path[i], path[i + 1], (0, 255, 0), 5)
|
|
|
|
utils.display_image("Solution", image)
|
|
|
|
utils.wait_close_app()
|