Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Modules/ImageProcessor/ImageProcessorTools/SUSANEdgeDetectionLite.cpp

Go to the documentation of this file.
00001 
00002 /** 
00003 * @file SUSANEdgeDetectionLite.cpp
00004 * Implementation of file SUSANEdgeDetectionLite.
00005 *
00006 * @author <A href=mailto:walter.nistico@uni-dortmund.de>Walter Nistico</A>
00007 */
00008 
00009 #include "SUSANEdgeDetectionLite.h"
00010 
00011   SUSANEdgeDetectionLite::SUSANEdgeDetectionLite(int edgeThreshold)
00012   {
00013       setupSusanLUT(edgeThreshold);
00014   }
00015   
00016   SUSANEdgeDetectionLite::~SUSANEdgeDetectionLite(){};
00017 
00018 
00019   void SUSANEdgeDetectionLite::setupSusanLUT(int threshold) 
00020   {
00021     unsigned char temp;
00022     for (int k=127; k<255; k++) {
00023       temp = (unsigned char) (255*exp((double)(-pow(((k-126)<<1)/threshold,6))));
00024       Susan_LUT[k] = temp;
00025       Susan_LUT[254-k] = temp;
00026     }
00027   }
00028 
00029 
00030   bool SUSANEdgeDetectionLite::isEdgePoint(const Image& image, int posx, int posy, ColorSpectra channel) const
00031   {
00032     register int counter;
00033     register unsigned char center;
00034     unsigned char neighbours0;
00035     unsigned char neighbours1;
00036     unsigned char neighbours2;
00037     unsigned char neighbours3;
00038     unsigned char neighbours4;
00039     unsigned char neighbours5;
00040     unsigned char neighbours6;
00041     unsigned char neighbours7;
00042     
00043     int sp = static_cast<int> (channel);
00044     
00045     center = image.image[posy][sp][posx];          
00046     neighbours0 = image.image[posy-1][sp][posx];          
00047     neighbours1 = image.image[posy+1][sp][posx];          
00048     neighbours2 = image.image[posy][sp][posx-1];          
00049     neighbours3 = image.image[posy][sp][posx+1];          
00050     neighbours4 = image.image[posy-1][sp][posx-1];          
00051     neighbours5 = image.image[posy+1][sp][posx-1];          
00052     neighbours6 = image.image[posy-1][sp][posx+1];          
00053     neighbours7 = image.image[posy+1][sp][posx+1];          
00054     
00055     counter = correlation(neighbours0-center);
00056     counter += correlation(neighbours1-center);
00057     counter += correlation(neighbours2-center);
00058     counter += correlation(neighbours3-center);
00059     counter += correlation(neighbours4-center);
00060     counter += correlation(neighbours5-center);
00061     counter += correlation(neighbours6-center);
00062     counter += correlation(neighbours7-center);
00063 
00064     if (counter<GEOMETRIC_THRESHOLD)
00065       return true;
00066     else 
00067       return false;
00068   };
00069  
00070 /*
00071 * Change log :
00072 * 
00073 * $Log: SUSANEdgeDetectionLite.cpp,v $
00074 * Revision 1.1.1.1  2004/05/22 17:19:53  cvsadm
00075 * created new repository GT2004_WM
00076 *
00077 * Revision 1.2  2004/03/11 21:00:39  schmidtb
00078 * removed errors with enums and destructor
00079 *
00080 * Revision 1.1  2004/03/03 13:43:51  nistico
00081 * -Added SUSANEdgeDetectionLite
00082 *
00083 *
00084 *
00085 */

Generated on Thu Sep 23 19:57:29 2004 for GT2004 by doxygen 1.3.6