Computer Vision

89 views
Skip to first unread message

geo0rpo

unread,
Feb 9, 2021, 4:26:55 PM2/9/21
to OpenPnP
Hello friends.
I am really trying to find information on various stages of the vision pipelines but no luck.
For example in "FilterContours" what is the minArea and maxAre etc.

Where can I find this kind of information?


Jason von Nieda

unread,
Feb 9, 2021, 4:32:58 PM2/9/21
to ope...@googlegroups.com
Many of the stages have help information which is shown in the pipeline editor:

Screen Shot 2021-02-09 at 3.29.35 PM.png

For the stages that don't, the next best place is the source code: https://github.com/openpnp/openpnp/tree/develop/src/main/java/org/openpnp/vision/pipeline/stages

If you look at FilterContours ( https://github.com/openpnp/openpnp/blob/develop/src/main/java/org/openpnp/vision/pipeline/stages/FilterContours.java ) the important bit is Imgproc.contourArea(contour);, which calculates the area of a contour.

Most of the stages are thin wrappers around OpenCV functions, so in many cases, you can just search the OpenCV documentation for a similarly named thing: https://docs.opencv.org/3.4/d3/dc0/group__imgproc__shape.html#ga2c759ed9f497d4a618048a2f56dc97f1

Jason



--
You received this message because you are subscribed to the Google Groups "OpenPnP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openpnp+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openpnp/f1655c18-bd73-4020-8b1f-18238f15a152n%40googlegroups.com.

geo0rpo

unread,
Feb 9, 2021, 4:43:59 PM2/9/21
to OpenPnP
Yes I have seen all this but there is no explanation.
What is the minArea. What is the unit? Pixel? What does it define?

Jason von Nieda

unread,
Feb 9, 2021, 4:47:57 PM2/9/21
to ope...@googlegroups.com
In general, all the stages use pixels as units. This one does too.

The FilterContours stage takes the output from the FindContours stage and removes any contours that have an area in pixels smaller than the min or larger than the max. In the bottom vision pipeline it is mostly used to filter out contours that are very small, from noise, dust, or artifacts in the image.

Jason


geo0rpo

unread,
Feb 9, 2021, 4:56:26 PM2/9/21
to OpenPnP

OK, I understand this but it does not seem to be so valid.
If you move the mouse cursor over the image you can see the current pixel  X,Y (I guess).
In the image below, the capacitor starts at pixel 610 (in X) and ends at 670.
This would mean a X range of about 60 pixels, but in order to make it work I have to set min area to 1000 (much lower values also work) but the maxArea must be above 1300.
Maybe it is part X size in pixels * part Y size in pixels? By part in this case I mean contour size.

tony...@att.net

unread,
Feb 9, 2021, 6:19:29 PM2/9/21
to OpenPnP
FilterContours filters by area which has units of pixels^2.  So yes, for a rectangular contour the area would be X size * Y size (each in pixels).

Eventually I'd like see all the pipeline stages converted to use machine units like millimeters and millimeters^2 rather than pixels and pixels^2 - that way pipelines would be portable across machines.

Tony

Reply all
Reply to author
Forward
0 new messages