捕获并存储深度图图像 [英] Capture and store depth map images

查看:70
本文介绍了捕获并存储深度图图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要帮助..

我想要一个示例代码每1秒捕获一次深度图图像并将其保存为JPEG图像文件..

i want a sample code to capture depth map image every 1 second and save it as JPEG image file..

然后将其与我的数据集 图片进行比较,如果它与其中一个图片相匹配,请执行* action *

then compare it with my data set image and if it match one of those images do *action*

I还需要另一个建议..

I need another suggestions too..

推荐答案

每秒捕获深度帧的最简单方法是连接到KinectSensor.OnDepthFrameReady事件并使用整数每帧计数一个。帧速率可能不稳定,因此如果您需要更高的精度,则应使用DispatcherTimer
,间隔为1秒,以设置一个标记,表示应捕获下一帧。

The easiest way to capture a depth frame every second is to hook up to the KinectSensor.OnDepthFrameReady Event and use an integer to count up by one each frame. The framerate may be unstable, so if you need more precision you should use a DispatcherTimer with an interval of 1 second to set a flag that the next frame shall be captured.

在C#中,第一个解决方案如下所示:

In C# the first solution would look like this:

int i = 0;
private void Kinect_DepthFrameReady(object sender, DepthFrameReadyEventArgs e)
        {
            i++;//increase the counter
            if (i<30) return;//only proceed every 30th frame
            i=0;//reset the counter
            //save the depth data...
            //compare with older datasets, maybe in a new thread
        }

您不应该将深度数据保存为JPEG文件!  JPEG用于图片(深度数据不同)并且它是压缩的,因此您不仅需要CPU电源来保存它,但你也松了一大笔信息!您应该将
(JSON)序列化,或以逗号分隔值保存到文本文件中。

You should not save the depth data to a JPEG file! JPEG is for pictures (depth data is different) and it is compressed, so you would not only need CPU power to save it, but also you loose a significant amout of information! You should save it either (JSON) serialized, or as comma seperated values into a text file.

欢呼!


这篇关于捕获并存储深度图图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆