00001
00004
00005
00006
00007
00008
00009
00010 #ifndef IMAGE_H_DEFINED
00011 #define IMAGE_H_DEFINED
00012
00013 #include <mex.h>
00014
00015
00017
00019 class Image
00020 {
00021 public:
00022
00023
00031
00033 Image();
00034
00036 Image(const mxArray *arr);
00037
00039 Image(const Image& other);
00040
00042 Image(const int w, const int h);
00043
00045 Image operator=(const Image other);
00046
00048 void initialize(const mxArray *arr);
00049
00051 void initialize(const int w, const int h);
00052
00054
00057
00059 int getWidth() const;
00060
00062 int getHeight() const;
00063
00065 int getSize() const;
00066
00068 bool isInitialized() const;
00069
00071
00072 mxArray* getArray();
00073
00075
00076 const mxArray* getConstArray() const;
00077
00079 bool coordsOK(int x, int y) const;
00080
00082 double getVal(int index) const;
00083
00085 double getVal(int x, int y) const;
00086
00088 void setVal(int index, double val);
00089
00091 void setVal(int x, int y, double val);
00092
00094
00097
00099
00101 void clamp(const double bottom, const double top);
00102
00104
00105 void clampBottom(const double bottom);
00106
00108
00109 void clampTop(const double top);
00110
00112
00115 void getLocalMaxima(const double thresh, int *lm_num, double *lm_sum);
00116
00118 Image operator*=(const double factor);
00119
00121
00128
00130 typedef double* iterator;
00131
00133 typedef const double* const_iterator;
00134
00136 const_iterator begin() const;
00137
00139 const_iterator end() const;
00140
00142 iterator beginw();
00143
00145 iterator endw();
00146
00148
00149 protected:
00150 bool itsInitialized;
00151 mxArray *itsArray;
00152 };
00153
00154 #endif