Skip to content
Snippets Groups Projects
Commit 14451d92 authored by Christian's avatar Christian
Browse files

Changed to cost image plot

parent 2a8b9214
No related branches found
No related tags found
1 merge request!3Live wire to be implemented into GUI
......@@ -83,13 +83,21 @@ def backtrack_pixels_on_image(img_color, path_coords, bgr_color=(0, 0, 255)):
img_color[row, col] = bgr_color
return img_color
def export_path(path_coords, path_name):
"""
Export the path to a np array.
"""
np.save(path_name, path_coords)
return None
#### Main Script ####
def main():
# Define input parameters
image_path = 'bipes_slice.png'
image_path = 'agamodon_slice.png'
image_type = 'gray' # 'gray' or 'color'
downscale_factor = 100 # % of original size
points_path = 'bipesPoints.npy'
points_path = 'agamodonPoints.npy'
# Load image
image = load_image(image_path, image_type)
......@@ -128,11 +136,15 @@ def main():
# If you want to mark it in red, do (0,0,255) because OpenCV uses BGR format.
color_img = backtrack_pixels_on_image(color_img, path_rc, bgr_color=(0, 0, 255))
# Export path
export_path(path_rc, 'agamodonPath.npy')
# Display results
plt.figure(figsize=(20, 8))
plt.subplot(1, 2, 1)
plt.title("Canny Edges")
plt.imshow(canny_img, cmap='gray')
plt.title("Cost image")
plt.imshow(cost_image, cmap='gray')
plt.subplot(1, 2, 2)
plt.title("Path from Seed to Target")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment