Okay so here are the code i tried to run… it complains about the Arraylist in my processing. If you find a workaround i would be thrilled, since this code is exactly what i am looking for
import gab.opencv.*;
import org.opencv.imgproc.Imgproc;
import org.opencv.core.Mat;
OpenCV opencv;
PImage src;
ArrayList<Circle> circles;
void setup(){
src = loadImage("cans.jpg");
src.resize(800,0);
opencv = new OpenCV(this, src);
size(opencv.width, opencv.height);
circles = new ArrayList<Circle>();
}
void draw(){
opencv.loadImage(src);
// opencv.setROI(mouseX, mouseY, 90, 100);
// opencv.threshold(190);
image(opencv.getOutput(),0,0);
noFill();
stroke(0,255,0);
strokeWeight(3);
for(Circle circle : circles){
circle.draw();
}
}
void keyPressed(){
findCircles();
}
void findCircles(){
Mat cs = new Mat();
println("find hough circles");
Imgproc.HoughCircles(opencv.getGray(), cs, Imgproc.CV_HOUGH_GRADIENT, opencv.getGray().rows()/20, 50);
println();
for(int i = 0; i < cs.cols(); i++){
println(i);
circles.add(new Circle((float)cs.get(0,i)[0], (float)cs.get(0,i)[1], (float)cs.get(0,i)[2]));
}
println(cs.cols() + "x" + cs.rows());
}