Hi there
I am simulating a stereo camera in gazebo and am working on the depth ground truth from a depth camera. These two sensor have different fovs.
Left (reference) stereo camera:
<sensor name="camera_sensor_right" type="camera">
<pose >0.112 0 -0.052 0.0099771 1.5970566 1.5671158 </pose>
<always_on>1</always_on>
<update_rate>35</update_rate>
<topic>camera/image_right</topic>
<camera name="OV7521">
<lens>
<type>stereographic</type> <!-- Type of the lens mapping -->
<scale_to_hfov>true</scale_to_hfov> <!-- If true the image will be scaled to fit horizontal FOV -->
<cutoff_angle>3.14</cutoff_angle> <!-- camera angle outside of which everything is hidden -->
<env_texture_size>640</env_texture_size> <!-- resolution of the cubemap texture -> image sharpness (default : 256)-->
<intrinsics>
<fx>256.666691776 </fx> <!-- in pixels (default : 257.1726164141661) -->
<fy>254.19732909</fy> <!-- in pixels (default : 254.75785544530143) -->
<cx>353.781709595</cx> <!-- in pixels (default : 354.04231531997004) -->
<cy>236.287076</cy> <!-- in pixels (default : 235.46582540891967) -->
</intrinsics>
</lens>
<!--distortion>
<k1>0.9322052742586934</k1--> <!-- field-of-view of the ideal fish-eye lens (FOV MODEL)-->
<!--center>0.552783921242578 0.492264741665797</center--> <!-- cx and cy in normalized coordinates -->
<!--/distortion-->
<image>
<width>640</width> <!-- in pixels (default : 640) -->
<height>480</height> <!-- in pixels (default : 480) -->
<format>R8G8B8</format>
<anti_aliasing>4</anti_aliasing>
</image>
<clip>
<near>0.001</near>
<far>300</far>
</clip>
<!-- Gaussian-sampled "output amplifier noise" between 0 and 1 added independently to each
color channel of each pixel & converted to an unsigned integer (0-255) in the image using 8
bits per channel via a GLSL shader (GPU required). -->
<noise>
<mean>0.0</mean>
<stddev>0.0</stddev> <!-- recommended value : 0.007-->
</noise>
<!--save enabled="true">
<path>/home/tanguy/dataset_ws/</path>
</save-->
</camera>
</sensor>
So I have a focal length fx of 256.667 (pixels) and a resolution in x direction of 640 pixels. Calculating the fov manually using the formula
FoV = 2 × arctan(w / 2f)
I get 102.534957338 degrees. Which converts to 1.789572604 radians.
Depth camera:
<sensor type="depth" name="GT">
<update_rate>35.0</update_rate>
<pose >0.02 0 -0.052 0.0099771 1.5970566 1.5671158 </pose>
<always_on>1</always_on>
<topic>camera/depth_GT</topic>
<camera name="GT_camera">
<horizontal_fov>1.789572604</horizontal_fov>
<image>
<width>640</width>
<height>480</height>
</image>
<clip>
<near>0.05</near>
<far>300</far>
</clip>
<noise>
<type>gaussian</type>
<!-- Noise is sampled independently per pixel on each frame.
That pixel's noise value is added to each of its color
channels, which at that point lie in the range [0,1]. -->
<mean>0.0</mean>
<stddev>0.000</stddev>
</noise>
</camera>
</sensor>
I noticed that using the parameters of focal length didn’t have any impact on the depth camera so I played around and found that manually setting the fov has an impact. I placed the calculated value but the images are still not aligned. (I also set the scale_to_hfov parameter to true for all of the cameras but still.
Here is an image of the result (left: left camera, right: depth camera gt at left position): (As can be seen the depth camera still seems a bit zoomed in compared to the reference image)
Thanks a lot for any ideas on this.
A few points that might help:
- I’m working with gazebo garden
- I’m using the gazebo-ros2 bridge and ros-ros2 bridge as my code will have to run on ros.