img.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #ifndef _Img_h_
  2. #define _Img_h_
  3. #include <string>
  4. // Classe image
  5. #define SIZEHISTO 4096
  6. /* Differents type coding for images and buffers.
  7. */
  8. #define MAXBLOB 8191 // ! On utilise parfois MAXBLOB + 1
  9. typedef enum ImageType {
  10. TYPE_UNKNOWN,
  11. TYPE_UCHAR,
  12. TYPE_SCHAR,
  13. TYPE_USHORT,
  14. TYPE_SSHORT,
  15. TYPE_INT,
  16. TYPE_ULINT,
  17. TYPE_FLOAT,
  18. TYPE_DOUBLE
  19. };
  20. typedef char s8;
  21. typedef unsigned char u8;
  22. typedef short int s16;
  23. typedef unsigned short int u16;
  24. typedef int i32;
  25. typedef int s32;
  26. typedef unsigned long int u64;
  27. typedef float r32;
  28. typedef double r64;
  29. struct blob { // Utilise pour le blob coloring
  30. int bind; // Indice du blob
  31. int used;
  32. long size;
  33. unsigned int *first; // Image des blobs en int
  34. };
  35. class img
  36. {
  37. public:
  38. void *data; // Data of the image which contain the pixels data
  39. int init; // Image initialized
  40. int itype; // Type of the pixel date
  41. int dimh; // Dimension Horizontal
  42. int dimv; // Dimension Vertical
  43. unsigned long nbpix; // Nb of pixels of the image
  44. img();
  45. ~img();
  46. void Del();
  47. int Create(int it, int dh, int dv);
  48. void CopyTo(img *img2);
  49. void Fill(int value);
  50. int GetValue(int x, int y);
  51. void SetValue(int x, int y, int value);
  52. void Equalize(int ngray);
  53. // Mathematical morphology
  54. void BinaryErosion(img *res);
  55. void BinaryDilatation(img *res);
  56. void BinaryOpening(img *tamp);
  57. void BinaryClosing(img *tamp);
  58. void RemplaceCouleur(int a, int b);
  59. int BlobColoring(blob tblob[MAXBLOB], img *img1);
  60. long GetBlobSize(int nblob);
  61. void SaveImgAsRaw();
  62. };
  63. #endif