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.
[0] https://docs.opencv.org/2.4/doc/tutorials/calib3d/camera_cal...
[0] https://docs.opencv.org/2.4/doc/tutorials/calib3d/camera_cal...