#include <stdlib.h>
#include <set>
#include <map>
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <cv.h>
#include <highgui.h>
#include <glut.h>

using namespace std;

typedef struct {
        double l, r, b, t;
} Extent;

template<class T> class Image
{
    private:
        IplImage* imgp;
    public:
        Image(IplImage* img=0) {imgp=img;}
        ~Image(){imgp=0;}
        void operator=(IplImage* img) {imgp=img;}
        inline T* operator[](const int rowIndx) {
            return ((T *)(imgp->imageData + rowIndx*imgp->widthStep));}
};

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;
