Print on part mangles up pin detection

262 views
Skip to first unread message

Fabian Kropp

unread,
Feb 20, 2023, 6:15:40 AM2/20/23
to OpenPnP
Hi, 

any idea how to cope with prints on the bottom side of a part?
Sadly I am too stupid to figure how to mask out white parts,..
Sorry for the iPhone Foto, but I guess you get the idea.

BR

Fabian

IMG_2022.jpeg

mark maker

unread,
Feb 20, 2023, 6:19:29 AM2/20/23
to ope...@googlegroups.com

Ar you saying they printed stuff in white on the back of that thing?

(photo is really bad)

_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/992e7b5e-7199-4ad6-9301-c9039238718dn%40googlegroups.com.

Fabian Kropp

unread,
Feb 20, 2023, 6:26:09 AM2/20/23
to OpenPnP
ma...@makr.zone schrieb am Montag, 20. Februar 2023 um 12:19:29 UTC+1:
 

Ar you saying they printed stuff in white on the back of that thing?

yes they did.....
 

(photo is really bad)

Sadly I cannot take a screenshot currently.
Will try to provide that as soon as possible.

but this foto should show the whole mess:

IMG_2023.jpeg

mark maker

unread,
Feb 20, 2023, 7:45:47 AM2/20/23
to ope...@googlegroups.com

Aren't they morons?!

Assuming you use default stock pipelines, and you have (at least) the DEBUG logging level selected, look in your

~/.openpnp2/org.openpnp.vision.pipeline.stages.ImageWriteDebug/

directory for images bv_source_*.png and send those.

Also tell me your calibrated Unit per Pixel on the bottom camera. I'll try something.

_Mark

mark maker

unread,
Feb 20, 2023, 8:00:23 AM2/20/23
to ope...@googlegroups.com

Another thought: are these standard 0.1" pitch contacts?

Then with a well calibrated machine, perhaps you'd be able to place them without using bottom vision at all. Perhaps they would also self-align further in reflow, through surface tension.

https://youtu.be/_5lksMvmqQc?t=66

_Mark

Fabian Kropp

unread,
Feb 20, 2023, 8:01:28 AM2/20/23
to OpenPnP
See attached images / screenshots.
I had added a polygon mask, as the improved bottom camera of the lumen now sees part of the ring light (ring light was not moved down by 30 mm )

THX

Fabian

bottomcam_details1.jpgbottomcam_details2.jpgbv_source_1676897676052874066.pngbv_source_1676897682632129365.pngbv_source_1676897683650277185.pngbv_source_1676897684671475926.pngbv_source_1676897685702742470.png

Fabian Kropp

unread,
Feb 20, 2023, 8:04:51 AM2/20/23
to OpenPnP
pitch is 1.5 mm. 
And I still own the LumenPnP. Dunno how accurate it got to be, but I have my doubts

BR

Fabian

mark maker

unread,
Feb 20, 2023, 9:39:44 AM2/20/23
to ope...@googlegroups.com

Hi Fabian,

I was hoping to distinguish ENIG "gold" color from markings, but that seems hopeless. 🙁

However, as I now see you have a magenta color-keyed backdrop, so we could forget about contacts altogether and just go for the overall outline of the whole part (maybe you need to color the backdrop a bit better, i.e. less whitish smudges).

Unfortunately, that means going back to square one 🙁. You would have to undo the changes to the center in the E-CAD, i.e. again make it centered on the whole part (PCB) body. I'm just assuming you can pick it like that (nozzle tip rim must never overlap the metallic cover edge).

Sorry about that U-turn 😅

Then do the following:

  1. Delete the footprint.
  2. Instead enter one pseudo pad with the size of the whole part*.
  3. Make sure you have Issues & Solutions done, with all the Camera Device Settings, White Balance.
  4. Make sure you have Issues & Solutions Background Calibration done, using "Brightness and Key-Color".
  5. Then go to our package, and press Specialize for XY if you haven't yet.
  6. Paste the pipeline given below
<cv-pipeline>
   <stages>
      <cv-stage class="org.openpnp.vision.pipeline.stages.ParameterNumeric" name="pDetail" enabled="true" parameter-label="Min. Detail Size" parameter-description="Minimal size of a detail that should be included in the detected shape." stage-name="filterContours" property-name="minArea" effect-stage-name="contours" preview-result="true" minimum-value="0.0" maximum-value="0.25" default-value="0.01" numeric-type="SquareMillimetersToPixels"/>
      <cv-stage class="org.openpnp.vision.pipeline.stages.ImageCapture" name="0" enabled="true" default-light="true" settle-option="Settle" count="1"/>
      <cv-stage class="org.openpnp.vision.pipeline.stages.ImageWriteDebug" name="deb0" enabled="true" prefix="bv_source_" suffix=".png"/>
      <cv-stage class="org.openpnp.vision.pipeline.stages.BlurGaussian" name="3" enabled="true" kernel-size="9" property-name="BlurGaussian"/>
      <cv-stage class="org.openpnp.vision.pipeline.stages.ConvertColor" name="5" enabled="true" conversion="Bgr2HsvFull"/>
      <cv-stage class="org.openpnp.vision.pipeline.stages.MaskHsv" name="threshold" enabled="true" auto="false" fraction-to-mask="0.0" hue-min="60" hue-max="130" saturation-min="32" saturation-max="255" value-min="64" value-max="100" soft-edge="0" soft-factor="1.0" invert="false" binary-mask="true" property-name="MaskHsv"/>
      <cv-stage class="org.openpnp.vision.pipeline.stages.MaskCircle" name="4" enabled="true" diameter="525" property-name="MaskCircle"/>
      <cv-stage class="org.openpnp.vision.pipeline.stages.FindContours" name="findCountours" enabled="true" retrieval-mode="List" approximation-method="None"/>
      <cv-stage class="org.openpnp.vision.pipeline.stages.FilterContours" name="filterContours" enabled="true" contours-stage-name="findCountours" min-area="0.01" max-area="900000.0" property-name="FilterContours"/>
      <cv-stage class="org.openpnp.vision.pipeline.stages.MaskCircle" name="11" enabled="true" diameter="0" property-name=""/>
      <cv-stage class="org.openpnp.vision.pipeline.stages.DrawContours" name="contours" enabled="true" contours-stage-name="filterContours" thickness="2" index="-1">
         <color r="255" g="255" b="255" a="255"/>
      </cv-stage>
      <cv-stage class="org.openpnp.vision.pipeline.stages.MinAreaRect" name="results" enabled="true" threshold-min="100" threshold-max="255" expected-angle="0.0" search-angle="45.0" left-edge="true" right-edge="true" top-edge="true" bottom-edge="true" diagnostics="false" property-name="MinAreaRect"/>
      <cv-stage class="org.openpnp.vision.pipeline.stages.ImageRecall" name="14" enabled="true" image-stage-name="0"/>
      <cv-stage class="org.openpnp.vision.pipeline.stages.DrawRotatedRects" name="15" enabled="true" rotated-rects-stage-name="results" thickness="2" draw-rect-center="false" rect-center-radius="20" show-orientation="false"/>
      <cv-stage class="org.openpnp.vision.pipeline.stages.ImageWriteDebug" name="deb1" enabled="true" prefix="bv_result_" suffix=".png"/>
   </stages>
</cv-pipeline>


*) Use the pseudo pad as described in point (2) above for now. But I've just added a Body option to Vision Compositing, so you can align the body instead of the pads, see screen shot:


Will be available in the next OpenPnP test version. 😎

_Mark

Fabian Kropp

unread,
Feb 20, 2023, 11:56:20 AM2/20/23
to OpenPnP
Hi Mark,

that looks really promising....
But, there is a catch with the view angle (the magenta is not wide enough :-) )
Masking out with a polygon mask did not work for me (as masking whitens the outline :-/

See attached images for the input on the real machine.

BR

Fabian 

P.S: Sadly I have no clue how to feed this into simulated bottom camera to play with the pipelines a bit more - doing that on the real machine is tedious and currently due to health constraints not possible for a longer period of time :-(

bv_source_1676909562455406729.pngbv_source_1676909563394775337.pngbv_source_1676909564417328216.pngbv_source_1676909565356269657.png

mark maker

unread,
Feb 20, 2023, 1:44:57 PM2/20/23
to ope...@googlegroups.com

> But, there is a catch with the view angle (the magenta is not wide enough :-) )

Can't you make it so?

> Masking out with a polygon mask did not work for me

You should not apply any additional mask, Vision Compositing already does that using a circular mask and that should be considered minimal, as it goes into the compositing calculation.

> ... as masking whitens the outline :-/

Well, the mask must now come after the MaskHsv.

_Mark

Fabian Kropp

unread,
Feb 20, 2023, 3:07:51 PM2/20/23
to OpenPnP

Hi,

ma...@makr.zone schrieb am Montag, 20. Februar 2023 um 19:44:57 UTC+1:

> But, there is a catch with the view angle (the magenta is not wide enough :-) )

Can't you make it so?

I had if I could :-/ - dual nozzle and nozzle close to the vertical moving part of the head.
 SO no I can't. even if I could, the white outline of the ring light would be in the way anyways. 

> Masking out with a polygon mask did not work for me

You should not apply any additional mask, Vision Compositing already does that using a circular mask and that should be considered minimal, as it goes into the compositing calculation.

ok, I need to check that, as soon as I can get access to the machine again I will try to figure that. 

> ... as masking whitens the outline :-/

Well, the mask must now come after the MaskHsv.

that's a good hint, I apparently had not done that.

BR

Fabian 

Fabian Kropp

unread,
Feb 20, 2023, 5:26:48 PM2/20/23
to OpenPnP
I am now using this pipeline:

<cv-pipeline>
   <stages>
      <cv-stage class="org.openpnp.vision.pipeline.stages.ParameterNumeric" name="pDetail" enabled="true" parameter-label="Min. Detail Size" parameter-description="Minimal size of a detail that should be included in the detected shape." stage-name="filterContours" property-name="minArea" effect-stage-name="contours" preview-result="true" minimum-value="0.0" maximum-value="0.25" default-value="0.01" numeric-type="SquareMillimetersToPixels"/>
      <cv-stage class="org.openpnp.vision.pipeline.stages.ImageCapture" name="0" enabled="false" default-light="true" settle-option="Settle" count="1"/>
      <cv-stage class="org.openpnp.vision.pipeline.stages.ImageWriteDebug" name="deb0" enabled="false" prefix="bv_source_" suffix=".png"/>
      <cv-stage class="org.openpnp.vision.pipeline.stages.ImageRead" name="1" enabled="true" file="/Users/fabiankropp/dev/kroppit/LumenPNP/bv_source_1676909565356269657.png" color-space="Bgr" handle-as-captured="false"/>

      <cv-stage class="org.openpnp.vision.pipeline.stages.BlurGaussian" name="3" enabled="true" kernel-size="9" property-name="BlurGaussian"/>
      <cv-stage class="org.openpnp.vision.pipeline.stages.ConvertColor" name="5" enabled="true" conversion="Bgr2HsvFull"/>
      <cv-stage class="org.openpnp.vision.pipeline.stages.MaskHsv" name="threshold" enabled="true" auto="false" fraction-to-mask="0.0" hue-min="160" hue-max="240" saturation-min="80" saturation-max="130" value-min="240" value-max="255" soft-edge="0" soft-factor="1.0" invert="true" binary-mask="true" property-name="MaskHsv"/>

      <cv-stage class="org.openpnp.vision.pipeline.stages.MaskCircle" name="4" enabled="true" diameter="525" property-name="MaskCircle"/>
      <cv-stage class="org.openpnp.vision.pipeline.stages.FindContours" name="findCountours" enabled="true" retrieval-mode="List" approximation-method="Tc89Kcos"/>
      <cv-stage class="org.openpnp.vision.pipeline.stages.FilterContours" name="filterContours" enabled="true" contours-stage-name="findCountours" min-area="0.01" max-area="900.0" property-name="FilterContours"/>
      <cv-stage class="org.openpnp.vision.pipeline.stages.MaskCircle" name="11" enabled="true" diameter="400" property-name=""/>

      <cv-stage class="org.openpnp.vision.pipeline.stages.DrawContours" name="contours" enabled="true" contours-stage-name="filterContours" thickness="2" index="-1">
         <color r="255" g="0" b="204" a="255"/>

      </cv-stage>
      <cv-stage class="org.openpnp.vision.pipeline.stages.MinAreaRect" name="results" enabled="true" threshold-min="100" threshold-max="255" expected-angle="0.0" search-angle="45.0" left-edge="true" right-edge="true" top-edge="true" bottom-edge="true" diagnostics="false" property-name="MinAreaRect"/>
      <cv-stage class="org.openpnp.vision.pipeline.stages.ImageRecall" name="14" enabled="true" image-stage-name="0"/>
      <cv-stage class="org.openpnp.vision.pipeline.stages.DrawRotatedRects" name="15" enabled="true" rotated-rects-stage-name="results" thickness="2" draw-rect-center="false" rect-center-radius="20" show-orientation="false"/>
      <cv-stage class="org.openpnp.vision.pipeline.stages.ImageWriteDebug" name="deb1" enabled="true" prefix="bv_result_" suffix=".png"/>
   </stages>
</cv-pipeline>

That seems to expose the corners pretty good. still It does not recognise the surrounding rect I assume (I would see this in the pipeline edit stage I assume)

I need a hint where to go next from here.

BR

Fabian


bv_source_1676909565356269657.pngbv_source_1676909564417328216.pngbv_source_1676909563394775337.pngbv_source_1676909562455406729.png

Fabian Kropp

unread,
Feb 21, 2023, 2:04:17 AM2/21/23
to OpenPnP
one more thing, is green the better color of choice ? 
I figured I may not be able to  make the screen larger, but I can bring it closer to the tip, which will make it use more space of the viewport 

mark maker

unread,
Feb 21, 2023, 2:30:18 AM2/21/23
to ope...@googlegroups.com

> one more thing, is green the better color of choice ?

No.

> I figured I may not be able to  make the screen larger, but I can bring it closer to the tip, which will make it use more space of the viewport

Good! I'm quite sure this will work.

I'm mostly offline today.

_Mark

mark maker

unread,
Feb 21, 2023, 2:43:01 AM2/21/23
to ope...@googlegroups.com

> > one more thing, is green the better color of choice ?

> No.

I was a bit quick with that. From a vision standpoint it does not matter. But of course it is also a matter of any electronic parts not having this color. As the very common Juki nozzle tips use green, I guess most part manufacturers will actively avoid using green as a color on parts. Maybe.

But I would not rip out the magenta just because of that assumption. Maybe in case you need to replace it anyways 😉.

_Mark

Fabian Kropp

unread,
Feb 22, 2023, 12:08:35 AM2/22/23
to OpenPnP
Works now, I lost the ability for the second nozzle now (nozzle heads are way too close together), but that was not going to happen in the near future anyways.

thank you for the support!

br

Fabian 

mark maker

unread,
Apr 15, 2023, 11:38:56 AM4/15/23
to ope...@googlegroups.com

Hi Fabian,
Hi all,

I made some extensions for this use case:

image

See the "Instructions for use" in the PR:

https://github.com/openpnp/openpnp/pull/1546

Available in the test version, allow some minutes to deploy.

_Mark

fabian kropp

unread,
Apr 15, 2023, 12:16:53 PM4/15/23
to ope...@googlegroups.com
Hi Mark,

Thanks, I will give it a try ASAP

Regards

Fabian 

fabian kropp

unread,
Jun 15, 2023, 11:07:22 AM6/15/23
to ope...@googlegroups.com
ASAP was today :-(
Sorry my lumenpnp gave me a shitload of headache lately.

Works brilliant ;-)
Thx for the kicad footprint import that is amazing 

Cheers 

Fabian 

Fabian Kropp

unread,
Jun 16, 2023, 1:56:47 AM6/16/23
to OpenPnP
Sadly something went host now with the part detection.
I am unsure if I just had been too stupid to test it or if had to restart the lumen and had not recognised the problem in the first place.
The body is no longer detected :-( it always measures the whole viewport as the surrounding rectangle :-(

I tried playing with the min detail size and the threshold without luck (after I reverted to the default pipeline)

Can someone point out my stupidity please?

THX

Fabian 
(dbg images and config is attached)


bv_result_1686894130564572647.pngbv_result_1686894131476199947.pngbv_result_1686894132626842566.pngbv_result_1686894133524368698.pngbv_source_1686894130442808376.pngbv_source_1686894131395287219.pngbv_source_1686894132553187511.pngbv_source_1686894133430639090.png
machine.xml
parts.xml
boards.xml
panels.xml
packages.xml
vision-settings.xml

Mark

unread,
Jun 16, 2023, 8:14:03 AM6/16/23
to ope...@googlegroups.com

Fabian,

please follow the following carefully, it is complex and everything must play together:

  1. Downloaded the newest test version.
  2. Select the "Whole Part Body Bottom Vision Settings" on packages/parts where you need it.
  3. Select the Body method on the Vision Compositing tab, if you need multi-shots because the part is too large for the camera view.
  4. Ensure the Nozzle Tip Background Calibration is done properly and shows the magenta background color (either manually or by using Issues & Solutions, which is triggered, if you switch off Nozzle tip calibration and then press Find Issues & Solutions):
    https://github.com/openpnp/openpnp/wiki/Nozzle-Tip-Background-Calibration
  5. Probably the most important: Your camera images from earlier messages show your magenta shade is not large enough to cover the whole camera view. To handle this, on the Nozzle tip, make sure the Max. Part Diameter is smaller than the shade in all directions across the center of the camera view. As you can see, that diameter is rather small:

  6. Needless to say, it yould be better to fix the shade, i.e., make it larger or move it closer to the camera.

_Mark

Fabian Kropp

unread,
Jun 16, 2023, 10:10:34 AM6/16/23
to ope...@googlegroups.com
Am 16.06.2023 um 14:14 schrieb 'Mark' via OpenPnP <ope...@googlegroups.com>:

Fabian,

please follow the following carefully, it is complex and everything must play together:

  1. Downloaded the newest test version.
  2. Select the "Whole Part Body Bottom Vision Settings" on packages/parts where you need it.
  1. Select the Body method on the Vision Compositing tab, if you need multi-shots because the part is too large for the camera view.
  1. <w2Lofd1zvdXtlXKA.png>
  1. Ensure the Nozzle Tip Background Calibration is done properly and shows the magenta background color (either manually or by using Issues & Solutions, which is triggered, if you switch off Nozzle tip calibration and then press Find Issues & Solutions):
    https://github.com/openpnp/openpnp/wiki/Nozzle-Tip-Background-Calibration
  1. Probably the most important: Your camera images from earlier messages show your magenta shade is not large enough to cover the whole camera view. To handle this, on the Nozzle tip, make sure the Max. Part Diameter is smaller than the shade in all directions across the center of the camera view. As you can see, that diameter is rather small:
  1. <tQOobm5bd0we7GlI.png>
  1. Needless to say, it yould be better to fix the shade, i.e., make it larger or move it closer to the camera.
    A feature of Version 3 ( to which I upgraded ) was to lower the bottom camera - that now bites me in the butt :-(
    Fixing the shade is not really a viable option, as the design is „special“.

    I will look into this during the weekend.

    BR

    Fabian 

    Mark

    unread,
    Jun 16, 2023, 10:40:31 AM6/16/23
    to ope...@googlegroups.com

    > A feature of Version 3 ( to which I upgraded ) was to lower the bottom camera - that now bites me in the butt :-(
    > Fixing the shade is not really a viable option, as the design is „special“.

    > I will look into this during the weekend.

    Cool, and while at it, please send us a photo from the side, so we "see"😎

    _Mark

    Fabian Kropp

    unread,
    Jun 16, 2023, 2:51:07 PM6/16/23
    to OpenPnP
    detail from the side, sorry lighting here is horrible .... 
    In any case ist works now ( as bad as the floppy and unreliable / imprecise machine seems to work)

    Thank you for the support

    Fabian 
    IMG_2347.jpeg
    Reply all
    Reply to author
    Forward
    0 new messages