Operations in this section have to do with selecting arbitrarily shaped regions in images, a process also called image segmentation. All operations generate mattes, which are single-channel images describing region "membership". A matte pixel is 1 if the corresponding image pixel belongs to a region, and 0 if it does not. Intermediate values indicate "partial" membership and serve to soften, or feather, matte edges.

ice.Image SeedFill(seedPoint, startRadius, endRadius)

Seed-filling, or region-growing, operation. Returns a matte image. Starting at a specified location, a region of contiguous pixels is computed such that the pixels satisfy a color proximity criterion. Pixels closer than startRadius generate a matte value of unity, and pixels further away than endRadius generate a matte value of zero. Intermediate values roll-off linearly. Useful values for the distance are in the 10-100 range.

Parameters

seedPoint

Location of "nucleus" (list). 

startRadius

Color distance below which matte value is unity (int). 

endRadius

Color distance above which matte value is zero (int).

Example

point = (608,260)
result = image.SeedFill(point, 10, 40))

The color proximity metric used is Euclidean in the n-space that the pixels inhabit, where n is the number of channels. No guarantees of perceptual proximity are made: images must be transformed into a suitable space before attempting the fill.

 

ice.Image ColorKey(seedColor, startRadius, endRadius)

Select all pixels in an image satisfying a certain proximity criterion. Pixels closer than startRadius generate a matte value of unity, and pixels further away than endRadius generate a matte value of zero. Intermediate values roll-off linearly. Useful values for the distance are in the 10-100 range.

Parameters

seedColor

Color of pixel to be used as the "cluster" center (list). 

startRadius

Color distance below which matte value is unity (int). 

endRadius

Color distance above which matte value is zero (int).

Example

# Note that this operation gets non-contiguous pixels, too 
color = [0.384, 0.294, 0.0745]
result = cdev.ColorKey(color, 0, 15) 

The color proximity metric used is Euclidean in the n-space that the pixels inhabit, where n is the number of channels. No guarantees of perceptual proximity are made: images must be transformed into a suitable space before attempting the fill.


ColorKeyFill(x, y, seedColor, startRadius, endRadius)

Seed-filling, or region-growing, operation. Returns a matte image. Starting at a specified location, a region of contiguous pixels is computed such that the pixels satisfy a color proximity criterion. Pixels closer than startRadius generate a matte value of unity, and pixels further away than endRadius generate a matte value of zero. Intermediate values roll-off linearly. Useful values for the distance are in the 10-100 range.

This version differs from ColorFill in that a pixel different from the one at the "nucleus" can be specified.

Parameters

x

x coord start seed fill operatiion (int).y: y coord to start seed fill operation (int). 

seedColor

Color of pixel to be used as the "cluster" center (list). 

startRadius

Color distance below which matte value is unity (int). 

endRadius

Color distance above which matte value is zero (int).