Example usage for org.opencv.core Point clone

List of usage examples for org.opencv.core Point clone

Introduction

In this page you can find the example usage for org.opencv.core Point clone.

Prototype

public Point clone() 

Source Link

Usage

From source file:Reconhecimento.SaltoSegmentacaoCirculo.java

private static Point segmentarCirculo(Mat img) {
    Mat grayImg = new Mat();
    Mat circles = new Mat();
    Mat element = new Mat();

    Imgproc.cvtColor(img, grayImg, Imgproc.COLOR_BGR2GRAY);

    // filtro da mediana
    Imgproc.medianBlur(grayImg, grayImg, 5);

    // transformada circular de hough
    Imgproc.HoughCircles(grayImg, circles, Imgproc.CV_HOUGH_GRADIENT, 1, 100, 220, 17, 5, 10);

    Point centro = new Point(0, 0);
    Point center;

    for (int x = 0; x < circles.cols(); x++) {
        double vCircle[] = circles.get(0, x);

        center = new Point(Math.round(vCircle[0]), Math.round(vCircle[1]));

        // pegar o circulo mais embaixo
        if (centro.y < center.y) {
            centro = center.clone();
        }//from ww  w  .j ava2  s .c om

        int radius = (int) Math.round(vCircle[2]);

        Core.circle(img, center, radius, new Scalar(0, 0, 255), 3, 8, 0);
    }
    return centro;
}