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

  1.      /*******************************************
  2.      *
  3.      *   gray_shade_region(...
  4.      *
  5.      *   This function segments an image by
  6.      *   growing regions based only on gray
  7.      *   shade.
  8.      *
  9.      *******************************************/
  10.  
  11. gray_shade_region(in_name, out_name, the_image,
  12.                   out_image, il, ie, ll, le,
  13.                   diff, min_area, max_area)
  14.    char   in_name[], out_name[];
  15.    int    il, ie, ll, le;
  16.    short  the_image[ROWS][COLS],
  17.           out_image[ROWS][COLS],
  18.           diff, min_area, max_area;
  19. {
  20.    int    a, b, big_count, count, i, j, k, l,
  21.           not_finished, length, width;
  22.    short  temp[3][3];
  23.    struct tiff_header_struct image_header;
  24.  
  25.    if(does_not_exist(out_name)){
  26.       printf("\n\n output file does not exist %s",
  27.               out_name);
  28.       read_tiff_header(in_name, &image_header);
  29.       round_off_image_size(&image_header,
  30.                            &length, &width);
  31.       image_header.image_length = length*ROWS;
  32.       image_header.image_width  = width*COLS;
  33.       create_allocate_tiff_file(out_name, &image_header,
  34.                                 out_image);
  35.    }  /* ends if does_not_exist */
  36.  
  37.    read_tiff_image(in_name, the_image, il, ie, ll, le);
  38.    pixel_grow(the_image, out_image, diff,
  39.               min_area, max_area);
  40.    write_array_into_tiff_image(out_name, out_image,
  41.                                il, ie, ll, le);
  42.  
  43. }  /* ends gray_shade_region */
  44.  
  45.