我想將一個kinect深度傳感器圖像保存到一個PNG文件。我試圖用我的RGB相機,並沒有任何問題。有什麼我錯過了嗎? P.S.我正在使用Kinect ToolKit的rgb和深度圖像顯示功能。捕獲Kinect深度圖像到PNG文件
WriteableBitmap depthBitmap;
DepthStreamManager dsm;
dsm = new DepthStreamManager();
kinect.DepthStream.Enable(DepthImageFormat.Resolution640x480Fps30);
kinect.DepthFrameReady += kinect_DepthFrameReady;
depthBitmap = new WriteableBitmap(kinect.DepthStream.FrameWidth,this.kinect.DepthStream.FrameHeight, 96.0, 96.0, PixelFormats.Gray16, null);
private string TakeImage(int x)
{
if (x == 0)
{
BitmapEncoder encoder = new PngBitmapEncoder();
encoder.Frames.Add(BitmapFrame.Create(this.depthBitmap));
string myPhotos = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
string path = System.IO.Path.Combine(myPhotos, "Image 1.png");
try
{
using (FileStream fs = new FileStream(path, FileMode.Create))
{
encoder.Save(fs);
}
}
catch (IOException details)
{
Console.Write(details.ToString());
}
if (path == null)
return "Image was not taken.";
else
return path;
}}
什麼是順式'wmp = cis.Bitmap; ' 是來自某個庫的任何類對象...? 如果是這樣的庫?並參考solutioExplorer ..? 對不起,這是一個基本的問題,但我是新來的這個領域.. – kAmol