Created
April 3, 2015 21:45
-
-
Save andreinechaev/4cbbeb0c8803ae0e52f6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ConsoleApplication2.cpp : Defines the entry point for the console application. | |
// | |
#include "stdafx.h" | |
#include <pxcsensemanager.h> | |
#include <util_render.h> | |
int _tmain(int argc, _TCHAR* argv[]) | |
{ | |
// create the PXCSenseManager | |
PXCSenseManager *psm = 0; | |
psm = PXCSenseManager::CreateInstance(); | |
if (!psm) { | |
wprintf_s(L"Unable to create the PXCSenseManager\n"); | |
return 1; | |
} | |
//connect to all lenses/streams of camera | |
//(PXCCapture::StreamType, width=0, height=0, frameRate=0); | |
psm->EnableStream(PXCCapture::STREAM_TYPE_COLOR); | |
psm->EnableStream(PXCCapture::STREAM_TYPE_DEPTH); | |
psm->EnableStream(PXCCapture::STREAM_TYPE_IR); | |
// Manager initializing | |
psm->Init(); | |
//natural representation like in a mirror | |
psm->QueryCaptureManager()->QueryDevice()->SetMirrorMode(PXCCapture::Device::MirrorMode::MIRROR_MODE_HORIZONTAL); | |
//renderer(L"NAME OF THE WINDOW") | |
UtilRender renderColor(L"color"), renderDepth(L"depth"), renderIR(L"ir"); | |
while (true) { | |
//trying to get a frame (true - synchronize all streams) (false - show them as they come) | |
if (psm->AcquireFrame(true) < PXC_STATUS_NO_ERROR) break; | |
//retrieve sample | |
PXCCapture::Sample *sample = psm->QuerySample(); | |
if (sample) { | |
//render frame in the window | |
if (!renderColor.RenderFrame(sample->color)) break; | |
if (!renderDepth.RenderFrame(sample->depth)) break; | |
if (!renderIR.RenderFrame(sample->ir)) break; | |
} | |
psm->ReleaseFrame(); | |
} | |
// close the streams (if any) and release any session and processing module instances | |
psm->Release(); | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment