AutoDeskew Example VB

This example shows how to deskew an image automatically.  (It also shows how to invoke other functions that can prepare an image for OCR processing.)

void CImgEdit1Dlg::OnCleanup() 
{
    // Here are some functions you might want to perform on
    // an image prior to OCR.

    VARIANT evt; V_VT(&evt) = VT_ERROR; // set to default
    // Perform automatic straighten on the image
    ImgEdit1.AutoDeskew();
    // Remove speckles on the image using the default
    // threshold value for dot size
    ImgEdit1.Despeckle(evt);
    // If there is a lot of extraneous space around image
    // borders, cropping might reduce processing time
    ImgEdit1.AutoCrop(evt);
    // Show the OCR dialog box
    ImgOcr1.ShowOcr();
}