I have an image which is all black and white and has a certain colored pixels over the black part, which is pink(those colored pixels are all same i.e., they have have same rgb values). I have the numpy ndarray for those pink pixels in the image. And using that ndarray i want to traverse the image , in such a way that for every colored pink pixel i go orthogonal(with yellow i have depicted the direction where i need to travel). I somehow need to find out the width of the black part doing so.
90 degrees to that pixel depiction: [![90 degrees to that pixel depiction][1]][1]
I basically need to note down the sharp change in the pixels while i do so, the moment i see a transition between black pixels to white i need to note down that distance from the point of the colored pixel to the point of transition.
i had written this code which showed me the pixels in an image(rgb) but is not working for my current example here..
for i, j in np.ndindex(img.shape[:-1]):
print(img[i,j])
Here is how, with the input image (
image.png) as:Output: