Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

I have imported a color image using openCV imread function.

im = cv2.imread('test.jpg')

I am looking to find the indices of white pixels, which have a pixel value of [255, 255, 255]. I know im is actually a 3D array. But what is weird is the value of im[0,0] is [255 255 255], rather than [255, 255, 255]. And im[0,0,0] is 255. So [255 255 255] seems like a list or something, but actually not equivalent to [255, 255, 255].

>>> print im[0,0]
[255 255 255]

>>> print im[0,0,0]
255

So my questions are:

  1. What is the difference between [255 255 255] and [255, 255, 255]?
  2. How can I get the indices of all withe pixels? What search algorithm should I use?
share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.