#ifndef MOM01D2_HH #define MOM01D2_HH /////////////////////////////////////////////////////////////////////////// //! file="amma/Image/Region/Mom01d2.hh" //! lib=iaps //! userlevel=Normal //! author="Radek Marik" //! docentry="Image.Image Processing.Region Model" //! rcsid="$Id: Mom01d2.hh,v 1.8 1999/12/02 11:32:46 ees1cg Exp $" //! date="06/08/95" #include "amma/StdType.hh" class ostream; class istream; class BoundaryC; // ----------------------------------------------------------------- // *************** Moments01d2C *********************************** // ----------------------------------------------------------------- //: The class Moments01d2C is the representation of the first 3 moments //: (00, 01, 10) of a 2-dimensional object. class Moments01d2C { public: // Type definitions. // ----------------- typedef LongIntT AreaT; // Area of a 2D object. public: // Constructors, copies, assigment, and destructor // ----------------------------------------------- Moments01d2C(const BoundaryC & boundary); // get the center and the area of the region // which is determined by the 'boundary'. // Access to the object model // -------------------------- inline RealT M00() const; // Returns the moment m00. inline RealT M10() const; // Returns the moment m10. inline RealT M01() const; // Returns the moment m01. // Derived characteristics of the object // ------------------------------------- inline AreaT Area() const; // Returns the moment m00, e.g. the area of the 2 dimensional object. inline RealT CentroidX() const; // Returns the x co-ordinate of the centroid. The M00 moment must // be different 0. inline RealT CentroidY() const; // Returns the y co-ordinate of the centroid. The M00 moment must // be different 0. private: // The representation of the object // -------------------------------- RealT m00; // the momemt 00 (xy) RealT m01; // the moment 01 (xy) RealT m10; // the moment 10 (xy) friend istream & operator>>(istream & is, Moments01d2C & mom); }; ostream & operator<<(ostream & os, const Moments01d2C & mom); istream & operator>>(istream & is, Moments01d2C & mom); /*-------------------------------------------------------------------*/ /********* Moments01d2C **********************************************/ /*-------------------------------------------------------------------*/ inline Moments01d2C::AreaT Moments01d2C::Area() const //======================== { return (AreaT)m00; } inline RealT Moments01d2C::M00() const //======================= { return m00; } inline RealT Moments01d2C::M10() const //======================= { return m10; } inline RealT Moments01d2C::M01() const //======================= { return m01; } inline RealT Moments01d2C::CentroidX() const //============================= { return M10()/M00(); } inline RealT Moments01d2C::CentroidY() const //============================= { return M01()/M00(); } #endif // IAPS - Image analysis program system. // End of include file Mom01d2.hh