This functionality is built into OpenCV[0]. If you're using a reference image (or if you know the lens properties) it doesn't require ML. It's mostly just a matrix transform.
Ah yes! It looks like this is related to what I was looking for. It was a long time ago that I saw a demo about this and I was under the impression that ML was used to calculate the correction matrix.
[0] https://docs.opencv.org/2.4/doc/tutorials/calib3d/camera_cal...