sue-ling
sue-ling

Reputation: 399

masking in openCV

Mat mask = Mat::zeros(img1.rows, img1.cols, CV_8UC1)

this piece of code is supposed to create a mask, I think, by using C++. What is the equivalent to creating a mask in C, like this? also, can someone explain to me what this piece of code is actually doing please?

Upvotes: 1

Views: 1324

Answers (1)

Samuel Audet
Samuel Audet

Reputation: 4994

With the C API, we would call

IplImage *mask = cvCreateImage(cvGetSize(img1), IPL_DEPTH_8U, 1);
cvSetZero(mask);

The C API is easier to read IMO, and what it does is create an image with 8 bits per pixel, 1 channel (grayscale), of the same size as img1, and then setting all its pixel values to zero.

Upvotes: 1

Related Questions