Is there a way to simulate camera depth of field in Gazebo? [closed]

asked 2020-05-06 13:38:55 -0500

McGroto gravatar image

updated 2022-01-22 16:10:32 -0500

Evgeny gravatar image

Simply put, I am trying to create a realistic camera simulation that includes making objects that are out of focus blurry. There does not seem to be any documentation online of this being done though. I already have a camera model that publishes distorted image_raw topics for reference.

edit retag flag offensive reopen merge delete

Closed for the following reason Gazebo Question: The Gazebo community prefers to answer questions at: by gvdhoorn
close date 2020-05-06 13:45:04.310371


Seeing as you're specifically asking about Gazebo and how its sensor are simulated, I believe it would be better to ask your question over at

If/when you post there, please post a comment with a link here, so we can keep things connected.

gvdhoorn gravatar image gvdhoorn  ( 2020-05-06 13:45:52 -0500 )edit

Since its difficult for new users to comment on that thread in, @McGroto - did you find any answer elsewhere? I too am looking for focus control and aperture settings to control bokeh and depth of field, but it seems most answers online refer to gazebo only modelling a pinhole camera = infinite focal distance?

w00dw0rm gravatar image w00dw0rm  ( 2021-10-12 09:41:14 -0500 )edit

@w00dw0rm there is not an official way to do this in gazebo. I ended up defining the camera as a depth camera, then taking the raw images and depth images and making the depth of field effect in post processing. You can set this up yourself by subscribing to both topics and then performing a blurring operation once you have both.

If you come up with a better technique though I'd like to know!

McGroto gravatar image McGroto  ( 2021-10-12 18:29:03 -0500 )edit