when i run the full example
Processing IDE / File / Examples / OpenCV for Processing / FindContours /
and not your code snipplet
it works here:
Raspberry Pi / Raspbian Linux / Processing 3.5.1 / JAVA mode
The outbound box is found as a contour and came up at 2388 points. Close enough to the 600x4 dimension. I guess some points are cut a the corners.
But then the weirdest thing: The circle inside is not found as an edge.
Specific for each contour.
The sketch finds a number of contours and indexes them 0,1,2,3,…
Right now the numPoints refers to the sum total of all of them.
Is there syntax that would extract the points for contour 1 for instance?
kll
Thanks again, you’re a big help.
The code above worked, however the result of println is not giving me the contour number as a 0,1,2 but I get:
found 219 points in contour gab.opencv.Contour@56005110
found 563 points in contour gab.opencv.Contour@118bf155
found 3588 points in contour gab.opencv.Contour@3621520a
I wonder what those numbers mean. Is there a way to make them comprehensible?
also I tried
int PointsFor0 = contours.get(0).numPoints() ;
int PointsFor1 = contours.get(1).numPoints() ;
int PointsFor2 = contours.get(2).numPoints() ;
println(PointsFor0+ " " +PointsFor1+ " " +PointsFor2);
And it worked really well.
I made a simple jpeg for testing and the numbers make sense.
If you still want to help, there is one more thing. You could do this for the entire Processing community.
Greg, the author of this library has also developed a compare contours function. That would be really useful to me and probably others.
All the class definitions and stuff are here. I just wish I knew how to generate an example.
But I dont. Wonder if you’d want to make one.