How to fill OpenCV image with one solid color?
Using the OpenCV C API with IplImage* img: Use cvSet(): cvSet(img, CV_RGB(redVal,greenVal,blueVal)); Using the OpenCV C++ API with cv::Mat img, then use either: cv::Mat::operator=(const Scalar& s) as in: img = cv::Scalar(redVal,greenVal,blueVal); or the more general, mask supporting, cv::Mat::setTo(): img.setTo(cv::Scalar(redVal,greenVal,blueVal));