public StreamView()
{
InitializeComponent();
pictureBoxOverlay.BackColor = Color.Transparent;
try
{
this.context = new Context(@".\Data\openniconfig.xml");
this.depth = context.FindExistingNode(NodeType.Depth) as DepthGenerator;
if (this.depth == null)
{
throw new Exception(@"Error in Data\openniconfig.xml. No depth node found.");
}
this.histogram = new int[this.depth.GetDeviceMaxDepth()];
MapOutputMode mapMode = this.depth.GetMapOutputMode();
this.bitmap = new Bitmap((int)mapMode.nXRes, (int)mapMode.nYRes, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
}
catch (Exception ex)
{
///
/// - todo: proper error logging here
///
MessageBox.Show("Error initializing OpenNI.");
MessageBox.Show(ex.Message);
this.Close();
}
}