case 19: /* shape operations */
printf("\nCIPS> Enter input image name\n");
get_image_name(name);
printf("\nCIPS> Enter output image name\n");
get_image_name (name2);
get_parameters(&il, &ie, &ll, &le);
get shape_options(low_high, &value, &threshold, &number);
if(strncmp("thi", low_high, 3) == 0){
thinning(name, name2, the_image, out_image,
il, ie, ll, le, value, threshold, 0);
}
if(strncmp("dnj", low_high, 3) ==0){
dilate_not_join(name, name2, the_image,
out_image, il, ie, ll, le,
value, threshold);
}
if(strncmp("ero", low_high, 3) == 0){
erosion(name, name2, the_image, out_image,
il, ie, ll, le, value, threshold);
}
if(strncmp("dil", low_high, 3) == 0){
dilation(name, name2, the_image, out_image,
il, ie, ll, le, value, threshold);
}
if(strncmp("mer", low_high, 3) == 0){
mask_erosion(name, name2, the_image,
out_image, il, ie, ll, le,
value, threshold);
}
if(strncmp("mdi", low_high, 3) == 0){
mask_dilation(name, name2, the_image,
out_image, il, ie, ll, le,
value, threshold);
}
if(strncmp("int", low_high, 3) == 0){
interior_outline(name, name2, the_image,
out_image, il, ie, ll, le,
value, threshold);
}
if(strncmp("ext", low_high, 3) == 0){
exterior_outline(name, name2, the_image,
out_image, il, ie, ll, le,
value, threshold);
}
if(strncmp("ope", low_high, 3) ==0){
opening(name, name2, the_image, out_image, il,
ie, ll, le, value, threshold, number);
}
if(strncmp("clo", low_high, 3) == 0){
closing(name, name2, the_image, out_image, il,
ie, ll, le, value, threshold, number);
}
if(strncmp("spo", low_high, 3) == 0){
special_opening(name, name2, the image,
out_image, il, ie, ll, le,
value, threshold, number);
}
if(strncmp("spc", low_high, 3) == 0){
special_closing(name, name2, the_image,
out_image, il, ie, ll, le,
value, threshold, number);
}
if(strncmp("edm", low_high, 3) == 0){
edm(name, name2, the_image, out_image,
il, ie, ll, le, value);
}
if(strncmp("mat", low_high, 3) == 0){
edm(name, name2, the image, out_image,
il, ie, ll, le, value);
}
break;
case 30: /* exit system */
not finished = 0;
break;
.
.
.
/*************************************************
* show_menu(..
*
* This function displays the CIPS main menu.
**************************************************/
show_menu()
{
printf(""
"\n\n\t\t\tWelcome to CIPS"
"\n\t\tThe C Image Processing System"
"\n\t\tDwayne Phillips 1990-1993"
"\nThese are your choices:"
"\n1. Display image header
11. Image add & subtract"
"\n2. Show image numbers
12. Image cut & paste"
"\n3. Print image numbers
13. Image rotate & flip"
"\n4. Display (EGA & VGA)
14. Image scaling"
"\n5. Display or print using halftoning
15. Create blank image"
"\n6. Print using dithering
16. Image thresholding"
"\n7. Print or display histogram
17. Image segmentation"
"\n8. Edge Detection
18. Edge & gray segmentation"
"\n9. Edge Enhancement
19. Shape operations"
"\n10. Image filtering"
"\n"
"\n30. Exit system\n"
"\nEnter choice __\b\b");
} /* ends show_menu */
.
.
.
/****************************************************
* get_shape_options(...
*
* This function interacts with the user to obtain
* the parameters for calling the shape routines.
****************************************************/
get_shape_options(type, value, threshold, number)
char type[];
int *number, *threshold;
short *value;
{
int not_finished = 1, response;
while(not_finished){
printf("\nThe shape options are:");
printf("\n\t1. Type is %s", type);
printf("\n\t recall: EROsion DILation Mask-ERosion"
"\n\t Mask_DIlation INTerior-outline"
"\n\t EXTerior-outline THInning"
"\n\t Dilate-Not-Join OPEning"
"\n\t CLOsing SPecial-Opening"
"\n\t SPecial-Closing"
"\n\t Euclidean-Distance-Measure"
"\n\t Medial-Axis-Transform");
printf("\n\t2. value is %d", *value);
printf("\n\t3. threshold or mask type is %d", *threshold);
printf("\n\t4. number of iterations is %d", *number);
printf("\n\t (used only in opening and closing)");
printf("\n\nEnter choice (0 = no change) _\b");
get_integer(&response);
if(response == 0){
not_finished = 0;
}
if(response == 1){
printf("\nEnter type of operation");
printf("\n\t recall: EROsion DILation Mask-ERosion"
"\n\t Mask_DIlation INTerior-outline"
"\n\t EXTerior-outline THinning"
"\n\t Dilate-Not-Join OPEning"
"\n\t CLOsing SPecial-Opening"
"\n\t SPecial-Closing"
"\n\t Euclidean-Distance-Measure"
"\n\t Medial-Axis-Transform");
printf("\n\t:");
gets(type);
}
if(response == 2){
printf("\nEnter value: __\b\b\b");
get_integer(value);
}
if(response == 3){
printf("\nEnter threshold or mask type: __");
printf("\b\b\b");
get_integer(threshold);
}
if(response == 4){
printf("\nEnter number of iterations: __");
printf("\b\b\b");
get_integer(number);
}
} /* ends while not_finished */
} /* ends get_shape_options */
/* End of File */