Mat::Zeros doesn't seem to do anything when called from object (Bug #320)


Added by Gijs Molenaar almost 15 years ago. Updated over 14 years ago.


Status:Done Start date:
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:core
Target version:-
Affected version: Operating System:
Difficulty: HW Platform:
Pull request:

Description

example:
Mat x = Mat(100, 100, CV_8UC1);
x.zeros(x.size(), x.type());

This doesn't do anything to the image.

But this does work:
x = Mat::zeros(x.size(), x.type());

Now I use:
x.setTo(Scalar(0));

to reset an image which is okay, but somehow I think it would be much easier to be able to just use x.zeros() (without arguments).


History

Updated by Gijs Molenaar almost 15 years ago

I mean more intuitive, not easier

Updated by Vadim Pisarevsky over 14 years ago

you can simply write

x = Scalar(0);

this is not a bug, this is how C++ works. zeros() is a static method that is, for some strange reasons, is still allowed to be called as <Mat instance>.zeros(), not as Mat::zeros().

  • Status changed from Open to Done
  • (deleted custom field) set to wontfix

Also available in: Atom PDF