本文整理汇总了C++中openni::Device::getSensorInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ Device::getSensorInfo方法的具体用法?C++ Device::getSensorInfo怎么用?C++ Device::getSensorInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openni::Device
的用法示例。
在下文中一共展示了Device::getSensorInfo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VideoException
openni::VideoMode OpenNi2Video::FindOpenNI2Mode(
openni::Device & device,
openni::SensorType sensorType,
int width, int height,
int fps, openni::PixelFormat fmt
) {
// Query supported modes for device
const openni::Array<openni::VideoMode>& modes =
device.getSensorInfo(sensorType)->getSupportedVideoModes();
// Select last listed mode which matches parameters
int best_mode = -1;
for(int i = 0; i < modes.getSize(); i++) {
if( (!width || modes[i].getResolutionX() == width) &&
(!height || modes[i].getResolutionY() == height) &&
(!fps || modes[i].getFps() == fps) &&
(!fmt || modes[i].getPixelFormat() == fmt)
) {
best_mode = i;
}
}
if(best_mode >= 0) {
return modes[best_mode];
}
throw pangolin::VideoException("Video mode not supported");
}
示例2: openStream
int openStream(openni::Device& device, const char* name, openni::SensorType sensorType, SensorOpenType openType, openni::VideoStream& stream, const openni::SensorInfo** ppSensorInfo, bool* pbIsStreamOn)
{
*ppSensorInfo = device.getSensorInfo(sensorType);
*pbIsStreamOn = false;
if (openType == SENSOR_OFF)
{
return 0;
}
if (*ppSensorInfo == NULL)
{
if (openType == SENSOR_ON)
{
printf("No %s sensor available\n", name);
return -1;
}
else
{
return 0;
}
}
openni::Status nRetVal = stream.create(device, sensorType);
if (nRetVal != openni::STATUS_OK)
{
if (openType == SENSOR_ON)
{
printf("Failed to create %s stream:\n%s\n", openni::OpenNI::getExtendedError(), name);
return -2;
}
else
{
return 0;
}
}
nRetVal = stream.start();
if (nRetVal != openni::STATUS_OK)
{
stream.destroy();
if (openType == SENSOR_ON)
{
printf("Failed to start depth stream:\n%s\n", openni::OpenNI::getExtendedError());
return -3;
}
else
{
return 0;
}
}
*pbIsStreamOn = true;
return 0;
}
示例3: openCommon
void openCommon(openni::Device& device, bool defaultRightColor)
{
XnStatus nRetVal = XN_STATUS_OK;
g_bIsDepthOn = false;
g_bIsColorOn = false;
g_bIsIROn = false;
g_depthSensorInfo = device.getSensorInfo(openni::SENSOR_DEPTH);
g_colorSensorInfo = device.getSensorInfo(openni::SENSOR_COLOR);
g_irSensorInfo = device.getSensorInfo(openni::SENSOR_IR);
if (g_depthSensorInfo != NULL)
{
nRetVal = g_depthStream.create(device, openni::SENSOR_DEPTH);
if (nRetVal != openni::STATUS_OK)
{
printf("Failed to create depth stream:\n%s\n", openni::OpenNI::getExtendedError());
return;
}
nRetVal = g_depthStream.start();
if (nRetVal != openni::STATUS_OK)
{
printf("Failed to start depth stream:\n%s\n", openni::OpenNI::getExtendedError());
g_depthStream.destroy();
return;
}
g_bIsDepthOn = true;
}
if (g_colorSensorInfo != NULL)
{
nRetVal = g_colorStream.create(device, openni::SENSOR_COLOR);
if (nRetVal != openni::STATUS_OK)
{
printf("Failed to create color stream:\n%s\n", openni::OpenNI::getExtendedError());
return;
}
if (defaultRightColor)
{
nRetVal = g_colorStream.start();
if (nRetVal != openni::STATUS_OK)
{
printf("Failed to start color stream:\n%s\n", openni::OpenNI::getExtendedError());
g_colorStream.destroy();
return;
}
g_bIsColorOn = true;
}
}
if (g_irSensorInfo != NULL)
{
nRetVal = g_irStream.create(device, openni::SENSOR_IR);
if (nRetVal != openni::STATUS_OK)
{
printf("Failed to create IR stream:\n%s\n", openni::OpenNI::getExtendedError());
return;
}
if (!g_bIsColorOn)
{
nRetVal = g_irStream.start();
if (nRetVal != openni::STATUS_OK)
{
printf("Failed to start IR stream:\n%s\n", openni::OpenNI::getExtendedError());
g_irStream.destroy();
return;
}
g_bIsIROn = true;
}
}
initConstants();
readFrame();
}