Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

it works a bit different in c++

// m.type() == CV_8U
uchar u = m.at<uchar>(row,col);
m.at<uchar>(row,col) = 17;

// m.type() == CV_32F
float f = m.at<float>(row,col);
m.at<float>(row,col) = 11.1f;

// m.type() == CV_8UC3
Vec3f v = m.at<Vec3f>(row,col);
m.at<Vec3f>(row,col)[1] = 17;

// etc. m.type() determines, what type you've got to feed into Mat::at<type_here>()

it works a bit different in c++

// m.type() == CV_8U
uchar u = m.at<uchar>(row,col);
m.at<uchar>(row,col) = 17;

// m.type() == CV_32F
float f = m.at<float>(row,col);
m.at<float>(row,col) = 11.1f;

// m.type() == CV_8UC3
Vec3f Vec3b v = m.at<Vec3f>(row,col);
m.at<Vec3f>(row,col)[1] m.at<Vec3b>(row,col);
m.at<Vec3b>(row,col)[1] = 17;

// etc. 
// m.type() determines, what type you've got to feed into Mat::at<type_here>()