project_point_to_pixel
Dug into the math to undistort the Brown-Conrady distortion and noticed that the operations in project_point_to_pixel don't match project_pixel_to_point.
Point-to-pixel uses...
float f = ...
x *= f;
y *= f;
float dx = x + 2*intrin->coeffs[2]*x*y + intrin->coeffs[3]*(r2 + 2*x*x);
float dy = y + 2*intrin->coeffs[3]*x*y + intrin->coeffs[2]*(r2 + 2*y*y);
...which means the f factor is baked into all parts of dx and dy.
Compare that to project_pixel_to_point:
float f = ...
float ux = x*f + 2*intrin->coeffs[2]*x*y + intrin->coeffs[3]*(r2 + 2*x*x);
float uy = y*f + 2*intrin->coeffs[3]*x*y + intrin->coeffs[2]*(r2 + 2*y*y);
...where the f factor only modifies the first x and y, and which matches how the Brown-Conrady model is usually documented. Why the difference?
i didn't check the math behind the transformation, but taking a pixel with its depth value and doing a deprojection to point followed by a projection to pixel brings back the pixel values - to some error. Pseudo-code and result:
pixel, depth = [ 240.0 320.0], 0.500696
point = deproject_pixel_to_point(pixel, depth)
>>> [-0.07933103 0.07876374 0.50069648]
pixel = project_point_to_pixel(point)
>>> [ 239.45333862 320.69567871]
So seems to be working.