3D visionTroubleshooting

Depth camera curved plane edges: check rectification first

Why a depth camera renders a flat plane with curved edges: lens rectification is off or set on the wrong application. Diagnose it, enable it, verify the bow.

LumaSpec Vision10 min read Share on LinkedIn

On this page 9 sections
  1. 01Why does a flat wall get curved edges in a depth point cloud?
  2. 02How to confirm the bow is lens distortion and not the target or the mount
  3. 03How to turn rectification on in the camera configuration
  4. 04Why did the rectification flag change nothing on the point cloud?
  5. 05Will the edges be perfectly straight once rectification is on?
  6. 06How large is the lateral error before and after rectification?
  7. 07How to verify the fix on a known-flat target
  8. 08When to move from ToF to a structured-light depth camera
  9. 09Questions

A depth camera aimed square at a flat wall should return a rectangle of points, yet the cloud arrives with its corners pulled in and its long edges bowed like a barrel. The reflex is to suspect the sensor, the mount or the processing script. Nearly always the cause is simpler: the camera's lens-distortion rectification is switched off, or it was switched on for an application the camera is not actually running. This guide walks the diagnosis from symptom to fix, shows how to enable rectification for the application your host really uses, works the lateral-error arithmetic through with real numbers, and gives pass criteria that decide whether the rectified camera is accurate enough for the job.

Why does a flat wall get curved edges in a depth point cloud?

The lens, not the sensor, is bending your rectangle: with rectification disabled, the point cloud inherits the wide-angle optic's barrel distortion. That displaces each pixel's viewing ray radially while leaving the measured range along that ray correct.

A time-of-flight pixel reports how far the surface lies along its own line of sight. The camera turns that range into X, Y and Z through an ideal pinhole model, and an un-rectified wide-angle lens is not a pinhole. Straight lines in the world land on curved image lines, dominated by a radial barrel term that grows with roughly the cube of the distance from the image centre. The centre of your wall sits at the correct coordinates while the corners drift inward — exactly the signature in front of you.

The same radial coefficient causes grief at calibration time, where Camera calibration returns five distortion coefficients: fix k3 explains what each coefficient does. The practical point here is simpler. The camera carries the correction but ships it dormant, and the cloud inherits whatever the lens does until you switch the flag on.

How to confirm the bow is lens distortion and not the target or the mount

Put a machine-flat plate square in front of the camera and check the raw amplitude image. If the plate's outline bows there too, with the deepest bow in the corners, the curve is in the camera's projection rather than in your mounting, your script or the surface.

Three cross-checks settle it in a couple of minutes:

  • Roll test. Turn the camera 90° about its optical axis without moving the plate. Distortion is fixed to the image corners, so the bow rotates with the camera; a genuinely curved surface stays where it is.
  • Shape check. Mounting tilt gives a keystone, with one edge of the rectangle longer than the opposite edge, while barrel distortion pulls both long edges inward symmetrically. A trapezoid is a mount problem, not a lens problem.
  • Target check. A machined plate, granite surface plate or window glass is trustworthy; sheet building material bows several millimetres over a metre, enough to fake the residual you are about to measure.

If the cloud comes back planar but squashed flat in X and Y instead of bowed, stop here. That is the optical-frame mix-up covered in Depth camera point cloud flat in XY: fix the optical frame, not distortion.

How to turn rectification on in the camera configuration

Rectification is a setting stored in the camera, per application, not a filter in your code. Dump the running configuration to JSON, set the rectification flags for the distance and amplitude images to true, and load the file back.

  1. Save the running configuration with the SDK's config-dump command; ToF SDKs write the complete application set as one JSON file. Keep the original untouched as your rollback.
  2. Open the file and locate the rectification flags inside the block for the application your grabbing session selects. One flag covers the distance image, one the amplitude image; the vendor's application-configuration reference names them explicitly.
  3. Set the distance-image flag to true in every case: the point cloud follows it. Set the amplitude flag too whenever you overlay the 2D image on the cloud.
  4. Load the modified file back with the SDK's config-load command and let the application restart.
  5. Dump the configuration once more and confirm the flags read back true before you trust a single frame.

Why did the rectification flag change nothing on the point cloud?

In practice the flag was set on an application the camera is not running: a ToF camera stores a complete configuration per application, and an edit saved under one application has no visible effect while the host session selects another.

Work the three misses in order:

  • Wrong application. Check which application index your grab session requests, then open that same block in the JSON. Flags edited under another application do nothing for the active stream.
  • Load never landed. Dump again immediately after loading. If the flags still read false, the write did not reach the camera; check the command's error output.
  • Amplitude only. The cloud ignores the amplitude flag, so an amplitude-only edit straightens the 2D image while the point cloud keeps its bow.

One more trap: a client session that stayed open through the change can hold stale parameters. Reconnect before you re-judge the cloud.

Will the edges be perfectly straight once rectification is on?

No — expect a small residual bow that grows toward the frame corners. Rectification resamples the depth through a fitted distortion map whose fit is weakest at the edge of the field.

The residual is small next to the uncorrected curve, and it is normal: fitted maps run out of accuracy where the calibration coverage runs out, at the corners. Judge it with numbers rather than against a screen render. If the rectified image looks warped rather than gently bowed, the sign and storage conventions in Inverse distortion coefficients: why rectified depth looks warped explain why. On a stereo depth camera the word means something different — aligning the two sensors' image rows — and its checks differ, as Stereo depth node distortion correction: why rectification differs sets out.

Translate a measured bow into a real-world error with two lines:

f_px = (W / 2) / tan(FOV_x / 2) e_xy = z × px_offset / f_px

Here W is the image width in pixels, FOV_x the horizontal field of view, z the range to the surface, and px_offset the bow at the point of interest in pixels.

How large is the lateral error before and after rectification?

For a 90° horizontal field of view on a 352 px wide depth image, 12 px of bow puts the corner of a wall at 2.0 m about 136 mm from its true position; after rectification the same corner sits within about 17 mm.

The inputs below are illustrative for the arithmetic, not a product specification: read W and FOV_x from your camera's intrinsics and measure px_offset on your own rig against a straight edge or a taut wire.

  • f_px = (352 / 2) / tan(45°) = 176 / 1 = 176 px
  • Before rectification: e_xy = 2.0 m × 12 px / 176 px = 0.136 m ≈ 136 mm
  • After rectification: e_xy = 2.0 m × 1.5 px / 176 px = 0.017 m ≈ 17 mm

The error scales linearly with range and with px_offset, and inversely with f_px: double the working distance and it doubles; anything that doubles f_px, a narrower field of view or a wider image, halves it.

Range to the wall Error at 12 px bow (before) Error at 1.5 px bow (after)
1.0 m 68 mm 9 mm
2.0 m 136 mm 17 mm
4.0 m 273 mm 34 mm

Two decisions fall straight out of the table:

  • Volume and presence checks that tolerate about ±20 mm at 2.0 m pass on the rectified camera at 17 mm, with little margin. Narrow the field of view or raise the resolution to buy headroom.
  • Robot guidance onto a 50 mm feature that needs ±10 mm at 1.5 m fails on ToF: the same geometry gives 1.5 m × 1.5 px / 176 px ≈ 13 mm at the corners. That job belongs to a projected pattern.

How to verify the fix on a known-flat target

Score the fix numerically instead of by eye: capture ten frames of the flat plate, fit a plane to each cloud, and log the largest radial residual along the plate's straight edges before and after the change.

  • Fit the plane with RANSAC rather than plain least squares so a handful of stray points cannot tilt the reference; the trade-offs are worked through in Plane fitting on 3D point clouds: least squares vs RANSAC.
  • Convert the surviving corner px_offset to millimetres with the formula above at your true working distance, and write that number on the commissioning sheet.
  • For a fuller edge-error audit with acceptance figures, follow the method in Depth camera flat plane distortion: quantify edge error.
  • Average the ten frames rather than judging one: single-frame range noise can rival the residual you are measuring, and the mean stabilises the corner offsets.

Prevention is one line on the station checklist: dump the configuration at installation and after every firmware update, and confirm the rectification flags still read true. More depth-cloud diagnostics sit on the 3D vision topic page.

When to move from ToF to a structured-light depth camera

Move when the measured post-rectification residual at your working distance still breaks the tolerance your process puts on edge position: for the worked example that is anything tighter than about 17 mm at 2.0 m, which is projected-pattern territory rather than ToF.

If you are rescuing an existing install, work the sections above first — a flag set correctly on the active application costs nothing. If you are specifying hardware, the ToF entry in the catalogue for presence and volume work is the MV-DT01WMU, a ToF sensing camera.

3D sensorsHikrobot MV-DT01WMU ToF sensing cameraMV-DT01WMU
Type
Depth / ToF camera
Price on requestView and quote

Where corner XY must beat what a rectified wide-angle ToF map delivers, pick a camera that solves the projection from a projected pattern or a steered laser rather than interpolating a fitted map:

3D sensorsHikrobot MV-DPS200P-02 Projected structured-light 3D cameraMV-DPS200P-02
Type
Stereo / structured light
$8,829.00 · quotedView and quote
3D sensorsHikrobot MV-DLS300P-04 Laser galvanometer stereo cameraMV-DLS300P-04
Type
Stereo / structured light
$16,579.00 · quotedView and quote

Compare the depth classes on the 3D sensors page or filter the camera finder by 3D type. Then close the loop: measure the bow on your rig, set your working distance and edge tolerance against the table above, and keep the camera if the rectified number clears the tolerance. If it does not, start a system from the camera step in the vision configurator, or send both numbers through the contact page and we will check the geometry with you.

Questions

Does un-rectified distortion change the depth values themselves?

No. A time-of-flight pixel measures the range along its own ray, so the Z value at a wall's centre reads correctly even when the outline is badly bowed. What distortion corrupts is the ray direction, so X and Y curve while Z stays sound. That is why a bowed cloud can pass a height check at the centre while failing every width measurement.

Should I rectify the distance image, the amplitude image, or both?

The point cloud follows the distance-image flag, so that one is mandatory. Rectify the amplitude image as well whenever you overlay or tint the cloud with the 2D image: with only one of the two rectified, the overlay drifts at the frame edges by roughly the same pixel count as the bow you just removed, tens of pixels at 2 m in the worked example's geometry.

Can I undistort on the host PC instead of in the camera?

Yes for the 2D image: apply the vendor's stored distortion coefficients to the amplitude frame with a standard undistort call on the host. The point cloud is different, because ToF cameras build it inside the camera from the raw depth; without the camera-side flag you would have to deproject the depth yourself. Switching the flag on is the practical route, and it costs nothing.

How flat does the test target have to be?

Flatter than the error you are measuring. A machined plate, granite surface plate or window glass is safe; sheet building material bows several millimetres over a metre, the same order as the residual you are quantifying, so it can fake or mask the result. Read the plate at the same working distance as production and square to the optical axis, or the keystone from tilt will join the bow you are chasing.

Does a narrower field of view reduce the residual edge error?

Yes, in inverse proportion to the pixel focal length. With f_px = (W / 2) / tan(FOV_x / 2), narrowing a 352 px wide image from 90° to 60° raises f_px from 176 px to 305 px, and the same 1.5 px residual at 2.0 m drops from about 17 mm to about 10 mm. Doubling the image width at a fixed field of view helps by the same factor.