Part Identification Pipeline
Part identification is the most difficult pipeline to tune because different parts will need special consideration. Even just for the normal components used in the FTP, you need to be sure that the picked components are distinguishable from the tip of your nozzle. Depending on how well you set your camera exposure and other settings, you may need to go back and adjust them, which would require that you re-tune your nozzle tip pipeline to account for the changes.
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 "Expand" checkbox to open all of the features about your machine.
-
Click on
Heads > ReferenceHead H1 > Nozzles > ReferenceNozzle N1
-
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
-
Select the package for the component you'll be tuning. For example, the
R_0603_1608Metric
package used in the Test Placement. -
Check that your nozzle tip is compatible with the package you'll be working with.
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.
-
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.
Test part identification
-
Select the package for the component you'll be tuning. For example, the
R_0603_1608Metric
package used in the Test Placement.