-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfeaturevector.cpp
More file actions
146 lines (119 loc) · 3.4 KB
/
Copy pathfeaturevector.cpp
File metadata and controls
146 lines (119 loc) · 3.4 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
//
// featurevector.cpp
// colorDescriptor
//
// Copyright 2022 Grigorios Piperagkas. All rights reserved.
// 3-clause BSD License
//
//
//#include <stdlib.h>
class featureVector{
private:
int **x;
int **y;
int **xe;
int **ye;
double **mins;
double **maxs;
int i,ii,j,jj,c,sx,sy;
public:
int **fmins;
int **fmaxs;
int fsize;
int **fmines;
int **fmaxes;
int fsizee;
featureVector(double **mins, double **maxs, double **mines, double **maxes, int sizex, int sizey) //constructor
{
sx=sizex;
sy=sizey;
c=0;
fsize=0;
ii=0;
for (i=0;i<sx;i++)
{
for (j=0;j<sy;j++)
{
if (mins[c][i*sy+j]<255 || maxs[c][i*sy+j]>0)
fsize++;
if (mines[c][i*sy+j]<255 || maxes[c][i*sy+j]>-255)
fsizee++;
}
}
fmins = new int*[3];
for (i=0;i<3;i++)
fmins[i] = new int[fsize];
fmaxs = new int*[3];
for (i=0;i<3;i++)
fmaxs[i]=new int[fsize];
fmines = new int*[3];
for (i=0;i<3;i++)
fmines[i] = new int[fsizee];
fmaxes = new int*[3];
for (i=0;i<3;i++)
fmaxes[i]=new int[fsizee];
x = new int*[3];
for (i=0;i<3;i++)
x[i]=new int[fsize];
y = new int*[3];
for (i=0;i<3;i++)
y[i]=new int[fsize];
xe = new int*[3];
for (i=0;i<3;i++)
xe[i]=new int[fsizee];
ye = new int*[3];
for (i=0;i<3;i++)
ye[i]=new int[fsizee];
}
void buildfVector(double **mins, double **maxs, double **mines, double **maxes) //build extrema vectors of size fsize with coordinates x y for each color RGB and Ex, Elx, Ellx
{
for (c=0;c<3;c++)
{
ii=0;
jj=0;
for (i=0;i<sx;i++)
{
for (j=0;j<sy;j++)
{
if ((mins[c][i*sy+j]<255 || maxs[c][i*sy+j]>0)&&(ii<fsize))
{
x[c][ii]=i;
y[c][ii]=j;
fmins[c][ii]=int(mins[c][i*sy+j]);
fmaxs[c][ii]=int(maxs[c][i*sy+j]);
ii++;
}
if ((mines[c][i*sy+j]<255 || maxes[c][i*sy+j]>-255)&&(jj<fsizee))
{
xe[c][ii]=i;
ye[c][ii]=j;
fmines[c][ii]=int(mines[c][i*sy+j]);
fmaxes[c][ii]=int(maxes[c][i*sy+j]);
jj++;
}
}
}
}
}
~featureVector() //destructor
{
for (i=0;i<3;i++){
delete fmins[i];
delete fmaxs[i];
delete x[i];
delete y[i];
delete fmines[i];
delete fmaxes[i];
delete xe[i];
delete ye[i];
}
delete[] fmines;
delete[] fmaxes;
delete[] xe;
delete[] ye;
delete[] fmins;
delete[] fmaxs;
delete[] x;
delete[] y;
}
};