Skip to content
Snippets Groups Projects

Live wire to be implemented into GUI

Merged s224389 requested to merge live_wire into GUI
1 file
+ 16
4
Compare changes
  • Side-by-side
  • Inline
+ 16
4
@@ -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")
Loading