daily pastebin goal
70%
SHARE
TWEET

Untitled

a guest Mar 22nd, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //operação morfológica erosão e dilatação
  2. int main(void)
  3. {
  4.     IVC *image[4];
  5.  
  6.     image[0] = vc_read_image("Images/FLIR/flir-01.pgm");
  7.  
  8.     image[1] = vc_image_new(image[0]->width, image[0]->height, 1, image[0]->levels);
  9.  
  10.  
  11.     if (image[0] == NULL)
  12.     {
  13.         printf("ERROR -> vc_read_image():\n\tFile not found!\n");
  14.         getchar();
  15.         return 0;
  16.     }
  17.  
  18.     if (image[1] == NULL) {
  19.  
  20.         printf("ERROR -> vc_image_new():\n\tFail to create file!\n");
  21.         getchar();
  22.         return 0;
  23.     }
  24.  
  25.     vc_gray_to_binary(image[0], image[1], 127);
  26.  
  27.     image[2] = vc_image_new(image[1]->width, image[1]->height, 1, image[1]->levels);
  28.  
  29.     vc_binary_erode(image[1], image[2], 3);
  30.  
  31.     image[3] = vc_image_new(image[2]->width, image[2]->height, 1, image[2]->levels);
  32.  
  33.     vc_binary_dilate(image[2], image[3], 3);
  34.  
  35.     vc_write_image("results/result06.pgm", image[3]);
  36.  
  37.     vc_image_free(image[0]);
  38.     vc_image_free(image[1]);
  39.     vc_image_free(image[2]);
  40.     vc_image_free(image[3]);
  41.  
  42.  
  43.     system("cmd /c start FilterGear Images/FLIR/flir-01.pgm");
  44.     system("FilterGear results/result06.pgm");
  45.  
  46.     printf("Press any key to exit...\n");
  47.     getchar();
  48.  
  49.     return 0;
  50. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top