[sane-devel] uploading color transformation matrix on HP 4c/3c

Peter Kirchgessner peter@kirchgessner.net
Fri, 25 Jan 2002 22:31:09 +0100


Hello Michal,

Michal Marus(ka wrote:

> Peter Kirchgessner <peter@kirchgessner.net> writes:
> 
> 
>>Hello Michal,
>>
>>you need to set mode color to use matrix-rgb. It is not available for
>>mode greyscale.
>>
> 
> it should be available. Reference manual of HP SCL (v8.0) says:
> 
> 

>>on a color scanner, the grayscale data before being modified by the tone map
>>is taken from the output of the green channel going through the coefficient
>>matrix.
>>
> 
> So, where is the problem? 
> 


I am talking about the hp-backend of SANE. Some options are only active 
under certain conditions. When I had a look at the backend, it seemed to 
me that option --matrix-rgb is only active when --mode Color is 
selected. But that is not true.
If you want to use the --matrix-rgb, you need to rebuild SANE (or at 
least the hp-backend) from source. You need to modify hp.h:

Change line
#define ENABLE_10BIT_MATRIXES
to
#undef ENABLE_10BIT_MATRIXES

Change line
#undef ENABLE_CUSTOM_MATRIX
to
#define ENABLE_CUSTOM_MATRIX


After these changes rebuild SANE (be sure to remove all hp*o from the 
backend's directory). Now the option --matrix-type has a new choice 
"Custom". You need to use it along with --matrix-rgb:

scanimage -d hp:/dev/sg0 --mode Grayscale --matrix-type Custom --matrix-rgb
1.98,1.98,1.98,0,0,0,0,0,0 > scan.ppm

This creates a grayscale scan where the data represents the data from 
the red channel.


> ...so we need to to change just 1 row of the matrix. It would be nice to scan a
> color sample (let's say i have hundreds of documents written in red on green
> paper), select (in some GUI) the most suitable transformation RGB->greyscale
> (as a vector representing it), and then scan in greyscale!
> 
>


You can start xscanimage and switch to matrix-type Custom. Then you see 
what is used to enter the values for matrix-rgb. This was the reason why 
  custom matrix has been disabled. Using 9 sliders would be an alternative.


> 
> 
>>Please tell me if it works. I never tried that.
>>
> i've realized the importance of this matrix just after thousands of scans :(
> 
> 
> 
>>Where did you find <pkirchg@aol.com> ? This address is no longer valid.
>>
> in sane-backends/backend/hp.README
> 
> 
I see. At that place it is ok.


--Peter



-- 
Peter Kirchgessner
http://www.kirchgessner.net
mailto:peter@kirchgessner.net