Image Handling
From STAB Resources
Datatype : Mat
- Image is basically a 2d array or matrix.
- Elements can be of various sizes, like 8,16, 32 bits. Also there can be multiple channels.
- Grayscale, RGB, HSV, HSL.
- Declare a Mat as follows:
Mat img(rows, cols,CV_<bit-depth>{U|S|F}C<no_of_channels>);
Mat Functions
a.at<int>(i,j) //access element at (i,j) a.rows; a.cols //returns no of rows, cols a.row(i); //access to ith row as another Mat a.zeros(rows,cols,CV_8U); //mat full of zeros a.rowRange(i,j); //access rows from i to j as another Mat a.t(); or a’; //transpose a.clone(b); //full copy a.convertTo(b,CV_32F); //change type Operations like +,-,* work with usual matrix rules a.mul(b); //element wise multiplication //other usual matrix operations are available, you can look have a look at the reference.