本文整理汇总了C++中openni::VideoStream::getSensorInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ VideoStream::getSensorInfo方法的具体用法?C++ VideoStream::getSensorInfo怎么用?C++ VideoStream::getSensorInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openni::VideoStream
的用法示例。
在下文中一共展示了VideoStream::getSensorInfo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setONI2StreamMode
/*
void openni::VideoMode::setResolution()
Setter function for the resolution of this VideoMode. Application use of this function is not recommended.
Instead, use SensorInfo::getSupportedVideoModes() to obtain a list of valid video modes
-- cited from OpenNI2 help. setResolution() is not recommended.
*/
bool setONI2StreamMode(openni::VideoStream& stream, int w, int h, int fps, openni::PixelFormat format){
//std::cout << "Ask mode: " << w << "x" << h << " " << fps << " fps. format " << format << std::endl;
bool found = false;
const openni::Array<openni::VideoMode>& modes = stream.getSensorInfo().getSupportedVideoModes();
for(int i = 0, i_end = modes.getSize();i < i_end;++i){
// std::cout << "Mode: " << modes[i].getResolutionX() << "x" << modes[i].getResolutionY() << " " << modes[i].getFps() << " fps. format " << modes[i].getPixelFormat() << std::endl;
if(modes[i].getResolutionX() != w){
continue;
}
if(modes[i].getResolutionY() != h){
continue;
}
if(modes[i].getFps() != fps){
continue;
}
if(modes[i].getPixelFormat() != format){
continue;
}
openni::Status rc = stream.setVideoMode(modes[i]);
if(rc != openni::STATUS_OK){
return false;
}
return true;
}
return false;
}
示例2: setONI2StreamMode
bool setONI2StreamMode(openni::VideoStream& stream, int w, int h, int fps, openni::PixelFormat format){
/*
void openni::VideoMode::setResolution()
Setter function for the resolution of this VideoMode. Application use of this function is not recommended.
Instead, use SensorInfo::getSupportedVideoModes() to obtain a list of valid video modes
-- cited from OpenNI2 help. setResolution() is not recommended.
*/
bool found = false;
const openni::Array<openni::VideoMode>& modes = stream.getSensorInfo().getSupportedVideoModes();
for(int i = 0, i_end = modes.getSize();i < i_end;++i){
if(modes[i].getResolutionX() != w){
continue;
}
if(modes[i].getResolutionY() != h){
continue;
}
if(modes[i].getPixelFormat() != format){
continue;
}
openni::Status rc = stream.setVideoMode(modes[i]);
if(rc != openni::STATUS_OK){
printf("%s:Couldn't find RGB stream:\n%s\n", __FUNCTION__, openni::OpenNI::getExtendedError());
return false;
}
return true;
}
return false;
}
示例3: printMode
void OpenNI2Interface::printModes(const openni::VideoStream& stream,const openni::VideoMode& requestedMode)
{
const auto& modes = stream.getSensorInfo().getSupportedVideoModes();
std::cout << "Requested mode:\n";
printMode(requestedMode);
std::cout << "Supported modes:\n";
for(int i = 0; i < modes.getSize(); i++)
{
printMode(modes[i]);
}
}
示例4:
bool OpenNI2Interface::isModeSupported(const openni::VideoStream& stream,const openni::VideoMode& mode)
{
const auto& modes = stream.getSensorInfo().getSupportedVideoModes();
for(int i = 0; i < modes.getSize(); i++)
{
if(modes[i].getResolutionX() == mode.getResolutionX() &&
modes[i].getResolutionY() == mode.getResolutionY() &&
modes[i].getFps() == mode.getFps() &&
modes[i].getPixelFormat() == mode.getPixelFormat())
{
return true;
}
}
return false;
}