|
#ifndef IMAGE_H
#define IMAGE_H
#include <cv.h>
#include <cxcore.h>
#include <highgui.h>
#include <iostream>
using namespace std;
template<class type>
class Image
{
public :
Image(IplImage *_p = 0){ _pImage = _p; }
~Image(){ _pImage = 0; }
void operator= (IplImage *_p){ _pImage = _p; }
inline type* operator[] (const int row)
{
return ((type*)(_pImage->imageData + row*_pImage->widthStep));
}
operator IplImage*() { return _pImage; }
protected :
IplImage *_pImage;
};
typedef struct
{
unsigned char b,g,r;
} RgbPixel;
typedef struct
{
float b,g,r;
} RgbPixelFloat;
typedef Image<RgbPixel> RgbImage;
typedef Image<RgbPixelFloat> RgbImageFloat;
typedef Image<unsigned char> BwImage;
typedef Image<float> BwImageFloat;
#endif
|
|