private static void DrawPredictionOverlay(ProcessorState state)
{
List<Tuple<byte,byte,byte>> label_colors = Util.GiveMeNColors(state.feature.num_classes_);
ResetOverlay(state);
// debug
int count_nonbackground = 0;
for (int i = 0; i < state.predict_labels_.Length; i++)
if (state.predict_labels_[i] != 0)
count_nonbackground++;
Debug.WriteLine("{0} non-backgrounds: ", count_nonbackground);
// end of debug
for (int y = state.crop.Value.Y; y <= state.crop.Value.Y + state.crop.Value.Height; y++)
{
for (int x = state.crop.Value.X; x <= state.crop.Value.X + state.crop.Value.Width; x++)
{
int depth_index = Util.toID(x, y, width, height, kDepthStride);
int predict_label = state.predict_labels_[depth_index];
int bitmap_index = depth_index * 4;
if (predict_label != (int)HandGestureFormat.Background)
{
state.overlay_bitmap_bits_[bitmap_index + 2] = (int)label_colors[predict_label].Item1;
state.overlay_bitmap_bits_[bitmap_index + 1] = (int)label_colors[predict_label].Item2;
state.overlay_bitmap_bits_[bitmap_index + 0] = (int)label_colors[predict_label].Item3;
}
}
}
state.overlay_start_.Value = true;
}