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

Revision history [back]

click to hide/show revision 1
initial version

Hello Paul!

Somewhere within the gazebo robot configuration you will find the camera parameters like the following:

<sensor:camera name="cam_front_sensor">
  <imageSize>640 480</imageSize>
  <imageFormat>B8G8R8</imageFormat>
  <hfov>90</hfov>
  <nearClip>0.1</nearClip>
  <farClip>100</farClip>
  <updateRate>20.0</updateRate>
  .....
</sensor:camera>

You can compute the focal length with

f = (width/2) / tan( deg2rad(hfov)/2)

Don't forget to convert the angle to radiant

Greetings Markus Gazebo camera FOV vs. focal length

Hello Paul!

Somewhere within the gazebo robot configuration you will find the camera parameters like the following:

<sensor:camera name="cam_front_sensor">
  <imageSize>640 480</imageSize>
  <imageFormat>B8G8R8</imageFormat>
  <hfov>90</hfov>
  <nearClip>0.1</nearClip>
  <farClip>100</farClip>
  <updateRate>20.0</updateRate>
  .....
</sensor:camera>

You can compute the focal length with

f = (width/2) / tan( deg2rad(hfov)/2)deg2rad(hfov)/2) = (640/2) / tan(deg2rad(90)/2) = 320

The example above will give you a focal length of 320. Don't forget to convert the angle to radiant

Greetings Markus Gazebo camera FOV vs. focal length

Hello Paul!

Somewhere within the gazebo robot configuration you will find the camera parameters like the following:following: Changing the hfov will change you the field of view :-)

<sensor:camera name="cam_front_sensor">
  <imageSize>640 480</imageSize>
  <imageFormat>B8G8R8</imageFormat>
  <hfov>90</hfov>
  <nearClip>0.1</nearClip>
  <farClip>100</farClip>
  <updateRate>20.0</updateRate>
  .....
</sensor:camera>

You can compute the focal length with

f = (width/2) / tan( deg2rad(hfov)/2) = (640/2) / tan(deg2rad(90)/2) = 320

The example above will give you a focal length of 320. Don't forget to convert the angle to radiant

Greetings Markus Gazebo camera FOV vs. focal length