DeBarrel


Author V. C. Mohan
Last modified Date Mar 20, 2008

This plugin corrects Barrel type or Pin Cushion type distortions in an image that result in due to camera lens projecting image on to a flat film or sensor array. ( The distortions due to perspective are not compensated by this plugin. For that distortion one need to use Reform plugin.)

A polynomial with 4 coefficients are used to correct. a, b, and c are the coefficients to be specified and the fourth d is computed internally. These parameters mainly depend upon the lens of the camera, focal length of lens and setting of zoom.

For many high definition still photographic cameras databases are available on the web. But for video cams there is no such database. The possible reasons are 1. Video camera resolution is limited 2. The camera and or subjects move and therefore such distortions are not noticeable. However, due to advent of HD video cams and the consequent increased usage of tripod one may attempt to correct for such distortions.

The parameters can be derived by a nearest fit approach. Using Grid on a blankclip one can generate Barrel type distortion specifying for "pin" as true or vice versa. By playing with parameters an optimum set can be arrived at. The examples given are produced similarly.


Note a + b + c should not exceed 1.0.
Input clip RGB format only .
After correction one may need to crop image at the edges.
Details of parameters
Description Name Type Limits Default
Input clip clip RGB format only none
coefficient a a float between 0 and 0.5 0.005
coefficient b b float between 0 and 0.5 0.005
coefficient c c float between 0 and 0.5 0.005
whether to correct pin cushion or barrel type distortion pin Boolean true for pin, false for barrel false

#Usage examples:-
blankclip(width = 720, height = 480, pixel_type = "RGB32",color = $ffffff,  length = 10)
grid()
pin = DeBarrel(a = 0.005, b = 0.005, c = 0.005,pin = false)
 bar = DeBarrel(a = 0.005, b = 0.005, c = 0.005,pin = true)





To my index page down load plugin To Avisynth