We're back after a server migration that caused effbot.org to fall over a bit harder than expected. Expect some glitches.

The ImageCrackCode Module (PIL Plus)

(PIL Plus) The ImageCrackCode module allows you to detect and measure features in an image.

This module is no longer available.

Functions

CrackCode

CrackCode(image, position) ⇒ CrackCode instance

Identifies a feature in the given image. If the position is omitted, the constructor searches from the top left corner.

Methods and attributes

area

cc.area

(attribute). The feature area, in pixels.

bbox

cc.bbox

(attribute). The bounding box, given as a 4-tuple (left, upper, right, lower).

caliper

cc.caliper

(attribute). The caliper size, given as a 2-tuple (height, width).

centroid

cc.centroid

(attribute). The center of gravity.

edge

cc.edge

(attribute). True if the feature touches the edges of the image, zero otherwise.

links

cc.links

(attribute). The number of links in the crack code chain.

offset

cc.offset

(attribute). The offset from the upper left corner of the image, to the feature’s bounding box,

start

cc.start

(attribute). The first coordinate in the crack code chain.

top

cc.top

(attribute). The topmost coordinate in the crack code chain.

hit

cc.hit(xy) ⇒ flag

Check if the given point is inside this feature.

topath

cc.topath(xy) ⇒ path

Return crack code outline as an ImagePath object.

getmask

cc.getmask() ⇒ image

Get filled feature mask, as an image object.

getoutline

cc.getoutline() ⇒ image

Get feature outline, as an image object.