kadu
kadu

Reputation: 513

Initialize a matrix with specified number of column and rows with zeros in opencv?

I have obtained the number of rows and column with the below code. first i read the image and the size of rows and column are found out.

 Mat image;
 int rows=image.rows;
 int columns=image.cols;

I want to create a new mat object with zeros having the size of rows and columns.So that i can initialize it.

Can anyone help me.

Upvotes: 0

Views: 463

Answers (1)

skm
skm

Reputation: 5659

Mat new_image= Mat::zeros(rows, cols, CV_whatever datatype you want);

Upvotes: 4

Related Questions