I have a hough transform object detection code which detects the target objects. But a few lines are detected from the green background (trees). I wish to eliminate all the green background. I tried a code based on [this](http://opencv-srf.blogspot.com/2010/09/object-detection-using-color-seperation.html) and it worked fine. But the problem is that the resulting image is black and white. I want the green part to go black, but I want the rest to remain as the original image.
I also tried the second solution from [this](http://answers.opencv.org/question/31592/subtract-color-from-mat/), with the image given there. The problem was whenever I accessed the result image and displayed it with `imshow`, it would display like the original.
So, are there any better solutions? Is there a way that I can see all pixels that fall in an hsv range, using `inRange` and then, instead of turning the whole image black and white, just turn those pixels in the range to black?
↧