I'm unsing cv::undistort but it crops the image. I'd like to have all the undistorted image, so that the undistorted size is bigger then the original one, like this:

I think I need to use cv::getOptimalNewCameraMatrix but I had no luck with my trials.. some help?
the best would be subclass OpenCV's class and overload the method undistort(), in order to access all the images you need.