Hi
there is a bug in the standard pipeline. I reported it here,
https://groups.google.com/g/openpnp/c/c9jclp9Dii0/m/81dBYeC_AwAJ
At the time Tony Luken was in the middle of developing other improvements to the ReferenceStripFeeder, so I hoped he would fix it, but it seems to have gone unnoticed.
This is what I reported (fixed pipeline pasted at the end):
The ReferenceStripFeeder standard pipeline has a Canny edge detection in front of Hough Circles.
But Hough circles has its own Canny edge detection in-built, so this will create "the edges of the edges". What Hough is seeing is this (simulated with two Cannies in a row):
Sometimes it will therefore fuse parts of the outer and inner circles together and create this:
That's easily observable in the NullDriver Auto Setup.
The Canny should be removed.
Also, I don't think a Median Blur is a good thing before edge detection, it will amplify aliasing. Just leave the Gaussian blur in.
When I disable Canny and BlurMedian I get this:
Now I can successfully pick 0201. Well in the NullDriver... :-)
That's what I'd recommend. But as @tonlyluken is on it, I hope he can consider and integrate this:
<cv-pipeline>
_Mark
<stages>
<cv-stage class="org.openpnp.vision.pipeline.stages.ImageCapture" name="original" enabled="true" settle-first="true" count="1"/>
<cv-stage class="org.openpnp.vision.pipeline.stages.ConvertColor" name="gray" enabled="true" conversion="Bgr2Gray"/>
<cv-stage class="org.openpnp.vision.pipeline.stages.BlurGaussian" name="predetect-1" enabled="true" kernel-size="5"/>
<cv-stage class="org.openpnp.vision.pipeline.stages.DetectFixedCirclesHough" name="results" enabled="true" dp="1.0" param-1="25.0" param-2="20.0"/>
<cv-stage class="org.openpnp.vision.pipeline.stages.ImageRecall" name="recalled" enabled="true" image-stage-name="original"/>
<cv-stage class="org.openpnp.vision.pipeline.stages.DrawCircles" name="display" enabled="true" circles-stage-name="results" thickness="1">
<color r="255" g="0" b="0" a="255"/>
</cv-stage>
</stages>
</cv-pipeline>
Hello,I have a problem with detection of holes in strip feeder. Top camera px/mm is calibrated (reticle.jpg) so 1.5mm on camera is exact 1.5mm hole on strip. I changed pipeline for holes detection a bit as per improved pipeline.jpg. When I edit pipeline or even try to detect holes on feeder, red circles are spot on on holes on strip (spot on circles.jpg). The cricles I believe are used to set up feeder (green) are offset though (offset.jpg). I'm wondering af anybody can offer any help on that? I tried a few different cameras, calibrated lens, calibrated px/mm and problem still exists.
--
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/00c27d4d-8d58-4b8f-8b18-ddf4247d36c8n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openpnp/171a565d-3408-485d-975c-331618cf53d7n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openpnp/38fa6184-619a-487d-bda1-badd1256191dn%40googlegroups.com.
Note that this head offset is only valid at a single z-height (your PCB height) and it is recommended to have all pick locations/feeders/strip tapes on the same z-height.
To view this discussion on the web visit https://groups.google.com/d/msgid/openpnp/55980d4e-6b8d-46f1-aeb0-ed364e358f9en%40googlegroups.com.
Hi Richard
Your rationale behind Canny is perfectly valid, but the problem is that HoughCircles has a built-in Canny that you may have overlooked, because it is not very well documented. In fact you need to read the rather obscure comments about param1 to realize it:
By adding a second Canny in front of HoughCircles you are doubling the edges of the sprocket hole, so the HoughCircles detection now has two potential targets.
> Hough will never detect overlapping circles
Not two overlapping circles but one
off-center circle that takes some of its gradient maxima
from one edge and other maxima from the doubled-up edge. The
HoughCircles is probabilistic and tolerant to some degree (see
param2). It seems it can easily derail from one edge and snap into
the other. In fact I only found the issue because that is
precisely what happened in my case (see my earlier post with the
image showing it clearly).
-->
vs. 
In real camera images, the holes are often away from the camera
center and will therefore be seen slightly from the side, which
makes the sprocket hole look asymmetric (in 3D). Shadows and
highlights may also vary due to lighting, that is not centered
relative to the hole. As a consequence, there may actually be
multiple asymmetric edges in play. The double Canny will make it
even more likely that some of these doubled-up asymmetric edges
can blend into each other and shift the detected circle.
_Mark
To view this discussion on the web visit https://groups.google.com/d/msgid/openpnp/CAEP8J%3DMG2UHVYbo%3DLqSBB90%3DHGYJ8VAY4LtKXJmP5NusW_JeWQ%40mail.gmail.com.
> I can see in your bug report that your red circles were off. On my machine red circles are spot on and problem is with green circles being off.
The circles all come from the same detection. The ones forming
the longest row are highlighted in red. Those are the only ones
that matter for setup, if I remember correctly. You can forget
about the other colors (in fact you could probably disable the
stage drawing them).
If you want to setup multiple feeders side by side you need to
optically cover the ones you don't want detected. Somebody should
probably fix that to only include rows near the camera center.
Looking at your original pictures more closely, I noticed you
don't have the double Canny stage at all. So my initial remark
does not apply. Sorry about the wasted cycle.
The detection does not actually look that bad. Once you cover up
the unwanted feeder and roughly center the camera above the
sprocket holes, I'm not sure you have a problem there at all.
_Mark
To view this discussion on the web visit https://groups.google.com/d/msgid/openpnp/171a565d-3408-485d-975c-331618cf53d7n%40googlegroups.com.
Personally, I'm not convinced it's this issue, see my other reply.
But, he probably means that you calibrated your camera for a
specific mm/pixels value at PCB surface height. And maybe the
feeder is at a different height from your PCB. This will change
the effective mm/pixels scale because the feeder/tape
surface/sprocket hole edge is closer to/farther away from the
camera. The ReferenceStripFeeder Vision assumes and depends on
correct camera image scale to some degree.
You can enable millimeter ticks on the cross-hairs, so you can
see if the row of sprocket holes matches every 2nd tick.
If you have a wide lens and wildly different feeder/PCB heights
there may be a point where you simply can't make it work. Either
make sure to have very similar heights across PCB and all (visual)
feeders or use a much longer lens and higher-up camera mount.
Like I said, I don't believe that's the case for your examples.
But maybe others will read this in the future and it might help
them.
_Mark
To view this discussion on the web visit https://groups.google.com/d/msgid/openpnp/38fa6184-619a-487d-bda1-badd1256191dn%40googlegroups.com.
Oh, just saw that Richard already answered to that effect.
To view this discussion on the web visit https://groups.google.com/d/msgid/openpnp/2ab6f5dd-7478-5649-cd9c-d0dcec703b38%40makr.zone.