-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ASUS Xtion Pro support with OpenNI2 #757
Comments
I did some digging. Let me give the punchline first pcl::io::openni2::OpenNI2Device::getDefaultColorMode () const
{
// Search for and return VGA@30 Hz mode
vector<OpenNI2VideoMode> modeList = getSupportedColorVideoModes ();
for (vector<OpenNI2VideoMode>::iterator modeItr = modeList.begin (); modeItr != modeList.end (); modeItr++)
{
OpenNI2VideoMode mode = *modeItr;
if ( (mode.x_resolution_ == 640) && (mode.y_resolution_ == 480) && (mode.frame_rate_ == 30.0) )
return mode;
}
return (modeList.at (0)); // <<<<-----BADUM-TSCH
} Now for the details getDefaultColorMode() calls getSupportedColorVideoModes() . Which is the relevant function where the problem starts. pcl::io::openni2::OpenNI2Device::getSupportedColorVideoModes () const
{
boost::shared_ptr<openni::VideoStream> stream = getColorVideoStream ();
color_video_modes_.clear ();
if (stream)
{
const openni::SensorInfo& sensor_info = stream->getSensorInfo ();
color_video_modes_ = openniModeToGrabberMode (sensor_info.getSupportedVideoModes ());
}
return (color_video_modes_);
} getColorVideoStream() will actually check if the camera has a color stream and return Going back up to setColorVideoMode() isn't important here because it does nothing if it doesn't have a stream anyway. The problem is the empty vector dereference. This is a bug, there needs to be some array size checking when dereferencing or an |
Hi @akshmakov I think this is really old code, so it would be great if you can send a pull request with a fix, thanks for digging into it :). |
Marking this as stale due to 30 days of inactivity. It will be closed in 7 days if no further activity occurs. |
I've just compiled from source enabling
BUILD_OPENNI2
andWITH_OPENNI2
CMake variables.I'm using the ASUS Xtion Pro with no RGB camera. When I create a
pcl::io::openni2::OpenNI2DeviceManager
object and I use itsgetAnyDevice()
method my application crash because it is trying to perform this line of the file openni2_device.cpp:setColorVideoMode (getDefaultColorMode ())
I think that here there should be a check if the device support color or not.
Am I right?
here is a code sample:
The text was updated successfully, but these errors were encountered: