kopia lustrzana https://gitlab.com/sane-project/website
190 wiersze
6.7 KiB
HTML
190 wiersze
6.7 KiB
HTML
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
|
||
|
"http://www.w3.org/TR/REC-html40/loose.dtd">
|
||
|
<HTML>
|
||
|
<HEAD>
|
||
|
<TITLE>sane-devel: Re: Calibration algorithms</TITLE>
|
||
|
<META NAME="Author" CONTENT="Karsten Festag (karsten.festag@t-online.de)">
|
||
|
<META NAME="Subject" CONTENT="Re: Calibration algorithms">
|
||
|
</HEAD>
|
||
|
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
|
||
|
<H1>Re: Calibration algorithms</H1>
|
||
|
<!-- received="Mon May 21 13:54:04 2001" -->
|
||
|
<!-- isoreceived="20010521205404" -->
|
||
|
<!-- sent="Mon, 21 May 2001 21:57:05 +0200" -->
|
||
|
<!-- isosent="20010521195705" -->
|
||
|
<!-- name="Karsten Festag" -->
|
||
|
<!-- email="karsten.festag@t-online.de" -->
|
||
|
<!-- subject="Re: Calibration algorithms" -->
|
||
|
<!-- id="3B097311.6CADC379@t-online.de" -->
|
||
|
<!-- inreplyto="3B085D90.E47B72AF@goata.nz.componic.com" -->
|
||
|
<STRONG>From:</STRONG> Karsten Festag (<A HREF="mailto:karsten.festag@t-online.de?Subject=Re:%20Calibration%20algorithms&In-Reply-To=<3B097311.6CADC379@t-online.de>"><EM>karsten.festag@t-online.de</EM></A>)<BR>
|
||
|
<STRONG>Date:</STRONG> Mon May 21 2001 - 12:57:05 PDT
|
||
|
<P>
|
||
|
<!-- next="start" -->
|
||
|
<LI><STRONG>Next message:</STRONG> <A HREF="0282.html">Andy Angrick: "RE: something very bad??"</A>
|
||
|
<UL>
|
||
|
<LI><STRONG>Previous message:</STRONG> <A HREF="0280.html">Karsten Festag: "Re: something very bad??"</A>
|
||
|
<LI><STRONG>In reply to:</STRONG> <A HREF="0261.html">Glenn Ramsey: "Calibration algorithms"</A>
|
||
|
<!-- nextthread="start" -->
|
||
|
<!-- reply="end" -->
|
||
|
<LI><STRONG>Messages sorted by:</STRONG>
|
||
|
<A HREF="date.html#281">[ date ]</A>
|
||
|
<A HREF="index.html#281">[ thread ]</A>
|
||
|
<A HREF="subject.html#281">[ subject ]</A>
|
||
|
<A HREF="author.html#281">[ author ]</A>
|
||
|
</UL>
|
||
|
<HR NOSHADE><P>
|
||
|
<!-- body="start" -->
|
||
|
<P>
|
||
|
Hi,
|
||
|
<BR>
|
||
|
<P>The microtek2 scanners I dealt with in the last time (Phantom 330CX and
|
||
|
<BR>
|
||
|
636CX) also do backend calibration. The white stripe inside the cover is
|
||
|
<BR>
|
||
|
the white point reference. I'm not sure about the dots but I assume they
|
||
|
<BR>
|
||
|
are the reference point for the starting position of the scanhead.
|
||
|
<BR>
|
||
|
I made up the backend calibration as follows: (you can download my code
|
||
|
<BR>
|
||
|
at <A HREF="http://home.t-online.de/home/karsten.festag">http://home.t-online.de/home/karsten.festag</A>)
|
||
|
<BR>
|
||
|
<P>-first do a scan of the white stripe with full optical resolution and
|
||
|
<BR>
|
||
|
maximum bit depth whith the lamp switched on, then the same with the
|
||
|
<BR>
|
||
|
lamp switched off. Thus you get 2 images with the width of the CCD and
|
||
|
<BR>
|
||
|
the height of about 50...80% of the white stripe. Don't use the whole
|
||
|
<BR>
|
||
|
stripe because sometimes there are artefacts at the borders of the
|
||
|
<BR>
|
||
|
stripe.
|
||
|
<BR>
|
||
|
My Phantom 330CX provides a special command 'read shading' which reads
|
||
|
<BR>
|
||
|
the black and white shading data at once (function read_cx_shading in my
|
||
|
<BR>
|
||
|
backend). The 636CX provides information about the location and size of
|
||
|
<BR>
|
||
|
the white stripe via the 'scanner attribute' command and the backend has
|
||
|
<BR>
|
||
|
to scan the stripe like a normal image (function read_shading_image).
|
||
|
<BR>
|
||
|
<P>-now calculate the average over the height of these images (function
|
||
|
<BR>
|
||
|
calc_cx_shading_line for the 330CX and prepare_shading_data for the
|
||
|
<BR>
|
||
|
636CX). Now you have one line of white and one line of dark pixels, each
|
||
|
<BR>
|
||
|
pixel corresponding to a pixel of the CCD. This data can be stored so
|
||
|
<BR>
|
||
|
that the scanner has to read the data not for every scan. I do a new
|
||
|
<BR>
|
||
|
calibration at the first scan when the backend was started and when the
|
||
|
<BR>
|
||
|
mode was changed (gray/color).
|
||
|
<BR>
|
||
|
By the way, if your scanner needs backend calibration, I won't recommend
|
||
|
<BR>
|
||
|
using the lineart mode of the scanner. Do a calibration corrected
|
||
|
<BR>
|
||
|
grayscale scan and make lineart out of it in the backend. Otherwise you
|
||
|
<BR>
|
||
|
get a too white middle and too black sides in your scan.
|
||
|
<BR>
|
||
|
<P>-when you perform a scan you will have to know which pixels of the CCD
|
||
|
<BR>
|
||
|
are used for scanning because you will have to take the corresponding
|
||
|
<BR>
|
||
|
pixels of the shading data for calibration. This is especially essential
|
||
|
<BR>
|
||
|
when scanning with low resolution because only a few ccd pixels are used
|
||
|
<BR>
|
||
|
in this case.
|
||
|
<BR>
|
||
|
The Phantom scanners have a command 'read control bits'. You have to
|
||
|
<BR>
|
||
|
perform this before the 'read image' command. You recieve some bytes in
|
||
|
<BR>
|
||
|
which each set bit represents a used CCD pixel. For examlple: The 330CX
|
||
|
<BR>
|
||
|
is a 300dpi scanner with 2550 pixel. That means you need (2550 pixel)/(8
|
||
|
<BR>
|
||
|
bit per byte) = 319 control bytes. I recieve 320 control bytes and have
|
||
|
<BR>
|
||
|
some junk at the start and the end. If I scan an image in the middle of
|
||
|
<BR>
|
||
|
the scan area with 100dpi the control bits look like:
|
||
|
<BR>
|
||
|
...00000000000000000000001001001001001001001001001001001000000000000000000...
|
||
|
<BR>
|
||
|
<P>-now you have to create the shading data that suits the scanned image
|
||
|
<BR>
|
||
|
(condensed shading data): you have to pick the pixels out of your
|
||
|
<BR>
|
||
|
shading data that correspond to a set control bit. (function
|
||
|
<BR>
|
||
|
condense_shading)
|
||
|
<BR>
|
||
|
<P>-now you can scan the image and take the raw image data from the scanner
|
||
|
<BR>
|
||
|
and the condensed shading data and perform the following shading
|
||
|
<BR>
|
||
|
correction:
|
||
|
<BR>
|
||
|
<P>pixel_to_frontend = ( *from_effective - s_d ) * maxval / ( s_w - s_d );
|
||
|
<BR>
|
||
|
<P>(*from_effective contains the raw data, s_d is the dark shading value,
|
||
|
<BR>
|
||
|
s_w the white and maxval depends on the bit depth (e.g. 255 for 8bit)
|
||
|
<BR>
|
||
|
<P>It's a simple linear interpolation, maybe a nonlinear function suits
|
||
|
<BR>
|
||
|
better, but the results I get are pretty good.
|
||
|
<BR>
|
||
|
<P>This is done in gray_copy_pixels / segreg_copy_pixels /
|
||
|
<BR>
|
||
|
lplconcat_copy_pixels.
|
||
|
<BR>
|
||
|
<P>Note that some scanners seem to do only white calibration (no scan with
|
||
|
<BR>
|
||
|
dark lamp). In this case s_d is 0.
|
||
|
<BR>
|
||
|
<P>Happy coding!
|
||
|
<BR>
|
||
|
<P>Karsten
|
||
|
<BR>
|
||
|
<P><P><PRE>
|
||
|
--
|
||
|
Source code, list archive, and docs: <A HREF="http://www.mostang.com/sane/">http://www.mostang.com/sane/</A>
|
||
|
To unsubscribe: echo unsubscribe sane-devel | mail <A HREF="mailto:majordomo@mostang.com?Subject=Re:%20Calibration%20algorithms&In-Reply-To=<3B097311.6CADC379@t-online.de>">majordomo@mostang.com</A>
|
||
|
</PRE>
|
||
|
<P><!-- body="end" -->
|
||
|
<HR NOSHADE>
|
||
|
<UL>
|
||
|
<!-- next="start" -->
|
||
|
<LI><STRONG>Next message:</STRONG> <A HREF="0282.html">Andy Angrick: "RE: something very bad??"</A>
|
||
|
<LI><STRONG>Previous message:</STRONG> <A HREF="0280.html">Karsten Festag: "Re: something very bad??"</A>
|
||
|
<LI><STRONG>In reply to:</STRONG> <A HREF="0261.html">Glenn Ramsey: "Calibration algorithms"</A>
|
||
|
<!-- nextthread="start" -->
|
||
|
<!-- reply="end" -->
|
||
|
<LI><STRONG>Messages sorted by:</STRONG>
|
||
|
<A HREF="date.html#281">[ date ]</A>
|
||
|
<A HREF="index.html#281">[ thread ]</A>
|
||
|
<A HREF="subject.html#281">[ subject ]</A>
|
||
|
<A HREF="author.html#281">[ author ]</A>
|
||
|
</UL>
|
||
|
<!-- trailer="footer" -->
|
||
|
<HR NOSHADE>
|
||
|
<P>
|
||
|
<SMALL>
|
||
|
<EM>
|
||
|
This archive was generated by <A HREF="http://www.hypermail.org/">hypermail 2b29</A>
|
||
|
: <EM>Mon May 21 2001 - 13:57:50 PDT</EM>
|
||
|
</EM>
|
||
|
</SMALL>
|
||
|
</BODY>
|
||
|
</HTML>
|