00001 #ifndef __ISimpleErosionOp__ 00002 #define __ISimpleErosionOp__ 00003 00005 // Morphological erosion Operation 00006 // =============================== 00007 // 00008 // Author: Bernard De Cuyper 00009 // Purpose: Shrink a binary image 00010 // 00012 00013 #include <stdio.h> 00014 00015 #include "ISimpleMorphologicalOp.hpp" 00016 00017 00018 class ISimpleErosionOp : public ISimpleMorphologicalOp 00019 { 00020 protected: 00021 00022 int ntimes; 00023 00024 int grey; 00025 int r, g, b; 00026 00027 AnImage* I0; 00028 00029 00030 protected: 00031 00032 virtual bool greyNeigbour(AnImage* src, int x, int y); 00033 00034 virtual bool colorNeigbour(AnImage* src, int x, int y); 00035 00036 public: 00037 00038 ISimpleErosionOp(int n, int greyFg) 00039 {ntimes= n; grey= greyFg; r= grey; g= grey; b= grey; I0= 0;} 00040 ISimpleErosionOp(int n, int red, int green, int blue) 00041 {ntimes= n; grey= (33*red+55*green+12*blue)/100; r= red; g= green; b= blue; I0=0;} 00042 00043 virtual ~ISimpleErosionOp(){I0=0;} 00044 00045 virtual void setIterations(int iter){ntimes=iter;} 00046 00047 virtual void setSource(AnImage* src){I0= src;} 00048 00049 virtual AnImage* filter(AnImage* src, AnImage* dest=0); 00050 00051 virtual void report(FILE* file){} 00052 }; 00053 00054 00055 #endif