Correct Photos of Documents – Two- and Three-dimensional Skew

As I mentioned in my previous post, Correct Photos of Documents – Ambient Lighting, most images of documents suffer from skew. There are two types of skew: two-dimensional and three-dimensional.

Text is typically parallel to the top and bottom of the paper. Simply put, two-dimensional skew is the angle of the text when compared to the top or bottom edge of the image. This type of skewing can occur in photos of documents as well as document images produced by a scanner. While it is relatively easy to correct with a simple rotate, determining the angle of rotation can be tricky. Fortunately, LEADTOOLS includes a DeskewCommand class that can determine the angle of skew.

private static void AutoDeskew(RasterImage image)
{
    ProcessImage(image,
        new DeskewCommand(RasterColor.White, DeskewCommandFlags.FillExposedArea));
}

Three-dimensional skew is also known as perspective skew and is more complicated than a simple rotation angle distortion. When the document is skewed in three dimensions, a rectangular document is warped into convex quadrilateral. To correct a perspective skew, the corners of the document have to be found and then the image has to be warped back into a rectangular shape. Again, LEADTOOLS includes the PerspectiveDeskewCommand class to automatically find the corners and correct the distortion without user input. As a bonus, the command removes parts of the image that it did not consider to be a part of the document.

private static void PerspectiveDeskew(RasterImage image)
{
    ProcessImage(image, new PerspectiveDeskewCommand());
}

The aforementioned PerspectiveDekewCommand class does not require any user input, which is perfect for my workflow. (I want to right-click any document image in Windows Explorer and convert it to PDF). The PerspectiveDekewCommand usually does a perfect job, but there are some cases where it can incorrectly remove part of the document. An example of an image that can confuse the command is one of a letter that is tri-folded from being in an envelope. Ideally, the paper should be completely flat before taking the picture, but that is not always possible. The fold causes three-dimension distortion in two different directions, so the PerspectiveDeskewCommand corrects the larger part of the image with the distortion.

In the “Before” example above, I highlighted what the PerspectiveDeskewCommand found as the document corners. As shown, the part of the document above the fold is incorrectly cropped out of the “After” image. Depending on the application, LEADTOOLS has other image processing commands, such as the KeyStoneCommand and ManualPerspectiveDeskewCommand, that can be used if the PerspectiveDeskewCommand does not work perfectly. Both require user input to find the corners of the document. Since my workflow does not allow for user input, I cannot use them. However, there is another way.

Stay tuned for my next post where I show how I solved this problem in a way that does not require any user input. 🧙

Posted in Document Imaging | Tagged , , | 1 Comment

New ConvertBarcodeSplit Web API Method for LEADTOOLS Cloud Services

Since releasing LEADTOOLS Cloud Services only a few months ago, we have seen a lot of usage from customers as well as some feedback. It’s a product we look forward to supporting and improving by making additional LEADTOOLS imaging functionality available in an easy-to-consume Web API. Today marks the first update to LEADTOOLS Cloud Services and are happy to announce a new method endpoint for the service: ConvertBarcodeSplit.

Continue reading
Posted in Barcode | Tagged , , , , , , , , , , | 1 Comment

Correct Photos of Documents – Ambient Lighting

In my previous post, “Solution to 4 Common First-world Problems – Convert and Merge to PDF,” I implemented a solution to convert images of documents to text-searchable PDF files. The source images were produced from a document scanner and the camera on my phone. Since that post, I have received some questions on how to improve the human readability of the PDFs that were originally camera images.

Continue reading
Posted in Document Imaging | Tagged | 3 Comments

Code Tip: Converting PDF, IBM FileNet P8, Wang, and LEAD Annotations

annotations

Annotations are an important part of many document and medical imaging workflows. They allow users to mark up images with various shapes, notes, highlights, and redactions without having to permanently alter the image or document itself. One difficulty developers face is that annotations are not standardized. There are many standards, both open and proprietary, but not all of them play nicely with each other.

Continue reading
Posted in Document Imaging | Tagged , , , , , , , | Leave a comment

Solution to 4 Common First-world Problems – Convert and Merge to PDF

This past weekend, I was very fortunate compared to so many people that recently faced and are still having to deal with Hurricane Florence. At home, the power is out, but there is no major damage. I am fortunate. Since there is nothing I can do at the moment about the power and everyone around me is safe, I decided to forget my first-world problems, go to the office, which does have power, and write a small and simple app that solves some common first-world problems. I am hoping that you will find this tool useful, too!

Continue reading
Posted in Document Imaging, OCR, PDF | Tagged , , , | Leave a comment

.NET Conference 2018

Today is the first day of the highly anticipated .NET Conference, a free, online conference for everyone in the .NET community from beginners to seasoned engineers. This 3-day virtual conference has a packed agenda covering the latest in development technologies for the .NET ecosystem including ASP.NET, Xamarin, C#, Azure, AI/ML, and new things just over the horizon. Make sure you tune into social media as well (#DotNetConf) because there will be a virtual attendee party hosted by LEAD and other .NET Conference sponsors in which you can learn more and win prizes.

Watch it Here!

Continue reading
Posted in News | Tagged , | Leave a comment

Create a QR Code from OCR Results

We take great pride in the fact that LEADTOOLS is truly a comprehensive imaging SDK. We developed LEADTOOLS with the mindset that we want it to be a one-stop-shop for imaging. There are many applications, especially in the document imaging world, where technologies intersect and you may find the need to piecemeal multiple SDKs together. For example, Scanning + Document Cleanup + OCR, OMR + Forms Recognition + OCR, or OCR + PDF. How about something a little less common, like OCR + Barcode?

Continue reading
Posted in OCR | Tagged , , , , , , | Leave a comment