Deskew

 

The angle of skewing of an image can be corrected by using the DeskewDIB and DeskewDIBWithoutBlackBorder functions/methods of the BiDocImg DLL/OCX.

 

[C++]

 

/* Deskewing an image*/

 

#include “BiDocImg.h”

 

HDIB hDibNew;

 

/* 1. parameter: Handle of the DIB to filter

   2. parameter: Paper white or black

   3. parameter: Show progress

   4. parameter: Handle of parent window

   5. parameter: Fill background after rotate */

 

hDibNew = DeskewDIB(hDib, TRUE, TRUE,

AfxGetMainWnd()->m_hWnd, TRUE);

 

if (!hDibNew)

{

            // Error

}

 

[VB]

 

‘ Deskewing an image

 

Dim BIDocImgObj As Object

Dim hDibNew As Long

 

Set BIDocImgObj = CreateObject("BIDOCIMG.BIDocImgCtrl.1")

 

‘ 1. parameter: Handle of the DIB to filter

‘ 2. parameter: Paper white or black

‘ 3. parameter: Show progress

‘ 4. parameter: Fill background after rotate

 

hDibNew = BIDocImgObj.DeskewDIB(hDib, True, True, True)

 

Set BIDocImgObj = Nothing

 

If hDibNew = 0 Then

            ‘ Error

End If

 

[C#]

 

/* Deskewing an image*/

 

int hDibNew;

 

/* 1. parameter: Handle of the DIB to filter

   2. parameter: Paper white or black

   3. parameter: Show progress

   4. parameter: Fill background after rotate */

 

hDibNew = BiDocImg.DeskewDIB(hDib, true, true, true);

 

if (hDibNew == 0)

{

            // Error

}