Ask Your Question

Revision history [back]

Hi Pat!

When you create a cv::Mat, the required memory is reserved for it and AFAIK that memory is not initialized to any value unless you specify it, with this constructor for example:

Mat::Mat(Size size, int type, const Scalar& s)

The cv::Mat will be initialized with any value that you assign to s. Otherwise the content of the matrix is not guaranteed to have any specific value, so the unset pixels will probably contain garbage (the values left after that memory was last used).

I hope this helps.