title: Efficient way to convert image stored as numpy array into hsv
body: <p>I'm doing some data analysis of images. For some analysis I would like to convert the image's pixels in to HSV from RGB in which they are originally stored.</p>
  
  <p>At the moment I'm using this code:</p>
  
  <pre><code>def generate_hsv(im):
      coords = product(range(im.shape[0]), range(im.shape[1]))
      num_cores = multiprocessing.cpu_count()
  
      m = Parallel(n_jobs=num_cores)(delayed(process_pixels)(im[i]) for i in coords)
      return np.array(m).reshape(im.shape)
  </code></pre>
  
  <p>Where <code>process_pixels</code> is just a wrapper for my conversion function:</p>
  
  <pre><code>def process_pixels(pixel):
      return rgb_to_hsv(pixel[0], pixel[1], pixel[2])
  </code></pre>
  
  <p>The thing is it runs sluggishly.</p>
  
  <p>Is there a more efficient way to do this? Or a better way to parallelize?</p>