# Revision history [back]

Here is a much simpler and faster way to do it using numpy for the heavy lifting, it ran at 12ms on my machine.

from SimpleCV import Image

def bin(img):
numpyImg = img.getNumpyCv2()
hsvValues = img.toHSV().getNumpyCv2()
hValues = hsvValues[:,:,0] # slice off Hue values
hueThreshold = 50 #If above this value make it black
black = (0,0,0) #RGB black, this could be whatever color you want
numpyImg[hValues < hueThreshold] = black   #if value less than threshold set to black
img = Image(numpyImg)
return img

image = Image('http://upload.wikimedia.org/wikipedia/commons/5/51/DSHwiki.jpg') #picture of dog
img = bin(image)
img.show()