Обнаружение кругов Хафа android

Я пытаюсь обнаружить круги с помощью android. Мне удалось реализовать алгоритм обнаружения линий, но ничего не отображается при попытке алгоритма рисования кругов.

Вот мой код:

Mat thresholdImage = new Mat(getFrameHeight() + getFrameHeight() / 2, getFrameWidth(), CvType.CV_8UC1);
            mYuv.put(0, 0, data);
            Imgproc.cvtColor(mYuv, destination, Imgproc.COLOR_YUV420sp2RGB, 4);
            Imgproc.cvtColor(destination, thresholdImage, Imgproc.COLOR_RGB2GRAY, 4);
            Imgproc.GaussianBlur(thresholdImage, thresholdImage, new Size(9, 9), 2, 2 );

        Mat circles = new Mat();


        Imgproc.HoughCircles(thresholdImage, circles, Imgproc.CV_HOUGH_GRADIENT, 1d, (double)thresholdImage.height()/70, 200d, 100d);

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

                Point center=new Point(Math.round(vCircle[0]), Math.round(vCircle[1]));
                int radius = (int)Math.round(vCircle[2]);
                // draw the circle center
                Core.circle(destination, center, 3,new Scalar(0,255,0), -1, 8, 0 );
                // draw the circle outline
                Core.circle( destination, center, radius, new Scalar(0,0,255), 3, 8, 0 );

        }
6
задан user1118321 22 March 2015 в 23:15
поделиться