/* calculate x/y_move the spaceship */ void calculate_move(celestial_object *obj, int direction) { int deg; double cos_rad, sin_rad; /* Angle in degrees */ deg = (obj->rcSrc.x / obj->sprite_size) * 10; calculate_angle(deg, &cos_rad, &sin_rad); if (direction == FORWARD) { obj->x_move += cos_rad; obj->y_move += -sin_rad; obj->speed = fabsf(obj->x_move) + fabsf(obj->y_move); if (obj->speed > MAX_SPEED) { obj->x_move -= cos_rad; obj->y_move -= -sin_rad; } } if (direction == BACK) { obj->x_move -= cos_rad; obj->y_move -= -sin_rad; obj->speed = fabsf(obj->x_move) + fabsf(obj->y_move); if (obj->speed > MAX_SPEED) { obj->x_move += cos_rad; obj->y_move += -sin_rad; } } }
void calculate_shot(celestial_object *spaceship, celestial_object *bullet, int offset) { int deg; double cos_rad, sin_rad; /* Angle in degrees */ deg = (spaceship->rcSrc.x / spaceship->sprite_size) * 10 + offset; calculate_angle(deg, &cos_rad, &sin_rad); /* Multiplication for rounding precision */ bullet->x_move = cos_rad; bullet->y_move = sin_rad; }
// DataHandler receives data from the server void __cdecl DataHandler(sFrameOfMocapData* data, void* pUserData) { if (acommand.packet_counter != 4) { acommand.packet_counter++; return; } acommand.packet_counter = 0; NatNetClient* pClient = (NatNetClient*) pUserData; printf("Received frame %d\n", data->iFrame); if(fp) _WriteFrame(fp,data); int i=0; // same system latency test float fThisTick = (float)GetTickCount(); float fDiff = fThisTick - data->fLatency; double dDuration = fDiff; printf("Latency (same system) (msecs): %3.2lf\n", dDuration); // timecode // decode to values int hour, minute, second, frame, subframe; bool bValid = pClient->DecodeTimecode(data->Timecode, data->TimecodeSubframe, &hour, &minute, &second, &frame, &subframe); // decode to friendly string char szTimecode[128] = ""; pClient->TimecodeStringify(data->Timecode, data->TimecodeSubframe, szTimecode, 128); printf("Timecode : %s\n", szTimecode); // Other Markers printf("Other Markers [Count=%d]\n", data->nOtherMarkers); for(i=0; i < data->nOtherMarkers; i++) { printf("Other Marker %d : %3.2f\t%3.2f\t%3.2f\n", i, data->OtherMarkers[i][0], data->OtherMarkers[i][1], data->OtherMarkers[i][2]); } // Rigid Bodies printf("Rigid Bodies [Count=%d]\n", data->nRigidBodies); double theta = calculate_angle(data->RigidBodies[0], data->RigidBodies[1], data->RigidBodies[2]); double dist_calc = calculate_distance(data->RigidBodies[0], data->RigidBodies[3]); printf("\n\n\nAngle is %Lf and distance is %Lf\n\n\n", theta*180/3.14, dist_calc); for(i=0; i < data->nRigidBodies; i++) { //location_data[i] = data->RigidBodies[i]; printf("Rigid Body [ID=%d Error=%3.2f]\n", data->RigidBodies[i].ID, data->RigidBodies[i].MeanError); printf("\tx\ty\tz\tqx\tqy\tqz\tqw\n"); printf("\t%3.2f\t%3.2f\t%3.2f\t%3.2f\t%3.2f\t%3.2f\t%3.2f\n", data->RigidBodies[i].x, data->RigidBodies[i].y, data->RigidBodies[i].z, data->RigidBodies[i].qx, data->RigidBodies[i].qy, data->RigidBodies[i].qz, data->RigidBodies[i].qw); printf("\tRigid body markers [Count=%d]\n", data->RigidBodies[i].nMarkers); for(int iMarker=0; iMarker < data->RigidBodies[i].nMarkers; iMarker++) { printf("\t\t"); if(data->RigidBodies[i].MarkerIDs) printf("MarkerID:%d", data->RigidBodies[i].MarkerIDs[iMarker]); if(data->RigidBodies[i].MarkerSizes) printf("\tMarkerSize:%3.2f", data->RigidBodies[i].MarkerSizes[iMarker]); if(data->RigidBodies[i].Markers) printf("\tMarkerPos:%3.2f,%3.2f,%3.2f\n" , data->RigidBodies[i].Markers[iMarker][0], data->RigidBodies[i].Markers[iMarker][1], data->RigidBodies[i].Markers[iMarker][2]); } } // skeletons printf("Skeletons [Count=%d]\n", data->nSkeletons); for(i=0; i < data->nSkeletons; i++) { sSkeletonData skData = data->Skeletons[i]; printf("Skeleton [ID=%d Bone count=%d]\n", skData.skeletonID, skData.nRigidBodies); for(int j=0; j< skData.nRigidBodies; j++) { sRigidBodyData rbData = skData.RigidBodyData[j]; printf("Bone %d\t%3.2f\t%3.2f\t%3.2f\t%3.2f\t%3.2f\t%3.2f\t%3.2f\n", rbData.ID, rbData.x, rbData.y, rbData.z, rbData.qx, rbData.qy, rbData.qz, rbData.qw ); printf("\tRigid body markers [Count=%d]\n", rbData.nMarkers); for(int iMarker=0; iMarker < data->RigidBodies[i].nMarkers; iMarker++) { printf("\t\t"); if(rbData.MarkerIDs) printf("MarkerID:%d", rbData.MarkerIDs[iMarker]); if(rbData.MarkerSizes) printf("\tMarkerSize:%3.2f", rbData.MarkerSizes[iMarker]); if(rbData.Markers) printf("\tMarkerPos:%3.2f,%3.2f,%3.2f\n" , data->RigidBodies[i].Markers[iMarker][0], data->RigidBodies[i].Markers[iMarker][1], data->RigidBodies[i].Markers[iMarker][2]); } } } // labeled markers printf("Labeled Markers [Count=%d]\n", data->nLabeledMarkers); for(i=0; i < data->nLabeledMarkers; i++) { sMarker marker = data->LabeledMarkers[i]; printf("Labeled Marker [ID=%d] [size=%3.2f] [pos=%3.2f,%3.2f,%3.2f]\n", marker.ID, marker.size, marker.x, marker.y, marker.z); } if (!init_called) { //init(); init_called = true; } EnterCriticalSection(&dest_cont.lock); int destination = dest_cont.dests[dest_cont.step_num]; int stn = dest_cont.step_num; int nsc = num_same_cmds; int num_dests = dest_cont.num_dests; LeaveCriticalSection(&dest_cont.lock); if (destination >0) { double angle_to_dest = calculate_angle(data->RigidBodies[0], data->RigidBodies[1], data->RigidBodies[destination]); double dist_to_dest = calculate_distance(data->RigidBodies[0], data->RigidBodies[destination]); printf("==================================== %f", dist_to_dest); printf("angle is %f", angle_to_dest); char return_val[1]; if (dist_to_dest < .4) { if (acommand.state != '0' || last_dest != destination) { acommand.cmd = '0'; send_cmd(NULL); last_dest = destination; //HANDLE thread = (HANDLE)::_beginthreadex(NULL, 0, send_cmd, &(acommand.cmd), 0, NULL); //state = '0'; EnterCriticalSection(&dest_cont.lock); dest_cont.step_num += 1; //dest_cont.num_dests -= 1; LeaveCriticalSection(&dest_cont.lock); num_same_cmds = 0; } else { num_same_cmds += 1; if (num_same_cmds > 20) { acommand.cmd = '0'; send_cmd(NULL); num_same_cmds = 0; } } //dest_cont.step_num += 1; return; } if ( angle_to_dest <165 ) { if (acommand.state != 'R') { acommand.cmd = 'R'; send_cmd(NULL); num_same_cmds = 0; //HANDLE thread = (HANDLE)::_beginthreadex(NULL, 0, send_cmd, &(acommand.cmd), 0, NULL); } else { num_same_cmds += 1; if (num_same_cmds > 20) { acommand.cmd = 'R'; send_cmd(NULL); num_same_cmds = 0; } } state = 'R'; return; } else if (angle_to_dest > 170) { if (acommand.state == 'R' || acommand.state == 'L') { acommand.cmd = '0'; send_cmd(NULL); num_same_cmds = 0; //HANDLE thread = (HANDLE)::_beginthreadex(NULL, 0, send_cmd, &(acommand.cmd), 0, NULL); //state = '0'; } else { if (acommand.state != 'D') { acommand.cmd = 'D'; send_cmd(NULL); num_same_cmds = 0; //HANDLE thread = (HANDLE)::_beginthreadex(NULL, 0, send_cmd, &(acommand.cmd), 0, NULL); } else { num_same_cmds += 1; if (num_same_cmds > 20) { acommand.cmd = 'D'; send_cmd(NULL); num_same_cmds = 0; } } //state = 'D'; } } } }
static void compute_fiducial_statistics( FidtrackerX *ft, FiducialX *f, Region *r, int width, int height ) { double all_x, all_y; double black_x, black_y; char *depth_string; ft->black_x_sum = 0.; ft->black_y_sum = 0.; ft->black_leaf_count = 0.; ft->white_x_sum = 0.; ft->white_y_sum = 0.; ft->white_leaf_count = 0.; ft->total_leaf_count = 0; ft->total_leaf_size = 0.; ft->average_leaf_size = 0.; // ft->min_leaf_width_or_height = 0x7FFFFFFF; set_depth( r, 0 ); sum_leaf_centers( ft, r, width, height ); ft->average_leaf_size = ft->total_leaf_size / (double)(ft->total_leaf_count); all_x = (double)(ft->black_x_sum + ft->white_x_sum) / (double)(ft->black_leaf_count + ft->white_leaf_count); all_y = (double)(ft->black_y_sum + ft->white_y_sum) / (double)(ft->black_leaf_count + ft->white_leaf_count); black_x = (double)ft->black_x_sum / (double)ft->black_leaf_count; black_y = (double)ft->black_y_sum / (double)ft->black_leaf_count; f->x = all_x; f->y = all_y; f->angle = (M_PI * 2) - calculate_angle( all_x - black_x, all_y - black_y ); f->leaf_size = (float)(ft->average_leaf_size); f->root_size = ((r->right-r->left)+(r->bottom-r->top))/2; /* print_unordered_depth_string( r ); printf( "\n" ); fflush( stdout ); */ /* // can differ due to fuzzy fiducial tracking assert( r->depth == 0 ); assert( r->descendent_count >= ft->min_target_root_descendent_count ); assert( r->descendent_count <= ft->max_target_root_descendent_count ); */ if(r->flags & LOST_SYMBOL_FLAG) f->id = INVALID_FIDUCIAL_ID; else { ft->next_depth_string = 0; depth_string = build_left_heavy_depth_string( ft, r ); ft->temp_coloured_depth_string[0] = (char)( r->colour ? 'w' : 'b' ); ft->temp_coloured_depth_string[1] = '\0'; strcat( ft->temp_coloured_depth_string, depth_string ); f->id = treestring_to_id( ft->treeidmap, ft->temp_coloured_depth_string ); /*if (f->id != INVALID_FIDUCIAL_ID) { if (!(check_leaf_variation(ft, r, width, height))) { f->id = INVALID_FIDUCIAL_ID; printf("filtered %f\n",ft->average_leaf_size); } }*/ } }
static void compute_fiducial_statistics( FidtrackerX *ft, FiducialX *f, Region *r, int width, int height ) { double all_x = 0.; double all_y = 0.; double black_x = 0.; double black_y = 0.; double all_x_warped = 0.; double all_y_warped = 0.; double black_x_warped = 0.; double black_y_warped = 0.; char *depth_string; ft->black_x_sum = 0.; ft->black_y_sum = 0.; ft->black_leaf_count = 0.; ft->white_x_sum = 0.; ft->white_y_sum = 0.; ft->white_leaf_count = 0.; ft->black_x_sum_warped = 0.; ft->black_y_sum_warped = 0.; ft->black_leaf_count_warped = 0.; ft->white_x_sum_warped = 0.; ft->white_y_sum_warped = 0.; ft->white_leaf_count_warped = 0.; ft->total_leaf_count = 0; ft->total_leaf_size = 0.; ft->average_leaf_size = 0.; // ft->min_leaf_width_or_height = 0x7FFFFFFF; set_depth( r, 0 ); sum_leaf_centers( ft, r, width, height ); if(ft->total_leaf_count<1 || ft->black_leaf_count<1 || ft->white_leaf_count<1) { //fprintf(stderr, "did not find any leafs (%d)!", ft->total_leaf_count); r->flags |= LOST_SYMBOL_FLAG; f->id = INVALID_FIDUCIAL_ID; return; } ft->average_leaf_size = ft->total_leaf_size / (double)(ft->total_leaf_count); all_x = (double)(ft->black_x_sum + ft->white_x_sum) / (double)(ft->black_leaf_count + ft->white_leaf_count); all_y = (double)(ft->black_y_sum + ft->white_y_sum) / (double)(ft->black_leaf_count + ft->white_leaf_count); black_x = (double)ft->black_x_sum / (double)ft->black_leaf_count; black_y = (double)ft->black_y_sum / (double)ft->black_leaf_count; if (ft->pixelwarp) { if (ft->total_leaf_count>(ft->black_leaf_count_warped+ft->white_leaf_count_warped)) { int pixel = width*(int)all_y+(int)all_x; if ((pixel>=0) && (pixel<width*height)) { all_x_warped = ft->pixelwarp[pixel].x; all_y_warped = ft->pixelwarp[pixel].y; if ((all_x_warped>0) || (all_y_warped>0)) { pixel = (int)black_y*width+(int)black_x; if ((pixel>=0) && (pixel<width*height)) { black_x_warped = ft->pixelwarp[pixel].x; black_y_warped = ft->pixelwarp[pixel].y; if ((black_x_warped>0) || (black_y_warped>0)) { f->angle = calculate_angle( all_x_warped - black_x_warped, all_y_warped - black_y_warped ); } else f->angle = 0.0f; } else f->angle = 0.0f; f->x = all_x_warped; f->y = all_y_warped; } else { f->x = 0.0f; f->y = 0.0f; f->angle = 0.0f; r->flags |= LOST_SYMBOL_FLAG; } } else r->flags |= LOST_SYMBOL_FLAG; } else { all_x_warped = (double)(ft->black_x_sum_warped + ft->white_x_sum_warped) / (double)(ft->black_leaf_count_warped + ft->white_leaf_count_warped); all_y_warped = (double)(ft->black_y_sum_warped + ft->white_y_sum_warped) / (double)(ft->black_leaf_count_warped + ft->white_leaf_count_warped); black_x_warped = (double)ft->black_x_sum_warped / (double)ft->black_leaf_count_warped; black_y_warped = (double)ft->black_y_sum_warped / (double)ft->black_leaf_count_warped; f->x = all_x_warped; f->y = all_y_warped; f->angle = calculate_angle( all_x_warped - black_x_warped, all_y_warped - black_y_warped ); } } else { f->x = all_x; f->y = all_y; f->angle = calculate_angle( all_x - black_x, all_y - black_y ); } //f->a = black_x; //f->b = black_y; f->leaf_size = (float)(ft->average_leaf_size); f->root_size = r->right-r->left; if ((r->bottom-r->top)>f->root_size) f->root_size = r->bottom-r->top; f->root_colour=r->colour; f->node_count=r->descendent_count; /* print_unordered_depth_string( r ); printf( "\n" ); fflush( stdout ); */ /* // can differ due to fuzzy fiducial tracking assert( r->depth == 0 ); assert( r->descendent_count >= ft->min_target_root_descendent_count ); assert( r->descendent_count <= ft->max_target_root_descendent_count ); */ if (r->flags & LOST_SYMBOL_FLAG) f->id = INVALID_FIDUCIAL_ID; else { ft->next_depth_string = 0; depth_string = build_left_heavy_depth_string( ft, r ); ft->temp_coloured_depth_string[0] = (char)( r->colour ? 'w' : 'b' ); ft->temp_coloured_depth_string[1] = '\0'; strcat( ft->temp_coloured_depth_string, depth_string ); f->id = treestring_to_id( ft->treeidmap, ft->temp_coloured_depth_string ); /*if (f->id != INVALID_FIDUCIAL_ID) { if (!(check_leaf_variation(ft, r, width, height))) { f->id = INVALID_FIDUCIAL_ID; printf("filtered %f\n",ft->average_leaf_size); } }*/ } }
void processlayers(psd_file_t f, struct psd_header *h) { int i, j = 0, c = 0; //char buf[7]; psd_bytes_t savepos; extern char *last_layer_name; if(listfile) fputs("assetlist = {\n", listfile); for(i = 0; i < h->nlayers; ++i){ struct layer_info *li = &h->linfo[i]; psd_pixels_t cols = li->right - li->left, rows = li->bottom - li->top; VERBOSE("\n layer %d (\"%s\"):\n", i, li->name); if(listfile && cols && rows){ if(numbered) fprintf(listfile, "\t\"%s\" = { pos={%4d,%4d}, size={%4u,%4u} }, -- %s\n", li->nameno, li->left, li->top, cols, rows, li->name); else fprintf(listfile, "\t\"%s\" = { pos={%4d,%4d}, size={%4u,%4u} },\n", li->name, li->left, li->top, cols, rows); } if(xml){ fputs("\t<LAYER NAME='", xml); fputsxml(li->name, xml); // FIXME: what encoding is this in? maybe PDF Latin? fprintf(xml, "' TOP='%d' LEFT='%d' BOTTOM='%d' RIGHT='%d' WIDTH='%u' HEIGHT='%u'>\n", li->top, li->left, li->bottom, li->right, cols, rows); } layerblendmode(f, 2, 1, &li->blend); last_layer_name = NULL; if(extra || unicode_filenames){ // Process 'additional data' (non-image layer data, // such as adjustments, effects, type tool). savepos = (psd_bytes_t)ftello(f); fseeko(f, li->additionalpos, SEEK_SET); g_lid = j; UNQUIET("Layer %d additional data:\n", i); doadditional(f, h, 2, li->additionallen); fseeko(f, savepos, SEEK_SET); // restore file position } li->unicode_name = last_layer_name; if (g_info.layers) { if (li->top || li->left || li->bottom || li->right) { if (!writepng) { if (is_photo(li->name)) { g_info.layers[j].type = LT_Photo; } strcpy(g_info.layers[j].name, li->name); g_info.layers[j].opacity = (float)li->blend.opacity / 255; g_info.layers[j].top = li->top; g_info.layers[j].left = li->left; g_info.layers[j].bottom = li->bottom; g_info.layers[j].right = li->right; g_info.layers[j].channels = li->channels; g_info.layers[j].bound.width = cols; g_info.layers[j].bound.height = rows; g_info.layers[j].center.x = (int)cols / 2 + li->left; g_info.layers[j].center.y = (int)rows / 2 + li->top; #ifdef VER_NO_1_0_0 g_info.layers[j].angle = 0; #else calculate_angle(&g_info.layers[j]); #endif } else { if (li->blend.clipping && j && !h->linfo[i - 1].blend.clipping && LT_Photo == g_info.layers[j].type) { g_info.layers[j - 1].type = LT_Mask; strcpy(g_info.layers[j].mid, g_info.layers[j - 1].lid); } } j++; } } doimage(f, li, unicode_filenames && last_layer_name ? last_layer_name : (numbered ? li->nameno : li->name), h); if(xml) fputs("\t</LAYER>\n\n", xml); } for (i = 0; i < g_info.count; i++) { if (g_info.layers[g_lid].canvas) { c = 1; break; } } if (!c) { g_info.layers[c].canvas = 1; } VERBOSE("## end of layer image data @ %ld\n", (long)ftello(f)); }
void compute_fiducial_statistics( FidtrackerX *ft, FiducialX *f, Region *r, int width, int height ) { double all_x = 0.; double all_y = 0.; double black_x = 0.; double black_y = 0.; double all_x_warped = 0.; double all_y_warped = 0.; double black_x_warped = 0.; double black_y_warped = 0.; char *depth_string; double black_average = 0.; double white_average = 0.; double leaf_variation = 10.; double black_variation = 10.; double white_variation = 10.; ft->black_x_sum = 0.; ft->black_y_sum = 0.; ft->black_leaf_count = 0.; ft->white_x_sum = 0.; ft->white_y_sum = 0.; ft->white_leaf_count = 0.; ft->black_x_sum_warped = 0.; ft->black_y_sum_warped = 0.; ft->black_leaf_count_warped = 0.; ft->white_x_sum_warped = 0.; ft->white_y_sum_warped = 0.; ft->white_leaf_count_warped = 0.; ft->total_leaf_count = 0; ft->white_leaf_size = 0; ft->black_leaf_size = 0; ft->white_leaf_nodes = 0; ft->black_leaf_nodes = 0; ft->min_black = 0xFFFF; ft->min_white = 0xFFFF; ft->max_black = 0; ft->max_white = 0; set_depth( r, 0 ); sum_leaf_centers( ft, r, width, height ); all_x = (double)(ft->black_x_sum + ft->white_x_sum) / (double)(ft->black_leaf_count + ft->white_leaf_count); all_y = (double)(ft->black_y_sum + ft->white_y_sum) / (double)(ft->black_leaf_count + ft->white_leaf_count); black_x = (double)ft->black_x_sum / (double)ft->black_leaf_count; black_y = (double)ft->black_y_sum / (double)ft->black_leaf_count; f->raw_x = all_x; f->raw_y = all_y; f->raw_a = calculate_angle( all_x - black_x, all_y - black_y ); if (ft->pixelwarp) { if (ft->total_leaf_count>(ft->black_leaf_count_warped+ft->white_leaf_count_warped)) { int pixel = width*(int)floor(all_y+.5f)+(int)floor(all_x+.5f); if ((pixel>=0) && (pixel<width*height)) { all_x_warped = ft->pixelwarp[pixel].x; all_y_warped = ft->pixelwarp[pixel].y; if ((all_x_warped>0) || (all_y_warped>0)) { pixel = width*(int)floor(black_y+.5f)+(int)floor(black_x+.5f); if ((pixel>=0) && (pixel<width*height)) { black_x_warped = ft->pixelwarp[pixel].x; black_y_warped = ft->pixelwarp[pixel].y; if ((black_x_warped>0) || (black_y_warped>0)) { f->angle = calculate_angle( all_x_warped - black_x_warped, all_y_warped - black_y_warped ); } else f->angle = 0.0f; } else f->angle = 0.0f; f->x = all_x_warped; f->y = all_y_warped; } else { f->x = 0.0f; f->y = 0.0f; f->angle = 0.0f; r->flags |= FUZZY_SYMBOL_FLAG; } } else r->flags |= FUZZY_SYMBOL_FLAG; } else { all_x_warped = (double)(ft->black_x_sum_warped + ft->white_x_sum_warped) / (double)(ft->black_leaf_count_warped + ft->white_leaf_count_warped); all_y_warped = (double)(ft->black_y_sum_warped + ft->white_y_sum_warped) / (double)(ft->black_leaf_count_warped + ft->white_leaf_count_warped); black_x_warped = (double)ft->black_x_sum_warped / (double)ft->black_leaf_count_warped; black_y_warped = (double)ft->black_y_sum_warped / (double)ft->black_leaf_count_warped; f->x = all_x_warped; f->y = all_y_warped; f->angle = calculate_angle( all_x_warped - black_x_warped, all_y_warped - black_y_warped ); } } else { f->x = f->raw_x; f->y = f->raw_y; f->angle = f->raw_a; } f->root = r; /* print_unordered_depth_string( r ); printf( "\n" ); fflush( stdout ); */ /* // can differ due to fuzzy fiducial tracking assert( r->depth == 0 ); assert( r->descendent_count >= ft->min_target_root_descendent_count ); assert( r->descendent_count <= ft->max_target_root_descendent_count ); */ if (ft->black_leaf_nodes>0) black_average=ft->black_leaf_size/ft->black_leaf_nodes; if (ft->white_leaf_nodes>0) white_average=ft->white_leaf_size/ft->white_leaf_nodes; if ((white_average>0) && (black_average>0)) { if (black_average>white_average) leaf_variation = black_average/white_average-1; else leaf_variation = white_average/black_average-1; if (ft->max_black>=ft->min_black) black_variation = (ft->max_black-ft->min_black)/black_average; //else printf("black %f %f\n",ft->max_black,ft->min_black); if (ft->max_white>=ft->min_white) white_variation = (ft->max_white-ft->min_white)/white_average; //else printf("white %f %f\n",ft->max_white,ft->min_white); } //printf("variation %f %f %f\n",leaf_variation,black_variation,white_variation); f->id = INVALID_FIDUCIAL_ID; // initialize if ((f->x<0) || (f->y<0)) return; // this can happen else if (r->flags & FUZZY_SYMBOL_FLAG) { // select fuzzy fiducials before decoding if ((ft->white_leaf_nodes>=ft->min_leafs) || (ft->black_leaf_nodes>=ft->min_leafs)) f->id = FUZZY_FIDUCIAL_ID; } else if ((leaf_variation>1.0f) && ((black_variation>1.0f) || (white_variation>1.0f))) { // eliminate noise if ((ft->white_leaf_nodes>ft->min_leafs) || (ft->black_leaf_nodes>ft->min_leafs)) f->id = FUZZY_FIDUCIAL_ID; } else { // decode valid fiducal candidates ft->next_depth_string = 0; depth_string = build_left_heavy_depth_string( ft, r ); ft->temp_coloured_depth_string[0] = (char)( r->colour ? 'w' : 'b' ); ft->temp_coloured_depth_string[1] = '\0'; strcat( ft->temp_coloured_depth_string, depth_string ); f->id = treestring_to_id( ft->treeidmap, ft->temp_coloured_depth_string ); if (f->id != INVALID_FIDUCIAL_ID) r->flags |= ROOT_REGION_FLAG; else if ((ft->white_leaf_nodes>=ft->min_leafs) || (ft->black_leaf_nodes>=ft->min_leafs)) f->id = FUZZY_FIDUCIAL_ID; //if (f->id != INVALID_FIDUCIAL_ID) printf("%d %s %f\n",f->id,ft->temp_coloured_depth_string,leaf_variation); } }