Skip to content
Snippets Groups Projects
find_path.py 392 B
Newer Older
  • Learn to ignore specific revisions
  • from skimage.graph import route_through_array
    
    
    s224361's avatar
    s224361 committed
    def find_path(cost_image, points):
    
    
        if len(points) != 2:
            raise ValueError("Points should be a list of 2 points: seed and target.")
        
        seed_rc, target_rc = points
    
        path_rc, cost = route_through_array(
    
    s224361's avatar
    s224361 committed
            cost_image, 
            start=seed_rc, 
            end=target_rc, 
    
            fully_connected=True
        )
    
    
    s224361's avatar
    s224361 committed
        return path_rc