diff --git a/debug-steps/001_Image.png b/debug-steps/001_Image.png new file mode 100644 index 0000000..a205fd7 Binary files /dev/null and b/debug-steps/001_Image.png differ diff --git a/debug-steps/002_Normalized.png b/debug-steps/002_Normalized.png new file mode 100644 index 0000000..bfa4566 Binary files /dev/null and b/debug-steps/002_Normalized.png differ diff --git a/debug-steps/003_Eroded.png b/debug-steps/003_Eroded.png new file mode 100644 index 0000000..a6b82fa Binary files /dev/null and b/debug-steps/003_Eroded.png differ diff --git a/debug-steps/004_Threshold.png b/debug-steps/004_Threshold.png new file mode 100644 index 0000000..830080d Binary files /dev/null and b/debug-steps/004_Threshold.png differ diff --git a/debug-steps/005_Dilated.png b/debug-steps/005_Dilated.png new file mode 100644 index 0000000..c501e79 Binary files /dev/null and b/debug-steps/005_Dilated.png differ diff --git a/debug-steps/006_Cropped.png b/debug-steps/006_Cropped.png new file mode 100644 index 0000000..cfc5633 Binary files /dev/null and b/debug-steps/006_Cropped.png differ diff --git a/debug-steps/007_Maze.png b/debug-steps/007_Maze.png new file mode 100644 index 0000000..fd0195d Binary files /dev/null and b/debug-steps/007_Maze.png differ diff --git a/debug-steps/008_Maze Bitmap.png b/debug-steps/008_Maze Bitmap.png new file mode 100644 index 0000000..ec29df4 Binary files /dev/null and b/debug-steps/008_Maze Bitmap.png differ diff --git a/debug-steps/009_Maze Path.png b/debug-steps/009_Maze Path.png new file mode 100644 index 0000000..12b57d2 Binary files /dev/null and b/debug-steps/009_Maze Path.png differ diff --git a/debug-steps/010_Solution.png b/debug-steps/010_Solution.png new file mode 100644 index 0000000..aa8478b Binary files /dev/null and b/debug-steps/010_Solution.png differ diff --git a/main.py b/main.py index 409e826..7b1aeea 100644 --- a/main.py +++ b/main.py @@ -1,4 +1,3 @@ -# import the necessary packages import cv2 import utils @@ -9,6 +8,7 @@ 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") +ap.add_argument("-d", "--debug", action="store_true", help="display debug information") args = vars(ap.parse_args()) # load the input image and convert it to grayscale @@ -17,7 +17,7 @@ print("[INFO] loading image...") image = cv2.imread(args["image"]) utils.display_image("Image", image) -path = cv_maze.solve_maze(image) +path = cv_maze.solve_maze(image, debug=args["debug"]) # draw the path on the original image diff --git a/utils.py b/utils.py index 26a5c82..c2bd8e4 100644 --- a/utils.py +++ b/utils.py @@ -26,6 +26,7 @@ def display_image(label, image, default_width: int = 800, default_height: int = cv2.namedWindow(label, cv2.WINDOW_NORMAL) cv2.resizeWindow(label, default_width, default_height) cv2.imshow(label, image) + cv2.imwrite(f"debug-steps/{len(WINDOW_LABELS):03}_{label}.png", image) def wait_frame():