Advertisement
Guest User

vc.h

a guest
Apr 21st, 2018
441
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.55 KB | None | 0 0
  1. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2. // INSTITUTO POLITÉCNICO DO CÁVADO E DO AVE
  3. // 2011/2012
  4. // ENGENHARIA DE SISTEMAS INFORMÁTICOS
  5. // VISÃO POR COMPUTADOR
  6. //
  7. // [ DUARTE DUQUE - dduque@ipca.pt ]
  8. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  9.  
  10.  
  11. #define VC_DEBUG
  12. #define MAX(a,b) (a > b ? a : b)
  13. #define MIN(a,b) (a < b ? a : b)
  14.  
  15.  
  16. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  17. // ESTRUTURA DE UMA IMAGEM
  18. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  19.  
  20.  
  21. typedef struct {
  22. unsigned char *data;
  23. int width, height;
  24. int channels; // Binário/Cinzentos=1; RGB=3
  25. int levels; // Binário=1; Cinzentos [1,255]; RGB [1,255]
  26. int bytesperline; // width * channels
  27. } IVC;
  28.  
  29. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  30. // ESTRUTURA DE UM BLOB (OBJECTO)
  31. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  32.  
  33. typedef struct {
  34. int x, y, width, height; // Caixa Delimitadora (Bounding Box)
  35. int area; // Área
  36. int xc, yc; // Centro-de-massa
  37. int perimeter; // Perímetro
  38. int label; // Etiqueta
  39. } OVC;
  40.  
  41.  
  42. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  43. // PROTÓTIPOS DE FUNÇÕES
  44. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  45.  
  46. OVC* vc_binary_blob_labelling(IVC *src, IVC *dst, int *nlabels);
  47. int vc_binary_blob_info(IVC *src, OVC *blobs, int nblobs);
  48.  
  49. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  50. // PROTÓTIPOS DE FUNÇÕES
  51. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  52.  
  53. // FUNÇÕES: ALOCAR E LIBERTAR UMA IMAGEM
  54. IVC *vc_image_new(int width, int height, int channels, int levels);
  55. IVC *vc_image_free(IVC *image);
  56.  
  57. // FUNÇÕES: LEITURA E ESCRITA DE IMAGENS (PBM, PGM E PPM)
  58. IVC *vc_read_image(char *filename);
  59. int vc_write_image(char *filename, IVC *image);
  60. int vc_rgb_to_hsv_red(IVC *srcdst);
  61. int vc_rgb_to_hsv_yellow(IVC *srcdst);
  62. int vc_rgb_to_hsv_blue(IVC *srcdst);
  63. int vc_rgb_to_hsv_madeira(IVC *srcdst);
  64. int vc_rgb_get_red_gray(IVC *srcdst);
  65. int vc_scale_gray_to_rgb(IVC *src, IVC *dst);
  66. int vc_gray_to_binary(IVC *srcdst, int threshold);
  67. int vc_rgb_to_binary_midpoint(IVC *src, IVC *dst, int kernel);
  68. int vc_binary_dilate(IVC *src, IVC *dst, int kernel);
  69. OVC *vc_binary_blob_labelling(IVC *src, IVC *dst, int *nlabels);
  70. int vc_binary_blob_info(IVC *src, OVC *blobs, int nblobs);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement