Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Scoring hits in a shooting target

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/1285/stationary-target-shooting-algorithm/. 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.

Scoring hits in a shooting target

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/1285/stationary-target-shooting-algorithm/. 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. 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");
}

Scoring hits in a shooting target

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/1285/stationary-target-shooting-algorithm/. 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");
}