-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsegment.h
38 lines (32 loc) · 945 Bytes
/
segment.h
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
/*
* Author: Artur Dobrogowski
* 2020-01-04
*/
#ifndef SEGMENT_H
#define SEGMENT_H
#include "point.h"
#include "configuration.h"
#include <opencv2/core/core.hpp>
/**
* @todo write docs
*/
class Segment {
public:
cv::Mat origin;
Point start;
Point end;
Point sample;
BasicMomentType m[4][4]; // Basic moments
MomentType M[4][4]; // Central moments
int circumference;
void updateMoments(Coord x, Coord y, BasicMomentType f);
void updateMomentsCentralMoments();
MomentType getIMCoeff(short n);
Segment(cv::Mat o, Coord ox, Coord oy);
void addPoint(Coord x, Coord y, BasicMomentType f);
friend ostream& operator<<(ostream& ostr, const Segment& seg);
BasicMomentType getArea() { return m[0][0]; }
Point getMassCenter() { return Point((m[0][0]/2 + m[1][0])/m[0][0], (m[0][0]/2 + m[0][1])/m[0][0]); }
Point getBboxCenter() { return (start+end)/2; }
};
#endif // SEGMENT_H