I've got a binary image where I need to select the nearest white pixel to a given set of pixel coordinates.
For example, if I click on a pixel I need to have Python search for the nearest pixel with a value greater than 0 then return that pixel's coordinates.
Any thoughts?
I figured I should add what I've done so far.
import cv2
import numpy as np
img = cv.imread('depth.png', 0) # reads image as grayscale
edges = cv2.Canny(img, 10, 50)
white_coords = np.argwhere(edges == 255) # finds all of the white pixel coordinates in the image and places them in a list.
# this is where I'm stuck