-
Notifications
You must be signed in to change notification settings - Fork 1
/
k_means.h
45 lines (30 loc) · 892 Bytes
/
k_means.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
39
40
41
42
43
44
45
#ifndef K_MEANS_H
#define K_MEANS_H
#include <vector>
class KMeans {
public:
KMeans(double **matrix, int &a, int &b, int &c);
~KMeans();
void clusterize(int &step);
// calculation dissimilarity between points with euclidean disatnce
double euclidean_distance(double a_1, double b_1,
double a_2, double b_2,
double a_3, double b_3);
void update_centroid();
void output_data();
private:
// the number of clusters
int k;
// the dimension of data
int dimension;
// the sum number of point
int point_num;
// all points extract from image
double **point_set;
// store centroid information B G R value
double **centroids;
double **copy_centroids;
// store cluster points
std::vector< std::vector<int> > clusters;
};
#endif