source: libs/magicsquares/applications/harvest/src/BlobContour.h @ 998

Revision 998, 1.9 KB checked in by dave, 10 years ago (diff)

select spirit, opencv updated to fix camera

Line 
1#ifndef BLOBCONTOUR_H_INCLUDED
2#define BLOBCONTOUR_H_INCLUDED
3
4
5#include "list"
6#include "cv.h"
7//#include "cxtypes.h"
8
9//! Type of chain codes
10typedef unsigned char t_chainCode;
11//! Type of list of chain codes
12typedef CvSeq* t_chainCodeList;
13//! Type of list of points
14typedef CvSeq* t_PointList;
15
16
17//! Max order of calculated moments
18#define MAX_MOMENTS_ORDER               3
19
20
21//! Blob contour class (in crack code)
22class CBlobContour
23{
24        friend class CBlob;
25       
26public:
27        //! Constructors
28        CBlobContour();
29        CBlobContour(CvPoint startPoint, CvMemStorage *storage );
30        //! Copy constructor
31        CBlobContour( CBlobContour *source );
32
33        ~CBlobContour();
34        //! Assigment operator
35        CBlobContour& operator=( const CBlobContour &source );
36
37        //! Add chain code to contour
38        void AddChainCode(t_chainCode code);
39
40        //! Return freeman chain coded contour
41        t_chainCodeList GetChainCode()
42        {
43                return m_contour;
44        }
45
46        bool IsEmpty()
47        {
48                return m_contour == NULL || m_contour->total == 0;
49        }
50
51        //! Return all contour points
52        t_chainCodeList GetContourPoints();
53
54protected:     
55
56        CvPoint GetStartPoint() const
57        {
58                return m_startPoint;
59        }
60
61        //! Clears chain code contour
62        void ResetChainCode();
63       
64
65       
66        //! Computes area from contour
67        double GetArea();
68        //! Computes perimeter from contour
69        double GetPerimeter();
70        //! Get contour moment (p,q up to MAX_CALCULATED_MOMENTS)
71        double GetMoment(int p, int q);
72
73        //! Crack code list
74        t_chainCodeList m_contour;     
75
76private:
77        //! Starting point of the contour
78        CvPoint m_startPoint;
79        //! All points from the contour
80        t_PointList m_contourPoints;
81
82
83
84        //! Computed area from contour
85        double m_area;
86        //! Computed perimeter from contour
87        double m_perimeter;
88        //! Computed moments from contour
89        CvMoments m_moments;
90
91        //! Pointer to storage
92        CvMemStorage *m_parentStorage;
93};
94
95#endif  //!BLOBCONTOUR_H_INCLUDED
96
97
Note: See TracBrowser for help on using the repository browser.