Approximate simulation and inversion of optical camera distortion, using binary search. This is old crappy code (it only covers the radial part of a radial-tangential distortion model), but it works ✌!
The application will take your image, distort it, and then undistort the intermediate result to arrive back at the beginning -- except that a whole lot of information is lost along the way.
The final image is an approximation of what an undistorted image of a real camera looks like, given the specified distortion parameters. This code was used to generate training data for a stereo-vision deep neural network in the "TrimBot" EU Horizon 2020 research project, also also for another paper and finally in my PhD thesis.
Put CImg.h into src, then make and run the resulting generic_executable.