[sane-devel] Probs... test

m. allan noah kitno455 at gmail.com
Wed Sep 14 18:39:41 UTC 2011


You have to dig into the sane standard a bit to understand why values
sometimes get rounded. SANE_FIX datatype has a certain granularity,
and the backend itself sets a step quantity on any range values, and
then the backend also gets to 'clean' the value after the frontend
changes it. It is certainly possible that these three things add up to
strange results, particularly as the test backend is rather
infrequently used :)

I've never seen multi-pass noise reduction, though I have seen
scanning at higher resolution than required, and downsampling.
However, this will cause a significant speed reduction. Also, this
might just mask the real problem, which is poor calibration (or cheap
hardware).

allan

On Wed, Sep 14, 2011 at 10:36 AM, Michael Talbot-Wilson <mtw at view.net.au> wrote:
> Dear all, I'm a newcomer to the list.  My first message.  Hope you can
> help.  Several points.
>
> (My scanner is an Epson Perfection 4990 Photo detected as Epson
> GT-X800.)
>
> I've written a Tcl/Tk frontend/interface to scanimage (quite
> restricted, 260 lines) in part because I want XPosition and YPosition
> tags, which xsane doesn't save, in part also because I want the TIFF
> tags, equivalents, in PGM files (as comments).  The scanimage output,
> PGM, is piped to a program that reads and writes up to the first
> whitespace, writes its comments, and then copies the rest.
>
> Noticed this along the way.  Using the test device I can't duplicate
> scanimage's calculation of the br coords, and I can't see anything
> wrong with my code.  I do a mouse drag of a rectangle to obtain the
> args for scanimage, run it (using -l -t -x -y not --tl-x etc.), and
> see messages such as
>
> scanimage: rounded value of tl-x from 18.288 to 18
> scanimage: rounded value of tl-y from 16.256 to 16
> scanimage: rounded value of br-x from 49.496 to 49
> scanimage: rounded value of br-y from 51.052 to 51
>
> but my own corresponding calculations are
>
> min x in pixels = 36
> min y in pixels = 32
> tl-x in mm = 18.288
> tl-y in mm = 16.256
> max x in pixels = 98
> max y in pixels = 101
> br-x in mm = 49.784
> br-y in mm = 51.308
>
> I can't understand the "convert x/y to br_x/br_y" section of
> scanimage.c.
>
> I'm doing the calculations like this, where $prevres, the resolution of
> the preview file, is 50 (per inch).
>
> bind .w <ButtonPress-2> {
>   set x1 %x
>   set y1 %y
> }
> bind .w <B2-Motion> {
>   set x2 %x
>   set y2 %y
> }
>
> set xmin [min $x1 $x2]
> set ymin [min $y1 $y2]
> set xmax [max $x1 $x2]
> set ymax [max $y1 $y2]
>
> set tlx [expr ${xmin}.0 / ${prevres}.0 * 25.4]
> set tly [expr ${ymin}.0 / ${prevres}.0 * 25.4]
> set brx [expr ${xmax}.0 / ${prevres}.0 * 25.4]
> set bry [expr ${ymax}.0 / ${prevres}.0 * 25.4]
>
> puts "min x in pixels = $xmin"
> puts "min y in pixels = $ymin"
> puts "tl-x in mm = $tlx"
> puts "tl-y in mm = $tly"
> puts "max x in pixels = $xmax"
> puts "max y in pixels = $ymax"
> puts "br-x in mm = $brx"
> puts "br-y in mm = $bry"
>
> Also, I notice:
>
> $ sane-backends-1.0.22/frontend/.libs/scanimage -d test --tl-x 3.1
> --tl-y 4.7 --br-x 10 --br-y 11 >/dev/null
> scanimage: rounded value of tl-x from 3.10001 to 3
> scanimage: rounded value of tl-y from 4.7 to 5
> ./scanimage: unrecognized option '--br-x'
>
> Finally, does anyone do multiple passes and averaging for noise reduction?
> Scanning a black sheet I seem to see some noise, a little (doing
> histograms/counts), but I don't know whether modern scanners ever need
> noise reduction.
>
> Oops, sorry, not final.  I just noticed this, using device test with
> --format tiff:
>
> Script started on Wed 14 Sep 2011 10:13:30 CST
> $ file scan1315957558
> scan1315957558: TIFF image data, big-endian
> $ tiffinfo  scan1315957558
> TIFFReadDirectory: Warning, scan1315957558: wrong data type 8992 for
> "XResolution"; tag ignored.
> TIFFReadDirectory: Warning, scan1315957558: invalid TIFF directory;
> tags are not sorted in ascending order.
> TIFFReadDirectory: Warning, scan1315957558: unknown field with tag
> 26991 (0x696f) encountered.
> TIFFReadDirectory: Warning, scan1315957558: unknown field with tag
> 25971 (0x6573) encountered.
> TIFF Directory at offset 0x8 (8)
>  Subfile Type: (0 = 0x0)
>  Image Width: 623 Image Length: 680
>  Bits/Sample: 8
>  Compression Scheme: None
>  Photometric Interpretation: min-is-black
>  Orientation: row 0 top, col 0 lhs
>  Samples/Pixel: 1
>  Rows/Strip: 680
>  Min Sample Value: 0
>  Max Sample Value: 255
>  Planar Configuration: single image plane
> TIFFFetchDirectory: scan1315957558: Can not read TIFF directory count.
> TIFFReadDirectory: scan1315957558: Failed to read directory at offset 0.
> $ exit
> exit
>
> Script done on Wed 14 Sep 2011 10:14:05 CST
>
> As a newbie I threw that in just in case the people who have been
> working on SANE for years had never noticed.  Doesn't stop it from
> working perfectly well as a test device.  Sorry.
>
> Still, I hope someone can say something about multiple scanner takes
> for noise reduction.  Is it useful, or it is overdoing things
> insanely?  NonSANEly?  Unsaintly?
>
> --
> sane-devel mailing list: sane-devel at lists.alioth.debian.org
> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel
> Unsubscribe: Send mail with subject "unsubscribe your_password"
>            to sane-devel-request at lists.alioth.debian.org
>



-- 
"The truth is an offense, but not a sin"



More information about the sane-devel mailing list