43 #define BAD_RATING 1000.0
62 int num_chars = chunks[0] + 1;
71 for (
int i = 1; i <= num_chars; i++) {
72 last_blob = (i > chunks[0]) ? num_joints : first_blob + chunks[i];
74 char_widths->
widths[2*i-2] =
77 char_widths->
widths[2*i-1] =
82 tprintf(
"width_record[%d]s%d--s%d(%d) %d %d:%d\n",
83 i-1, first_blob, last_blob, chunks[i],
85 chunk_widths->
widths[2*last_blob+1]);
86 first_blob = last_blob + 1;
99 for (
int x = 0; x < wrec->
num_chars; x++) {
101 if (x == wrec->
num_chars - 1 && wh_ratio > 0.3)
114 for (
int x = 0; x < wrec->
num_chars - 1; x++) {
146 unsigned int mask = (num_joints > 32) ? (1 << (num_joints - 1 - 32))
147 : (1 << (num_joints - 1));
148 float seam_cost = 0.0f;
149 for (x = num_joints - 1; x >= 0; x--) {
150 int i = num_joints - 1 - x;
152 bool state_on = value & mask;
163 tprintf(
"seam_cost: %f\n", seam_cost);
178 BLOB_CHOICE_LIST *blob_choices;
179 BLOB_CHOICE_IT blob_choice_it;
180 inT16 first_chunk = 0;
188 for (
int x = 0; blob_chunks[x]; x++) {
189 last_chunk = first_chunk + blob_chunks[x];
191 blob_choices = chunks_record->
ratings->
get(first_chunk, last_chunk - 1);
192 if (blob_choices !=
NOT_CLASSIFIED && blob_choices->length() > 0) {
193 blob_choice_it.set_to_list(blob_choices);
194 ratings += (
inT16) blob_choice_it.data()->rating();
195 for (
int y = first_chunk; y < last_chunk; y++) {
199 first_chunk = last_chunk;
204 static_cast<FLOAT32>(weights);
206 tprintf(
"rating_cost: r%f / w%f = %f\n", ratings, weights, rating_cost);
237 normalizing_height = denorm.
y_scale() *
240 tprintf(
"WidthPriority: %f %f normalizing height = %f\n",
247 penalty += width_var;
251 for (
int x = 0; x < width_rec->
num_chars; x++) {
254 squat /= normalizing_height;
255 gap /= normalizing_height;
258 squat, 0.0
f, x == 0 || x == width_rec->
num_chars -1,
307 return width_cost * 1000 + shape_cost;
322 float seg_bias = 1.0;
323 if (width_cost < 1) seg_bias *= 0.85;
331 tprintf(
"SegCost: %g Weight: %g rating: %g width: %g seam: %g\n",
332 total_cost, seg_bias, shape_cost, width_cost, seam_cost);