Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to initialize a Mat object with zeros

I want to create a Mat object initially initialized with zeros, and i want to avoid doing that using two nested for-loops. is there any alternative solution to the one posted below?

code:

this.mDest = new Mat(this.mMatEdges.rows(), this.mMatEdges.cols(), CvType.CV_8U);
    for (int i =  0; i < this.mMatEdges.size().height; i++) {
        for (int j = 0; j < this.mMatEdges.size().width; j++) {
            this.mDest.put(i, j, 0);
        }
    }