Ask Your Question
1

How to initialize Mat size and fill it with zeros in a class ?

asked 2016-11-16 01:53:49 -0500

Nbb gravatar image

updated 2016-11-16 02:02:11 -0500

How do I initialize a Mat with a certain size and fill it with zeros in a class ? The simple

cv::Mat test(cv::Size(1, 49), CV_64FC1);

does not work. Sorry this worked

cv::Mat texture_ = cv::Mat::zeros(cv::Size(1,49), CV_64FC1);
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
5

answered 2016-11-16 02:00:33 -0500

berak gravatar image
// #1
cv::Mat test(cv::Size(1, 49), CV_64FC1);
test = 0;

// #2
cv::Mat test(cv::Size(1, 49), CV_64FC1, Scalar(0)); 

// #3
cv::Mat test = cv::Mat::zeros(cv::Size(1, 49), CV_64FC1);
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2016-11-16 01:53:49 -0500

Seen: 21,891 times

Last updated: Nov 16 '16