Ask Your Question
2

cvZero fucntion for c++ api

asked 2014-01-13 02:06:50 -0500

sandwish gravatar image

I want to set all the pixel values of an image to zero. I know this can be done using cvZero function in the c api. But I am using the c++ api. Please suggest me an alternative. Thanks in advance.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
6

answered 2014-01-13 03:22:10 -0500

Vladislav Vinogradov gravatar image

Use setTo method:

mat.setTo(cv::Scalar::all(0));
edit flag offensive delete link more

Comments

Thanx a lot!

sandwish gravatar imagesandwish ( 2014-01-14 00:22:38 -0500 )edit
4

answered 2014-01-13 03:30:52 -0500

Mat zero=Mat::zeros(Size(100,100),CV_8UC1);

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

Stats

Asked: 2014-01-13 02:06:50 -0500

Seen: 4,422 times

Last updated: Jan 13 '14