0
$\begingroup$

Rosanswers logo

Hello. When I try right clicking the image window, from image:=/camera/depth/image, to save the image on jpeg format I get on my folder a totally black picture. I know it works on RGB images and on image:=/camera/depth/image_rect_raw. So any idea to get the image on jpeg format from image:=/camera/depth/image cuz it's way better than image:=/camera/depth/image_rect_raw.


Originally posted by Fer Nunez on ROS Answers with karma: 11 on 2012-08-22

Post score: 0

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

Neither of those is an image in the JPEG sense. They are depth images.

If you want the RGB camera image, use one of these topics (or the rectified versions):

  • camera/rgb/image_mono
  • camera/rgb/image_color

See REP-0118 for details.


Originally posted by joq with karma: 25443 on 2012-08-22

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$
0
$\begingroup$

Rosanswers logo

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


Originally posted by Luis Parra with karma: 11 on 2012-09-19

This answer was NOT ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.