home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 8 / CDASC08.ISO / VRAC / CUJJUN93.ZIP / 1106096A < prev    next >
Text File  |  1993-04-08  |  6KB  |  182 lines

  1.         case 18: /* edge & gray shade segmentation */
  2.          printf("\nCIPS> Enter input image name\n");
  3.          get_image_name(name);
  4.          printf("\nCIPS> Enter output image name\n");
  5.          get_image_name(name2);
  6.          get_parameters(&il, &ie, &ll, &le);
  7.          get_edge_region_options(er_method, 
  8.              &detect_type, &min_area, &max_area,
  9.              &value, &diff, &percent, &erode);
  10.          if(er_method[0] == 'e' || 
  11.             er_method[0] == 'E')
  12.             edge_region(name, name2, the_image, 
  13.                         out_image, il, ie, ll, le,
  14.                         detect_type, min_area, 
  15.                         max_area, diff, percent,
  16.                         value, erode);
  17.          if(er_method[0] == 'g' || 
  18.             er_method[0] == 'G')
  19.             gray_shade_region(name, name2, the_image,
  20.                         out_image, il, ie, ll, le,
  21.                         diff, min_area, max_area);
  22.          if(er_method[0] == 'c' || 
  23.             er_method[0] == 'C')
  24.             edge_gray_shade_region(name, name2,
  25.                         the_image, out_image, 
  26.                         il, ie, ll, le, detect_type,
  27.                         min_area, max_area, diff,
  28.                         percent, value, erode);
  29.         break;
  30.  
  31.                        .
  32.                        .
  33.                        .
  34.  
  35.    /*************************************************
  36.    *
  37.    *   show_menu(..
  38.    *
  39.    *   This function displays the CIPS main menu.
  40.    *
  41.    **************************************************/
  42. show_menu()
  43. {
  44.  
  45.    printf("\n\nWelcome to CIPS");
  46.    printf("\nThe C Image Processing System");
  47.    printf("\nThese are you choices:");
  48.    printf("\n\t1.  Display image header");
  49.    printf("\n\t2.  Show image numbers");
  50.    printf("\n\t3.  Print image numbers");
  51.    printf("\n\t4.  Display image (VGA & EGA only)");
  52.    printf("\n\t5.  Display or print image using "
  53.                    "halftoning");
  54.    printf("\n\t6.  Print graphics image using "
  55.                    "dithering");
  56.    printf("\n\t7.  Print or display histogram "
  57.                    "numbers");
  58.    printf("\n\t8.  Perform edge detection");
  59.    printf("\n\t9.  Perform edge enhancement");
  60.    printf("\n\t10. Perform image filtering");
  61.    printf("\n\t11. Perform image addition and "
  62.                    "subtraction");
  63.    printf("\n\t12. Perform image cutting and pasting");
  64.    printf("\n\t13. Perform image rotation and "
  65.                    "flipping");
  66.    printf("\n\t14. Perform image scaling");
  67.    printf("\n\t15. Create a blank image");
  68.    printf("\n\t16. Perform image thresholding");
  69.    printf("\n\t17. Perform image segmentation");
  70.    printf("\n\t18. Perform edge & gray shade"
  71.                    " image segmentation");
  72.    printf("\n\t20. Exit system");
  73.    printf("\n\nEnter choice _\b");
  74.  
  75. }  /* ends show_menu */
  76.  
  77.                        .
  78.                        .
  79.                        .
  80.  
  81.    /********************************************
  82.    *
  83.    *  get_edge_region_options(...
  84.    *
  85.    *  This function interacts with the user to   
  86.    *  get the options needed to call the 
  87.    *  edge and region based segmentation 
  88.    *  routines.
  89.    *
  90.    ********************************************/
  91.  
  92. get_edge_region_options(method, edge_type, 
  93.          min_area, max_area, set_value, 
  94.          diff, percent, erode)
  95.    char  method[];
  96.    float *percent;
  97.    int   *edge_type;
  98.    short *diff, *erode, 
  99.          *min_area, *max_area, 
  100.          *set_value;
  101. {
  102.    int not_finished = 1, response;
  103.  
  104.    while(not_finished){
  105.       printf("\n\nEdge Region Segmentation Options:");
  106.       printf("\n\t1.  Method is %s", method);
  107.       printf("\n\t    Recall: Edge, Gray shade, "
  108.                       "Combination");
  109.       printf("\n\t2.  Edge type is %d", *edge_type);
  110.       printf("\n\t    Recall: ");
  111.       printf("\n\t     1=Prewitt     2=Kirsch");
  112.       printf("\n\t     3=Sobel       4=quick");
  113.       printf("\n\t     5=homogeneity 6=difference");
  114.       printf("\n\t     7=contrast    8=gaussian");
  115.       printf("\n\t     10=range      11=variance");
  116.       printf("\n\t3.  Min area is %d", *min_area);
  117.       printf("\n\t4.  Max area is %d", *max_area);
  118.       printf("\n\t5.  Set value is %d", *set_value);
  119.       printf("\n\t6.  Difference value is %d", *diff);
  120.       printf("\n\t7.  Threshold percentage is %f",
  121.                       *percent);
  122.       printf("\n\t8.  Erode is %d", *erode);
  123.       printf("\n\nEnter choice (0 = no change) _\b");
  124.  
  125.       get_integer(&response);
  126.  
  127.       if(response == 0){
  128.         not_finished = 0;
  129.       }
  130.  
  131.       if(response == 1){
  132.          printf("\n\t    Recall: Edge, Gray shade, "
  133.                          "Combination");
  134.          printf("\n\t> ");
  135.          read_string(method);
  136.       }
  137.  
  138.       if(response == 2){
  139.          printf("\n\t    Recall:"); 
  140.          printf("\n\t     1=Prewitt     2=Kirsch");
  141.          printf("\n\t     3=Sobel       4=quick");
  142.          printf("\n\t     5=homogeneity 6=difference");
  143.          printf("\n\t     7=contrast    8=gaussian");
  144.          printf("\n\t     10=range      11=variance");
  145.          printf("\n\t__\b");
  146.          get_integer(edge_type);
  147.       }
  148.  
  149.       if(response == 3){
  150.          printf("\nEnter min area:__\b\b");
  151.          get_integer(min_area);
  152.       }
  153.  
  154.       if(response == 4){
  155.          printf("\nEnter max area:__\b\b");
  156.          get_integer(max_area);
  157.       }
  158.  
  159.       if(response == 5){
  160.          printf("\nEnter set value:__\b\b");
  161.          get_integer(set_value);
  162.       }
  163.  
  164.       if(response == 6){
  165.          printf("\nEnter difference:__\b\b");
  166.          get_integer(diff);
  167.       }
  168.  
  169.       if(response == 7){
  170.          printf("\nEnter threshold percentage:__\b\b");
  171.          get_float(percent);
  172.       }
  173.  
  174.       if(response == 8){
  175.          printf("\nEnter erode:__\b\b");
  176.          get_integer(erode);
  177.       }
  178.  
  179.    }  /* ends while not_finished */
  180. }  /* ends get_edge_region_options */
  181.  
  182.