Imgproc.findContours(getCurrentMat(), contourMat, new Mat(), contourFindingMode, Imgproc.CHAIN_APPROX_NONE);
} catch(CvException e){
PApplet.println("ERROR: findContours only works with a gray image.");
}
for (MatOfPoint c : contourMat) {
result.add(new Contour(parent, c));
}
if(sort){
Collections.sort(result, new ContourComparator());
}