(palette-extract colormap graymap)
This procedure extracts the color palette from the colormap by associating an RGB value to each occurring gray value. Usually, the graymap is derived from the colormap in some way (see the example below).
The extracted palette is returned and is ready for interpolation or any other processing.
> (define c (colormap-readjpg "input.jpg"))
c
> (define g (colormap->graymap c))
g
> (graymap-equalize! g)
#<graymap(16) orow:-1 ocol:-1 xres:-1 yres:-1 w:880 h:587>
> (graymap-normalize! g)
#<graymap(16) orow:-1 ocol:-1 xres:-1 yres:-1 w:880 h:587>
> (define p (palette-extract c g))
p
> p
#<colormap orow:-1 ocol:-1 xres:-1 yres:-1 w:65536 h:1>
> (palette-interpolate! p)
#<colormap orow:-1 ocol:-1 xres:-1 yres:-1 w:65536 h:1>
>