Save images kinect - 30fps
I have to record a dataset using the kinect, it should contains RBG images and depth images..
Using this code:
char filename[80];
int i=0,j=0;
void imageCallbackdepth(const sensor_msgs::ImageConstPtr& msg)
{
// convert message from ROS to openCV
cv_bridge::CvImagePtr cv_ptr;
try
{
cv_ptr = cv_bridge::toCvCopy(msg, sensor_msgs::image_encodings::TYPE_32FC1);
}
catch (cv_bridge::Exception& e)
{
ROS_ERROR("cv_bridge exception: %s", e.what());
return;
}
sprintf(filename,"depth_%d.png", i++);
cv::imwrite(filename,cv_ptr->image);
}
void imageCallbackrgb(const sensor_msgs::ImageConstPtr& msg)
{
//The same for RGB
}
I have a couple of questions:
How can I make sure that I'm saving images at 30fps? Am I not missing any frame? How can I change this parameter?
Saving RBG and depth at the same time and adding another sensor (stereocamera) doesn't effect that?
My program is correct, is it the right way to do this?