/*********************************************** * * file d:\cips\main3seg.c * * Functions: This file contains * main * * Purpose: * * External Calls: * gin.c - get_image_name * numcvrt.c - get_integer * int_convert * tiff.c - read_tiff_header * * Modifications: * 5 December 1992 - created * *************************************************/ #include "cips.h" short the_image[ROWS][COLS]; short out_image[ROWS][COLS]; main(argc, argv) int argc; char *argv[]; { char name[80], name2[80], low_high[80], type[80]; float fd, fsum, sum_div, percent; int count, i, ie, il, j, le, length, ll, looking = 1, lw, width; long lc, lr, llength, lwidth, num=0, sum=0; unsigned long histogram[GRAY_LEVELS+1]; short cutoff, value, value2, value3, value4; struct tiff_header_struct image_header; my_clear_text_screen(); /*********************************************** * * Interpret the command line parameters. * ************************************************/ if(argc < 4){ printf( "\n\nNot enough parameters:" "\n" "\n usage: main2seg in-file out-file type" " [value] [value2] [value3]" "\n" "\n recall type: edge-Region High-pixel Low-pixel" "\n Erosion Dilation Swap-pixel sKeleton" "\n pixel-Grow Automatic-threshold" "\n OVERLAY-TEST" "\n"); exit(0); } strcpy(name, argv[1]); strcpy(name2, argv[2]); strcpy(type, argv[3]); if(type[0] == 'a' || type[0] == 'A' || type[0] == 'r' || type[0] == 'R'){ percent = atof(argv[4]); value = atoi(argv[5]); value2 = atoi(argv[6]); value3 = atoi(argv[7]); value4 = atoi(argv[8]); } else{ value = atoi(argv[4]); value2 = atoi(argv[5]); value3 = atoi(argv[6]); } il = 1; ie = 1; ll = ROWS+1; le = COLS+1; /****************************************** * * Read the input image header and setup * the looping counters. * * If high or low pass filtering, setup * the filter mask array. * *******************************************/ read_tiff_header(name, &image_header); length = (90 + image_header.image_length)/ROWS; width = (90 + image_header.image_width)/COLS; count = 1; lw = length*width; printf("\nlength=%d width=%d", length, width); /****************************************** * * Loop over the input image and filter it * using either the high or low pass filters * using a mask OR using the median filter. * *******************************************/ value = atoi(argv[3]); value2 = atoi(argv[4]); for(i=0; i= percent) looking = 0; else sum = sum + histogram[i++]; } /* ends while looking */ cutoff = i; printf("\nCutoff is %d sum=%ld", cutoff, sum); create_file_if_needed(name, name2, out_image); count = 1; for(i=0; i