Calibrate works?
This commit is contained in:
parent
26e34f7671
commit
cc711c6343
1104 changed files with 636510 additions and 75 deletions
42
lib/opencv_processing/examples/FindContours/FindContours.pde
Normal file
42
lib/opencv_processing/examples/FindContours/FindContours.pde
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
import gab.opencv.*;
|
||||
|
||||
PImage src, dst;
|
||||
OpenCV opencv;
|
||||
|
||||
ArrayList<Contour> contours;
|
||||
ArrayList<Contour> polygons;
|
||||
|
||||
void setup() {
|
||||
src = loadImage("test.jpg");
|
||||
size(src.width, src.height/2);
|
||||
opencv = new OpenCV(this, src);
|
||||
|
||||
opencv.gray();
|
||||
opencv.threshold(70);
|
||||
dst = opencv.getOutput();
|
||||
|
||||
contours = opencv.findContours();
|
||||
println("found " + contours.size() + " contours");
|
||||
}
|
||||
|
||||
void draw() {
|
||||
scale(0.5);
|
||||
image(src, 0, 0);
|
||||
image(dst, src.width, 0);
|
||||
|
||||
noFill();
|
||||
strokeWeight(3);
|
||||
|
||||
for (Contour contour : contours) {
|
||||
stroke(0, 255, 0);
|
||||
contour.draw();
|
||||
|
||||
stroke(255, 0, 0);
|
||||
beginShape();
|
||||
for (PVector point : contour.getPolygonApproximation().getPoints()) {
|
||||
vertex(point.x, point.y);
|
||||
}
|
||||
endShape();
|
||||
}
|
||||
}
|
||||
|
||||
BIN
lib/opencv_processing/examples/FindContours/test.jpg
Normal file
BIN
lib/opencv_processing/examples/FindContours/test.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 100 KiB |
Loading…
Add table
Add a link
Reference in a new issue