When working with 1-channel (e.g. CV_8UC1) Mat objects in OpenCV, this creates a Mat of all ones: cv::Mat img = cv::Mat::ones(x,y,CV_8UC1).
CV_8UC1
cv::Mat img = cv::Mat::ones(x,y,CV_8UC1)
You can also initialize like this:
Mat img; /// Lots of stuff here ... // Need to initialize again for some reason: img = Mat::Mat(Size(width, height), CV_8UC3, CV_RGB(255,255,255));