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(), thencv2.thresholdon hue and saturation channels, then finally reconstitute the filtered image withcv2.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...