Recommended pipeline for detecting sprocket holes

398 views
Skip to first unread message

Jim Young

unread,
Apr 2, 2022, 5:36:00 PM4/2/22
to OpenPnP
I'm trying to setup a strip feeder, and I'm having no luck with the default pipeline detecting the sprocket holes. Can anyone point me in the direction of a guide that show you how to create a pipeline for detecting circles?

I've tried some basic configurations, based on the circle detection I used in the LitePlacer software, but nothing is working.

I have my own tape holder I designed that holds the tape down and exposes the sprocket holes. This has worked well with the LitePlacer software, but I am having no luck at all with OpenPnP.
tapehole.png

mark maker

unread,
Apr 3, 2022, 3:56:08 AM4/3/22
to ope...@googlegroups.com

This could be an option:

https://github.com/openpnp/openpnp/wiki/DetectCircularSymmetry#referencestripfeeder

read the whole Wiki page to see why.

Note: while the DetectCircularSymmetry stage itself is super robust, the vision programming in the ReferenceStripFeeder is not. For instance, it does not remove/mask areas where the part pockets are which may lead to misdetects in auto setup. This should not happen in routine (feed & pick) vision.

_Mark
--
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/5e527d4f-a432-4643-abd2-c32b6e9a4a1en%40googlegroups.com.

E O

unread,
Apr 3, 2022, 6:46:05 AM4/3/22
to OpenPnP
Keep in mind that with that strip orientation auto setup expects the first part to be at the bottom of the image - if you try to do it going the other way you'll get an error.

That picture looks like it would be fine, what do the results look like if you edit the pipeline?

Jim Young

unread,
Apr 5, 2022, 4:08:59 PM4/5/22
to OpenPnP
Here's my results with the default pipeline for white paper tape. As you can see none of the sprocket holes are being detected.
Any attempts at editing to improve the detection were fruitless. 
CircleDetection.png

mark maker

unread,
Apr 6, 2022, 3:19:01 AM4/6/22
to ope...@googlegroups.com

E O

unread,
Apr 6, 2022, 3:37:00 AM4/6/22
to OpenPnP
Have you done the camera calibration? It looks like your units per pixel is wrong.

Jim Young

unread,
Apr 6, 2022, 9:34:05 AM4/6/22
to OpenPnP
I did a camera calibration when initially setting things up. I'll try that again. The odd thing is that the homing fiducial is correctly recognized, no issues there, although it is the reverse coloring of the white tape.

Jim Young

unread,
Apr 6, 2022, 9:37:47 AM4/6/22
to OpenPnP
I did try using DetectCircularSymmetry but it did not work either. Maybe I was using it wrong. I'll try again. 

Jim Young

unread,
Apr 7, 2022, 12:49:15 AM4/7/22
to OpenPnP
After recalibrating my upper camera, I did finally get the pipeline to detect the sprocket holes. Using the stock pipeline, I added and Threshold stage after the first image capture. That allowed me to toss out a lot of the noise. I never could get DetectCircularSymmetry to work, no matter what I set the parameters to. DetectCircularSymmetry had a bad habit of detecting curves in the image and declaring them circles, ignoring the obvious circles in the image. To be honest, I find it cumbersome to specify geometric parameters in pixels, rather than distances. 

mark maker

unread,
Apr 7, 2022, 4:08:35 AM4/7/22
to ope...@googlegroups.com

> I never could get DetectCircularSymmetry to work

Did you test before or after you calibrated the camera i.e. after you got the Units per Pixel right? I'm asking because the DetectCircularSymmetry pipeline does rely on these heavily.

> To be honest, I find it cumbersome to specify geometric parameters in pixels, rather than distances.

If you are referring to the DetectCircularSymmetry pipeline, there should be no such thing necessary. The min/max diameter is controlled by the calling code, your changes are futile. Unfortunately, I see that the GUI user feed-back introduced lately, does not work in this case. I will fix that. However, this GUI issue does not affect the function of the stage, and again points to Units per Pixel being wrong.

If after fixing Units per Pixel it still does not work, I would be very interested in getting your raw images. Enable the ImageWriteDebug stage that comes immediately after the ImageCapture stage. It then saves the images in your $HOME/.openpnp2/org.openpnp.vision.pipeline.stages.ImageWriteDebug directory.

Thanks for helping with testing!

_Mark

Jim Young

unread,
Apr 7, 2022, 1:14:33 PM4/7/22
to OpenPnP
Image capture attached.
debug1649351546210115900.png

mark maker

unread,
Apr 8, 2022, 2:53:42 AM4/8/22
to ope...@googlegroups.com

Oh, and please post your camera's Units per Pixel.

Jim Young

unread,
Apr 8, 2022, 9:36:54 AM4/8/22
to OpenPnP
Here's the camera properties.
CameraProperties.png

Jim Young

unread,
Apr 15, 2022, 11:38:19 AM4/15/22
to OpenPnP
Hi Mark,

Were you able to reproduce the issue I was seeing?

It's strange that the stock White Tape pipeline is generating all these false positives. It is detecting the actual holes, but there are so many other detections that clearly are not holes at all. I'm wondering if that will affect things when the job runs.

FalsePositiveHoleDetection.png

Zdenko Stanec

unread,
Apr 15, 2022, 6:18:18 PM4/15/22
to OpenPnP
Hi,

Go to the pipeline of that Strip Feder and under "DetectCircularSymmetry" -> "maxTargetCount" - adjust how many sprocket holes fit in your camera view, or for example put 3-4, which should be fine, if not try to play a bit with other values.

Br,

Jim Young

unread,
Apr 15, 2022, 9:14:59 PM4/15/22
to OpenPnP
Thank you for your help.

DetectCircularSymmetry is not one of the stages in the pipeline. DetectFixedCirclesHough is there instead. If I add DetectCircularSymmetry as the result stage it does not detect any circles at all. I found that using the stock pipeline, with DetectFixedCirclesHough, and adding a Threashold stage after the image is first captured, I can eliminate the majority of the false positives.

Zdenko Stanec

unread,
Apr 16, 2022, 3:31:10 AM4/16/22
to OpenPnP
Hi,

Then you are not using Pipeline Mark suggested, please copy and paste this into your pipeline for that feeder.

<cv-pipeline>
   <stages>
      <cv-stage class="org.openpnp.vision.pipeline.stages.ImageCapture" name="original" enabled="true" default-light="true" settle-first="true" count="1"/>
      <cv-stage class="org.openpnp.vision.pipeline.stages.ImageWriteDebug" name="deb0" enabled="false" prefix="strip_" suffix=".png"/>
      <cv-stage class="org.openpnp.vision.pipeline.stages.BlurGaussian" name="predetect-1" enabled="false" kernel-size="5"/>
      <cv-stage class="org.openpnp.vision.pipeline.stages.DetectCircularSymmetry" name="results" enabled="true" min-diameter="10" max-diameter="100" max-distance="100" max-target-count="4" min-symmetry="1.2" corr-symmetry="0.25" property-name="sprocketHole" outer-margin="0.3" inner-margin="0.1" sub-sampling="8" super-sampling="2" diagnostics="false"/>
      <cv-stage class="org.openpnp.vision.pipeline.stages.ImageRecall" name="recalled" enabled="false" 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>
      <cv-stage class="org.openpnp.vision.pipeline.stages.ImageWriteDebug" name="deb1" enabled="false" prefix="strip_result_" suffix=".png"/>
   </stages>
</cv-pipeline>

Br,

Jim Young

unread,
Apr 16, 2022, 1:42:51 PM4/16/22
to OpenPnP
Thank you! That is working perfectly.

But, I wonder - Is the example you posted supposed to be the stock pipeline for white tape? Is so, where is the other pipeline that uses  DetectFixedCirclesHough coming from when I reset the pipeline? I looked in vision-settings.xml but don't see a pipeline specific to white tape.

mark maker

unread,
Apr 17, 2022, 4:49:21 AM4/17/22
to ope...@googlegroups.com

DetectCircularSymmetry is agnostic to the tape color.

https://github.com/openpnp/openpnp/wiki/DetectCircularSymmetry

_Marl

Jim Young

unread,
Apr 17, 2022, 9:56:34 AM4/17/22
to OpenPnP
>>  DetectCircularSymmetry is agnostic to the tape color.

Okay, thanks for that. I'm getting a better understanding about how the computer vision works in OpenPnP.

But, how can I make the pipeline xml in the article the standard for the various operations, so I don't have to paste them in every time I create a new feeder?

mark maker

unread,
Apr 17, 2022, 12:59:27 PM4/17/22
to ope...@googlegroups.com

Unfortunately, there is no such automatism for the ReferenceStripFeeder.

_Mark

Reply all
Reply to author
Forward
0 new messages