我们都知道OpenNI2与OpenCV可以通过Kinect获取深度与彩色图像。
但区别是OpenCV更强大满足需求更多,但是只能一帧一帧的保存。
而OpenNI2有一个videostream对象可以以视频类型保存数据。
因为我需要以视频类型保存数据,所以我选择OpenNI2来获取深度和彩色图像。
问题:
根据小斤(Kinect开发教程八:OpenNI2显示深度、彩色及融合图像)教程的代码:
<span style="font-family:Microsoft YaHei;">/*************************
OpenNI2 Deep, Color and Fusion Image
Author: Xin Chen, 2013.2
Blog: http://blog.csdn.net/chenxin_130
*************************/
#include <stdlib.h>
#include <iostream>
#include <string>
#include "OpenNI.h"
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
using namespace std;
using namespace cv;
using namespace openni;
void CheckOpenNIError( Status result, string status )
{
if( result != STATUS_OK )
cerr << status << " Error: " << OpenNI::getExtendedError() << endl;
}
int main( int argc, char** argv )
{
Status result = STATUS_OK;