Euglena tracking and OSC broadcasting: Difference between revisions

From Medien Wiki
No edit summary
Line 16: Line 16:
      
      
opencv.threshold(threshold);
opencv.threshold(threshold);
// ...
contours = opencv.findContours();
</source>
=== Skipping large/small contours ===
<source lang="java">
for (Contour contour : contours) {
      float a = contour.area();
      Rectangle r = contour.getBoundingBox();
      float wh = float(r.width)/float(r.height);
      if (a > minArea && wh > 0.1 && wh < 10 && a < maxArea) {
      // ...
</source>
</source>