Example usage for org.opencv.core MatOfPoint release

List of usage examples for org.opencv.core MatOfPoint release

Introduction

In this page you can find the example usage for org.opencv.core MatOfPoint release.

Prototype

public void release() 

Source Link

Usage

From source file:team492.GripVision.java

License:Open Source License

@Override
public Rect[] getDetectedObjectRects() {
    Rect[] objectRects = null;//from  w ww.  j av  a2 s.  c  om
    ArrayList<MatOfPoint> detectedObjects = pipeline.findContoursOutput();
    //
    // If we detected any objects, convert them into an array of rectangles.
    //
    if (detectedObjects != null && !detectedObjects.isEmpty()) {
        objectRects = new Rect[detectedObjects.size()];
        for (int i = 0; i < objectRects.length; i++) {
            MatOfPoint object = detectedObjects.get(i);
            objectRects[i] = Imgproc.boundingRect(object);
            object.release();
        }
    }

    return objectRects;
}