Search in sources :

Example 1 with RotatedRect

use of org.opencv.core.RotatedRect in project Relic_Main by TeamOverdrive.

the class Imgproc method minAreaRect.

// 
// C++:  RotatedRect minAreaRect(vector_Point2f points)
// 
// javadoc: minAreaRect(points)
public static RotatedRect minAreaRect(MatOfPoint2f points) {
    Mat points_mat = points;
    RotatedRect retVal = new RotatedRect(minAreaRect_0(points_mat.nativeObj));
    return retVal;
}
Also used : Mat(org.opencv.core.Mat) RotatedRect(org.opencv.core.RotatedRect)

Example 2 with RotatedRect

use of org.opencv.core.RotatedRect in project Relic_Main by TeamOverdrive.

the class Imgproc method fitEllipse.

// 
// C++:  RotatedRect fitEllipse(vector_Point2f points)
// 
// javadoc: fitEllipse(points)
public static RotatedRect fitEllipse(MatOfPoint2f points) {
    Mat points_mat = points;
    RotatedRect retVal = new RotatedRect(fitEllipse_0(points_mat.nativeObj));
    return retVal;
}
Also used : Mat(org.opencv.core.Mat) RotatedRect(org.opencv.core.RotatedRect)

Example 3 with RotatedRect

use of org.opencv.core.RotatedRect in project Relic_Main by TeamOverdrive.

the class Video method CamShift.

// 
// C++:  RotatedRect CamShift(Mat probImage, Rect& window, TermCriteria criteria)
// 
// javadoc: CamShift(probImage, window, criteria)
public static RotatedRect CamShift(Mat probImage, Rect window, TermCriteria criteria) {
    double[] window_out = new double[4];
    RotatedRect retVal = new RotatedRect(CamShift_0(probImage.nativeObj, window.x, window.y, window.width, window.height, window_out, criteria.type, criteria.maxCount, criteria.epsilon));
    if (window != null) {
        window.x = (int) window_out[0];
        window.y = (int) window_out[1];
        window.width = (int) window_out[2];
        window.height = (int) window_out[3];
    }
    return retVal;
}
Also used : RotatedRect(org.opencv.core.RotatedRect)

Example 4 with RotatedRect

use of org.opencv.core.RotatedRect in project kifu-recorder by leonardost.

the class SecondEllipseDetector method findPossibleEllipsesIn.

private List<RotatedRect> findPossibleEllipsesIn(Mat image, String suffix) {
    List<MatOfPoint> contours = findContoursIn(image);
    outputOriginalImageWith(contours, suffix);
    List<RotatedRect> ellipses = new ArrayList<>();
    for (MatOfPoint contour : contours) {
        RotatedRect ellipse = ellipseChecker.getEllipseFrom(contour);
        if (ellipse != null)
            ellipses.add(ellipse);
    }
    return ellipses;
}
Also used : ArrayList(java.util.ArrayList) MatOfPoint(org.opencv.core.MatOfPoint) RotatedRect(org.opencv.core.RotatedRect)

Example 5 with RotatedRect

use of org.opencv.core.RotatedRect in project kifu-recorder by leonardost.

the class SecondEllipseDetector method detectEllipsesIn.

public List<RotatedRect> detectEllipsesIn(Mat image) {
    this.originalImage = image;
    ellipseChecker.setImage(image);
    Mat preprocessedImage = preprocessImage(image);
    int numberOfBins = 16;
    Mat histogram = getHistogramFrom(preprocessedImage, numberOfBins);
    System.out.println("histogram with 16 bins = ");
    System.out.println(histogram.t().dump());
    // Centroid 0 centers around the dark pixels and centroid 1 around the light ones
    int numberOfClusters = 3;
    int[] centroids = clusterizeHistogramAndReturnCentroids(histogram, numberOfClusters);
    List<RotatedRect> darkEllipses = getPossibleEllipsesByFilteringBelow(centroids[0], preprocessedImage);
    List<RotatedRect> lightEllipses = getPossibleEllipsesByFilteringOver(centroids[1], preprocessedImage);
    List<RotatedRect> ellipses = new ArrayList<>();
    ellipses.addAll(darkEllipses);
    ellipses.addAll(lightEllipses);
    return ellipses;
}
Also used : Mat(org.opencv.core.Mat) ArrayList(java.util.ArrayList) RotatedRect(org.opencv.core.RotatedRect) Point(org.opencv.core.Point) MatOfPoint(org.opencv.core.MatOfPoint)

Aggregations

RotatedRect (org.opencv.core.RotatedRect)11 Mat (org.opencv.core.Mat)5 ArrayList (java.util.ArrayList)4 MatOfPoint (org.opencv.core.MatOfPoint)3 Point (org.opencv.core.Point)2 Scalar (org.opencv.core.Scalar)2 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