SetLensDistortion
Top  Previous  Next

Description

Sets distortion parameters for the lens distortion correction.


Syntax


[VB]
objActiveGige.SetLensDistortion Alpha, Beta, Interpolate


[C/C++]
HRESULT SetLensDistortion (float Alpha, float Beta, bool Interpolate)


Data Types
[VB]

Alpha: Single
Beta: Single
Interpolate: Boolean


Parameters
[C/C++]

Alpha [in]  
Floating point value of the radial distortion coefficient. The allowable range of values is from -1.0 to +1.0.  
Beta [in]  
Floating point value of the tangential distortion coefficient. The allowable range of values is from -1.0 to +1.0.  
Interpolate [in]  
If TRUE, the bilinear interpolation will be used for the lens distortion correction.  


Return Values


S_OK  
Success  
E_FAIL  
Failure.  

Example

The following VB examples activates the lens distortion correction and uses two scroll bars to adjust the distortion parameters in real time :

Private Sub
 Form_Load()
ActiveGige1.Acquire=
True

HScroll1.Min = -1000
HScroll1.Max = 1000
HScroll2.Min = -1000
HScroll2.Max = 1000
ActiveGige1.SetLensDistortion 0,0,
False

ActiveGige1.LensCorrect=
True

ActiveGige1.Acquire=
True

End Sub

Private Sub HScroll1_Scroll()
ActiveGige1.SetLensDistortion HScroll1.Value/1000., HScroll2.Value/1000., 
False
End Sub

Private Sub
 HScroll2_Scroll()
ActiveGige1.SetLensDistortion HScroll1.Value/1000., HScroll2.Value/1000., 
False
End Sub


Remarks


The lens distortion correction is used to compensate for the barrel or pincushion image distortion caused by camera lenses. The barrel distortion makes straight lines at the edges of the image bow outwards and it is commonly seen on wide angle lenses with short focal length. The pincushion distortion makes straight lines at the edges of the image bow inwards, and it is commonly seen on telephoto lenses with long focal length. Some lenses can have a combination of both types of distortion.

Use negative values for Alpha and Beta parameters to correct for the barrel distortion, and positive values to correct for the pincushion distortion. A combination of positive and negative values can be used to correct for the complex type of distortion.

The most practical way to select the distortion parameters is to point the camera to a square grid pattern and empirically adjust the values of both coefficients so that the lines at the edges of the frame become as close to straight ones as possible.