Common Lisp Package: CH-IMAGE

README:

FUNCTION

Public

4-NEIGHBORS (MATRIX I J)

Returns four values, each value is either a list containing the coordinates of a 4-neighbor of (i,j) in matrix or nil if the neighbor would be outside of the matrix. The order of the values is top, left, bottom, right.

8-NEIGHBORS (MATRIX I J)

Returns eight values, each value is either a list containing the coordinates of an 8-neighbor of (i,j) in matrix or nil if the neighbor would be outside of the matrix. The order of the values is top, left, bottom, right.

COMPONENT-BOUNDARY (MATRIX LABEL &KEY (NEIGHBOR-FUNCTION #'4-NEIGHBORS) (VALUE 1))

Returns the union of the interal and external boundaries of the component whose value is label. neighbor-function is 4-neighbors by default, using 8-neighbors will use 8 neighbors instead of 4 for computing the boundary.

COMPONENT-EXTERNAL-BOUNDARY (MATRIX LABEL &KEY (NEIGHBOR-FUNCTION #'4-NEIGHBORS) (VALUE 1))

Returns the external boundary of component label in the labelled connected components matrix. neighbor-function is 4-neighbors by default, using 8-neighbors will use 8 neighbors instead of 4 for computing the boundary.

COMPONENT-INTERNAL-BOUNDARY (MATRIX LABEL &KEY (NEIGHBOR-FUNCTION #'4-NEIGHBORS) (VALUE 1))

Returns the internal boundary of component label in the labelled connected components matrix. neighbor-function is 4-neighbors by default, using 8-neighbors will use 8 neighbors instead of 4 for computing the boundary.

DISTANCE-TRANSFORM (IN &KEY (BORDER 0))

Computes the distance transform of an image. The distance transform is a matrix where the value of each pixel is the distance between that pixel and the closest zero-valued pixel. This function uses the algorithm described in Soille, 2003, p. 48.

LABEL-COMPONENTS (MATRIX &KEY (NEIGHBOR-FUNCTION #'4-NEIGHBORS))

Returns a new matrix containing labels of the connected components of matrix. The default neighbor-fucntion is 4-neighbors.

READ-TIFF-STREAM (STREAM)

reads a TIFF image from a stream and returns either a 32-bit ARGB image or an 8-bit grayscale image

RESIZE-IMAGE (IMG Y X &KEY (INTERPOLATION BILINEAR) (CONSTRAIN-PROPORTIONS NIL))

Resize an image to new size y rows by x columns. If constrain proportions is t, then the xscale and yscale will be set to whichever scale has the largest absolute value and the image will be padded as needed.

Undocumented

BIT-MATRIX->UB8-IMAGE (M)

DISCRETE-CONVOLVE-IMAGE (IMG KERNEL)

FLIP-IMAGE (IMG)

GAUSSIAN-BLUR-IMAGE (IMG &KEY (K 2) (SIGMA 1) (TRIM K))

IMAGE (WIDTH HEIGHT)

IMAGE-DIM (IMG)

JPEG-GRAY-TO-GRAY-IMAGE (BUFFER WIDTH HEIGHT)

JPEG-RGB-TO-ARGB-IMAGE (BUFFER WIDTH HEIGHT)

JPEG-RGB-TO-GRAY-IMAGE (BUFFER WIDTH HEIGHT)

MAKE-MATRIX-IMAGE (M &KEY (MATRIX-TYPE 'UB8-MATRIX-IMAGE))

MAP-CHANNELS (FUNCTION IMAGE)

MAP-PIXELS (F IMG)

READ-IMAGE-FILE (PATH)

READ-JPEG-FILE (FILENAME)

READ-JPEG-STREAM (STREAM)

READ-PNG-FILE (FILE)

READ-PNG-STREAM (STREAM)

READ-TIFF-FILE (PATHNAME)

RESIZE-IMAGES-IN-DIRECTORY (SRC-DIR DEST-DIR &KEY HEIGHT WIDTH (SOURCE-TYPES '(tiff)) (DESTINATION-TYPE (IF (LISTP SOURCE-TYPES) (CAR SOURCE-TYPES) SOURCE-TYPES)) (INTERPOLATION BILINEAR) (CONSTRAIN-PROPORTIONS NIL))

SHARPEN-IMAGE (IMG)

WRITE-IMAGE-FILE (PATH IMAGE)

WRITE-TIFF-FILE (PATHNAME IMAGE)

WRITE-TIFF-STREAM (STREAM IMAGE)

Private

BACKWARD-4-NEIGHBORS (MATRIX I J)

Returns two values, each value is either a list containing the coordinates of a backward 4-neighbor of (i,j), that is the left or top neighbor, in matrix or nil if the neighbor would be outside of the matrix. The order of the values is top, left.

BACKWARD-8-NEIGHBORS (MATRIX I J)

Returns four values, each value is either a list containing the coordinates of a backward 8-neighbor of (i,j), that is the top-left, top, top-right, or left neighbor, in matrix or nil if the neighbor would be outside of the matrix. The order of the values is top-left, top, top-right, left.

DISTANCE-TRANSFORM-2 (IN &KEY (BORDER 0))

Computes the distance transform of an image. The distance transform is a matrix where the value of each pixel is the distance between that pixel and the closest zero-valued pixel. This function uses the algorithm described in Soille, 2003, p. 48.

DISTANCE-TRANSFORM-3 (IN &KEY (BORDER 0) (MAXVAL 255))

Computes the distance transform of an image. The distance transform is a matrix where the value of each pixel is the distance between that pixel and the closest zero-valued pixel. This function uses the algorithm described in Soille, 2003, p. 48.

DISTANCE-TRANSFORM-3-4 (IN)

Computes the distance transform of an image. The distance transform is a matrix where the value of each pixel is the distance between that pixel and the closest zero-valued pixel. This function uses the algorithm described in Soille, 2003, p. 48.

DISTANCE-TRANSFORM-4 (IN &KEY (SLOPE 1) (MAXVAL 255))

Computes the distance transform of an image. The distance transform is a matrix where the value of each pixel is the distance between that pixel and the closest zero-valued pixel. This function uses the algorithm described in Soille, 2003, p. 48.

FORWARD-4-NEIGHBORS (MATRIX I J)

Returns two values, each value is either a list containing the coordinates of a forward 4-neighbor of (i,j), that is the bottom or right neighbor, in matrix or nil if the neighbor would be outside of the matrix. The order of the values is bottom, right.

FORWARD-8-NEIGHBORS (MATRIX I J)

Returns two values, each value is either a list containing the coordinates of a forward 4-neighbor of (i,j), that is the bottom-left, bottom, bottom-right, or right neighbor, in matrix or nil if the neighbor would be outside of the matrix. The order of the values is bottom-left, bottom, bottom-right, right.

MAKE-GAMMA-CURVE-LOOKUP-TABLE (GAMMA &KEY (BITS 16))

Returns an array of length 2^bits of type unsigned-byte of length bits that contains where the kth element contains the value (k/2^bits-1)^gamma * 2^bits-1. The resulting curve can be used by the apply-gamma-curve to apply a gamma curve to an image using a lookup table of gamma values, rather than computing the appropriate value for each pixel.

Undocumented

GET-DEFAULT-MASKED-PIXEL (IMG)

GET-IMAGE-FILES-IN-DIRECTORY (DIRECTORY TYPE)

GRAY-IMAGE-MATRIX-TO-JPEG-ARRAY (M WIDTH HEIGHT)

IMAGE-CAUCHY-L2-DISTANCE (B0 B1)

IMAGE-FILE-READ-FUNCTION (PATH)

IMAGE-FILE-WRITE-FUNCTION (PATH)

IMAGE-NCC-DISTANCE (A B)

MAKE-HASH-TABLE-FROM-ALIST (ALIST &KEY (TEST #'EQL))

MAKE-NORM-UB8-IMAGE (MATRIX)

NORMALIZED-CROSS-CORRELATION (IMAGE FEATURE &KEY (U 0) (V 0))

RGB-TO-GRAY-PIXEL (R G B)

SHARPEN-IMAGE-SEPARABLE (IMG &KEY (TRIM 2))

SPLIT-AROUND-ZERO (K &KEY INTEGER)

WRITE-MATRIX-IMAGE-FILE (PATH MATRIX)

MACRO

Private

Undocumented

MULTIPLE-VALUE-LIST-REMOVE-NULLS (VALUES)

POSTINCF (X &OPTIONAL (STEP 1))

GENERIC-FUNCTION

Public

APPLY-GAMMA (IMG GAMMA)

Returns a copy of img to which a gamma curve of exponent gamma has been applied.

Undocumented

AFFINE-TRANSFORM-IMAGE (IMG XFRM &KEY U V X Y INTERPOLATION BACKGROUND (INTERPOLATION NIL INTERPOLATION-SUPPLIED-P) (BACKGROUND NIL BACKGROUND-SUPPLIED-P))

AND-PIXEL (IMG ROW COL VAL)

ARGB-IMAGE-TO-BLUE-IMAGE (SRC)

ARGB-IMAGE-TO-GRAY-IMAGE (SRC)

CONTEXT-FACE (TEXT-CONTEXT)

COPY-IMAGE (IMG)

CROP-IMAGE (IMG &KEY Y1 X1 Y2 X2)

DRAW-CHAR (IMG CONTEXT CHAR Y X &KEY &ALLOW-OTHER-KEYS)

DRAW-CIRCLE (IMG CENTER-Y CENTER-X RADIUS VALUE)

DRAW-LINE (IMG Y0 X0 Y1 X1 VALUE)

DRAW-POLYGON (IMG POINTS VALUE)

DRAW-RECTANGLE (IMG Y0 X0 Y1 X1 VALUE)

DRAW-STRING (IMG CONTEXT STR Y X &KEY &ALLOW-OTHER-KEYS)

DRAW-TRIANGLE (IMG Y0 X0 Y1 X1 Y2 X2 VALUE)

FILL-CIRCLE (IMG CENTER-Y CENTER-X RADIUS VALUE)

FILL-IMAGE (IMG VALUE)

FILL-RECTANGLE (IMG Y0 X0 Y1 X1 VALUE)

GET-ARGB-VALUES (IMG ROW COL)

GET-CHANNELS (IMG)

GET-GLYPH (FONT CHAR)

GET-GRAY-VALUE (IMG ROW COL)

GET-PIXEL (IMG ROW COL)

GET-RGB-VALUES (IMG ROW COL)

HORIZ-LINE (IMG Y X0 X1 VALUE)

IMAGE-L1-DISTANCE (B0 B1)

IMAGE-L2-DISTANCE (B0 B1)

MASK-IMAGE (IMG SEG &KEY MASK-VAL MASKED-PIXEL (MASKED-PIXEL (GET-DEFAULT-MASKED-PIXEL IMG)) (MASK-VAL 0))

OR-PIXEL (IMG ROW COL VAL)

SET-ARGB-VALUES (IMG ROW COL A R G B)

SET-CHANNELS (IMG CHANNELS)

SET-FONT (CONTEXT FONT SIZE &KEY)

SET-GRAY-VALUE (IMG ROW COL VALUE)

SET-IMAGE-DATA (IMG M)

SET-PIXEL (IMG ROW COL VAL)

SET-RGB-VALUES (IMG ROW COL R G B)

VERT-LINE (IMG Y0 Y1 X VALUE)

WRITE-JPEG-FILE (FILENAME IMG)

WRITE-JPEG-STREAM (STREAM IMG)

WRITE-PNG-FILE (FILE IMG)

WRITE-PNG-STREAM (FILE IMG)

XOR-PIXEL (IMG ROW COL VAL)

Private

APPLY-GAMMA-CURVE-LOOKUP-TABLE (IMG GAMMA-CURVE)

applys a gamma curve (usually created with make-gamma-curve-lookup-table to perform a gamma curve operation on an image by looking up the values in a lookup table, rather than computing them for eacho pixel

MAKE-TIFF-IMAGE (IMAGE)

Makes a tiff:tiff-image from a ch-image:image

Undocumented

ARGB-8888-IMAGE-TO-ARGB-FFFF-IMAGE (SRC)

ARGB-8888-IMAGE-TO-ARGB-HHHH-IMAGE (SRC)

ARGB-HHHH-IMAGE-TO-ARGB-8888-IMAGE (SRC)

COLOR-MAP-IMAGE (IMG &KEY COLORS CLASS (COLORS *DEFAULT-COLOR-MAP*) (CLASS 'ARGB-8888-IMAGE))

COPY-PIXELS (SRC DEST SRC-YSTART SRC-YEND SRC-XSTART SRC-XEND DEST-YSTART DEST-YEND DEST-XSTART DEST-XEND)

FOREGROUND-PIXEL-LIST (IMG &KEY BACKGROUND-PIXEL (BACKGROUND-PIXEL 0))

GET-CHANNEL-VALUE (IMG ROW COL)

GET-GRAY-IMAGE-LEVELS (IMG)

GET-LEVEL-ORDERING (L)

GRAY-IMAGE-TO-ARGB-8888-IMAGE (SRC &KEY (ALPHA 255))

GRAY-MATRIX-WRITE-JPEG (FILENAME M WIDTH HEIGHT)

GRAY-MATRIX-WRITE-JPEG-STREAM (IMG-STREAM M WIDTH HEIGHT)

MAKE-IMAGE-PNG (IMAGE)

PAD-IMAGE (IMG)

POSTERIZE (IMAGE LEVELS)

SET-CHANNEL-VALUE (IMG ROW COL V)

SLOT-ACCESSOR

Public

Undocumented

CLIP-REGION (OBJECT)

SETFCLIP-REGION (NEW-VALUE OBJECT)

IMAGE-A (OBJECT)

SETFIMAGE-A (NEW-VALUE OBJECT)

IMAGE-B (OBJECT)

SETFIMAGE-B (NEW-VALUE OBJECT)

IMAGE-DATA (OBJECT)

SETFIMAGE-DATA (NEW-VALUE OBJECT)

IMAGE-G (OBJECT)

SETFIMAGE-G (NEW-VALUE OBJECT)

IMAGE-HEIGHT (OBJECT)

SETFIMAGE-HEIGHT (NEW-VALUE OBJECT)

IMAGE-R (OBJECT)

SETFIMAGE-R (NEW-VALUE OBJECT)

IMAGE-WIDTH (OBJECT)

SETFIMAGE-WIDTH (NEW-VALUE OBJECT)

X1 (OBJECT)

SETFX1 (NEW-VALUE OBJECT)

X2 (OBJECT)

SETFX2 (NEW-VALUE OBJECT)

Y1 (OBJECT)

SETFY1 (NEW-VALUE OBJECT)

Y2 (OBJECT)

SETFY2 (NEW-VALUE OBJECT)

Private

Undocumented

CHANNELS (OBJECT)

SETFCHANNELS (NEW-VALUE OBJECT)

IMAGE-CHANNELS (OBJECT)

SETFIMAGE-CHANNELS (NEW-VALUE OBJECT)

INITIAL-ELEMENT (OBJECT)

SETFINITIAL-ELEMENT (NEW-VALUE OBJECT)

VARIABLE

Private

Undocumented

*DEFAULT-COLOR-MAP*

*GAMMA-045*

*GRAY-Q-TABS*

*IMAGE-READ-FUNCTIONS*

*IMAGE-WRITE-FUNCTIONS*

*MASKED-ARGB-PIXEL*

*MASKED-GRAY-PIXEL*

*MASKED-RGB-PIXEL*

*PRESET-DEFAULT-COLOR-LIST*

*RGB-SAMPLING*

*SHARPEN-KERNEL*

*SHARPEN-KERNEL-1D*

CLASS

Public

ARGB-IMAGE

ARGB (Alpha/Red/Green/Blue) image class

BIT-MATRIX-IMAGE

1-bit image class that is also a matrix

COMPLEX-MATRIX-IMAGE

complex image channel class that is also a matrix

DOUBLE-FLOAT-MATRIX-IMAGE

double-float image class that is also a matrix

GRAY-IMAGE

Grayscale 8-bit image class

IMAGE (WIDTH HEIGHT)

abstract image class

MATRIX-GRAY-IMAGE

Grayscale 8-bit image class that is also a matrix

RGB-IMAGE

RGB (Red/Green/Blue) image class

SB16-MATRIX-IMAGE

16-signed-bit image class that is also a matrix

SB32-MATRIX-IMAGE

32-signed-bit image class that is also a matrix

SB8-MATRIX-IMAGE

8-signed-bit image class that is also a matrix

SINGLE-FLOAT-MATRIX-IMAGE

single-float image class that is also a matrix

UB16-MATRIX-IMAGE

16-unsigned-bit image class that is also a matrix

UB32-MATRIX-IMAGE

32-unsigned-bit image class that is also a matrix

UB8-MATRIX-IMAGE

Grayscale 8-bit image class that is also a matrix

Undocumented

ARGB-8888-IMAGE

CLIP-RECT

CLIP-REGION (OBJECT)

FONT

GLYPH

RGB-888-IMAGE

RGB-HHH-IMAGE

TEXT-CONTEXT

Private

BIT-MATRIX-IMAGE-CHANNEL

1-bit image channel class that is also a matrix

COMPLEX-MATRIX-IMAGE-CHANNEL

complex image channel class that is also a matrix

DOUBLE-FLOAT-MATRIX-IMAGE-CHANNEL

double-float image channel class that is also a matrix

IMAGE-CHANNEL

base class for a single channel image

MATRIX-IMAGE-CHANNEL

image channel class that is also a matrix

SB16-MATRIX-IMAGE-CHANNEL

16-signed-bit image channel class that is also a matrix

SB32-MATRIX-IMAGE-CHANNEL

32-signed-bit image channel class that is also a matrix

SB8-MATRIX-IMAGE-CHANNEL

8-signed-bit image channel class that is also a matrix

SINGLE-FLOAT-MATRIX-IMAGE-CHANNEL

single-float image channel class that is also a matrix

UB16-MATRIX-IMAGE-CHANNEL

16-unsigned-bit image channel class that is also a matrix

UB32-MATRIX-IMAGE-CHANNEL

32-unsigned-bit image channel class that is also a matrix

UB8-MATRIX-IMAGE-CHANNEL

8-bit image channel class that is also a matrix

Undocumented

ARGB-FFFF-IMAGE

ARGB-HHHH-IMAGE

MULTICHANNEL-IMAGE

PLANAR-PNG

RGB-FFF-IMAGE

CONSTANT

Private

Undocumented

+NCOMP-ARGB+

+NCOMP-GRAY+

+NCOMP-RGB+