Rosanswers logo

I'm trying to get my camera_node working, and it doesn't seem to be taking the parameters given into account at all.

My launch file (excerpt):


Output from rostopic echo /lifecam/camera_info

  seq: 463
    secs: 1303400952
    nsecs: 715715842
  frame_id: camera
height: 480
width: 640
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

Clearly the calibration data is not being read (thus a bunch of zeros in the camera_info message), and the width/height parameters are the defaults, not the values I set them to.

I'm not sure what I'm doing wrong here: I can view the image stream in rviz, but rviz will complain about NaNs and infs in the calibration data (since it's not being read). Help would be greatly appreciated.


$ cat rover/lifecam.yaml 
image_width: 640
image_height: 480
camera_name: camera
  rows: 3
  cols: 3
  data: [661.285, 0, 391.756, 0, 650.523, 205.652, 0, 0, 1]
distortion_model: plumb_bob
  rows: 1
  cols: 5
  data: [0.125743, 0.237875, -0.0083126, 0.0506531, 0]
  rows: 3
  cols: 3
  data: [1, 0, 0, 0, 1, 0, 0, 0, 1]
  rows: 3
  cols: 4
  data: [661.285, 0, 391.756, 0, 0, 650.523, 205.652, 0, 0, 0, 1, 0]

I just updated the above data as per Markus Bader's recommendations - doesn't seem to have worked. The camera was recalibrated, and it appears that it is certainly not reading the params set: when set_camera_info is called, it saves the data into /tmp/calibration.yaml, not the file set in the launchfile. Thanks for all the help!

-- EDIT -- This seems to be some sort of a weird rosparam problem - I just tried to set the parameters by editing the defaults in /opt/ros/diamondback/stacks/camera_umd/uvc_camera/src/camera.cpp, and calibration data and everything work from there.

Originally posted by rbtying on ROS Answers with karma: 73 on 2011-04-20

Post score: 0

Original comments

Comment by Ken on 2011-04-21:
The combination of nodelets and the explicit node name is triggering the problem. With e.g.: "ROS_NAMESPACE=camera rosrun uvc_camera camera_node _width:=800 _height:=600 __name:=lifecam" the /camera/lifecam/height param is set but getPrivateNode still has us looking at /camera/uvc_camera/height

Comment by rbtying on 2011-04-20:
Yes, I did - see above for the lifecam.ini

Comment by Eric Perko on 2011-04-20:
What does your lifecam.ini file look like? Did you calibrate using the camera_calibration package and "commit" the calibration to that file?


2 Answers 2


Rosanswers logo

It looks like you are setting the size of the image to something different than what you calibrated with. The lifecam.ini is calibrated for 640x480, but you have the camera configured for 320x240. The camera calibration size needs to match the size of the image; the camera_info_manager doesn't handle the current image size being different than the calibrated size if I recall correctly.

Try setting the camera to 640x480 and see if the problem still occurs. If not, try setting the resolution to 320x240 and then recalibrating and using the new file. A shortcut could be to just edit your calibration's width and height values, but there is no guarantee that the calibration will still be correct at the different image size.

Originally posted by Eric Perko with karma: 8406 on 2011-04-20

This answer was ACCEPTED on the original site

Post score: 1

Original comments

Comment by rbtying on 2011-04-20:
It's probably worth noting that it did accept the calibration from the cameracalibrator.py's 'commit', it just didn't keep it after the instance was killed | also that NONE of the params are being set - changing the frame doesn't work, nor the dimensions, nor the framerate.

Comment by rbtying on 2011-04-20:
I tried setting width/height to 640x480, as well as changing the ini file's parameters, but there's no change: the camera_info still says 640x480 (regardless of what I set height/width to in both the launch and ini files), and the other values are all zero.


Rosanswers logo


I see there also an other problem in your launch file. You should not use absolute paths like you did in accept you realy want that :-)

<remap from="/image_raw" to="/lifecam/image_raw"/>
<remap from="/camera_info" to="/lifecam/camera_info"/>
<remap from="/set_camera_info" to="/lifecam/set_camera_info"/>

Better is to go with a name space or without the starting slashes.

  <group ns="lifecam" >
    <node name="lifecam" pkg="uvc_camera" type="camera_node">
      <param name="device" type="string" value="/dev/video0"/>
      <param name="width" type="int" value="320"/>
      <param name="height" type="int" value="240"/>
      <param name="fps" type="int" value="10"/>

Originally posted by Markus Bader with karma: 847 on 2011-04-21

This answer was NOT ACCEPTED on the original site

Post score: 1


Your Answer

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