Gazebo | Ignition | Community
Ask Your Question
2

RGBD camera noise model

asked 2015-10-09 02:20:07 -0500

I saw there are many sensor models and plugins in order to simulate an RGB camera (either Asus, Kinect, etc). However, I do not see any way to include noise in both RGB and Depth, neither in Gazebo nor in the available plugins. I tried the <noise> tag in the sensor but it seems to have no effect.

Is there any gazebo_ros plugin (or Gazebo plugin) somewhere to simulate the RGB camera more accurately?

Thank you!

For completeness, I include the part of the sensor of my model:

    <sensor type="depth" name="rgbd_camera">
        <camera>
            <horizontal_fov>1.047</horizontal_fov>
            <image>
                <width>640</width>
                <height>480</height>
                <format>R8G8B8</format>
            </image>
            <clip>
                <near>0.05</near>
                <far>30</far>
            </clip>
            <noise>   <!-- This does apparently nothing neither RGB nor depth-->
                <type>gaussian</type>
                <mean>0.0</mean>
                <stddev>5.0</stddev>
            </noise>
        </camera>
        <update_rate>30.0</update_rate>
        <always_on>1</always_on>
        <plugin name="multirotor_rgbd_plugin" filename="libgazebo_ros_openni_kinect.so">
            <imageTopicName>rgb/image_raw</imageTopicName>
            <cameraInfoTopicName>rgb/camera_info</cameraInfoTopicName>
            <pointCloudTopicName>depth/points</pointCloudTopicName>
            <depthImageTopicName>depth/image_raw</depthImageTopicName>
            <depthImageCameraInfoTopicName>depth/camera_info</depthImageCameraInfoTopicName>
            <pointCloudCutoff>0.4</pointCloudCutoff>
            <pointCloudCutoffMax>5.0</pointCloudCutoffMax>
            <frameName>rgbd_camera_link</frameName>
            <cameraName>rgbd_camera</cameraName>
            <updateRate>30.0</updateRate>
        </plugin>
    </sensor>
edit retag flag offensive close merge delete

Comments

Any ideas anyone?

asdfjkl gravatar imageasdfjkl ( 2016-05-26 18:43:36 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2016-05-27 11:10:03 -0500

nkoenig gravatar image

You will need to implement your own plugin to add depth noise.

edit flag offensive delete link more

Comments

Hi @nkoenig Is it the recommended way to achieve this? I think someone can simply add noise to camera sensor using noise model. http://bit.ly/2j886ck But this feature is aparently not available in DepthCamera sensor. http://bit.ly/2k4DKH7 Any specific reasons to omit that or can we expect this feature in a future release? Note: This requirement is also reported in https://bitbucket.org/osrf/gazebo/issues/2125/depth-sensor-noise-model

AravindaDP gravatar imageAravindaDP ( 2017-01-26 07:55:18 -0500 )edit

Hi, did you manage to add noise to the depth point cloud? If so, did you write your own plugin or did you find another (easier) way? I'm stuck at the same problem.

RedJohn gravatar imageRedJohn ( 2018-06-01 08:06:12 -0500 )edit
0

answered 2018-07-12 03:57:46 -0500

RedJohn gravatar image

updated 2018-07-12 03:59:03 -0500

I had to add my own implementation to add noise to a depth image from a kinect camera. I did this in my python program, not in a custom C++ sensor plugin. I simply added some gaussian noise to it and set some random pixels to zero. Can't really tell if this is a good solution or anyhow approximating the noise of a real camera, but anyway this is how I've done it:

data = rospy.wait_for_message('/camera/depth/image_raw', Image, timeout=5)
# change encoding of the image
bridge = CvBridge()
cv_image = bridge.imgmsg_to_cv2(data, desired_encoding="32FC1")
# convert to a numpy array
image = np.array(cv_image, dtype=np.float)
# adding noise to (simulated) depth image
image = image + np.random.normal(0.0, 10.0, image.shape)
# set approx. 5% of all pixels to zero
mask = (np.random.uniform(0,1,size=image.shape) > 0.95).astype(np.bool)
image[mask] = 0
# normalizing image
cv2.normalize(image, image, 0, 255, cv2.NORM_MINMAX)
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-10-09 02:20:07 -0500

Seen: 3,243 times

Last updated: Jul 12 '18