title: Python Opencv Reduce Colors to RGB Only
body: <p>I'm trying to take a RGB image and reduce the colors in it to only contain red (255, 0, 0) green (0, 255, 0) and blue (0, 0, 255). I've written a simple function to do this for me but it seems very inefficient.</p>
  <pre><code>def colorReduce(image):
      h, w = image.shape[:2]
      for x in range(h):
          for y in range(w):
              px = image[x][y]
              c = np.argmax(px)
              px = [0, 0, 0]
              px[c]=255
              image[x][y] = px
  </code></pre>
  <p>Do any of you have any ideas for a faster method for this? I know opencv has cv2.kmeans, but that too is not very efficient as it's a lot more powerful than what I need.</p>