Access intrinsic camera parameters

I’ve been told that all new Orbbec cameras are factory calibrated and that there is no need to do the calibration. I want to access the parameters. I found the extended API that is supposed to give access to these through “g_device”. None of the samples use a “device” to access the cameras. Is it an OpenNI device or an AstraSDK device? Can someone PLEASE give a code snippet that shows how to initialize a device variable that will give parameter access?

I believe it is in the Astra SDK. I ended up using openNI because Astra was not supported for arm64 in ubuntu. Here is what I did in openNI:

// Init color
if (device.getSensorInfo(SENSOR_DEPTH) != NULL)
color.create(device, SENSOR_COLOR);
colorVideoMode = color.getVideoMode();
colorWidth = colorVideoMode.getResolutionX();
colorHeight = colorVideoMode.getResolutionY();
colorVideoMode.setResolution(640, 480);

// To read color
int colorReady = 0;
OpenNI::waitForAnyStream(&color, 1, &colorReady, SAMPLE_READ_WAIT_TIMEOUT);

// color intrinsics
hfov_rad = color.getHorizontalFieldOfView();
vfov_rad = color.getVerticalFieldOfView();

focalLengthH_px = colorFrame.getWidth() / tan(hfov_rad/2)/2;
focalLengthV_px = colorFrame.getHeight() / tan(vfov_rad/2)/2;
focalLength_px = (focalLengthH_px + focalLengthV_px)/2;

originX = colorFrame.getWidth()/2;
originY = colorFrame.getHeight()/2;

All that has worked for me and you can add whatever checks you want for exception handling. The openNI2 API is pretty good with that. I basically followed their samples to get going and the intrinsics can be calculated using well known formulas. Just note, that center is generally “near” half your resolution pixels. It can vary camera to camera. That is why people suggest running the calibration program, but assuming the factory calibration is close to “perfect”, you can use the above. Hope this get you going. If anyone does this better, I’d like the knowledge for myself as well.

Thanks for your code snippet. This approach of using basic camera specifications works well for measurements within 2-3 cm, but I was hoping to get camera calibrated values for center, focal lengths as well as distortion parameters. Using these, it should be possible to get better measurements. I think these reside in the camera but I still haven’t been able to get them out. I have had to leave this topic for about a week, but will keep on it and see if I can find something better.

I was able to find these using openni methods, specifically,
device.getProperty(openni::OBEXTENSION_ID_CAM_PARAMS, (uint8_t *)&m_CamParams, &dataSize);