1 | initial version |
You can use matrix multiplication for single channel, or setTo function for multiple channels:
cv::Mat mat = cv::Mat::ones(rows,cols,CV_8UC1);
mat *= 12; // to set all values to 12
std::cout << mat << std::endl;
// To set a multi dimensional matrix
cv::mat mat2 = cv::Mat(rows,cols,CV_8UC2);
mat2.setTo(cv::Scalar(12,12)); // to set all values to 12
std::cout << mat2 << std::endl;