Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
FindCircles!
Renamed the HoughCircles into FindCircles
Now HoughCircles returns ArrayList< ArrayList <Integer> >
  • Loading branch information
EvansJahja committed May 5, 2015
commit 669f16f5f704e3692d8fc7ad42db350f57f8b2c3
47 changes: 11 additions & 36 deletions examples/FindCircles/FindCircles.pde
Original file line number Diff line number Diff line change
@@ -1,54 +1,29 @@
import gab.opencv.*;
//import processing.video.*;
import java.awt.*;
import org.opencv.core.*;

//Capture video;
OpenCV opencv;

void setup() {
size(300, 400);

//video = new Capture(this, 640, 480);
//opencv = new OpenCV(this, 640, 480);
//video.start();
size(300*2, 400);
ellipseMode(RADIUS);

opencv = new OpenCV(this, 300, 400);

}

void draw() {
//opencv.loadImage(video);
opencv.loadImage("sample.jpg");
float foo[]={0,0,0};
Mat m;// = new Mat(0,0,0);
m=opencv.HoughCircles();
image(opencv.getSnapshot(),0,0);
for(int x=0;x<20;x++)
image(opencv.getSnapshot(),0,0);
image(loadImage("sample.jpg"),300,0);

ArrayList< ArrayList< Integer> > arr = opencv.findCircles();

for (ArrayList<Integer> zx : arr)
{
for(int y=0;y<20;y++)
{
m.get(x,y,foo);
for (int i=0;i<3;i++)
{
if(foo[i]!=0)
{
//System.out.print("X: " + x +" Y: " + y + " foo["+i+"]: "+ foo[i] + "\n");
ellipseMode(RADIUS);
ellipse(foo[0],foo[1],foo[2],foo[2]);
}
}
}
ellipse(zx.get(0),zx.get(1),zx.get(2),zx.get(2)); //x, y, radius, radius (of the circle)
}

noFill();
stroke(0, 255, 0);
strokeWeight(3);



}

/*
void captureEvent(Capture c) {
c.read();
}
*/
Binary file modified library/opencv_processing.jar
Binary file not shown.
Loading