-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathParameters.cpp
More file actions
268 lines (223 loc) · 6.31 KB
/
Parameters.cpp
File metadata and controls
268 lines (223 loc) · 6.31 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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
/* Shared Use License: This file is owned by Derivative Inc. (Derivative)
* and can only be used, and/or modified for use, in conjunction with
* Derivative's TouchDesigner software, and only if you are a licensee who has
* accepted Derivative's TouchDesigner license or assignment agreement
* (which also govern the use of this file). You may share or redistribute
* a modified version of this file provided the following conditions are met:
*
* 1. The shared file or redistribution must retain the information set out
* above and this list of conditions.
* 2. Derivative's name (Derivative Inc.) or its trademarks may not be used
* to endorse or promote products derived from this file without specific
* prior written permission from Derivative.
*/
// Parameters.cpp generated using the cppParsTemplateGen Palette Component.
// https://derivative.ca/UserGuide/Palette:cppParsTemplateGen
#include <string>
#include <array>
#include "CPlusPlus_Common.h"
#include "Parameters.h"
#pragma region Evals
std::string
Parameters::evalClassifier(const TD::OP_Inputs* inputs)
{
return inputs->getParFilePath(ClassifierName);
}
double
Parameters::evalScalefactor(const TD::OP_Inputs* inputs)
{
return inputs->getParDouble(ScalefactorName);
}
int
Parameters::evalMinneighbors(const TD::OP_Inputs* inputs)
{
return inputs->getParInt(MinneighborsName);
}
bool
Parameters::evalLimitobjectsize(const TD::OP_Inputs* inputs)
{
return inputs->getParInt(LimitobjectsizeName) ? true : false;
}
double
Parameters::evalMinobjectwidth(const TD::OP_Inputs* inputs)
{
return inputs->getParDouble(MinobjectwidthName);
}
double
Parameters::evalMinobjectheight(const TD::OP_Inputs* inputs)
{
return inputs->getParDouble(MinobjectheightName);
}
double
Parameters::evalMaxobjectwidth(const TD::OP_Inputs* inputs)
{
return inputs->getParDouble(MaxobjectwidthName);
}
double
Parameters::evalMaxobjectheight(const TD::OP_Inputs* inputs)
{
return inputs->getParDouble(MaxobjectheightName);
}
bool
Parameters::evalDrawboundingbox(const TD::OP_Inputs* inputs)
{
return inputs->getParInt(DrawboundingboxName) ? true : false;
}
bool
Parameters::evalLimitobjectsdetected(const TD::OP_Inputs* inputs)
{
return inputs->getParInt(LimitobjectsdetectedName) ? true : false;
}
int
Parameters::evalMaximumobjects(const TD::OP_Inputs* inputs)
{
return inputs->getParInt(MaximumobjectsName);
}
#pragma endregion
#pragma region Setup
void
Parameters::setup(TD::OP_ParameterManager* manager)
{
{
TD::OP_StringParameter p;
p.name = ClassifierName;
p.label = ClassifierLabel;
p.page = "Object Detector";
p.defaultValue = "";
TD::OP_ParAppendResult res = manager->appendFile(p);
assert(res == TD::OP_ParAppendResult::Success);
}
{
TD::OP_NumericParameter p;
p.name = ScalefactorName;
p.label = ScalefactorLabel;
p.page = "Object Detector";
p.defaultValues[0] = 1.05;
p.minSliders[0] = 1.0;
p.maxSliders[0] = 5.0;
p.minValues[0] = 1.0;
p.maxValues[0] = 1.0;
p.clampMins[0] = true;
p.clampMaxes[0] = false;
TD::OP_ParAppendResult res = manager->appendFloat(p);
assert(res == TD::OP_ParAppendResult::Success);
}
{
TD::OP_NumericParameter p;
p.name = MinneighborsName;
p.label = MinneighborsLabel;
p.page = "Object Detector";
p.defaultValues[0] = 3;
p.minSliders[0] = 1.0;
p.maxSliders[0] = 10.0;
p.minValues[0] = 1.0;
p.maxValues[0] = 1.0;
p.clampMins[0] = true;
p.clampMaxes[0] = false;
TD::OP_ParAppendResult res = manager->appendInt(p);
assert(res == TD::OP_ParAppendResult::Success);
}
{
TD::OP_NumericParameter p;
p.name = LimitobjectsizeName;
p.label = LimitobjectsizeLabel;
p.page = "Object Detector";
p.defaultValues[0] = true;
TD::OP_ParAppendResult res = manager->appendToggle(p);
assert(res == TD::OP_ParAppendResult::Success);
}
{
TD::OP_NumericParameter p;
p.name = MinobjectwidthName;
p.label = MinobjectwidthLabel;
p.page = "Object Detector";
p.defaultValues[0] = 0.1;
p.minSliders[0] = 0.0;
p.maxSliders[0] = 1.0;
p.minValues[0] = 0.0;
p.maxValues[0] = 1.0;
p.clampMins[0] = true;
p.clampMaxes[0] = true;
TD::OP_ParAppendResult res = manager->appendFloat(p);
assert(res == TD::OP_ParAppendResult::Success);
}
{
TD::OP_NumericParameter p;
p.name = MinobjectheightName;
p.label = MinobjectheightLabel;
p.page = "Object Detector";
p.defaultValues[0] = 0.1;
p.minSliders[0] = 0.0;
p.maxSliders[0] = 1.0;
p.minValues[0] = 0.0;
p.maxValues[0] = 1.0;
p.clampMins[0] = true;
p.clampMaxes[0] = true;
TD::OP_ParAppendResult res = manager->appendFloat(p);
assert(res == TD::OP_ParAppendResult::Success);
}
{
TD::OP_NumericParameter p;
p.name = MaxobjectwidthName;
p.label = MaxobjectwidthLabel;
p.page = "Object Detector";
p.defaultValues[0] = 0.9;
p.minSliders[0] = 0.0;
p.maxSliders[0] = 1.0;
p.minValues[0] = 0.0;
p.maxValues[0] = 1.0;
p.clampMins[0] = true;
p.clampMaxes[0] = true;
TD::OP_ParAppendResult res = manager->appendFloat(p);
assert(res == TD::OP_ParAppendResult::Success);
}
{
TD::OP_NumericParameter p;
p.name = MaxobjectheightName;
p.label = MaxobjectheightLabel;
p.page = "Object Detector";
p.defaultValues[0] = 0.9;
p.minSliders[0] = 0.0;
p.maxSliders[0] = 1.0;
p.minValues[0] = 0.0;
p.maxValues[0] = 1.0;
p.clampMins[0] = true;
p.clampMaxes[0] = true;
TD::OP_ParAppendResult res = manager->appendFloat(p);
assert(res == TD::OP_ParAppendResult::Success);
}
{
TD::OP_NumericParameter p;
p.name = DrawboundingboxName;
p.label = DrawboundingboxLabel;
p.page = "Object Detector";
p.defaultValues[0] = true;
TD::OP_ParAppendResult res = manager->appendToggle(p);
assert(res == TD::OP_ParAppendResult::Success);
}
{
TD::OP_NumericParameter p;
p.name = LimitobjectsdetectedName;
p.label = LimitobjectsdetectedLabel;
p.page = "Object Detector";
p.defaultValues[0] = false;
TD::OP_ParAppendResult res = manager->appendToggle(p);
assert(res == TD::OP_ParAppendResult::Success);
}
{
TD::OP_NumericParameter p;
p.name = MaximumobjectsName;
p.label = MaximumobjectsLabel;
p.page = "Object Detector";
p.defaultValues[0] = 10;
p.minSliders[0] = 0.0;
p.maxSliders[0] = 20.0;
p.minValues[0] = 0.0;
p.maxValues[0] = 1.0;
p.clampMins[0] = false;
p.clampMaxes[0] = false;
TD::OP_ParAppendResult res = manager->appendInt(p);
assert(res == TD::OP_ParAppendResult::Success);
}
}
#pragma endregion