ofxCvContourFinder to get the surface instead of the contour

Hi,

I am using an ofxCvContourFinder to find certain non-rectangle shaped objects in an image. Now I want to have an RGB histogram of all the pixels inside the detected contour (not the bouning box). The problem is that the Blob I get out of the ofxCvContourFinder is the contour itself. But converting it to the surface of all the pixels inside does not seem so easy.

I thought of using the rectangle, fill it and overlay it onto the tresholded image in which the contour is detected so that I end up with a white/black image of the contour which I can then overlay onto the picture. Then ignoring all the black pixels (or maybe use some alpha channel) to make the histograms. Downside is that part of one contour could fall inside the bounding box of the other giving invalid histograms.

Any ideas how to go about this?

Thanks in advance!

Lourens