Part Identification Pipeline (Video Guide)
Part identification is the most difficult pipeline to tune because it needs to accomodate every part in your job.
If you receive an error after picking a component about No Results Found
, you need to tune your vision pipeline.
Setup nozzle
-
Install a nozzle tip on your first toolhead. In this example we'll work with the N045 nozzle tip.
-
Click on the
Machine Setup
tab in the top right pane. -
Click on the "Expand" checkbox.
-
Click on
Heads > ReferenceHead H1 > Nozzles > ReferenceNozzle N1
-
Click on the
Nozzle Tips
tab. -
Click the
Loaded?
checkbox for the nozzle you're tuning. -
Click on
Nozzle Tips > ReferenceNozzleTip N045
(or whichever nozzle you're working with). -
Check that the correct toolhead is selected in the
Machine Controls Tab
.
Pick component
To tune a part identification pipeline, you'll need to pick up the component you want to tune. You can setup a feeder and use the "pick" button.
Open the pipeline
-
With a part now picked and on the nozzle, go to the
Packages
tab. -
Select the package for the component you'll be tuning.
-
Check that your nozzle tip is compatible with the package you'll be working with.
-
Click on the
Bottom Vision Settings Tab
. -
Click on the Pipeline:
Edit
button.Affects all other parts
Directly clicking the "Edit" button will adjust the vision pipeline for every other package assigned to this pipeline. If you'd like to adjust the pipeline for just this package, click on the "Specialize for
PACKAGE_NAME
" button before editing. -
Allow OpenPnP to jog the nozzle to the bottom camera position.
Edit the pipeline
Reset pipeline to default
If you want to reset your part identification pipeline to the clean default configuration, you can easily update your vision pipeline as follows.
-
Click the "Copy" button in the code block below to save the vision pipeline to your clipboard.
<cv-pipeline> <stages> <cv-stage class="org.openpnp.vision.pipeline.stages.ImageCapture" name="CaptureImage" enabled="true" default-light="true" settle-option="Settle" count="1"/> <cv-stage class="org.openpnp.vision.pipeline.stages.ImageWriteDebug" name="SaveDebugImage" enabled="false" prefix="bv_source_" suffix=".png"/> <cv-stage class="org.openpnp.vision.pipeline.stages.MaskCircle" name="MaskCircle" enabled="true" diameter="250" property-name=""/> <cv-stage class="org.openpnp.vision.pipeline.stages.ConvertColor" name="ConvertToGray" enabled="true" conversion="Bgr2Gray"/> <cv-stage class="org.openpnp.vision.pipeline.stages.BlurGaussian" name="InitialBlur" enabled="true" kernel-size="9" property-name="BlurGaussian"/> <cv-stage class="org.openpnp.vision.pipeline.stages.Threshold" name="Threshold" enabled="true" threshold="230" auto="false" invert="false"/> <cv-stage class="org.openpnp.vision.pipeline.stages.BlurGaussian" name="SecondBlur" enabled="true" kernel-size="3" property-name="BlurGaussian"/> <cv-stage class="org.openpnp.vision.pipeline.stages.MinAreaRect" name="results" enabled="true" threshold-min="149" threshold-max="256" 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="RecallOriginal" enabled="true" image-stage-name="CaptureImage"/> <cv-stage class="org.openpnp.vision.pipeline.stages.DrawRotatedRects" name="DrawRectangle" 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="SaveDebugWithCV" enabled="false" prefix="bv_result_" suffix=".png"/> </stages> </cv-pipeline>
-
Click the "Clipboard" icon in the vision pipeline window to insert the new pipeline into OpenPnP.
-
Click on the
DrawRotatedRects
stage. -
The main view will show a rectangle around the silhouette of your component.
- If the rectangle is not precise around your component, then we need to more clearly distinguish the real component from the toolhead.
- If there is no rectangle, we need to loosen the threshold to make the component easier to identify.
- If the image looks like the good one above, your pipeline is properly tuned. If you've still been getting failures when homing, you may need to slightly loosen the filtering.
Threshold tuning
The Threshold
stage is the most commonly edited stage. It turns the camera image into black and white, which starkly defines the tip of your nozzle. This is especially important for detecting parts, as they should catch all of the light from the upward facing camera LEDs and turn totally white in the image. We need to detect both the position and rotation of the picked component, so a tight, precise rectangle identifying its body is very important. Raise or lower the threshold
parameter as necessary until the picked component is outlined precisely.
- If the image is too dark, lower the
threshold
setting. - If the image is too bright, raise the
threshold
setting.
Exposure settings
If you're having trouble getting your image to look like the "Good Threshold" image below, it could be that your bottom camera exposure is too high, making it difficult for OpenPnP to distinguish between the part and the nozzle tip. Adjust your bottom camera's exposure, then retry tuning your threshold value.