Image Processing (Concept): Difference between revisions

From Grooper Wiki
Created page with "== About == Regardless of how good an OCR Engine is, OCR is very rarely perfect. Characters can be segmented out from words wrong. Artifacts such as table lines, check..."
 
No edit summary
Line 111: Line 111:
# '''Temporary''' for OCR cleanup.
# '''Temporary''' for OCR cleanup.


=== Permanent ===
== Permanent IP ==


Permanent Image Processing is done via the Image Processing activity.  It is, as the name implies, a permanent alteration of the document's image.  The Image Processing activity will reference an IP Profile and permanently apply its IP Commands to the document images.  Once that image is changed, it is changed for the remainder of the Batch Process.  There is no going back!  IP Profiles used by the Image Processing activity should only use commands acceptable for final export.
Permanent Image Processing is done via the Image Processing activity.  It is, as the name implies, a permanent alteration of the document's image.  The Image Processing activity will reference an IP Profile and permanently apply its IP Commands to the document images.  Once that image is changed, it is changed for the remainder of the Batch Process.  There is no going back!  IP Profiles used by the Image Processing activity should only use commands acceptable for final export.
Line 124: Line 124:




==== Border Cleanup ====
=== Border Cleanup ===


Auto Border Crop, Border Fill
Auto Border Crop, Border Fill


==== Color Adjustment ====
=== Color Adjustment ===


Brightness Contrast, Contrast Stretch
Brightness Contrast, Contrast Stretch


==== Image Transforms ====
=== Image Transforms ===


Auto Deskew, Auto Orient
Auto Deskew, Auto Orient




=== Temporary ===
== Temporary IP ==


Temp text
Temp text

Revision as of 15:18, 20 February 2020

About

Regardless of how good an OCR Engine is, OCR is very rarely perfect. Characters can be segmented out from words wrong. Artifacts such as table lines, check boxes or even just specks from image noise can interfere with character segmenting and character recognition. Even when they are segmented out correctly, the OCR Engine's character recognition can make the wrong decision about what the character is.

Image Processing (often abbreviated as "IP") can assist the OCR operation by providing a "cleaner" image to the OCR Engine. The general idea is to give the OCR engine just the text pixels, so that is all the engine needs to process.

This image is much easier for OCR to process... ...than this image.


Images altered using an IP Profile, which contains a step by step list of IP Commands, each of which performs a specific alteration to the image. IP Profiles are highly configurable. There are multiple different IP Commands, each of which has its own configurable properties as well. In the example above, the image was altered using an IP Profile with six steps, each step containing a different IP Command.

This is the list of steps in this IP Profile, each one named for the IP Command used: Auto Border Crop, Binarize, Shape Removal, Line Removal, Speck Removal, and Blob Removal

! Order of operation matters! The image is altered step by step, from the first to the last. The first step hands the second step the results of its IP Command. The second step runs using the mutated image not the original image. The second step then hands its result to the third step and so on and so on.

For this IP Profile, the first step runs the "Auto Border Crop" command. It crops the image, removing its border.

In this case, the border was actually part of the document. Usually, borders appear around documents because of how they were scanned. However, the goal is still the same. Remove superfluous, non-text pixels interfering with the OCR operation.

Before After

The second step runs the "Binarize" command. The Binarize command turns the image black and white.

OCR requires a black and white image to analyze pixels and segment them out into characters. It needs a binary representation of the image: "Is text" or "is not text" While OCR Engines will binarize an image as part of their pre-processing phase, doing so in an IP Profile gives you control over how that operation is done. There is more than one way to binarize an image, and you have no control over it if you let the OCR engine do it for you.

Before After

The next step runs the "Shape Removal" command. Shape Removal takes trained examples of shapes, in this case the company logo, locates them on a document and removes them.

While probably not strictly necessary for this example, removing the shape does give OCR one less thing the OCR engine has to look at when segmenting out characters and figuring out what characters these pixels should be.

Before A dropout mask is created for
the detected sample shape.
After

The last three commands are Line Removal, Speck Removal, and Blob Removal. These three commands find three different types of pixel artifacts (lines, specks and blobs) and remove them, further isolating pixels that are only text characters.

Line Removal
Before A dropout mask is created
for detected lines.
After
Speck Removal
Before A dropout mask is created for small specks.
Here, mostly getting rid of dotted lines.
After


Blob Removal
Before A dropout mask is created for
detected blobs of a defined size.
After

You are left with an image that the OCR Engine can much easier break up into line, word and finally character segments, vastly improving the accuracy of character recognition.

A portion of OCR results without applying the IP Profile The same results with the IP Profile applied.


However, for the example above, the IP Profile's result is drastically different from the original image. While it certainly helps the OCR result, it's likely, at the end of the process, you want to export a document that looks more like the "before" picture than the "after". Luckily, Image Processing can be performed in two ways:

  1. Permanent for archival purposes.
  2. Temporary for OCR cleanup.

Permanent IP

Permanent Image Processing is done via the Image Processing activity. It is, as the name implies, a permanent alteration of the document's image. The Image Processing activity will reference an IP Profile and permanently apply its IP Commands to the document images. Once that image is changed, it is changed for the remainder of the Batch Process. There is no going back! IP Profiles used by the Image Processing activity should only use commands acceptable for final export.

The three categories of most commonly used IP Commands for permanent cleanup are

  • Border Cleanup - These commands clean up border artifacts around an image by cropping the image or filling in the border with a given color.
  • Color Adjustment - These commands adjust the color values of the image, including brightness, color saturation, and contrast.
  • Image Transforms - These commands change the image's size and orientation.

Of the commands in those categories, there are one or two that are particularly common.


Border Cleanup

Auto Border Crop, Border Fill

Color Adjustment

Brightness Contrast, Contrast Stretch

Image Transforms

Auto Deskew, Auto Orient


Temporary IP

Temp text