Detección de círculos de Hough android
Estoy tratando de detectar círculos con Android. Logré implementar el algoritmo de detección de líneas pero nada se muestra al intentar el algoritmo de círculos de hough de dibujo.
Aquí está mi código:
- Biblioteca binaria preconfigurada nativa en Android Studio con el complemento experimental de Gradle
- ButterKnife onclick no funciona
- ¿Puedo confiar en el recolector de basura para detener un AsyncTask?
- Cómo cargar marcadores dinámicamente para la posición actual en google-maps de Android?
- No se puede resolver el símbolo 'IOUtils'
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 ); }
- ¿Está bien crear varios threadspoints (ExecutorService)?
- MediaPlayer seekTo () no actualiza SurfaceView
- JavaPoet + Android Studio "addModifiers (Modifier) no se puede aplicar a Modificador"
- Depuración de Eclipse: while continue after return statement?
- OnPostExecute () de AsyncTask nunca se llama en AndroidTestCase
- No se pueden abrir archivos XML en Diseño gráfico: FakeAdapter no se puede convertir en BaseAdapter
- Android cómo pasar un Activity.class como un argumento para una función
- Clasificación de Fecha ArrayList
Usted puede tener esto ordenado por ahora, pero algunas cosas. Comprobaría que su alfombra de círculos realmente tiene algunos resultados; A veces vCircle parece volver nulo; Prueba una de las otras versiones de HoughCircles:
iCannyUpperThreshold = 100; iMinRadius = 20; iMaxRadius = 400; iAccumulator = 300; Imgproc.HoughCircles(thresholdImage, circles, Imgproc.CV_HOUGH_GRADIENT, 2.0, thresholdImage.rows() / 8, iCannyUpperThreshold, iAccumulator, iMinRadius, iMaxRadius); if (circles.cols() > 0) for (int x = 0; x < circles.cols(); x++) { double vCircle[] = circles.get(0,x); if (vCircle == null) break; Point pt = new Point(Math.round(vCircle[0]), Math.round(vCircle[1])); int radius = (int)Math.round(vCircle[2]); // draw the found circle Core.circle(destination, pt, radius, new Scalar(0,255,0), iLineThickness); Core.circle(destination, pt, 3, new Scalar(0,0,255), iLineThickness); }
(Cambié su código en el mío, cambió el nombre de algunas cosas y se cambió de nuevo, creo que lo tengo de nuevo para que funcione …)
SEGUNDO.
- Teclado suave Oculta ActionBar mientras usa adjustPan
- Usando el paquete para pasar datos entre fragmento a otro fragmento ejemplo