ALPRIM Ver. 1.0 User's manual

Table of contents
  1. Overview
  2. Overview of CJocrPrim class
  3. Subclasses of CJocrPrim class
Update history
  1. CJocrPrimEX subclass released:07/2000
  2. CJocrPrimRD subclass released 10/2000
  3. Version up:07/2002
  4. raster editing methods released:04/2003
  5. general document recognize methods released:08/2004
  6. drawing and draft title block recognize methods released:08/2005

ALPRIM manual home page

reference manual


Overview

ALPRIM Ver1.0 is an document image analysis library released in 1999. It can handle normal documents and also handle more complicated document like drafts or maps. It can separate text from graphics easily. Ver 1.0 provide functions as follows,
  1. It transforms monochrome bitmap into "primitive structure".
    We define connected components as "primitive" linking by 4 direction connectivity or by 8 direction connectivity. Componet of bit 0(white, background image) and bit 1 (black, foreground image) can be primitive. Normal document contains from tens of thousands to handreds of thousands primitive.
  2. It can abstract a set of primitives as a cluster. ALPRIM abstracts cluster by using parameters, size of primitive, area of primitive or/and distance of primitives.
  3. ALPRIM can calculate minimum size bounding box, which surrounds a cluster.
    There are two methods which can infer angle of cluster and you can specify the angle of cluster.
  4. Table abstraction
    It can abstract tables. Table is defined as an area which includes more than one cluster and is separated by grid lines. Flow chart of state transition table is also a table for ALPRIM library.
  5. Layer support
    Every primitive can be moved to any layers by variety of criterion. ALPRIM supports 255 layers.
  6. Calculate features, size, area, length of outline, center, circleness, line width of primitives.
  7. Classify primitives by feature value.
    Move primitives that meet the feature range conditions to specified layer.
  8. Delete primitives in some layer.
    You can use this function as noise reduction of document image.
  9. Simple layer movement
    For example, if you move text elements to layer 1 and delete that layer, you can get images without text
  10. You can transform primitives in a layer into bitmap.
  11. Get bitmap of specified rectangle and specified layer and specified magnification
    There are two methods, one is to get a bitmap of layer as monochrome image and the other is to get bitmap of whole layers as 255 palette color image.


Advantage

  1. High speed
    Even on Pentium 166MHz machine, this library can work well. For example you can abstract text paragraphs from A4 size 400dpi image within one second on slow CPU machine.
  2. Low memory resource
    ALPRIM can encode monochrome bitmap image losslessly. The size of transformed primitive array is normally less than the size of original image.
  3. Big image
    Coordinates value is 4 bytes. Easily handle A0 image.

Table of contents


OS

Windows 95,98,NT,2000,XP
Library is described by C and C++(ANSI standards, Codes are not depend on windows OS)


Table of contents


File lists

Class nameCJocrPrimRD,CJocrPrimEX or CJocrPrim
Header filesocrdef.h
ocrco.h
primitive.h
cjocrprim.h
absparam.h
cjocrprimex.h
cjocrprimrd.h
errcode.h
LIBNGKOCR4.LIB
DLLNGKOCR1.DLL
NGKOCR2.DLL
NGKOCR4.DLL
ALVEC.DLL
ALPOLYGON.DLL
compiler constantUSENGKDLL4

Table of contents


Class library

Firstly user set top address, width, height and background bits of bitmap image. Secondly make primitive structure and calculate primitive features. From this point, user can do primitive selection, layer operation and so on.
As a result of primitive selection and layer operation, you can get classified set of primitives and their bitmaps.

Table of contents


Overview of CJocrPrim class


  1. make primitive structures

    All operational methods of CJocrPrim class can be done after making primitive structure. "Primitives" are defined as a connected component of bit 0 region or bit 1 region. The connectivity is defined as 4 direction or 8 direction. ALPRIM supports both connectivity.

    4 direction connectivity and 8 direction connectivity

    In this table, same image is defined as one primitive and three primitives. Only horizontal and vertical connections are considerd in 4 directions connectivity. Oblique connections are considerd in 8 directions connectivity.
    Normal Japanese document consists of from tens of thousands to hundreds of thousands of primitives. After making strusture of primitives, user can select and operate on primitives.
    Table of contents


  2. abstract cluster(textblock or paragraph)

    We call a set of primitived as "cluster". They are collected by some criterion. For document processing, we can grasp cluster as text paragraph or text line. The criterions of cluster abstraction are, size and area of primitives, distance of primitives and number of primitives inside cluster, size of cluster and so on.

    Table of contents


  3. Table abstraction

    We define "table" as a set of cluster, which is separated/surrounded by grid lines.
    Grid lines does't need to be straight, so we can manage hand written tables.
    Example of table
    example of table 1only one cell
    example of table 2nomal table
    example of table 3without outmost frame
    example of table 4handwritten table
    example of table 5this also is a table

    Table of contents


  4. select primitive

    Table of contents

    You need to move primitives to another layer before doing operation on primitives.
    You can show the result of layer classification by showing layer bitmap. You can get both monochrome bitmap and 255 index color bitmap.
    The following list shows how to select primitive.

    1. Select primitives inside right-angled rectangle. Primitives that touch frame are not selected.
      ex.1
    2. Select primitives inside right-angled rectangle and on frame.
      ex.2
    3. Select primitives inside any-angle rectangle. Primitives that touch frame are not selected.
      ex.3
    4. Select primitives inside any-angle rectangle and on frame.
      ex.4
    5. Select primitives that touch line.
      ex.5
    Table of contents


  5. select primitives by line

    Select primitives that touch line with neighbour primitives. This function act as selection of one line text.
    ex.6
    Table of contents


  6. layer operation

    You can do operations on primitives belong to same layer. You can move primitives repeatedly from one layer to another.
    If you move text paragraphs from layer 0 to layer 1. Primitives that don't belong to text paragraph exist in layer 0 and primitives that belong to text paragraph exist in layer 1. After this operation, if you move small primitives from layer 0 to layer 2, you can get dot noise in layer 2. If you move small primitives before separate text paragraph, small primitives that belong to character image would be selected as noises.
    CJocrPrim class supports 255 layers. The initial primitives are all belong to layer 0.
    CJocrPrim support layer operations as follows.

    1. Delete layer primitives
    2. Convert layer primitives to bitmap

    CJocrPrim also support raster editing operations to a primitive and cluster. This operation is rarely used in OCR operation, so we don't describe the detail of raster editing operations. See reference manual for raster editing operations.
    1. transform primtive
    2. cut primitive
    3. delete primitive
    4. move primitive
    5. insert primitive

    Table of contents


  7. calculate features of primitive

    ALPRIM calculate features like area, outline length , moment , line width and circleness of primitives. You can use these features as criterion to classify primtives.(classification of primitves is equal to moveing primitives to another layer)

    Table of contents


  8. convert to bitmap

    ALPRIM can convert layer primitives to bitmap. It also can convert a primitive or cluster to bitmap. Cluster is identical with text paragraph in document recognition, getting cluster bitmap means getting paragraph bitmap.

    1. monochrome conversion
      1. Convert specified layer to monochrome bitmap
      2. Convert specified rectangle and specified layer to monochme bitmap at specified magnification
    2. 255 indexed color conversion
      1. Convert specifled rectangle to 255 indexed color bitmap at specified magnification

    Table of contents


  9. Subclasses of CJocrPrim class

    CJocrPrimEX class is a subclass of CJocrPrim.
    CJocrPrimRD class is a subclass of CJocrPrimEX.
    The functions and performance of cluster abstraction is enforced largely in CJocrPrimEX class
    We also enforce the performance and accuracy of angle inferrence in CJocrPrimEX class.
    CJocrPrimEX also has function to infer text abstraction parameters from document image automatically and to recognize dot line in document images.
    CJocrPrimRD class has more powerful functions to infer angle of cluster.
    We also provide other functions for raster vector conversion and raster editing functions in CJocrPrimRD class. But we don't explain those functions as a part of ALPRIM library, because they have nothing to do with OCR process.
    We strongly recommend you to use CJocrPrimRD class for CJocrPrim class, because performances of some methods are far better than CJocrPrim class. Of course, CJocrPrimRD class include all methods in CJocrPrim class.

    Table of contents



    CJocrPrimEX Class Released

    By using the subclass CJocrPrimEX class instead of the CJocrPrim class, it is possible to significantly improve the accuracy of string extraction.
    By switching the string extraction parameter file (extension .prm), it can support various types of documents.
    By using multiple parameter files, it is possible to extract text from complexly laid out documents.

    Table of contents



    CJocrPrimRD Class Released


    Table of contents



    Version Upgrade


    Table of contents



    Raster Editing Commands Released

    In April 2003, raster editing commands with the following features were added.
    Previously, there were only layer-based editing functions such as moving primitives or clusters between layers, deleting layers, obtaining rasters for each layer, and obtaining colored rasters for each layer.
    With the use of raster editing commands, editing operations at the level of primitives or clusters became possible.
    Furthermore, by using the disconnect commands for primitives or clusters, editing operations at the pixel level became possible as well.
    1. Delete Primitive
    2. Deletes the specified primitive.
      Used in combination with various primitive selection methods for raster editing.
    3. Delete Cluster
    4. Deletes the specified cluster.
      Used in combination with various cluster selection methods for raster editing.
      Deleting specific layer contents or removing noise can be processed more efficiently using dedicated APIs.
    5. Move Primitive
    6. Translates the specified primitive.
      Even if there is another primitive/cluster overlapping in the destination, it is managed as a separate object.
    7. Move Cluster
    8. Translates the specified cluster.
      Even if there is another primitive/cluster overlapping in the destination, it is managed as a separate object.
    9. Insert Primitive
    10. Inserts the specified primitive.
      By converting any image using this library, it can be inserted.
      It can be used, for example, to insert something drawn freely as a primitive.
    11. Insert Cluster
    12. Inserts as a cluster-level operation.
      It is possible to obtain and insert a specific layer of another image as a cluster, for example.
    13. Disconnect Primitive/Cluster 1
    14. Disconnects primitives/clusters with multiple cutting lines. Since it cuts with a width of 1, it can be visually confirmed, but the shape disappears by the width of the cutting line.
    15. Disconnect Primitive/Cluster 2
    16. Disconnects primitives/clusters with multiple cutting lines. Since it cuts with a width of 0, it cannot be visually confirmed, but the area of the shape does not change.
    17. Clusterization of specific layer
    The following functions are advanced raster editing functions, and their manual descriptions are optional. Manuals are provided depending on the contract agreement.
    1. Image Composition
    2. Can insert an entire image.
      When you want to insert the entire image, it can be processed faster than other APIs.
    3. Border Separation
    4. Separates border lines from characters.
    5. Line Separation
    6. Separates the line specified by two points from characters.
    7. Template Extraction
    8. Searches for the specified template shape in a grayscale image and makes it an independent primitive.

    Table of contents



    General Document Layout Extraction Option Released

    We have started providing a library to extract layouts of general documents (such as newspapers, journals, magazines, catalogs), not just text in drawings or topographic maps.
    It enables text extraction equivalent to commercial OCR.
    Separately sold optional library.
    For OCR software development, a character recognition library (sold separately) is required.

    Table of contents



    Report and Drawing Title Support Option Released

    Start providing library for extracting border line position information and separating border lines and characters for reports.
    Additional option library.
    For OCR software development, a separate character recognition library (sold separately) is required.


    Table of contents


    manual home page

    reference manual