0
$\begingroup$

Rosanswers logo

Hello,

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" />
</node>

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:

header: 
  seq: 22480
  stamp: 
    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
roi: 
  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.

Code:

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))
            continue;
     ROS_INFO("point with coordinates %f, %f, %f", cloud_xyz.points[i].x, cloud_xyz.points[i].y, cloud_xyz.points[i].z);
     ROS_INFO("A");
     cv::Point3d point(cloud_xyz.points[i].x, cloud_xyz.points[i].y, cloud_xyz.points[i].z);
     ROS_INFO("B");
     pixel = cam_model.project3dToPixel(point);

Trace:

[ 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

Raph


Originally posted by raphael favier on ROS Answers with karma: 1382 on 2011-05-19

Post score: 1


Original comments

Comment by Asomerville on 2011-05-20:
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.

Comment by raphael favier on 2011-05-19:
I followed your method but I haven't any "core" folder or file in my ~/.ros folder. Any idea?

Comment by Asomerville on 2011-05-19:
actually see this post here if you just want the stack trace without having to modify anything: http://answers.ros.org/question/910/is-there-functionality-built-into-ros-to-get-nodes

Comment by Eric Perko on 2011-05-19:
Use GDB ( http://www.ros.org/wiki/roslaunch/Tutorials/Roslaunch%20Nodes%20in%20Valgrind%20or%20GDB ) , 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.

Comment by raphael favier on 2011-05-19:
Noob question: any tool you advise for this?

Comment by Asomerville on 2011-05-19:
I don't know off hand, but might be able to tell you with a stacktrace.

Comment by brice rebsamen on 2013-07-09:
Hi. Have you made any progress with the ladybug? I'm trying to setup mine and I'd gladly learn from your experience.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by Eric Perko with karma: 8406 on 2011-05-19

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by Eric Perko on 2011-05-19:
Ah.. then that fromcamerainfo should most likely return false in your case :). Also, do post back with a link to the relevant ticket.

Comment by raphael favier on 2011-05-19:
thx for this info, ill post the ticket. Also fromcamerainfo returns a bool that was true in my case.

$\endgroup$

Your Answer

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