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