public void updateKinectImages(string imageData) { if (!MainWindow.getUpdateGUI()) { return; } if (this.rgbImg.Dispatcher.Thread != Thread.CurrentThread) { this.rgbImg.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new updateKinectImagesCallback(this.updateKinectImages), imageData); } else { try { string[] imageDatas = imageData.Split('*'); StringCompressor s = new StringCompressor(); byte[] rgbData = s.DecompressByteArray(imageDatas[0]); byte[] depthDataByte = s.DecompressByteArray(imageDatas[1]); if (rgbData == null || depthDataByte == null) { this.infoTextBlock.Text = "Image reading ERROR!!" + Environment.NewLine + this.infoTextBlock.Text; return; } /* Transfer Byte Array Data back to WriteableBitmap*/ this.colorImageWritableBitmap.WritePixels( new Int32Rect(0, 0, 1920, 1080), rgbData, 7680, 0); this.depthImageWritableBitmap.WritePixels( new Int32Rect(0, 0, 512, 424), depthDataByte, 512, 0); this.rgbImg.Source = this.colorImageWritableBitmap; this.depthImg.Source = this.depthImageWritableBitmap; byte[] point3DDataByte = s.DecompressByteArray(imageDatas[2]); point3DArray = new float[point3DDataByte.Length * 3]; Buffer.BlockCopy(point3DDataByte, 0, point3DArray, 0, point3DDataByte.Length); if (parentGUI.cali != null) { parentGUI.cali.updateImages(); } } catch { this.infoTextBlock.Text = "Image reading ERROR!!" + Environment.NewLine + this.infoTextBlock.Text; } } }