Q:

channel filtering in OpenCV

I need to filter OpenCV frames (that I get from a queue) on both hue and saturation in real-time.  There are basically two techniques of which I can think of:

Copy the frame to HSV using cv2.cvtColor(), then use the copy to filter the original BGR frame, giving something such as:
frame = queue2.get()
imh = cv2.cvtColor(frame,cv2.cv. CV_BGR2HSV)
frame[(imh[...,1]<30) | (imh[...,2]<100)]=0

Split the HSV copy into individual channels by using cv2.split(), then cv2.threshold on hue and saturation channels, then finally reconstitute the filtered image with cv2.merge. 

Does someone please have another faster idea to filter on both hue and saturation?  Because I am having some issues with my framerate (averages 30 fps), and I am already multiprocessing...

A:

You can try a cv2.LUT function.  With this function you can avoid split & merge steps.