colormap-difference

Synopsis

(colormap-difference colormap1 colormap2)

Parameters

  • colormap1
  • colormap2

Description

This procedure creates a new colormap by computing the absolute difference for each color channel of each pixel. The two suppied colormaps need to have the same dimensions, otherwise an error is signalled. The absolute difference for each single RGB channel is computed by subtracting the smaller value from the larger.

Side Effects

Return Value

The resulting colormap is returned.

Example

> (define image (colormap-readjpg "horses.jpg"))
image
> (define image2 (colormap-copy image))
image2
> (colormap-hmirror! image2)
#<colormap orow:-1 ocol:-1 xres:-1 yres:-1 w:2400 h:1600>
> (define image3 (colormap-difference image image2))
image3
> (colormap-writejpg image3 "horses-mirrordiff.jpg")
ok
>

The input image displays as follows (horses.jpg, JPG, 2400x1600): horses.jpg

The difference image of the original with its mirrored copy looks like this: horses-mirrordiff.jpg