Correcting of scanned or faxed images

Q: How can I correct the defects of the image after scanning or faxing?

A: There are many functions in the Document Imaging SDK DLLs to correct image defects. In this user guide we mention the use of some functions to correct image faults.If you have a noisy image after faxing, you can apply the CleanImage function in the BIDOCIMG.DLL. (See the description of the function.)There may be many errors after scanning. The image may be skewed. The DetectSkewAngle and DeskewDIB function in the BIDOCIMG.DLL can solve this problem.(See the description of the functions.). If you want to remove punch holes from the image, you can do it with PunchHoleRemover or AutoPunchHoleRemover functions. These functions are in the BIDOCIMG.DLL. (See the description of the functions.)  There is a black border around the image after scanning in many cases. The TrimBlackBorder function can eliminate the border. This function is in the BIDOCIMG.DLL (see the description of the function).

 

Code examples:

       #include “BiDocImg.h”

       …

       int Percent = 80;

       BeginWaitCursor();

       HDIB hDib1 = CleanImage(hDib, Percent, TRUE);             

       EndWaitCursor();

       …

       int angle = DetectSkewAngle(pDoc->hDib, TRUE, TRUE, AfxGetMainWnd()->m_hWnd);

TCHAR msg[128];

switch(angle)

{

case -1000:

                                AfxMessageBox(_T("Error on call DetectSkewAngle() function"), MB_OK|MB_ICONINFORMATION, NULL);

                                break;

                case -1001:

                                AfxMessageBox(_T("Invalid hDib parameter or not supported color depth"), MB_OK|MB_ICONINFORMATION, NULL);

                                break;

                case -1002:

                                AfxMessageBox(_T("User cancel the process"), MB_OK|MB_ICONINFORMATION, NULL);

                                break;

                default:

                                stprintf(msg, "The Angle of Skewing: %d",  angle);

                                AfxMessageBox(msg, MB_OK|MB_ICONINFORMATION, NULL);

}

       …

       HDIB NewDIB = DeskewDIB(hDib, TRUE, TRUE, AfxGetMainWnd()->m_hWnd, TRUE);

       …

       NewDIB = AutoPunchHoleRemover(hDib, TRUE, AfxGetMainWnd()->m_hWnd);

       …

       BeginWaitCursor();

       NewDIB = TrimBlackBorder(hDib);

       EndWaitCursor();