Page 102 -
P. 102
76 Chapter 2 ■ Edge-Detection Techniques
notChainEnd =0;
notChainEnd |= mark_connected(i ,j+1, level+1);
notChainEnd |= mark_connected(i ,j-1, level+1);
notChainEnd |= mark_connected(i+1,j+1, level+1);
notChainEnd |= mark_connected(i+1,j , level+1);
notChainEnd |= mark_connected(i+1,j-1, level+1);
notChainEnd |= mark_connected(i-1,j-1, level+1);
notChainEnd |= mark_connected(i-1,j , level+1);
notChainEnd |= mark_connected(i-1,j+1, level+1);
if (notChainEnd && ( level>0) )
{
/* do some contour thinning */
if ( thinFactor > 0 )
if ( (level%thinFactor) != 0 )
{
/* delete this point */
edges->data[i][j] = 255;
}
}
return 1;
}
/* finds zero-crossings in laplacian (buff) orig is the smoothed image */
int is_candidate_edge (IMAGE buff, float **orig, int row, int col)
{
/* test for zero-crossings of laplacian then make sure that zero-crossing */
/* sign correspondence principle is satisfied. i.e. a positive z-c must */
/* have a positive 1st derivative where positive z-c means the 2nd deriv */
/* goes from positive to negative as we pass through the step edge */
if (buff->data[row][col] == 1 && buff->data[row+1][col] == 0)
/* positive z-c */
{
if (orig[row+1][col] - orig[row-1][col] > 0) return 1;
else return 0;
}
else if (buff->data[row][col] == 1 && buff->data[row][col+1] == 0 )
/* positive z-c */
{
if (orig[row][col+1] - orig[row][col-1] > 0) return 1;
else return 0;
}
else if ( buff->data[row][col] == 1 && buff->data[row-1][col] == 0)
/* negative z-c */