Black borders after geometric correction do not, by themselves, mean your calibration failed. A corrected image can contain output pixels that have no corresponding location inside the captured frame. Cropping those pixels removes the border but may also remove inspection coverage.
For an inspection system, the useful question is whether every measurement region contains supported image data at sufficient resolution. The following checks separate rendering choices from calibration faults, then turn the remaining valid area into an acceptance criterion you can verify before changing optics.
Identify unsupported pixels before judging the calibration
Undistortion creates a new pixel grid and samples the original image to fill it. Some output locations map beyond the original image boundary. Software commonly fills these locations with zero, which appears black, although other border treatments are possible.
A black object and an unsupported output pixel can therefore look identical. Do not create a validity mask by simply selecting dark pixels in the corrected image.
Start with these checks:
- Save the original frame, corrected frame, output dimensions and active calibration settings.
- Generate a validity mask from the remapping geometry, independently of scene brightness.
- Overlay the mask boundary on the corrected image and mark every inspection region.
- Check whether the border changes when you change only the output bounds or output camera matrix.
For bilinear remapping, a useful diagnostic is to remap a floating-point source image filled with ones. Use the same mapping and zero-valued border fill. Values close to one indicate full sampling support; smaller values reveal partial or absent support. Allow for numerical tolerance when evaluating the result.
If you use another interpolation method, verify its complete sampling footprint rather than assuming the same mask test applies unchanged. Higher-order filters can require additional source pixels around the mapped coordinate.
Compare output policies before recalibrating
The output canvas and the virtual camera used to render it are separate choices. A fixed-size canvas can retain black borders, crop scene content, or do both, depending on the mapping.
| Rendering choice | What you may see | What to verify |
|---|---|---|
| Preserve more captured scene content | Unsupported corners or curved borders | Valid mask covers every inspection region |
| Crop to a fully supported rectangle | Clean edges but reduced scene coverage | Part motion and placement remain inside the crop |
| Keep the original image dimensions | Familiar frame size, but not necessarily familiar coverage | Output camera matrix and actual scene boundaries |
| Expand or shift the output canvas | More room for remapped content | Updated origin, principal point and downstream coordinates |
| Extend edge values or synthesize border pixels | A visually filled image | Filled pixels are excluded from measurements |
For the output-scaling trade-off itself, see undistortion scaling, cropping and field of view. Here, the acceptance test is stricter: determine which pixels are genuinely supported and whether they cover the inspection task.
Do not confuse a bounding box around valid pixels with a valid crop. Curved invalid regions can remain inside that box. Select a rectangle whose entire area passes the validity test, or retain a mask alongside the image.
Check the mapping and adjusted camera matrix
Most image remappers work backward: each output pixel asks which source position should supply its intensity. The output camera matrix defines the corrected pixel grid; the input matrix describes the captured image.
For a simple undistortion mapping without an additional camera rotation:
Here, focal lengths and principal-point coordinates are expressed in pixels. The distortion model converts ideal normalized coordinates into distorted normalized coordinates. The resulting source position must have enough neighboring pixels for the selected interpolation method.
Changing the output focal length changes how widely the corrected scene is spread across the canvas. Changing the output principal point translates that scene. Neither adjustment changes the physical lens or recovers rays outside the captured frame.
The physical relationship between sensor, lens and scene remains the same when software changes the output canvas:
Keep both camera matrices with the mapping configuration. If software supplies an adjusted output matrix, use that matrix for calculations involving the corrected image. Reusing the original matrix can shift overlays or corrupt angle and position estimates.
For coefficient conventions, use interpreting distortion coefficients in an unrectified image. Do not transfer coefficients between different models merely because the arrays have matching lengths.
Work through a crop and sampling budget
Consider a hypothetical corrected output measuring 4000 × 3000 pixels. Its validity mask permits a fully supported crop starting at column 200 and row 150, with dimensions of 3600 × 2700 pixels.
That percentage describes output canvas area, not automatically the percentage of physical field of view retained. To calculate coverage, you need the corrected image's mapping to the inspection plane.
Suppose independent measurements establish a uniform horizontal scale of 0.040 mm/pixel on that plane. The cropped horizontal coverage is then:
That margin must accommodate placement variation, not just a perfectly centered sample. It also applies only at the validated plane and geometry. Height changes can alter scale and coverage with ordinary perspective optics.
Now suppose the smallest feature is 0.20 mm wide, and your initial sampling target is five pixels across it:
The example meets the chosen sampling target but has little placement margin. Five pixels is a planning assumption, not a guarantee of detection or measurement accuracy. Validate contrast, focus and processing performance with representative parts.
For the broader sampling decision, see choosing resolution for dimensional inspection. Resizing the cropped image back to its original dimensions adds samples, not newly captured detail or scene coverage.
Test calibration accuracy separately from border shape
Once output support is understood, test whether the correction is geometrically accurate. Use independent images rather than relying only on the target views used to fit the calibration.
Check known straight features across the usable image, especially near its edges. Where a planar reference is available, compare known distances or positions at several locations. Match the test to the inspection's error budget.
For example, if an application allocates 0.10 mm to geometric error and the validated scale is 0.040 mm/pixel, the corresponding allowance is:
This does not make a particular calibration acceptable automatically. It only expresses that application's allocation in image coordinates. Target uncertainty, feature localization and part geometry also contribute to the result.
The procedure in measuring distortion-correction accuracy helps separate residual curvature from a rendering border. If you need new calibration images, review target coverage and lens margins and calibration target flatness.
A sensible diagnosis is conditional: supported inspection regions with acceptable independent geometry indicate an output-bounds issue. Failed geometric checks require investigation even if the corrected image has clean edges.
Check that acquisition geometry still matches calibration
If independent geometry fails, first confirm that the input image is the image the calibration describes. Common mismatches include a different acquisition region, resized frames, binning, rotated images or changed focus.
For a simple resize and crop, coordinate changes can be described as:
In this expression, the crop offsets are measured in resized-image coordinates. Exact resize conventions can include pixel-center offsets, so use the documented coordinate transform for your processing pipeline. Binning or sensor modes may also require more than this simple adjustment.
Verify these causes in order:
- Unexpected preprocessing: compare the acquired dimensions and orientation with the saved calibration metadata.
- Wrong coefficient convention: check model type, coefficient order and mapping direction against the software documentation.
- Changed optics or mounting: inspect focus settings and mechanical changes, then repeat independent geometry checks.
- Weak calibration coverage: inspect target observations near the working image boundaries and recapture where necessary.
Use calibration recovery after camera or mechanical changes when the acquisition setup has genuinely changed. Do not alter coefficients solely to make the black border disappear.
Change hardware only when valid coverage is insufficient
A camera replacement is not the first remedy for an output-canvas problem. Consider hardware changes when the supported scene area cannot contain the required part envelope, or when retained pixels cannot meet the inspection's sampling requirement.
Compare area scan cameras through the camera finder only after calculating the required valid dimensions. The LS-CMR-0166 is a USB3 rolling-shutter camera. It is a candidate for a broader acquisition review, not a software-border remedy.
- Sensor format
- 1/1.7"
- Interface
- USB3
- Resolution
- 12 MP
- Shutter
- Rolling
For optics, inspect machine vision lenses in the lens finder. The LS-FFL-0602 has an 8.5 mm focal length.
- Type
- Machine vision fixed
- Sensor format
- 1"
- Mount
- C-mount
- Resolution
- 6-10 MP
The LS-FFL-0567 has a 16 mm focal length. These are alternatives to evaluate against the required scene coverage, not interchangeable recommendations.
- Type
- Machine vision fixed
- Sensor format
- 1.1"
- Mount
- C-mount
- Resolution
- 16-25 MP
Before ordering, confirm sensor coverage, mount compatibility, working distance, focus range and performance over the retained inspection area. Nominal focal length alone does not predict valid corrected coverage. The lens sensor-format guide explains another compatibility check that software cropping cannot replace.
Keep image coordinates consistent after cropping
Cropping changes the image origin. If the accepted rectangle begins at horizontal offset x_crop and vertical offset y_crop, subtract those offsets from the corrected principal point and from image-coordinate annotations.
Keep detections, masks and measurements in a declared coordinate space: raw, corrected full canvas, cropped corrected image, or physical coordinates. Convert explicitly at each boundary. A correct detection can otherwise appear misplaced simply because its overlay uses another image origin.
Where measurements are involved, calibrating length measurements from image markers provides useful context. A visual overlay matching the part is helpful, but it is not an independent accuracy test.
Archive a configuration set containing the input dimensions, calibration model, input matrix, output matrix, map settings, interpolation method, crop rectangle and validity-mask rule. Regenerate dependent maps and overlays together when that set changes.
Verify the result and choose the next step
Before releasing the corrected image to inspection, complete this checklist:
- Independent validity mask: dark scene pixels are not mistaken for unsupported output.
- Complete inspection support: every measurement region stays within valid data throughout expected part movement.
- Coverage margin: the accepted crop contains the full placement envelope at relevant part heights.
- Sampling margin: the smallest feature retains sufficient captured detail after correction and cropping.
- Independent geometric test: residual errors meet the application allocation across the usable region.
- Coordinate consistency: overlays and measurement tools use the accepted output matrix and crop origin.
- Repeatable configuration: saved settings reproduce the same mask, bounds and measurements after restart.
The usual answer—crop away the border—is wrong when cropping excludes required features. Preserving borders with a mask is often preferable when inspection regions remain supported. A wider physical capture may be necessary when they do not.
If the current optics pass these checks, keep them and correct the rendering configuration. If coverage or sampling fails, start with the lens configuration step. For help reviewing a candidate setup, send the raw frame, validity mask, crop dimensions and inspection envelope through applications support.
문의사항
Do black borders after undistortion prove the calibration is wrong?
No. A valid correction can request source coordinates outside the captured image, leaving unsupported output pixels. Evaluate the remapping mask and test geometry independently. Recalibration becomes appropriate when accuracy checks fail or the acquisition setup no longer matches the saved calibration.
Can I use the bounding rectangle of valid pixels as my crop?
Not necessarily. Valid pixels can form a curved region whose enclosing rectangle still contains invalid corners. Check every pixel in the proposed crop against the support mask, including the interpolation footprint. Alternatively, retain the larger image and exclude unsupported regions from inspection.
Does enlarging the cropped result recover inspection resolution?
Enlarging the cropped image changes its displayed pixel count, but it cannot recover excluded scene content or detail absent from the original capture. Base your sampling budget on captured information and validate small features after the complete remapping and resizing pipeline.
Which camera matrix should I use after correction and cropping?
Keep the output matrix supplied or calculated for the corrected image. If you subsequently crop it, translate the principal point by the crop offset. Any further resizing requires another coordinate adjustment. Store these transformations with the image so downstream tools use consistent coordinates.
When should I change the lens or camera instead of the output settings?
Consider different hardware when no acceptable output configuration preserves the required inspection envelope with adequate captured detail. First verify acquisition settings and calibration conventions. Then compare physical coverage, placement variation, working distance, sensor compatibility and edge performance rather than choosing solely by nominal focal length.


