Question

Could someone explain the code below?

grey.create(sizes[0],sizes[1],CV_8U);
Was it helpful?

Solution

create() is a member function of cv::Mat class.

void Mat::create(int rows, int cols, int type)

It is used to create a cv::Mat and allocates new array data if needed.

In your example, grey will be a sizes[0] x sizes[1] matrix, i.e. Mat image with type CV_8U. grey can be viewed as a gray-scale image here with only one-channel, which is equivalent to:

Mat grey(sizes[0], sizes[1], CV_8UC1);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top