Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

using java, this all gets a bit clumsy.

ther are no "overloaded operators", and you cannot subtract a Mat from a Scalar, so you have to do like this:

    // build a Mat , filled with 255:
    Mat one = new Mat(floodFilled .size(), floodFilled.type(), new Scalar(255));
    // invert the floodFill Mat:
    Core.subtract(one, floodFilled, floodFilled);

the 2nd one is a simple submat():

    Mat floodFillRoi = floodFilled.submat(new Rect(1, 1, dilateGrad.cols-2, dilateGrad.rows-2)).

please bookmark a link to the docs , you'll need it ;)

using java, this all gets a bit clumsy.

ther there are no "overloaded operators", and you cannot subtract a Mat from a Scalar, so you have to do like this:

    // build a Mat , filled with 255:
    Mat one = new Mat(floodFilled .size(), floodFilled.type(), new Scalar(255));
    // invert the floodFill Mat:
    Core.subtract(one, floodFilled, floodFilled);

the 2nd one is a simple submat():

    Mat floodFillRoi = floodFilled.submat(new Rect(1, 1, dilateGrad.cols-2, dilateGrad.rows-2)).

please bookmark a link to the docs , you'll need it ;)