This program demonstrates how an OpenGL fragment program can be used to compensate for pincushion distortion in real time. This software is particularly useful for head-mounted displays which frequently have a significant amount of pincushion distortion.

Recent versions of Vizard include lens distortion correction software that is based on this software. The Vizard documentation includes a description of this feature. The following two lines of code enable lens correction in Vizard (the k1 parameter should be changed to approximate the amount of distortion in your display):

import vizlens
pincushion = vizlens.PincushionDistortion(k1=0.1,scaleToFit=True)
Demonstration: Download: Source code for real-time pincushion correction