unpaper truncates some images

Bug #1916937 reported by Bill Yikes
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
unpaper (Ubuntu)
New
Undecided
Unassigned

Bug Description

An envelope was scanned sideways to a PNG file, in grayscale. Imagemagick "convert" was used to produce a PGM file. Then unpaper was used to rotate it and bilevel it. This often works fine with no issues, but exceptionally for one image in particular, unpaper cuts a box out of the center of the image and shifts over the return address side of the envelope, ultimately causing corruption. This is the command used:

$ unpaper -v -t pbm -b 0.2 --pre-rotate 90 sample.pgm sample_b20.pbm

output was:

-------------------------------------------------------------------------------
Processing sheet #1: sample.pgm -> sample_b20.pbm
pre-rotating 90 degrees.
input-file for sheet 1: sample.pgm
output-file for sheet 1: sample_b20.pbm
sheet size: 2747x1156
...
noise-filter ... deleted 20062 clusters.
blur-filter... deleted 387 pixels.
auto-masking (1373,578): 0,0,2746,1155 (invalid detection, using full page size)
gray-filter... deleted 13774552 pixels.
auto-masking (1373,578): -7,0,1458,1155
detected rotation left: [-7,0,1458,1155]: 0.003491
detected rotation right: [-7,0,1458,1155]: -0.054105
rotation average: -0.025307 deviation: 0.040726 rotation-scan-deviation (maximum): 0.017453 [-7,0,1458,1155]
out of deviation range - NO ROTATING
rotate (1373,578): 0.000000
auto-masking (1373,578): -7,0,1458,1155
centering mask [-7,0,1458,1155] (1373,578): 647, 0
border detected: (0,25,1,21) in [0,0,2746,1155]
aligning mask [0,25,2745,1134] (0,22): 0, -3
writing output.
[image2 @ 0x561e104d1540] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
[image2 @ 0x561e104d1540] Encoder did not produce proper pts, making some up.
-------------------------------------------------------------------------------

The input file is attached.

It's easy to see the problem by noticing the postmark date on the input image, then seeing that the month and day are missing from the resulting image.

Revision history for this message
Bill Yikes (yik3s) wrote :
Revision history for this message
Bill Yikes (yik3s) wrote :

This comment attaches the output file showing the missing postmark date.

Revision history for this message
Bill Yikes (yik3s) wrote :

I should also mention the workaround that works, which is to use ImageMagick instead of unpaper, as follows:

$ convert sample.pgm -rotate 90 -threshold 80% -type bilevel sample_th80.pbm

Revision history for this message
Bill Yikes (yik3s) wrote :

Here's another sample input (attached) which shows the problem more clearly. Most right sidebar is lost.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.