Main Page   Class Overview   Pixels   Images   Geometry   Quick Index  

HxSftCentralMoments.h

00001 /*
00002  *  Copyright (c) 1998, University of Amsterdam, The Netherlands.
00003  *  All rights reserved.
00004  *
00005  *
00006  *  Author(s):
00007  *  Dennis Koelma (koelma@wins.uva.nl)
00008  *  Edo Poll (poll@wins.uva.nl)
00009  */
00010 
00011 #ifndef HxSftCentralMoments_h
00012 #define HxSftCentralMoments_h
00013 
00014 #include "HxSampleFunctorTem.h"
00015 
00016 /*  Generates all central moments up to order N.
00017  *
00018  *  Upq = Sum[ (x - xBar)^p * (y - yBar)^q * f(x,y) ]
00019  *        x,y
00020  *  with xBar = M10 / M00 (moments!)
00021  *  and  yBar = M01 / M00 (moments!)
00022  *  M00 = Sum [f(x,y)], M10 = Sum [x * f(x,y)], M01 = Sum [y * f(x,y)]
00023  *
00024  *  The order in the resulting list is determined by:
00025  *  for (int q=0 ; q<=N ; q++)
00026  *      for (int p=0 ; p<=N ; p++)
00027  *          if (p+q <= N)
00028  *              [Upq];
00029  *  For N=1 the order is: U00, U10, U01
00030  *  For N=2 the order is: U00, U10, U20, U01, U11, U02
00031  *  For N=3 the order is: U00, U10, U20, U30, U01, U11, U21, U02, U12, U03.
00032  */
00033 template <class ArgType, class ResType>
00034 class HxSftCentralMoments : public HxSampleFunctorTem<ArgType,ResType>
00035 {
00036 public:
00037                         HxSftCentralMoments(int order, HxString name);
00038     virtual             ~HxSftCentralMoments();
00039 
00040     virtual void        init();
00041     virtual void        next(ArgType pixV, ArgType maskV, HxPoint p);
00042     virtual void        result(HxValueListBackInserter res);
00043 
00044     virtual int         hasPhase2();
00045 
00046     virtual void        init2();
00047     virtual void        next2(ArgType pixV, ArgType maskV, HxPoint p);
00048     virtual void        result2(HxValueListBackInserter res);
00049 
00050 private:
00051     int                 _order;
00052     int                 _number;
00053     ResType             _m00;
00054     ResType             _m10;
00055     ResType             _m01;
00056     ResType             _xBar;
00057     ResType             _yBar;
00058     ResType*            _sums;
00059 };
00060 
00061 #ifdef INC_TEMPLATE_SRC
00062 #include "HxSftCentralMoments.c"
00063 #endif
00064 
00065 #endif

Generated on Tue Jan 8 13:59:16 2002 for C++Reference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001