# Camera calibration error on voxl 2

Source: https://forum.modalai.com/topic/1394/camera-calibration-error-on-voxl-2
Category: VOXL 2 and VOXL 2 Mini (https://forum.modalai.com/category/26/voxl-2-and-voxl-2-mini)
Tags: voxl-2
Posted: 2022-09-28 11:46:17 UTC by Tamas Pal 0
Replies: 3 · Views: 1034

## Tamas Pal 0 · 2022-09-28 11:46:17 UTC

While calibrating the cameras I getting this error. How to fix it ?
```
voxl2:/data/modalai$ voxl-calibrate-camera hires -s 6x9 -l 0.038
Please open voxl-portal in a web browser to view the camera calibrator overlay stream
Matrix
[693.6691539302459, 0, 288.005823202943;
 0, 696.732504080016, 320.7673427167344;
 0, 0, 1]
Distortion
[0.1797394659934352;
 -0.2310619433685658;
 -0.003705138274410424;
 -0.006883924563489691;
 0]
distortion_model: plumb_bob
Re-projection error reported by calibrateCamera: 1.47713
Calibration Failed
Max reprojection error:  0.5
Exiting Cleanly
munmap_chunk(): invalid pointer
Aborted
```
![vxlcalib4.png](https://forum.modalai.com/assets/uploads/files/1664365535276-vxlcalib4.png)

and
```
voxl2:/data/modalai$ voxl-calibrate-camera hires --fisheye -s 6x9 -l 0.034
Please open voxl-portal in a web browser to view the camera calibrator overlay stream
Matrix
[-367.8815041601071, -0, 330.2372757833328;
 0, -368.0547039271603, 319.7644104459951;
 0, 0, 1]
Distortion
[0.383366879780598;
 0.1689986582189106;
 0;
 0]
distortion_model: fisheye
Re-projection error reported by calibrateCamera: 1.54825
Calibration Succeded!

Writing data to: /data/modalai/opencv_hires_intrinsics.yml
Saved!
Exiting Cleanly

Segmentation fault:
Fault thread: voxl-calibrate-(tid: 14253)
Fault address: 0x7f88000000
Address not mapped.
Segmentation fault
```

## Reply by Guest · 2022-09-28 22:51:11 UTC

Hi,

A couple things:
1. You were on track in the first attempt, the hires camera shouldn't use the fisheye flag
2. The main error here is the reprojection error indicating the calibration wasn't good enough for our standards. The culprit here looks like the camera is very out of focus. If you look at the hires camera on the board you'll be able to twist the lens to change the focal length, we recommend putting the checkerboard about as far away as you'd like to be using the hires camera to inspect things and then twist the lens until the checkerboard is crisp.
3. The munmap/free issues: these seem to be an issue on our end when handling incoming color images. I think this is the first time that someone's attempted to calibrate the hires camera, and it's good that you brought this to our attention. I just pushed up a new version (0.2.3) of the calibrator tool to our staging branch that fixes this issue. You can install this version on your device by either:
a) Switch your device to our staging branch following the docs [here](https://docs.modalai.com/configure-pkg-manager/) and installing the new version with apt. This is the easier of the two ways but will also put you on our pre-release branch, so be wary of any other updates that you do (though this is not our beta testing branch and things here are usually pretty stable)
b) Manually download the package from [this](http://voxl-packages.modalai.com/dists/qrb5165/staging/binary-arm64/voxl-camera-calibration_0.2.3_arm64.deb) link and install it alone with dpkg. This is (only slightly) more involved but will also keep the rest of your projects on our most recent stable release.

## Reply by Tamas Pal 0 · 2022-09-29 09:36:14 UTC (in reply to Guest)

@Alex-Gardner Thank you for you suggestions.  I have upgraded the voxl-calibrate-camera and switched to staging version. The hires and tracking camera calibration is working fine now. But I am having  some problem regading streo camera calibration. How to fix it ? 
```
voxl2:/$ voxl-calibrate-camera stereo_front -s 6x9 -l 0.034
Please open voxl-portal in a web browser to view the camera calibrator overlay stream
Calibrating Left Camera
Matrix
[500.4213862090265, 0, 346.3373792923238;
 0, 501.227740248529, 228.878072211419;
 0, 0, 1]
Distortion
[-0.1660913438796711;
 0.05755259725598761;
 0.000863652065816025;
 0.0005852774309940085;
 0]
distortion_model: plumb_bob
Re-projection error reported by calibrateCamera: 0.419252
Calibration Succeded!
Calibrating Right Camera
Matrix
[513.8225740415423, 0, 334.0143369611135;
 0, 514.1101484689675, 257.1884653194029;
 0, 0, 1]
Distortion
[-0.1736357276577499;
 0.07324720821732762;
 0.002579625065851226;
 -0.0002603134282297033;
 0]
distortion_model: plumb_bob
Re-projection error reported by calibrateCamera: 0.410086
Calibration Succeded!
Calibrating Extrinsics
4 frames will be processed
R
[0.9990467365388441, -0.02586416972382951, 0.0351662186705121;
 0.02662023260498675, 0.9994207058449519, -0.02120414922685195;
 -0.03459741937112843, 0.02212006900701594, 0.9991565048179305]
T
[-0.07974387312689943;
 -0.001107340907051975;
 0.004462065261819127]
Re-projection error reported by stereoCalibrate: 0.594130
Detected horizontal stereo pair
Distance between cameras: 0.0797
Extrinsics Calibration Failed
exceeded allowable max reprojection error:  0.5

Saved intrinsics to: /data/modalai/opencv_stereo_front_intrinsics.yml
Exiting Cleanly
``` 
![vxlcalib5.png](https://forum.modalai.com/assets/uploads/files/1664444243016-vxlcalib5.png) 

**Also for every case the re-projection error is more than 0.4. Is there anyway to make it below 0.2?**

## Reply by Tamas Pal 0 · 2022-09-30 06:18:41 UTC (in reply to Guest)

@Alex-Gardner After installing the packages from staging version the cameras are not working. How to solve it ?
