title: Find X and Y Coordinates of a value in a python array
body: <p>I am trying to get the x and y coordinates of a given value in a numpy image array.  </p>
  
  <p>I can do it by running through the rows and columns manually with a for statement, but this seems rather slow and I am possitive there is a better way to do this. </p>
  
  <p>I was trying to modify a solution I found in this post. <a href="https://stackoverflow.com/questions/12138339/finding-the-x-y-indexes-of-specific-r-g-b-color-values-from-images-stored-in">Finding the (x,y) indexes of specific (R,G,B) color values from images stored in NumPy ndarrays</a></p>
  
  <pre><code>a = image
  c = intensity_value
  
  y_locs = np.where(np.all(a == c, axis=0))
  x_locs = np.where(np.all(a == c, axis=1))
  
  return np.int64(x_locs), np.int64(y_locs)
  </code></pre>
  
  <p>I have the np.int64 to convert the values back to int64. </p>
  
  <p>I was also looking at <a href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.where.html" rel="nofollow noreferrer">numpy.where documentation</a></p>