Remove Lens Distortion

I´m trying to implement a Kernel in the GPU (Nvidia Cuda) to correct the radial and tangential distortion in a sequence of images. The radial and tangential parameters (K1,K2,K3 - Radial - P1,P2 - Tangential) are known by previous camera calibration.

Anyone as implemented a similar CUDA Kernel? Can you give me some information?

Thanks in advance

BR,
Nuno Pessanha Santos