[sane-devel] Digital ICE support

Major A andras@users.sourceforge.net
Sun, 30 Nov 2003 16:05:39 +0000

> since some days I've been thinking about implementing routines to
> utilize the infrared channel supplied by my Nikon LS-2000 scanner for
> automatic defect correction. Is someone already working on this?

There a few people who've tried things, myself included, but none of
the efforts have produced anything robust enough to go into SANE.

> My ideas for a first shot on this are (with low IR values ("black")
> being high defect probability values):

You've missed the first point: the IR information must be extracted
first. Since the IR channel is a non-linear combination of the defect
map with the R, G, B channels, this might get rather tricky. IBM has a
patent on this as well.

> - Identify single defects (pixel clusters):
>   - Count all pixels above a certain probability threshold automatically
>     as defects

This works, the only problem is there doesn't seem to be a universal
threshold. Something that's adaptive (i.e. a threshold varying across
the image) would be the ideal solution.

>   - Group adjacent defect pixels into defect clusters

What for?

>   - Add pixels adjacent to a cluster that are above a second (lower)
>     defect probability threshold to the defect cluster

I would just add all adjacent pixels, no threshold necessary.

Also, you have to treat any parts of the image that are obscured by,
say, the slide mount, separately. Otherwise they will also fall in the
category of dirty pixels, and interpolating a large area for nothing
is probably the last thing you want to spend your CPU time on.

> - Repair defects by interpolation between "healthy" pixels. Obviously
> this is the trickier part of it all.

This is the easiest bit... if you do the rest, I'll add this one :)

If you have some time, please look at my code in Coolscan2 CVS:


There's some rudimentary code there that works OK if you have time to
tweak the parameters a lot... I haven't done anything to it recently
because I haven't yet come up with a good way of doing the defect
detection adaptively.

I'd love to have defect removal functionality in SANE, so please let
me know if you have any good ideas and maybe we can one day make
something that rivals ICE.


Major Andras
    e-mail: andras@users.sourceforge.net
    www:    http://andras.webhop.org/