[sane-devel] Custom Gamma Curves

Henning Meier-Geinitz henning@meier-geinitz.de
Tue, 5 Nov 2002 23:08:28 +0100


Hi,

On Tue, Nov 05, 2002 at 09:16:29PM +0000, Martin Collins wrote:
> I find myself needing to use custom gamma curves with my Mustek
> Paragon 1200 A3 Pro and Xsane. Am I right in thinking that if I select
> the "Use custom gamma table" button Xsane sends its gamma settings to
> the scanner?

Yes.

> Or does it just use whatever is already in the scanner?

No.

The intended behaviour is:
The backend always uploads a gamma table to the scanner. If the option
is not selected, a linear gamma table is uploaded. Otherwise, the
gamma table set up by xsane (or any other frontend) is uploaded.
If the option is not set, XSane applies the gamma table on its own (in
software). Theoretically, the uploaded gamma table should yield better
results because it's applied to the raw (12 bits?) data. However, I
didn't do any tests, if the harware gamma is really better.

Anyway, while looking through the code, I found out that there is a
bug: If you enable "Use custom gamma table", set up a gamma value,
then disable the option again, the gamma table will be applied twice.
I'll fix that in the backend code.

> If the former; are there any plans for a curves tool in Xsane?

xscanimage and quiteinsane have curves tools.

> I had a look at gamma4scanimage but it only allows you to set 3 points
> which is essentially the same as the histogram in xsane (except you
> can't set separate RGB components). Also, it returned 255 for minin
> whereas for the A3 Pro it should return 4095.

The Mustek backend currently uses only 256 bytes of gamma. The gamma
table is scaled up before the upload. I think I did that for
compatibility reasons with frontends that didn't support any other
size. Feel free to change the code in mustek.c.

>  I would like to be able to save more than one setting as different
> source materials require different gamma curves.

I haven't tested that but you can choose the filename when saving the
options.

Bye,
  Henning