00001 #ifndef __SusanOp__ 00002 #define __SusanOp__ 00003 00005 // Susan filter 00006 // ======================== 00007 // 00008 // Group: Eggs and Pictures. 00009 // Author: Bernard De Cuyper 00010 // Date: 10/06/2002 00011 // 00012 // Purpose: Detect edges and corners with a statistical window 00013 // 00014 // Paper: "Susan, a new approach to low level image processing.", 00015 // Smith & Brady, IJCV 1996. 00016 // 00017 // Copyrights: Bernard De Cuyper & Eddy Fraiha 2002, 00018 // Eggs & Pictures. 00019 // MIT/Open BSD copyright model. 00020 // 00022 00023 #include "AnImageOp.hpp" 00024 00025 00026 class SusanFilter : public AnImageOp 00027 { 00028 private: 00029 00030 int width; 00031 int height; 00032 00033 int maxKernelSize; // kernel upper width 00034 int maxKernelRange; // kernel upper width 00035 int nmax; 00036 00037 double t; // minimum contrast threshold gvalue 00038 double g; // geometric threshold 00039 00040 AnImage* image; 00041 00042 double** r0; // edge detection 00043 00044 // statistics 00045 double** n0; // m00 00046 double** cgx; // m10 -> mu10 00047 double** cgy; // m01 -> mu01 00048 double** mu20; 00049 double** mu11; 00050 double** mu02; 00051 00052 protected: 00053 00054 void init(AnImage* im); 00055 00056 double distance2(int x0, int y0); // distance a cg USAN 00057 bool isCorner(int x0, int y0); 00058 int getBrightness(int x, int y); 00059 int getResponse(int x, int y); 00060 00061 double c(int x, int y, int x0, int y0); 00062 00063 void computeLocalMoments(int x0,int y0); 00064 void computeUSAN(); 00065 00066 public: 00067 00068 SusanFilter(double contrast, double geometricThreshold); 00069 SusanFilter(int kernelSize, double contrast, double geometricThreshold); 00070 00071 AnImage* filter(AnImage* src, AnImage* dest); 00072 }; 00073 00074 #endif