Page 99 -
P. 99
Chapter 2 ■ Edge-Detection Techniques 73
{
register int row, col;
float b1, b2;
b1 = (1.0 - b)/(1.0 + b);
b2 = b*b1;
/* compute boundary conditions */
for (row=0; row<nrows; row++)
{
A[row][0] = b1 * x[row][0];
B[row][ncols-1] = b2 * x[row][ncols-1];
}
/* compute causal component */
for (col=1; col<ncols; col++)
for (row=0; row<nrows; row++)
A[row][col] = b1 * x[row][col] + b * A[row][col-1];
/* compute anti-causal component */
for (col=ncols-2; col>=0; col--)
for (row=0; row<nrows;row++)
B[row][col] = b2 * x[row][col] + b * B[row][col+1];
/* boundary case for computing output of first filter */
for (row=0; row<nrows; row++)
y[row][ncols-1] = A[row][ncols-1];
/* now compute the output of the second filter and store in y */
/* this is the sum of the causal and anti-causal components */
for (row=0; row<nrows; row++)
for (col=0; col<ncols-1; col++)
y[row][col] = A[row][col] + B[row][col+1];
}
/* compute the band-limited laplacian of the input image */
IMAGE compute_bli (float **buff1, float **buff2, int nrows, int ncols)
{
register int row, col;
IMAGE bli_buffer;
bli_buffer = newimage(nrows, ncols);
for (row=0; row<nrows; row++)
for (col=0; col<ncols; col++)
bli_buffer->data[row][col] = 0;
/* The bli is computed by taking the difference between the smoothed image */
/* and the original image. In Shen and Castan’s paper this is shown to */