Page 100 -
P. 100
74 Chapter 2 ■ Edge-Detection Techniques
/* approximate the band-limited laplacian of the image. The bli is then */
/* made by setting all values in the bli to 1 where the laplacian is */
/* positive and 0 otherwise. */
for (row=0; row<nrows; row++)
for (col=0; col<ncols; col++)
{
if (row<OUTLINE || row >= nrows-OUTLINE ||
col<OUTLINE || col >= ncols-OUTLINE) continue;
bli_buffer->data[row][col] =
((buff1[row][col] - buff2[row][col]) > 0.0);
}
return bli_buffer;
}
void locate_zero_crossings (float **orig, float **smoothed, IMAGE bli,
int nrows, int ncols)
{
register int row, col;
for (row=0; row<nrows; row++)
{
for (col=0; col<ncols; col++)
{
/* ignore pixels around the boundary of the image */
if (row<OUTLINE || row >= nrows-OUTLINE ||
col<OUTLINE || col >= ncols-OUTLINE)
{
orig[row][col] = 0.0;
}
/* next check if pixel is a zero-crossing of the laplacian */
else if (is_candidate_edge (bli, smoothed, row, col))
{
/* now do gradient thresholding */
float grad = compute_adaptive_gradient (bli,
smoothed, row, col);
orig[row][col] = grad;
}
else orig[row][col] = 0.0;
}
}
}
void threshold_edges (float **in, IMAGE out, int nrows, int ncols)
{
register int i, j;
lap = in;
edges = out;