Function File: A = applylut (BW, LUT)

Uses lookup tables to perform a neighbour operation on binary images.

A = applylut(BW,LUT) returns the result of a neighbour operation using the lookup table LUT which can be created by makelut.

It first computes a matrix with the index of each element in the lookup table. To do this, it convolves the original matrix with a matrix which assigns each of the neighbours a bit in the resulting index. Then LUT is accessed to compute the result.

See also: makelut.

Demonstration 1

The following code

 lut = makelut (@(x) sum (x (:)) >= 3, 3);
 S = applylut (eye (5), lut);
 disp (S)
 ## Everything should be 0 despite a diagonal which doesn't reach borders.

Produces the following output

0   0   0   0   0
   0   1   0   0   0
   0   0   1   0   0
   0   0   0   1   0
   0   0   0   0   0

Package: image