Scoring hits in a shooting target

asked 2018-04-25 12:57:42 -0600

kkalwa gravatar image

updated 2018-04-25 13:24:33 -0600

I am working on a Java project in which I take the image of shooting target and I compute scoring. I've alreeady found this http://answers.opencv.org/question/12.... But it wasn't helpful. I already written code that finds bullet holes and now I need something that will score them. I was thinking about Hough Transform to find circles but the algorithm works poorly in my case (I don't know why but I can't add an image). In my case algorithm finds 88 circles on my image and that is too much. I need help with improving Hough or with developing other algorithm. EDIT:

Type of target I'm working with Type of target I'm working with

Below output of Hough transform Circles found on my image with circular Hough Transform

Below the code I used for Hough Transform

 static void drawCircles(Mat input, Mat circles)
{
    for(int i=0; i<circles.cols(); ++i)
    {
        double[] current = circles.get(0, i);
        for(double e: current)
        {
            Imgproc.circle(input,new Point(current[0], current[1]), (int)current[2], new Scalar(0,0,255),10);
        }
    }
}
static void tests()
{
    Mat input = Imgcodecs.imread(sciezkaStartowa + "D.jpg"), output = new Mat(), gray = new Mat();
    if(input.empty())
    {
        System.out.println("Couldn't open file");
        return;
    }

    Imgproc.cvtColor(input, gray, Imgproc.COLOR_BGR2GRAY);
    Mat circles = new Mat();
    Imgproc.HoughCircles(gray, circles, Imgproc.HOUGH_GRADIENT, 0.5, 50, 120, 200, 40, gray.cols());
    drawCircles(input, circles);
    saveFile(input, "Kola.jpg");
}
edit retag flag offensive close merge delete

Comments

show us images, you're working on, and code, that you tried, please.

(only referencing, what others did, is not helpful at all here)

berak gravatar imageberak ( 2018-04-25 13:00:07 -0600 )edit