Numpy + OpenCV-Python : Get coordinates of white pixels

SomethingSomething picture SomethingSomething · Apr 26, 2017 · Viewed 8.9k times · Source

I have a grayscale image and I want to get all the coordinates of pixels with intensity level 255.

I tried using:

pixels = np.where(img[img == 255])

But instead of getting a list of (X,Y) coordinates, I got a list of numbers, like if img was a one dimensional vector.

What am I doing wrong?

Answer