ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
You can get a depth image suscribing to the ROS topic and using OpenCV to save the file
void kinectWindow::getDepthImageFromKinect(sensor_msgs::Image image)
{
cv_bridge::CvImagePtr cv_ptr(new cv_bridge::CvImage);
if (frameCounter==6) {
char numstr[21]; // enough to hold all numbers up to 64-bits
sprintf(numstr, "%d", fileCounter);
std::string result = directory + name + numstr + ext;
cv::imwrite(result, (cv_ptr->image)*10);
frameCounter = 0;
fileCounter++;
} else {
frameCounter++;
}
}
Just initializate as string directory, name (filename), and desired extension (ext) and be sure to suscribe to the right topic... You can check how to suscribe to topics here