00001 #ifndef BLOBCONTOUR_H_INCLUDED 00002 #define BLOBCONTOUR_H_INCLUDED 00003 00004 00005 #include "list" 00006 #include <ros/ros.h> 00007 #include <opencv/cv.h> 00008 #include "cxtypes.h" 00009 00011 typedef unsigned char t_chainCode; 00013 typedef CvSeq* t_chainCodeList; 00015 typedef CvSeq* t_PointList; 00016 00017 00019 #define MAX_MOMENTS_ORDER 3 00020 00021 00023 class CBlobContour 00024 { 00025 friend class CBlob; 00026 00027 public: 00029 CBlobContour(); 00030 CBlobContour(CvPoint startPoint, CvMemStorage *storage ); 00032 CBlobContour( CBlobContour *source ); 00033 00034 ~CBlobContour(); 00036 CBlobContour& operator=( const CBlobContour &source ); 00037 00039 void AddChainCode(t_chainCode code); 00040 00042 t_chainCodeList GetChainCode() 00043 { 00044 return m_contour; 00045 } 00046 00047 bool IsEmpty() 00048 { 00049 return m_contour == NULL || m_contour->total == 0; 00050 } 00051 00053 t_chainCodeList GetContourPoints(); 00054 00055 protected: 00056 00057 CvPoint GetStartPoint() const 00058 { 00059 return m_startPoint; 00060 } 00061 00063 void ResetChainCode(); 00064 00065 00066 00068 double GetArea(); 00070 double GetPerimeter(); 00072 double GetMoment(int p, int q); 00073 00075 t_chainCodeList m_contour; 00076 00077 private: 00079 CvPoint m_startPoint; 00081 t_PointList m_contourPoints; 00082 00083 00084 00086 double m_area; 00088 double m_perimeter; 00090 CvMoments m_moments; 00091 00093 CvMemStorage *m_parentStorage; 00094 }; 00095 00096 #endif //!BLOBCONTOUR_H_INCLUDED 00097 00098