Binarize and pad
Resize to height H, convert to gray, pad with white to an N×N square that the FFT handles fast, then a Gaussian adaptive threshold (C = −10) keeps ink as 1.
Straighten a tilted document page with Adaptive Radial Projection on the Fourier Magnitude Spectrum (Pham et al., ICIP 2022). The whole estimator runs in your browser and matches the official jdeskew code angle for angle.
Or test the ten photos jdeskew gets wrong.
Ten Real5-RotAny photos where the released jdeskew is more than 15° off. Each column adds one change to the one before it. Cells show the absolute error modulo quarter turns; green is within 1°. Click a cell to open that photo with that column's settings, or click a photo to open it with every fix on.
| Photo | True tilt (clockwise) | Released ±15° | Wider range ±44.9° | + Hann window | + Keep edge peak | Profile deskewer (cases.csv) |
|---|
True tilts and the profile deskewer's numbers come from cases.csv, where positive means clockwise. The four jdeskew columns run here in your browser with the current estimator, H, W and D. Small differences from the Python run come from the browser's JPEG decoder and resizing.
The four steps of the method, computed live on the input above. Text lines become a bright line through the centre of the Fourier spectrum; the angle of that line is the skew.
Resize to height H, convert to gray, pad with white to an N×N square that the FFT handles fast, then a Gaussian adaptive threshold (C = −10) keeps ink as 1.
Log-scaled for display. The dashed circle has radius W, the shaded fan is the search range, and the orange ray is the angle being tested.
Treats the current image as straight, tilts it to 25 known angles across the search range, and scores both estimators with the paper's metrics: average error (AED), share within 0.1° (CE), and worst error (WE).
| Estimator | AED | CE (≤ 0.1°) | WE |
|---|---|---|---|
| ● Initial projection only (jdeskew code) | – | – | – |
| ● Adaptive radial projection (paper) | – | – | – |