Skip to main content

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:

  1. You take a "reference photo" (the template image) of a perfect part
  2. You point to specific features on that photo (corners, edges, holes) that look the same on every part
  3. Every time a new part arrives, the camera finds those same features in the new image
  4. It calculates the difference: "this part is 5 pixels left, 2 pixels up, and tilted 1.2 degrees"
  5. 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

Place 2-3 small template regions as far apart as possible on the part

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:

Aligner tool, full page overview

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:

Edge highlights and red dot reference point

  • 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
High sensitivity + aggressive cleanup = best results

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.

Sensitivity slider

5. Set rotation range

Rotation range setting

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
Use rotation as a quality gate

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

Confidence threshold setting

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.

  1. Click Save. This trains and deploys the aligner.
  2. Click Live Preview Mode
  3. Move the part around: left, right, up, down
  4. Rotate it within your expected range
  5. Put it in the corners of the frame
  6. Try different valid parts
  7. 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.

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

Quick reference

SettingRecommendedAdjust when...
Template regions2-3, as far apart as possibleAlignment jitters → add regions, spread them out
SensitivityLowest that gives solid green on your featuresNot enough edges (red) → increase, then clean up noise
Rotation range±180° for most applicationsParts come in a known orientation → narrow the range
Confidence0.6-0.9Wrong matches → increase. Missing valid parts → decrease
Scale invariantOff unless neededParts at varying distance from camera → enable

Troubleshooting alignment

Common alignment problems and fixes
ProblemLikely causeFix
ROIs don't move with the partSkip Aligner is on, or no template regionsDisable skip; add template regions
Alignment jitters back and forthSingle region, or regions too close togetherAdd 2-3 regions far apart on opposite sides
Confidence stays near 0%No usable edges in regionsMove regions to features with strong, clear edges
Matches the wrong thingFeatures aren't unique enough, threshold too lowChoose more distinctive features; increase confidence threshold
Works on some parts, fails on othersRegions placed on features that vary between partsMove 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.