Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
SecurityCam - Image.h

Image.h

Caricato da: Carlduke
Scarica il programma completo

  1. #ifndef IMAGE_H
  2. #define IMAGE_H
  3.  
  4. #include <cv.h>
  5. #include <cxcore.h>
  6. #include <highgui.h>
  7. #include <iostream>
  8.  
  9. using namespace std;
  10.  
  11. template<class type>
  12. class Image
  13. {
  14.   public :
  15.           Image(IplImage *_p = 0){ _pImage = _p; }
  16.           ~Image(){ _pImage = 0; }
  17.  
  18.           void operator= (IplImage *_p){ _pImage = _p; }
  19.  
  20.           inline type* operator[] (const int row)
  21.           {
  22.                    return ((type*)(_pImage->imageData + row*_pImage->widthStep));
  23.           }
  24.  
  25.           operator IplImage*()  { return _pImage; }
  26.   protected :
  27.           IplImage *_pImage;
  28. };
  29.  
  30. typedef struct
  31. {
  32.   unsigned char b,g,r;
  33. } RgbPixel;
  34.  
  35. typedef struct
  36. {
  37.   float b,g,r;
  38. } RgbPixelFloat;
  39.  
  40. typedef Image<RgbPixel>       RgbImage;
  41. typedef Image<RgbPixelFloat>  RgbImageFloat;
  42. typedef Image<unsigned char>  BwImage;
  43. typedef Image<float>          BwImageFloat;
  44.  
  45. #endif