Mat lineMat = new Mat();
Imgproc.HoughLinesP(getCurrentMat(), lineMat, 1, PConstants.PI/180.0, threshold, minLineLength, maxLineGap);
for (int i = 0; i < lineMat.width(); i++) {
double[] coords = lineMat.get(0, i);
result.add(new Line(coords[0], coords[1], coords[2], coords[3]));
}
return result;
}