Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

fill contour with drawContours


I have a question concerning the drawContours function.

I've searched on the internet and on the openCV forum but without any success.

What I'm looking for is when I have a square contour, fill the inside of this contour using a specific color.

So far when I draw the contour, the border is red and the inside is filled with white :

cv::drawContours(targetMat, contours, maxAreaIdx, cv::Scalar(255,0,0),CV_FILLED);

What can I do for filling the inside with a specific color (if possible using RGBA)?

I've tried using cvRectangle function but I don't know how to convert a cv::Mat to CVArr (I'm not sure this function will help btw).

I really thank you for your help