How to find contours only in black colour?

asked 2015-02-17 18:24:03 -0500

Peter55555 gravatar image

updated 2015-02-17 19:09:15 -0500

theodore gravatar image

I try to remove noises from an image. I have some black group of pixels in the image. I use cv::findContours and cv::boundingRect. And I fill small rectangles (small rectangles are noises in the image) with white colour. But this method also find me white contours (for example middle of black circle). How to find countours for black pixels? Is there any easy solution?

edit retag flag offensive close merge delete

Comments

2

again as I mentioned to other threads a short of image example would help us to clarify your problem easier

theodore gravatar imagetheodore ( 2015-02-17 18:58:32 -0500 )edit

IMHO if it is finding the contours for the image parts that you consider "not objects", I think it is a simple way to fix it by doing a negative of the binary image with cv::bitwise_not(image, image) and then apply the findContours... Or maybe you can use morphology operations. Anyway, can you post some images (one input, one result) for better and more coherent replies?

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-02-18 08:32:43 -0500 )edit