Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To answer all your basic questions, check out the tutorials HERE.

Both .get and .put are, in c++, .at< type >(). However, this is not the most efficient way if you need to access all the elements of a Mat, but for your example, it's simple enough.

For example

Mat A = Mat(1,3,CV_32F);
A.at<float>(0,0) = -1;
A.at<float>(0,1) = 0;
A.at<float>(0,2) = 1;

The type is replaced by the appropriate c++ type that the matrix is. For example:

  • CV_8UC1 = uchar or cv::Vec1b
  • CV_16UC1 = ushort
  • CV_8UC3 = cv::Vec3b
  • CV_32FC1 = float

ect.