Search in sources :

Example 1 with SecondEllipseDetector

use of br.edu.ifspsaocarlos.sdm.kifurecorder.processing.cornerDetector.ellipseDetector.SecondEllipseDetector 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);
}
Also used : SecondEllipseDetector(br.edu.ifspsaocarlos.sdm.kifurecorder.processing.cornerDetector.ellipseDetector.SecondEllipseDetector) EllipseDetectorInterface(br.edu.ifspsaocarlos.sdm.kifurecorder.processing.cornerDetector.ellipseDetector.EllipseDetectorInterface) ArrayList(java.util.ArrayList) RotatedRect(org.opencv.core.RotatedRect) FirstEllipseDetector(br.edu.ifspsaocarlos.sdm.kifurecorder.processing.cornerDetector.ellipseDetector.FirstEllipseDetector)

Aggregations

EllipseDetectorInterface (br.edu.ifspsaocarlos.sdm.kifurecorder.processing.cornerDetector.ellipseDetector.EllipseDetectorInterface)1 FirstEllipseDetector (br.edu.ifspsaocarlos.sdm.kifurecorder.processing.cornerDetector.ellipseDetector.FirstEllipseDetector)1 SecondEllipseDetector (br.edu.ifspsaocarlos.sdm.kifurecorder.processing.cornerDetector.ellipseDetector.SecondEllipseDetector)1 ArrayList (java.util.ArrayList)1 RotatedRect (org.opencv.core.RotatedRect)1