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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations