注:获取原始数据时,必须是ushort ,如果用short 则用opencv 的imwrite函数写入png会自动转为uint8 .
原始数据直接表示深度,单位mm,相机有效距离为200mm~1200mm,无穷远处为0
#include <pxcsensemanager.h>
#include <pxcsession.h>
#include "util_render.h"
#include <iostream>
#include <string>
#include <stdio.h>
#include <opencv2\opencv.hpp>
#define WIDTH 640
#define HEIGHT 480
using namespace cv;
using namespace std;
int main(int argc, char** argv)
{
UtilRender *renderColor = new UtilRender(L"COLOR_STREAM");
UtilRender *renderDepth = new UtilRender(L"DEPTH_STREAM");
PXCSenseManager *psm = 0;
psm = PXCSenseManager::CreateInstance();
if (!psm)
{
wprintf_s(L"Unabel to create the PXCSenseManager\n");
return 1;
}
psm->EnableStream(PXCCapture::STREAM_TYPE_COLOR, WIDTH, HEIGHT);
psm->EnableStream(PXCCapture::STREAM_TYPE_DEPTH, WIDTH, HEIGHT);
if (psm->Init