Page 106 -
P. 106
80 Chapter 2 ■ Edge-Detection Techniques
im = get_image(name);
display_image (im);
/* Look for parameter file */
params = fopen (“shen.par“, “r“);
if (params)
{
fscanf (params, “%lf“, &ratio);
fscanf (params, “%lf“, &b);
if (b<0) b = 0;
else if (b>1.0) b = 1.0;
fscanf (params, “%d“, &window_size);
fscanf (params, “%d“, &thinFactor);
fscanf (params, “%d“, &do_hysteresis);
printf (“Parameters:\n“);
printf (“ %% of pixels to be above HIGH threshold: %7.3f\n“, ratio);
printf (“ Size of window for adaptive gradient: %3d\n“,
window_size);
printf (“ Thinning factor : %d\n“, thinFactor);
printf (“Smoothing factor : %7.4f\n“, b);
if (do_hysteresis) printf (“Hysteresis thresholding turned on.\n“);
else printf (“Hysteresis thresholding turned off.\n“);
fclose (params);
}
else printf (“Parameter file 'shen.par' does not exist.\n“);
embed (im, OUTLINE);
res = newimage (im->info->nr, im->info->nc);
shen (im, res);
debed (res, OUTLINE);
display_image (res);
save_image (res, “shen.jpg“);
return 0;
}
2.11 Website Files
canny.c Canny edge detector
colorEdge1.c Color edge detector