I'm trying to separate the background (green field and light green towel) from the objects using OpenCV so I segmented the following image manually:
By bordering the objects in red and coloring blue the connected components which should not be taken into consideration as you can see in the bottom right of the image:
After threasholding on 254 the channels R and B, I got the following:
- Channel Red
If I fulfill the all contours of red channel using
findContours( bordersRed, contoursRedChannel, hierarchyRedChannel, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, cv::Point(0, 0) );
for (int index = 0; index < contoursRedChannel.size(); index ++)
{
drawContours( bordersRed, contoursRedChannel, index, colorForMask, CV_FILLED, 8, hierarchyRedChannel, 0, cv::Point() );
}
the bottom right corner will be like:
But what I need is to ignore the contours that contains only blue points in order to have something like:
so I have to combine the red with blue channels to get it but don't know how yet. Any advice would be appreciated.
Thanks.