use of br.edu.ifspsaocarlos.sdm.kifurecorder.processing.cornerDetector.ellipseDetector.EllipseDetectorInterface in project kifu-recorder by leonardost.
the class EllipseCornerDetector method detectCandidateCornersIn.
public List<Corner> detectCandidateCornersIn(Mat image) {
List<EllipseDetectorInterface> ellipseDetectors = new ArrayList<>();
EllipseDetectorInterface firstEllipseDetector = new FirstEllipseDetector();
EllipseDetectorInterface secondEllipseDetector = new SecondEllipseDetector();
String prefix = "processing/corner" + cornerIndex + "_frame" + imageIndex;
firstEllipseDetector.setFilePrefix(prefix + "_first-filter");
secondEllipseDetector.setFilePrefix(prefix + "_second-filter");
ellipseDetectors.add(firstEllipseDetector);
ellipseDetectors.add(secondEllipseDetector);
List<Corner> candidateCorners = new ArrayList<>();
for (EllipseDetectorInterface ellipseDetector : ellipseDetectors) {
List<RotatedRect> ellipses = ellipseDetector.detectEllipsesIn(image);
for (RotatedRect ellipse : ellipses) {
Corner corner = new Corner((int) ellipse.center.x, (int) ellipse.center.y, true);
corner.stonePosition = ellipse;
candidateCorners.add(corner);
}
}
return mergeEllipsesWithCloseCenters(candidateCorners);
}
Aggregations