swing - Detecting Hough circles JAVA OpenCV -


i confused exception is.
first time coding detection program

public static void chargement(mat img) {     nbyte = (int) (img.total() * img.elemsize());     buffer = new byte[nbyte];     img.get(0, 0, buffer); }  public static point[] detectcercle(mat img, int rayon) {      mat circles = new mat();     point[] circleslist = null;      imgproc.houghcircles(img, circles, imgproc.cv_hough_gradient, 1, 60, 200, 20, 30, 0);      system.out.println("#rows " + circles.rows() + " #cols " + circles.cols());     double x = 0.0;     double y = 0.0;     int r = 0;      (int = 0; < circles.rows(); i++) {         double[] data = circles.get(i, 0);         (int j = 0; j < data.length; j++) {             x = data[0];             y = data[1];             r = (int) data[2];         }         circleslist[i] = new point(x, y);     }     return circleslist;  }  public static void main(string[] args) {     system.loadlibrary(core.native_library_name);     mat matimage1 = imgcodecs.imread("src/imge1.jpg", imgcodecs.cv_load_image_color);     mat matimage2 = imgcodecs.imread("src/image2.jpg", imgcodecs.cv_load_image_color);     mat matimage3 = imgcodecs.imread("src/image3.jpg", imgcodecs.cv_load_image_color);     detectcercle(matimage3,2);  } 

exception :

enter image description here

emphasized text image test :

enter image description here

houghcircles requires 8-bit image, flag cv_load_image_color converts image color image. try cv_load_image_grayscale maintain 8-bit image reading.

see docs: imread docs


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -