ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Camera_model segfault. Does it require a "real" camera_info not to crash?

asked 2011-05-19 04:36:29 -0600

raphael favier gravatar image

updated 2011-06-17 12:25:08 -0600

kwc gravatar image


I am working on a node that colors point clouds with a camera image. My strategy is to project each point on the camera image plane, and find the corresponding pixel color.

In order to do so, I use the image_geometry::PinholeCameraModel object that can initialize itself directly from a sensor_msgs::camera_info message via the function fromCameraInfo and project points via the function project3dToPixel.

The current setup I have consist of a labybug3 camera and a tilting hokuyo LRF. I haven't develop a proper driver for the camera, so for the moment, I am using the camera_1394 package using the following configuration:

<node pkg="camera1394" type="camera1394_node" name="ladybug" >
    <param name="guid" value="00b09d01009f01a2" />
    <param name="video_mode" value="1600x1200_mono8" />
    <param name="frame_id" value="ladybug0" />
    <param name="bayer_pattern" value="rggb" />
    <param name="auto_white_balance" value="2" />

As you can notice, I do not provide any calibration info, which result in uncalibrated camera_info messages. (from camera1394: If CameraInfo calibration is not available or is incompatible with the current video_mode, uncalibrated data will be provided instead.)

Which is indeed what I can observe with rostopic:

  seq: 22480
    secs: 1305821789
    nsecs: 356266975
  frame_id: /ladybug0
height: 1200
width: 1600
distortion_model: ''
D: []
K: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
R: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
P: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
binning_x: 0
binning_y: 0
  x_offset: 0
  y_offset: 0
  height: 0
  width: 0
  do_rectify: False

My problem is that I am able to initialize my camera model using those camera_info messages, but my program keeps crashing on the call to project3dToPixel.


cv::Point2d pixel;
pcl::PointCloud<pcl::PointXYZ> cloud_xyz;
for(int i = 0 ; i < (int) cloud_xyz.size(); i++)
     if (isnan (cloud_xyz.points[i].x) || isnan (cloud_xyz.points[i].y) || isnan (cloud_xyz.points[i].z))
     ROS_INFO("point with coordinates %f, %f, %f", cloud_xyz.points[i].x, cloud_xyz.points[i].y, cloud_xyz.points[i].z);
     cv::Point3d point(cloud_xyz.points[i].x, cloud_xyz.points[i].y, cloud_xyz.points[i].z);
     pixel = cam_model.project3dToPixel(point);


[ INFO] [1305820636.985045709]: point with coordinates 0.245843, -6.119996, 0.848742
[ INFO] [1305820636.985082376]: A
[ INFO] [1305820636.985117506]: B
Segmentation fault

I had a look inside image_geometry::PinholeCameraModel's documentation but I can't find any information on the case where the camera_info messages are 0.

My best guess so far is that the on calibrated camera_info message triggers the segfault at runtime. Does anyone has experience with this issue?

Thanks for your help


edit retag flag offensive close merge delete


I don't know off hand, but might be able to tell you with a stacktrace.
Asomerville gravatar image Asomerville  ( 2011-05-19 05:09:30 -0600 )edit
Noob question: any tool you advise for this?
raphael favier gravatar image raphael favier  ( 2011-05-19 05:21:53 -0600 )edit
Use GDB ( ) , when it starts type "run" if necessary and when it crashes, type "bt". If you do get a stacktrace, it would be good to attach to any ticket you create.
Eric Perko gravatar image Eric Perko  ( 2011-05-19 05:25:27 -0600 )edit
actually see this post here if you just want the stack trace without having to modify anything:
Asomerville gravatar image Asomerville  ( 2011-05-19 09:47:43 -0600 )edit
I followed your method but I haven't any "core" folder or file in my ~/.ros folder. Any idea?
raphael favier gravatar image raphael favier  ( 2011-05-19 23:19:59 -0600 )edit
You will have to reproduce the segfault to get the core. If you've done that, and it still doesn't show up, then I'm not sure. It should be there.
Asomerville gravatar image Asomerville  ( 2011-05-20 05:57:21 -0600 )edit

Hi. Have you made any progress with the ladybug? I'm trying to setup mine and I'd gladly learn from your experience.

brice rebsamen gravatar image brice rebsamen  ( 2013-07-09 11:34:03 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2011-05-19 05:24:13 -0600

Eric Perko gravatar image

You should file a ticket for this. The camera info message you see represents an uncalibrated camera, but is still a valid camera_info message. PinholeCameraModel should probably ROS_WARN or something when you attempt to make it with an uncalibrated or otherwise invalid camera_info message instead of segfaulting when it tries to apply that camera_info message.

On another note, you will have to provide a valid calibration in order for the PinholeCameraModel to use when projecting points to pixels.

edit flag offensive delete link more


thx for this info, ill post the ticket. Also fromcamerainfo returns a bool that was true in my case.
raphael favier gravatar image raphael favier  ( 2011-05-19 05:28:03 -0600 )edit
Ah.. then that fromcamerainfo should most likely return false in your case :). Also, do post back with a link to the relevant ticket.
Eric Perko gravatar image Eric Perko  ( 2011-05-19 14:00:37 -0600 )edit

Question Tools

1 follower


Asked: 2011-05-19 04:36:29 -0600

Seen: 437 times

Last updated: May 19 '11