There is a Kannala-Brandt camera distortion realization in /farm-ng-core/cpp/sophus/sensor/kannala_brandt.h file. Is it an error in function undistort(), line 119?
TScalar th = sqrt(rth);
May be the correct formula has to be:
TScalar th = atan(rth); ?