Step 2: Alignment
Time: 10–15 minutes
The aligner is the most powerful (and the most misunderstood) part of the camera. Once you understand it, everything clicks. Let's explain it simply.
What alignment does (and why you need it)
Imagine you're inspecting screws on a circuit board. You've drawn a little box around each screw location. But what happens when the next board comes in slightly shifted to the left? Or rotated a degree? Your boxes are now looking at the wrong spots.
The aligner solves this. It looks at each new image, figures out where the part moved to, and shifts all your inspection boxes to match. It's like having a helper who says "the board moved 3 pixels left and rotated 0.5 degrees, so let me move all your boxes to match."
Why this is powerful: When your inspection boxes can move with the part, you can make them smaller. And smaller boxes need less data to train the AI. It's a cascading benefit that starts with good alignment.
How it works: think of it like a puzzle
The aligner works by matching edges. Here's a simple way to think about it:
- You take a "reference photo" (the template image) of a perfect part
- You point to specific features on that photo (corners, edges, holes) that look the same on every part
- Every time a new part arrives, the camera finds those same features in the new image
- It calculates the difference: "this part is 5 pixels left, 2 pixels up, and tilted 1.2 degrees"
- It moves all your inspection boxes by exactly that amount
It's like playing a matching game. The camera finds the features you showed it and uses them as anchor points.
The golden rule of alignment
This single rule will determine whether your alignment works perfectly or jitters frustratingly. Here's why:
Think of it like this: Imagine you're trying to figure out if a picture frame on the wall is crooked.
- If you only look at one corner, you might think it's straight when it's actually tilted
- If you look at two opposite corners (top-left and bottom-right), you can instantly tell if it's crooked, and by exactly how much
The same principle applies to the aligner. With one region on one side of the part, a tiny measurement error of 0.5 degrees stays at 0.5 degrees. But with two regions on opposite sides, that same error averages out to about 0.05 degrees, ten times more accurate.
The aligner interface
Here's what the aligner setup screen looks like. You'll see your template image with colored edge highlights showing what the aligner is using as reference features:

Step-by-step setup
1. Capture the template image
Place a good, defect-free part in the camera's field of view. This part becomes the reference that every future part is compared against.
- The part should be well-lit with clear edges
- Make sure it's clean, with no debris or unusual markings
- Position it how it will typically appear in production
Click Capture Template Image.
2. Add template regions
Click + Rectangle (or + Circle) to create a template region. You'll place 2-3 of these.
What to align to (features that never change):
- Machined edges
- Drilled holes
- PCB outlines
- Molded features
- Stamped corners
What NOT to align to:
- Textured or variable surfaces
- Areas where defects might appear
- Reflective spots that create glare
- Tiny details that might not be visible in every image
- Labels or markings that could move
3. Understand the edge highlights
When you place a template region, you'll see colored highlights:

- Green highlights = Strong, usable edges detected. This is what you want.
- Red highlights = Not enough edges. Move the region to a feature with clearer edges.
- Red dot = The alignment reference point (center of all your inspection regions).
4. Clean up noisy edges with the Ignore tool
This step is overlooked by most people, and it makes a huge difference.
Click Ignore Template Region and paint over any edges you don't want the aligner to use. Remove:
- Random background texture
- Glare or reflections
- Surface noise
- Edges from debris or labels
- Any edge that might change between parts
If you need more edges, increase the sensitivity slider. But the more you increase sensitivity, the more important it is to clean up the noise with the Ignore tool. Think of it as casting a wide net, then carefully picking out only the good fish.
5. Set rotation range

This controls how much rotation the aligner will search for:
- ±180°: Find the part at any rotation (full 360). Best for most applications.
- ±5-20°: Only match if the part is roughly in the expected orientation
- ±0°: Exact angle match only
If you set a narrow range like ±5° and a part comes in rotated 10°, the aligner won't match it, and you can use this failure as a reject signal. Handy for catching parts that aren't properly oriented.
6. Set confidence threshold
How confident the aligner needs to be that it found the right match:
- Range: 0.0 to 1.0 (lower percentage = stricter match)
- Recommended: 0.6 to 0.9
- Too high → may miss valid parts. Too low → may match wrong features.
7. Enable Scale Invariant (if needed)
If your part can be ±10% closer or farther from the camera (height variation on a conveyor, for example), enable this. Otherwise, leave it off for maximum speed.
8. Save and test
This is the most important step. Do not skip testing.
- Click Save. This trains and deploys the aligner.
- Click Live Preview Mode
- Move the part around: left, right, up, down
- Rotate it within your expected range
- Put it in the corners of the frame
- Try different valid parts
- Try to break it. Find the positions where it fails.
If the alignment doesn't track reliably, fix it now. If you move on and spend time setting up inspection regions and training AI, then discover the alignment is unreliable, you'll have to come back and redo everything. That's the waterfall.
The 2D limitation (important to know)
The aligner works in 2D only: the flat plane that the camera sees. It handles:
- Left/right movement
- Up/down movement
- Rotation (spinning on the flat surface)
- Slight size changes (if Scale Invariant is on)
It does NOT handle:
- Warped or bent parts
- Parts tilted toward or away from the camera
- Any 3D variation
If your parts have 3D variation (one side closer to the camera than the other), skip the aligner entirely and use a segmenter with location-invariant training instead. (Segmenters require an OV20i or OV80i; the OV10i supports classifiers only.)
When to skip the aligner
You still need to capture a template image (the system requires it), but you can toggle Skip Aligner if:
- Your parts are in a precision fixture with less than 1-2 pixel movement
- You're using mechanical registration that guarantees exact positioning
- You're using a segmenter that doesn't need position tracking (OV20i/OV80i only)
Quick reference
| Setting | Recommended | Adjust when... |
|---|---|---|
| Template regions | 2-3, as far apart as possible | Alignment jitters → add regions, spread them out |
| Sensitivity | Lowest that gives solid green on your features | Not enough edges (red) → increase, then clean up noise |
| Rotation range | ±180° for most applications | Parts come in a known orientation → narrow the range |
| Confidence | 0.6-0.9 | Wrong matches → increase. Missing valid parts → decrease |
| Scale invariant | Off unless needed | Parts at varying distance from camera → enable |
Troubleshooting alignment
Common alignment problems and fixes
| Problem | Likely cause | Fix |
|---|---|---|
| ROIs don't move with the part | Skip Aligner is on, or no template regions | Disable skip; add template regions |
| Alignment jitters back and forth | Single region, or regions too close together | Add 2-3 regions far apart on opposite sides |
| Confidence stays near 0% | No usable edges in regions | Move regions to features with strong, clear edges |
| Matches the wrong thing | Features aren't unique enough, threshold too low | Choose more distinctive features; increase confidence threshold |
| Works on some parts, fails on others | Regions placed on features that vary between parts | Move regions to universal features (machined edges, holes) |
Alignment checklist
Before moving on, confirm:
- Template image captured from a good, defect-free part
- 2-3 template regions placed on strong, stable features
- Regions spread as far apart as possible on the part
- Noisy edges cleaned up with the Ignore tool
- Rotation range and confidence threshold set
- Live Preview tested; alignment tracks the part in all positions
Alignment working well? Move to Step 3: Inspection Regions.