Skip to content

Debugging a Beier-Neely Image Morph

What 26 line pairs, five transformation studies, and several coordinate bugs taught me about image warping.

Computer GraphicsC++Image Processing
Debugging a Beier-Neely Image Morph cover

Beier-Neely morphing creates a smooth transition between two images by using corresponding line pairs as geometric constraints. Each intermediate frame interpolates those lines, warps both source images toward the new geometry, and then dissolves their color values.

For the character study, I placed 26 line pairs around the silhouette and important local features. More lines gave me control, but they also made errors easier to amplify.

The first bug was a coordinate convention

Eigen image matrices are addressed as rows and columns. The morphing equations are expressed in geometric x-y coordinates. I initially treated those conventions as interchangeable, which sent otherwise correct calculations into the wrong image axes.

The fix was simple once the problem was visible: define one conversion boundary and keep every warp calculation in a consistent coordinate system.

Jitter came from integer conversion

The translated sequence shook vertically during its early frames. Changing line-pair length did not help, nor did adding more pairs for stabilization.

The actual cause was inconsistent conversion from floating-point warp positions to integer pixels. Some paths truncated, others rounded, and boundary handling differed. A consistent clamp and rounding strategy produced the smoothest translation.

Linear interpolation won

I tried several strategies for generating intermediate line pairs, including sine-shaped blends. Linear interpolation produced the least distortion. It was also the easiest behavior to reason about while debugging—simple made the system more legible.

Imperfect results are still useful results

Translation became stable, while scale remained only moderately successful. Rotation moved in the opposite direction from the expected result, pointing to a remaining issue in the warp or position calculation.

Those outputs remain in the case study. They document the boundary between what the implementation solved and what should be investigated next.

Migrated experiment

Warp field + four transformation studies

Abstract Beier-Neely line-pair warp field between two original geometric forms
Abstract warp fieldOriginal replacement visual · line-pair geometry at t = 0.50
TranslationStable after clamp + rounding fixes
Translate + scaleCombined transformation test
2D scaleWarp behavior under scaling
RotationAn imperfect result that exposed a warp-direction issue

Archive note: the old character source images are not republished because their original credit and publication license were not retained. The abstract field above was created for this archive; the four geometric videos preserve the implementation and debugging record without the third-party artwork.

Read the structured project case study.