Ask Your Question

Revision history [back]

The following steps need to be done to achieve this:

// Allocate memory for your matrix (e.g. 8x8 int matrix)
Mat temp_matrix (15, 15, CV_8UC1);
// Make a double loop over indexes and assign values
for(int rows; rows < 15; rows++){
   for(int cols; cols < 15; cols++){
      temp_matrix.at<uchar>(rows,cols) = selected_value;
   }
}