Numpy + OpenCV-Python : Get coordinates of white pixels [duplicate]

断了今生、忘了曾经 提交于 2020-01-22 20:16:05

问题


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?

来源:https://stackoverflow.com/questions/43632498/numpy-opencv-python-get-coordinates-of-white-pixels

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!