Function Reference
— 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(inline('sum(x(:))>=3','x'), 3);
 applylut(eye(5),lut)
 % everything should be 0 despite a diagonal which
 % doesn't reach borders.

Produces the following output

ans =

   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