Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Rectangle Issues

So I am trying to draw rectangles from contours and then save them as an image but whenever i use Imgproc.rectangle() the resulting Mat always comes out empty, my code is basically just...

       private Mat rectOut = new Mat();
       for(MatOfPoint contour : contours){
        Rect rect = Imgproc.boundingRect(contour);
        Imgproc.rectangle(rectOut, rect.tl(), rect.br(), new Scalar(50,50,50));
       }

The rect seems to be fine and has the points I want but the result always leaves me with an Empty mat, does anyone know what I am doing wrong?