Flatbed scanner geometry accuracy

There are cases where you want to remove the paper texture when you scan. An often mentioned technique is to do two scans, rotating the paper 180° between the two. Then in an image editor you load both images, and rotate one 180° so that they overlap again, and take advantage of the different shadows to remove them (“Lighten only” mode or else).

At least, this is the theory. But if I try this on my Epson V200 with a detached sheet of squared paper, vertical lines (in portrait mode) are shifted, and I cannot have them all overlap across the paper: if they overlap around the center, they won’t on the edges, and vice-versa, and there is about as much as 1mm of discrepancy across an A4 sheet. On the other hand horizontal lines can be made to overlap across the whole height of the paper.

Made a test sheet. Here is what I get when I use Gimp to show the difference between two scans (if the images a identical, the result is all black)

So, the result isn’t too bad (but far from perfect) when scanned in the same direction, but there is an obvious problem with the Rotated one.

Digging in to this a bit more, I find that a side of the sheet is slightly compressed, in other words, on the Original scan the center mark on the paper is not centered on the scan. The distance between the vertical lines of the pattern that correspond to my edges is 4822px, but the vertical line of the center is 2396px from left and 2426px from right in the Original scan. Of course, on the Rotated scan I find similar values but in the opposite direction, the left half is slightly wider that the right. So this is a 0.6% inaccuracy. Should I expect better? Do you see something similar with your scanner?

Any clues for the cause of the problem?

  • Incorrect paper handling (but then why only vertical lines)
  • Common problem with home-grade scanners, yours does that too…
  • Scanner is old technology
  • Scanner is old, period
  • Scanner is broken/out of specs

My surprise is that the scan head transport (timing belt/stepper motor) is still accurate, but whatever happens in the scanning head (I thought there were no moving part there) is not.

2 Likes

Morning, @Ofnuts,

Interesting!
a) What scanning software/OS?
b) Same if you invoke the scans from the scanner’s keypad?
c) What if you increase/decrease DPI settings?
d) Same if you scan to PDF vs. to jpg?
e) Got any HiFi setting?

Finally, I believe that @paperdigits is the resident expert™.

Have fun!
Claes in Lund, Sweden

In addition to @Claes:
f) What paper are you scanning? Plain A4 or an artistic textured paper like aquarel?

I’ve never seen these stripes with my Epson 3200 scanner…

If i understood the testing correctly, I think the glass surface is not flat enough and can be causing some distortion.

It looks to me like the scan head is nonuniform somehow; the sensels are closer together on one side than the other.

  1. Gimp+iScan, Kubuntu 20.04
  2. Didn’t try, what would be the difference?
  3. Same at 300PPI (tests above at 600PPI)
  4. Scanned directly to Gimp and measured before it’s saved as file
  5. None I could see
  6. The stripes are from my 5mm squared paper:
1 Like

Stripes are from the paper. See answer to @Claes.

Oh wow, that’s a lot of a difference. Could it be that the alignment between ccd line and glass is off? I mean, in vertical direction, if paper plane is xy, then shifted in z between both sides?

Yes, and this is what baffles me. But… if we just have an incorrect placement of fixed sensels then the problem would be the same everywhere along the same vertical, I would see one or more vertical dark bands, and what I see (rotated optimized for center) is a dark V shape. And I have a hard time believing that in 2007 they couldn’t produce regularly spaced photosites on a CCD.

The scanner specs says it has a 4800*9600 optical resolution, so normally it is not playing any tricks, and certainly not for 600DPI (or even 300PPI).

Before anyone wonders if it is the paper pattern which isn’t accurate:

  • I’m investigating this because I have got the problem on other pictures
  • As far as my ruler goes, the paper is accurate
  • Even if the original grid was vastly distorted on the paper, a 180° rotation (in the scanner) plus a 180° rotation (in Gimp) should produce two identical and overlapping images.

Your scanning is wobbly, said Pooh
[no, he didn’t, but relatively close…].

I imported your original into The Gimp,
and placed a ruler on one of the paper verticals…
Screenshot_2022-02-18_16-42-52

Then I mouse scrolled downwards…

Screenshot_2022-02-18_16-43-37

Before anyone wonders if it is the paper pattern which isn’t accurate

OK, then we won’t blame the grid printer.

Have fun!
Claes in Lund, Sweden

What you are measuring is the scan, not the paper grid, which as far as my ruler is concerned, is straight and accurate.

There is indeed a small cant in the scan but it is much smaller than the difference between the original and rotated scans…

How much vertical displacement would you need to have 1mm error laterally? The rails of the head are on the bottom half of the scanner, the glass is attached to the top half, there would be a visible gap between the two?

Look like I’m not alone. So even if I replace the scanner this may not fix the problem.

I will see if I can fix this by computing a displace map for Gimp.

1 Like

Hi @Ofnuts,

I just managed to start the scanner portion in my XP-960
(even if it was out of ink [!]). I scanned a 5x5mm grid sheet
twice (normal + turned 180 degs). I then aligned them in
The Gimp and compared them. The grids are off :frowning:
Not quite as wobbly as in your case, but slightly off.

Have fun!
Claes in Lund, Sweden

Actually the plot thickens… The scanner isn’t even scanning at 600PPI horizontally (more like 610PPI), so the correction would include a bit of general stretch (seems fine vertically).

In practice your scanner is a CIS scanner, so less subject to distorsion. You can have the orthogonal problem, better overlap on vertical lines than on horizontal ones.

OK, eventually:

  • Did some measurements (distances of 10 samples along an horizontal)
  • Put that in a spreadsheet
  • Obtained the expression of a 10-segment gradient for Gimp that will be used as a displace map. This correct both the distortion and the scale problem (horizontal scale appears to be 610PPI)
  • Added the Gradient file to Gimp

Then

  • Loaded the upright scan,
  • Added a layer, fill the layer with the gradient computed above
  • Applied the layer as a displace map to the upright scan layer. Now the center is really centered and the width is as expected.
  • Added the rotated scan as a layer
  • Applied the layer as a displace map to that one
  • Rotated the fixed layer
  • Acid test: checked the overlap between the two: not perfect, but a lot better:

My measures show that the distortion at the top and bottom is not strictly the same than in the middle, and this would explain that the corners aren’t too good. So maybe I should be using a layer made by composing three gradients for a more accurate compensation. But as it is already a huge improvement, I may not have to spend good money on a new scanner.

1 Like

The effect may also depend on other factors, such as ambient temperature or the current temperature of mechanical components.

I thought of temp. Would a misaligned, misshapen or asymmetrical track, gear or mechanism be a contributor?

Improved on the process:

  1. Scanned a real steel ruler at various positions in the scanner.
  2. Made a path with anchors on the divisions

  1. Wrote a python script to generate a displace map from the path data

Applied the script to the steel rulers image. The vertical guides in the image are where 1cm marks from the left edge should be:

Before:

This makes it clear that:

  1. The top rulers are missing 1mm at the top of the scanner bed. The bottom rulers aren’t. My explanation is that the scanner bed window and the scanner head guides are,'t perfectly aligned. This would explain the slight cant in the scans shown in my previous posts.
  2. Distortion is much stronger on the right. This may be the manufacturer trying to improve things for small scans. But then it is also a photo scanner and the backlight is in the middle, where the distortion is already noticeable.

After:

Close-up:

So, looks good. In practice, still not accurate enough to allow a perfect match on a double scan, but part of the inaccuracy could come from the measure.I’ll looking for something with very regular, thin and high-contrast lines (so my squared paper doesn’t qualify) that if possible starts along the edge. Any ideas?

Ideas

Sheet music: not a grid pattern but has fine horizontal, vertical and diagonal lines.

Cutting mat: the kind with guidelines.