How To: Get Reliable Results with the Right Template and Scene
LumiScan Template Finder finds a part by comparing a template, a small image of the part, with the camera image. How well this works depends less on the search parameters than on the template and the scene: a template that matches the scene is found reliably with the default settings; a template that does not match cannot be rescued by tuning.
This page explains what to look out for and shows three examples. The procedure itself - cutting a template and searching for it - is described in How To: Match a Part from a Camera Image.
What makes the search reliable
- Take the template from the same setup
-
Cut the template from an image of the camera that will search for it, with the part where it will be in production. Lighting, working distance and background are then the same in the template and in the image. LumiScan Template Finder cuts the template directly from the live camera image for this reason, see Creating a Template.
- Keep the part the same size in pixels
-
The part must appear at about the same size in the template and in the searched image. A template from another camera, another lens or another working distance has a different scale. If the distance varies in production, set a scale range, see Tuning the Search.
- Keep the lighting constant
-
Shadows, reflections and changes in brightness change the appearance of the part and lower the score. Use a dedicated illumination and shield the station from daylight and changing ambient light.
- Keep the background consistent and calm
-
The template contains some of the background around the part. If the background in production differs from that in the template, every score drops. A matt, non-reflective background in an even colour works best; it also keeps reflections off the part.
- Include what identifies the part, exclude what varies
-
Cut the template tightly around distinctive features. Background that changes from part to part, or parts of neighbouring objects, belong outside the region.
Examples
The three examples search ring-shaped parts. Each found part is framed and labelled with its score; the
part the template was cut from scores 1.00.
Example 1 - Template from the same scene, light grey background
Figure 1. Search image
|
Figure 2. Template
|
Figure 3. Result
|
Five of the six rings are found, at the right positions. Of the two rings that touch at the bottom, only
one is found, and it is reported twice. Parts that touch each other are harder to separate than parts
that lie apart. The ring on the right, seen at a slight angle, scores lower (0.87) because it looks
different from the template.
Example 2 - Template from the same scene, textured blue background
Figure 4. Search image
|
Figure 5. Template
|
Figure 6. Result
|
All six rings are found. The rings lie apart, so each frame contains only one ring and background. The
scores vary with the reflections on the individual rings, from 0.72 to 1.00.
Example 3 - Template from another scene
The template from example 2, cut on the blue background, is used to search the light grey image of example 1.
Figure 7. Search image
|
Figure 8. Template
|
Figure 9. Result
|
The result is unusable: two rings are not found, and the frames are too large and shifted against the
rings. The template differs from the scene in background, in lighting, and in size - the ring is larger
in pixels than the rings in the search image. The best match of a search always scores close to 1.00,
so a high score alone does not prove a correct position, see
Understanding the confidence.
The remedy is not a parameter but a new template, cut from the grey scene.
Checklist
-
The template is cut from the camera that searches, in the production setup.
-
The part has about the same size in pixels in the template and in the image. Otherwise, a scale range is set.
-
The lighting is the same when the template is cut and in production.
-
The background is the same, matt and even.
-
The template is found in the image it was cut from, at the centre of the region, with a score near
1.
If the part is still not found, or found in the wrong places, see Troubleshooting.