(F) Greymap Extensions

Abstract

Greymap Extension Procedures

greymap->bitmap

(greymap->bitmap <greymap>) converts the <greymap> into a bitmap and returns that bitmap. Each pixel whose greylevel is 128 and above is considered to be black in the resulting bitmap, 127 and below converts to white.

greymap->bitmap/t

(greymap->bitmap/t <greymap> <threshold>) works as greymap->bitmap but with a variable threshold that must be in the range between 0 and 255 inclusive. All pixel equal and above the given threshold are considered to be black.

greymap-copy

(greymap-copy <greymap>) returns a copy of the given greymap.

greymap-create

(greymap-create <row> <columns>) creates a new greymap containing white pixels and returns that greymap.

greymap-crop

(greymap-crop <greymap> <row> <col> <height> <width>) returns a copy of a region of a greymap. The region is defined by its position ( <row> and <col> ) and by the desired <height> and <width). It is an error if a pixel of the requested region lies outside the greymap where it should be copied from.

greymap-equal?

(greymap-equal? <greymap1> <greymap2>) returns #t if the contents of the two greymaps are identical, #f otherwise.

greymap-getpixel

(greymap-getpixel <greymap> <row> <column>) returns the content of the referenced pixel as an integer in the range of 0 … 255.

greymap-height

(greymap-height <greymap>) returns the actual height of a greymap.

greymap-invert!

(greymap-invert! <greymap>) inverts the given greymap such destructively modifying the greymap. If you want to preserve the original content of the bitmap use greymap-copy to preserve it. The greymap is returned after the inversion of all pixels.

greymap-ocol

(greymap-ocol <greymap>) returns the integer currently in the “original column” field of the internal greymap structure. A return value of -1 means “undefined”.

greymap-ocol-set!

(greymap-ocol-set! <greymap> <value>) sets the “original column” to the given integer value in the internal greymap structure.

greymap-orow

(greymap-orow <greymap>) returns the integer currently in the “original row” field of the internal greymap structure. A return value of -1 means “undefined”.

greymap-orow-set!

(greymap-orow-set! <greymap> <value>) sets the “original row” to the given integer value in the internal greymap structure.

greymap-readpng

(greymap-readpng <filename>) reads the PNG file given in <filename> and returns a greymap. greymap-readpng reads any PNG file format to greyscale doing an implicit to greyscale conversion if needed. greymap-readpng reads interlaced PNG files as well as non interlaces PNG files. Note that during read 16 bytes per pixel are allocated temporarily using the auxiliary memory allocation scheme of Inlab-Scheme.

greymap-scale

(greymap-scale <bitmap> <row-factor> <col-factor>) scales the given greymap by a row and col factor returning the new bitmap. Scaling is done simply by skipping or inserting suitable rows and columns. If you want do to a scaling with better looking results you should apply greymap-smooth or greymapsmooth/v before.

greymap-setpixel!

(greymap-setpixel! <greymap> <row> <column> <color>) sets a pixel at the given position to the specified color. The color has to be an integer in the range 0 … 2555 representing a greylevel (0 = white, 255 = black).

greymap-smooth

(greymap-smooth <greymap>) performs a smoothing operation as greymap-smooth/v with a square-height of 3.

greymap-smooth-region

(greymap-smooth-region <greymap> <row> <col> <height> <width> <value>) performs a smoothing operation on a given region of a greymap and returns that region. The region’s origin is <row> and <col>, its height and width are given in <height> and <width>, respectively. <value> is the odd height of a square that average greymap-value is computed for each pixel.

greymap-smooth/v

(greymap-smooth/v <greymap> <value>) performs a smoothing operation on the given greymap computing the average greymap-value of an square of the given height and width in value. Since every pixel has to be the center of the square <value> has to be an positive, odd value. A new, smoothed greymap is returned.

greymap-width

(greymap-width <greymap>) returns the actual width of a greymap.

greymap-writeipng

(greymap-writeipng <greymap> <filename>) stores the <greymap> in PNG format (GREYSCALE) in <filename> in interlaced format.

greymap-writepng

(greymap-writepng <greymap> <filename>) the supplied greymap is written out in PNG-format to the given file name.

greymap-xres

(greymap-xres <greymap>) returns the floating point value in the “x resolution” field of the internal greymap structure. A return value of -1.0 means “undefined”. The resolution unit is DPI (dots per inch).

greymap-xres-set!

(greymap-xres-set! <greymap> <float>) sets the “x resolution” field in the internal greymap structure to the given value, which must be an inexact floating point value.

greymap-yres

(greymap-yres <greymap>) returns the floating point value in the “y resolution” field of the internal greymap structure. A return value of -1.0 means “undefined”. The resolution unit is DPI (dots per inch).

greymap-yres-set!

(greymap-yres-set! <greymap> <float>) sets the “y resolution” field in the internal greymap structure to the given value, which must be an inexact floating point value.

greymap?

(greymap? <obj>) return #t if the supplied object <obj> is a greymap, otherwise #f .