How do i read a calibration file?

Hello,
I am creating an Opencv tutorial on how to extract the ground cordinates from lanemarkings detected in h264 videos by the LaneNet solution on the DrivePX2 - for educational purposes. For this I need to replicate the functionality of dwCalibratedCamera_pixel2Ray() in Opencv. There seems to be no documentation about this function nor the dwCalibratedCameraHandle_t which i need to pass to it. I cant even access the values of the calibrated camera object. The only way seems to be trying to go the theoretical way and solve it with inverse pinhole model. For that i need the intrinsic and extrinsic calibration matrix. All resources i have to find out what those matrices are, is a calibration file in json format which colleagues have generated with the camera calibration samples on the DrivePX2. These are the contents of the file:

{
“rig”: {
“sensors”: [
{
“correction_rig_T”: [
0.0,
0.0,
0.0
],
“correction_sensor_R_FLU”: {
“roll-pitch-yaw”: [
-6.00309633114193e-08,
-0.0,
0.0
]
},
“name”: “camera-0”,
“nominalSensor2Rig_FLU”: {
“roll-pitch-yaw”: [
2.87101459503174,
4.11304330825806,
1.50360453128815
],
“t”: [
1.79743587970734,
-0.30499255657196,
1.43192052841187
]
},
“parameter”: “”,
“properties”: {
“Model”: “ocam”,
“c”: “0.9989”,
“cx”: “960.00000”,
“cy”: “604.00000”,
“d”: “0.00000”,
“e”: “0.00000”,
“height”: “1208”,
“poly”: "9.83554382324219e+2 -6.92873308435082e-3 -4.18899755459279e-4 3.77428193587548e-7 -7.63053231711552e-10 ",
“width”: “1920”
},
“protocol”: “camera”
}
],
“vehicle”: {
“valid”: false,
“value”: {
“axlebaseFront”: 0.0,
“axlebaseRear”: 0.0,
“bumperFront”: 0.0,
“bumperRear”: 0.0,
“centerOfMassToRearAxle”: 0.0,
“frontCorneringStiffness”: 0.0,
“height”: 0.0,
“inertia”: 0.0,
“length”: 0.0,
“mass”: 0.0,
“rearCorneringStiffness”: 0.0,
“steeringCoefficient”: 0.0,
“wheelDiameter”: 0.0,
“wheelbase”: 0.0,
“width”: 0.0,
“widthWithMirrors”: 0.0
}
}
},
“version”: 2
}

From this i can see cx and cy intrinsic values but i dont know what the focal length is supposed to be. Is it c?
I assume that “poly” are the distortion coefficients, but that isnt clear either.
I couldnt find any documentation about this…
Also good would be if i could access implementation/detailed documentation of dwCalibratedCamera_pixel2Ray() and dwCalibratedCameraHandle_t.

Hello @gjorgji.nikolovski,

  1. Please look at the documentation here: /usr/local/driveworks-1.2/doc/nvdwx_html/dwx_rig_viewer_tool.html
    for rig viewer tool if that helps your purpose.
  2. Please look at the documentation here: /usr/local/driveworks-1.2/doc/nvdwx_html/rigconfiguration_usecase0.html
    where the rig file format is explained.

Note that cx and cy like the poly are properties of the camera optical model ocam that is supplied by the manufacturer:
/usr/local/driveworks-1.2/doc/nvdwx_html/group__rig__configuration__group.html#structdwOCamCameraConfig

Hope that helps

Hello,
Basically I managed to solve it indirectly with that, because i understood from it there is no way to get the infos I need from my calibration file.
The solution was to either recalibrate with a pinhole model setting in the samples, which also doesnt seem to exist from what I understood from forum posts,
read up the focal length in the camera specs if its specified
or calculate it with FOV: fx = (camera_pixel_width/2)/tan(fov_horizontal_degrees/2) and fy = (camera_pixel_height/2)/tan(fov_vertical_degrees/2)
Thanks for your reply.