Kinect虚拟试衣间开发(3)-拍照和声控功能

时间:2024-10-09 10:53:39
private void takephoto() { if (this.bitmap != null) { // Create a render target to which we'll render our composite image RenderTargetBitmap renderBitmap = new RenderTargetBitmap((int), (int), 96.0, 96.0, PixelFormats.Pbgra32); DrawingVisual dv = new DrawingVisual(); using (DrawingContext dc = ()) { VisualBrush brush = new VisualBrush(all); (brush, null, new Rect(new Point(), new Size(, ))); } (dv); // create a png bitmap encoder which knows how to save a .png file BitmapEncoder encoder = new PngBitmapEncoder(); // create frame from the writable bitmap and add to encoder ((renderBitmap)); string time = ("hh'-'mm'-'ss", ); string myPhotos = (); string path = (myPhotos, "KinectScreenshot-Color-" + time + ".png"); // write the new file to disk try { // FileStream is IDisposable using (FileStream fs = new FileStream(path, )) { (fs); } = "照片已保存到" + path; //("照片已保存到" + path); } catch (IOException) { = "照片保存失败"; //("照片保存失败"); } } }