MVisionPro Engineering Library · fix
Line-scan image stretched or compressed: how to find the cause
In short
Image a known-distance target before changing any setting. Cross-web pitch is the measured field of view divided by the pixels in the line. Motion pitch is the actual speed divided by the acquired line rate. With image pixels shown as squares, a larger motion pitch compresses the image and a smaller one stretches it. Either axis can cause the error, so check each axis separately before you correct anything.
Find the cause
Subtract cross-web pitch from motion pitch and divide by cross-web pitch to get the pitch error. Positive means too few lines, negative too many. Display each image pixel as a square, with no aspect-ratio correction. Rescaling the axes differently can hide or mimic distortion.
- The error changes with conveyor speed, but the cross-web scale holds. Suspect a fixed internal line rate, an inactive encoder trigger or a camera refusing triggers at the higher rate. Compare motion pitch at two speeds and check the trigger source and accepted-trigger counters. Then switch to encoder triggering, one line per fixed distance of travel (vendor guidance), or correct the commanded rate.
- The error is the same percentage at every speed. First confirm the cross-web pitch on a known target. Then calculate the counts per line, mark the wheel and compare the counted travel with a known distance. Five faults fit: a wrong PPR (pulses per revolution), decode factor (x1, x2 or x4), divider or effective wheel diameter under load, or wheel slip. Fix only the one the test proves wrong.
- The cross-web scale changed after a new lens, refocus or new working distance. The old encoder settings no longer match it, even with a healthy encoder. Measure a known distance across the line, then recalculate the target travel per line and the divider.
- Blur, missing or duplicated lines, or rejected triggers come with the distortion. Compare the requested exposure with the usable line period at the commanded trigger rate, and check the camera's status counters. Depending on the camera, a too-long exposure can cost triggers, line rate or sharpness. Shorten it, add light or lower the commanded rate before you judge any divider.
After any fix, image the target again and measure both axes.
Worked example: target pitch and encoder counts
Assume a 500 mm field, 4096 pixels and 2 m/s transport. The calculated cross-web pitch is 0.12207 mm, giving 16,384 Hz for square sampling, where both pitches are equal. The calculator's 20% margin, a camera-selection reserve, raises its working rate to 19,660.8 Hz. It does not set square sampling.
Add an assumed incremental encoder: 2048 pulses per revolution, x4 decoding, a 100 mm effective wheel diameter and no slip. That gives 8192 counts per revolution, 0.0383 mm per count and 3.18 counts per line. At 2 m/s the encoder count frequency is 52,151.89 Hz (all calculated). Setting the margin to 0% or 20% does not change it.
Counts per line is not a whole number, so a frequency converter approximates it with dividers and a multiplier. Pre-divider 1, multiplier 11 and post-divider 35 give 11 line triggers per 35 counts. The resulting 0.12202 mm per line against the 0.12207 mm target gives a −0.04% pitch error, a slight stretch (calculated). Check the register names in your camera manual.
Calculate for your case
The prepared link opens the calculator with this example's width, speed, detection mode, square sampling, margin and duty. Duty is the share of the line period left for exposure. Work in two passes.
- Choose the camera from the result rows. The page has no interface or pixel-format field, so check formats in the camera's datasheet modes or documented API.
- Set the encoder geometry: pulses per revolution, wheel diameter and x1, x2 or x4 decoding. The link carries the page defaults, 1024 pulses and x1, so enter 2048 and x4 for this example. The encoder panel works from the working rate, so at 20% margin it returns 2.65 counts and 0.102 mm of travel per line (calculated). Set the margin to 0 to get the example above. With the example's assumed duty of 0.8, the calculated planning exposure changes from 40.7 to 48.8 µs. Check the camera's actual exposure limits separately.
Changing only the field width asks the selector for a different sensor. For an installed camera, set the minimum feature to the measured field times the pixels per feature, divided by the pixels in the line. Recalculate whenever the field changes. The formulas are on the line-scan calculator reference.
Common mistakes
- A stretched image alone does not prove the line rate is too high. Measure travel per line and check the pitch-error sign.
- A line rate below the datasheet maximum does not prove correct scale. Check both pitches and the trigger counters.
- A connected encoder does not prove that lines are triggered by travel. Check its counts, polarity, decoding, divider and mechanical coupling.
When this rule breaks
A single scale factor needs a rigid, slip-free coupling, a steady wheel diameter and one trigger per line. Distortion that varies along the image suggests slip, vibration or speed ripple. Acceleration matters only if it breaks these conditions. Otherwise, triggering by travel keeps the scale.
Next step
Send us an image of a known-distance target, the actual speed, commanded and accepted line rates, and encoder settings. We will confirm the target pitch and counts per line for your camera.
Related
Sources
- MVisionPro engineering calculator and Hikrobot catalog records (datasheet fields); the calculations, the public API and the calculator page's own behaviour were reproduced from the tool sources and the engineering core on 2026-09-21
- Allied Vision, Check the image quality (adapt the encoder divider or the line rate when the image is compressed in transport direction): https://docs-linescan.alliedvision.com/docs/check-the-image-quality (checked 2026-09-21)
- Allied Vision, Set line trigger (external encoder and divider for LineStart generation, including non-integer relationships): https://docs-linescan.alliedvision.com/docs/set-line-trigger (checked 2026-09-21)
- Allied Vision, Image Format Control (line and encoder counters and a speed-too-high indicator): https://docs-linescan.alliedvision.com/docs/image-format-control-2-1-1 (checked 2026-09-21)
- Basler, line scan GigE use cases (acquisition line rate must be synchronized with object speed; encoder pulses when speed varies): https://docs.baslerweb.com/line-scan-gige-use-cases (checked 2026-09-21)
- KEYENCE application note on high-resolution line-scan imaging (encoder synchronization as the control against transport-direction distortion and missed regions): https://www.keyence.com/products/vision/applications/high-resolution-line-scan-cameras-for-high-speed-imaging.jsp (checked 2026-09-21)
- Allied Vision CoaXPress frame grabbers, eGrabber handbook (cross-web pitch set by sensor and magnification, motion pitch controlled by line trigger and encoder): https://www.alliedvision.com/assets/documents/products/frame-grabbers/D231ET-AV-CoaXPress-Frame-Grabbers-Handbook-eGrabber-26.02.1.2213.pdf (checked 2026-09-21)