00001
00012 #ifndef ___FILTER_TAG___
00013 #define ___FILTER_TAG___
00014
00015 #include <string>
00016 #include <map>
00017 #include <vector>
00018 #include "image.h"
00019 #include <iostream.h>
00020
00021 using namespace std;
00022
00023 enum BOX_TYPE {BASIC_BOX, FACE_TYPE};
00024
00025 class Box
00026 {
00027 public:
00028
00030 Box();
00031
00037 Box(unsigned int width, unsigned int height,
00038 unsigned int x, unsigned int y);
00039
00040 Box( Box& other);
00042 virtual ~Box();
00043
00046 virtual BOX_TYPE get_type();
00047 virtual Box * get_copy();
00048
00050 unsigned int get_width();
00051
00054 void set_width(unsigned int width);
00055
00057 unsigned int get_height();
00058
00061 void set_height(unsigned int height);
00062
00064 unsigned int get_x();
00065
00068 void set_x(unsigned int x);
00069
00071 unsigned int get_y();
00072
00075 void set_y(unsigned int y);
00076
00077 private:
00079 unsigned int x;
00081 unsigned int y;
00083 unsigned int width;
00085 unsigned int height;
00086
00087 };
00088
00093 class Face : public Box
00094 {
00095 public:
00096
00098 Face();
00099
00105 Face(unsigned int width, unsigned int height,
00106 unsigned int x, unsigned int y);
00107
00108
00109 Face( Face & other);
00111 virtual ~Face();
00112
00113 virtual BOX_TYPE get_type();
00114 virtual Box * get_copy();
00119 void set_label(string label);
00120
00123 string get_label();
00124
00125
00126
00128 unsigned int lx;
00130 unsigned int ly;
00132 unsigned int rx;
00134 unsigned int ry;
00135
00136 private:
00139 string label;
00140
00141 };
00142
00143
00148 class BoxVector
00149 {
00150 public:
00151 BoxVector();
00152 BoxVector(const BoxVector & other);
00153 ~BoxVector();
00154
00155 Box* & operator[](int index);
00156 BoxVector & operator=( BoxVector & other);
00157 void push_back(Box * element);
00158 unsigned int size();
00159 unsigned int length();
00160
00161 private:
00162 bool is_set;
00164 Box ** data;
00166 unsigned int physical_length;
00168 unsigned int element_length;
00169 };
00170
00171
00179 class FrameClass
00180 {
00181 public:
00182 FrameClass();
00185 FrameClass(string fileName);
00188 FrameClass(ColorImage & image);
00192 FrameClass(ColorImage * image);
00195 FrameClass( FrameClass & other);
00196
00197 FrameClass & operator =( FrameClass & other);
00198
00202 BoxVector & operator[](string key);
00203
00206 unsigned int attribute_size();
00207
00211 bool has_attribute(string key);
00212
00214 ~FrameClass();
00215
00218 string str(void);
00219
00221 ColorImage * show;
00223 GrayImage * work;
00224 bool is_set;
00225 private:
00230 map<const string, BoxVector > attributes;
00231 };
00232
00233
00234
00235 class Filter;
00236
00237 static const int PROPERTY_TYPE_STRING = 0;
00238 static const int PROPERTY_TYPE_FILENAME = 1;
00239 static const int PROPERTY_TYPE_INT = 2;
00240 static const int PROPERTY_TYPE_DOUBLE = 3;
00241 static const int PROPERTY_TYPE_LIST = 4;
00242 static const int PROPERTY_TYPE_SEPARATOR = 5;
00243
00244
00250 class Property{
00251 public:
00252
00254 Property(string s);
00255
00258 Property(string name, string value);
00259
00261 Property(string name, int value);
00262
00264 Property(string name, double value);
00265
00267 Property(string name, string *items, int nbitems);
00268
00270 string name;
00271
00273 int propertytype;
00274
00276 int int_value;
00278 double double_value;
00280 string string_value;
00282 vector<string> items;
00283
00285 bool editable;
00287 bool visible;
00288
00292 Filter *parent;
00293
00294 #ifndef NO_GUI
00295
00297 GtkWidget *entry;
00298 #endif
00299
00300 };
00301
00302
00355 class Filter
00356 {
00357 public:
00359 virtual ~Filter();
00364 virtual bool filter_frame(FrameClass & frame) = 0;
00365
00373 virtual void reset();
00377 virtual void property_changed();
00379 virtual int get_nb_inputs();
00381 virtual int get_nb_outputs();
00382
00385 vector<Property *> properties;
00387 string name;
00388 #ifndef NO_GUI
00389
00390 GdkPixmap *icon_pixmap;
00391 #endif
00392
00395 bool is_input_filter;
00396
00397 };
00398
00399
00400 #endif
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410