Hi Isaac Sim team,
We want to import the OAK-D-SR-PoE camera into Isaac sim, but we are not managing to make the physical and simulated outputs match. We have used a simple setup to try and validate the outputs. More specifically we can see that the amount of space taken up by the box used in our experiments physically and in simulation do not line up, this is after setting up the simulated camera using the intrinsic values and distortion coefficients.
Setup for initial validation
Images are taken of a box at set distances. The images are then analyzed and finally the % of the image taken by the box is noted. The experiment is repeated in simulation using the same set distances and finally the % of the image taken up by the physical image is compared to that of the simulated. The idea is to validate that the camera parameters in the simulation roughly match those of the real camera, so we are not looking for millimeter precision.
- The distances tested are 30, 40, 50, 60, 70, 80 and 100cm and these are measured from the front of the camera to the box surface.
- The camera is also placed on a box lifting the middle of the camera lens 10.5cm.
- The box is kept roughly in the middle of the frame to our best ability.
- The camera intrinsic parameters from the physical camera is used in simulation.
- The camera distortion coefficients from the physical camera is used in simulation.
- The box is initially offset by box_thickness/2 in simulation to make sure the box and camera start exactly on top of eachother.
- We are aware that the actual focal point could be inside the camera housing and that this can mean an error of 1-2 cm since we are measuring from the front of the camera housing (we added this distance in simulation afterwards to check and it makes such a small difference in the % space the box takes up that we are confident it is not the source of the discrepancy between real and simulated images).
Camera specifications
These are from the Luxonis page. The bold specs are the ones used in the script to create the simulated camera together with the camera intrinsic values and distortion coefficients.
Camera Specs | Stereo pair / Color | ToF |
---|---|---|
Sensor | OV9782 (color, PY074) | 33D ToF |
DFOV / HFOV / VFOV | 89.5° / 80° / 55° | 82.3° / 70° / 54.7° |
Resolution | 1MP (1280x800) | VGA (640x480) |
Range / Focus | FF: 20cm - ∞ | 20cm - 5m |
Max Framerate | 120 FPS (800P) | 30 FPS (VGA) |
Pixel size | 3µm x 3µm | 7µm x 7µm |
Lens size | 1/4 inch | 1/3.2 inch |
F-number | 2.0 ±5% | 1.45 ± 5% |
Effective Focal Length | 2.35mm | N/A |
Camera matrix
Summary
[[805.8621215820312, 0.0, 651.9990844726562], [0.0, 805.4034423828125, 412.4564208984375], [0.0, 0.0, 1.0]]
Distortion coefficients
Summary
k1: -9.155631065368652
k2: 91.02870178222656
p1: -0.002392938593402505
p2: 0.00018919834110420197
k3: -58.8187255859375
k4: -9.20724105834961
k5: 90.6237564086914
k6: -57.472503662109375
s1: 0.0
s2: 0.0
s3: 0.0
s4: 0.0
τx: 0.0
τy: 0.0
FOV
RGB FOV 71.86000061035156, Mono FOV 71.86000061035156. These were reported by the Luxonis calibration read script and we do not know what they are for, we simply used the documented FOVs in the camera specifications.
Script for defining camera specification
The script is a slight modification to the one in the Isaac Sim official camera documentation. We changed the division factor from 10 to 100 for the camera.set_focal_length as the documentation said it should be 1/10 of scene units.
from omni.isaac.sensor import Camera
from omni.isaac.core import World
my_world = World(stage_units_in_meters=1.0)
camera = Camera(prim_path="/World/camera")
camera.initialize()
# Camera example
width, height = 1280, 800
camera_matrix = [[805.8621215820312, 0.0, 651.9990844726562], [0.0, 805.4034423828125, 412.4564208984375], [0.0, 0.0, 1.0]]
pixel_size = 3 * 1e-3
f_stop = 2.0
focus_distance = 0.2
((fx,_,cx),(_,fy,cy),(_,_,_)) = camera_matrix
horizontal_aperture = pixel_size * width
vertical_aperture = pixel_size * height
focal_length_x = fx * pixel_size
focal_length_y = fy * pixel_size
focal_length = (focal_length_x + focal_length_y) / 2
camera.set_focal_length(focal_length / 100.0)
#camera.set_focus_distance(focus_distance)
camera.set_focus_distance(0.2)
camera.set_lens_aperture(f_stop * 100.0)
camera.set_horizontal_aperture(horizontal_aperture / 100.0)
camera.set_vertical_aperture(vertical_aperture / 100.0)
camera.set_clipping_range(0.05, 1.0e5)
diagonal_fov = 89.5 # from documentation of camera
camera.set_projection_type("fisheyePolynomial")
distortion_coefficients = [ -9.155631065368652, 91.02870178222656, -0.002392938593402505, 0.00018919834110420197, -58.8187255859375, -9.20724105834961, 90.6237564086914, -57.472503662109375]
camera.set_rational_polynomial_properties(width, height, cx, cy, diagonal_fov, distortion_coefficients)
Experiment results
Not including 60cm, 70cm and 80cm to keep post shorter. As you can see the amount of image that is taken up by the carton box do noes not match between the real and simulated images, we have checked and double checked that the camera parameters match but have not been able to identify what is going wrong.
30cm
40cm
50cm
100cm
Camera property inside Isaac Sim
Here are the raw values for the camera in simulation after setting everything up, I have not been successful in identifying which params are going wrong here, hopefully you can help clear it up for us. We used the camera documentation to create the camera using the polynomial f-theta model.
Can you help us match our simulated camera to the real-world one?
Thanks!