Modules
cv::Mat
// cv::Mat::Mat Constructor
Mat M(2, 2, CV_8UC3, Scalar(0,0,255));
// Use C/C++ arrays and initialize via constructor
int sz[3] = {2,2,2};
Mat L(3, sz, CV_8UC(1), Scalar::all(0));
// MATLAB style initializer
Mat E = Mat::eye(4, 4, CV_64F);
Mat O = Mat::ones(2, 2, CV_32F);
Mat Z = Mat::zeros(3, 3, CV_8UC1);
// For small matrices you may use comma separated initializers
Mat C = (Mat_<double>(3,3) << 0, -1, 0, -1, 5, -1, 0, -1, 0);
// Create a new header for an existing Mat object
Mat RowClone = C.row(1).clone();
// You can fill out a matrix with random values
Mat R = Mat(3, 2, CV_8UC3);
randu(R, Scalar::all(0), Scalar::all(255));
// Other common OpenCV data structures
Point2f P(5, 1);
Point3f P3f(2, 6, 7);
std::vector<float> v(20); Mat(v);
std::vector<Point2f> vPoints(20);
// Typedefs in CV Core module
// typedef Mat_< Vec3f > cv::Mat3f
// typedef Matx< double, 3, 3 > cv::Matx33dcv::ORB
cv::FileStorage
Line Features
Last updated