title: Finding the (x,y) indexes of specific (R,G,B) color values from images stored in NumPy ndarrays
body: <p>I have an image stored in a numpy array, as yielded by <code>imread()</code>:</p>
  
  <pre><code>&gt;&gt;&gt; ndim
  array([[[  0,   0,   0],
          [  4,   0,   0],
          [  8,   0,   0],
          ..., 
          [247,   0,  28],
          [251,   0,  28],
          [255,   0,  28]],
  
         [[  0, 255, 227],
          [  4, 255, 227],
          [  8, 255, 227],
          ..., 
          [247, 255, 255],
          [251, 255, 255],
          [255, 255, 255]]], dtype=uint8)
  &gt;&gt;&gt; ndim.shape
  (512, 512, 3)
  </code></pre>
  
  <p>I want to efficiently find the (x, y) coordinate (or coordinates) of pixels with a specific color value, e.g.</p>
  
  <pre><code>&gt;&gt;&gt; c
  array([ 32,  32, 109], dtype=uint8)
  
  &gt;&gt;&gt; ndim[200,200]
  array([ 32,  32, 109], dtype=uint8)
  
  &gt;&gt;&gt; ndim.T[0, 200, 200]
  32
  &gt;&gt;&gt; ndim.T[1, 200, 200]
  32
  &gt;&gt;&gt; ndim.T[2, 200, 200]
  109
  </code></pre>
  
  <p>... in this case, I know the pixel at (200, 200) has the RGB value (32, 32, 109) -- I can test for this.</p>
  
  <p>What I want to do is query the ndarray for a pixel value and get back the coordinates. In the above case, the putative function <code>find_pixel(c)</code> would return (200, 200).</p>
  
  <p>Ideally this <code>find_pixel()</code> function would return a list of coordinate tuples and not just the first value it finds.</p>
  
  <p>I've looked at numpy's "fancy indexing", which confused me greatly... Most of my attempts at figuring this out have been overwrought and unnecessarily baroque.</p>
  
  <p>I am sure there is a very simple method that I am overlooking here. What is the best way to do this -- is there an altogether better mechanism to get these values than that which I have outlined?</p>