63 examples =
new vector<image_class_example *>;
74 int first_represented_class_index = 0;
75 for(vector<image_class_example *>::iterator it =
examples->begin(); it <
examples->end(); it++)
77 if (represented_class_number == 0)
79 first_represented_class_index = (*it)->class_index;
80 represented_class_number = 1;
83 if ((*it)->class_index != first_represented_class_index)
99 for(vector<image_class_example *>::iterator it =
examples->begin(); it <
examples->end(); it++)
100 P[(*it)->class_index]++;
102 for(
int i = 0; i < class_number; i++)
127 for(vector<image_class_example *>::iterator it =
examples->begin(); it <
examples->end(); it++)
142 if (dp <= 0 && child_index == 0)
return true;
143 if (dp > 0 && child_index == 1)
return true;
151 return (
int)I[
d1] - (int)I[
d2];
157 if (dp <= 0)
return 0;
319 int u0 = image_width / 2, v0 = image_height / 2;
320 d1 = (v0 +
dv1) * image_width + u0 +
du1;
321 d2 = (v0 +
dv2) * image_width + u0 +
du2;
333 int u0 = image_width / 2, v0 = image_height / 2;
334 d1 = (v0 +
dv1) * image_width + u0 +
du1;
335 d2 = (v0 +
dv2) * image_width + u0 +
du2;
346 o <<
"LEAF " << node.
index <<
" " << node.
depth << endl;
351 if (node.
P[i] > 0.001)
352 o << i <<
" " << node.
P[i] << endl;
354 o <<
"-1 -1" << endl;
358 o <<
"NODE " << node.
index <<
" " << node.
depth << endl;
359 o <<
"2dots_tau0" << endl;
360 o << 0 <<
" " << node.
du1 <<
" " << node.
dv1 <<
" " << node.
du2 <<
" " << node.
dv2 << endl;
376 char dummyString[1000];
377 char node_type[1000];
381 if (strcmp(node_type,
"LEAF") == 0)
408 else if (strcmp(node_type,
"NODE") == 0)
410 int _scale, _du1, _dv1, _du2, _dv2;
412 is >> node.index >> node.depth;
416 is >> _scale >> _du1 >> _dv1 >> _du2 >> _dv2;
419 node.children_index =
new int[node.children_number];
421 for(
int i = 0; i < node.children_number; i++)
422 is >> node.children_index[i];
426 cerr <<
"Error while reading image_classification_node (token = " << node_type <<
")." << endl;