ALPRIM Ver. 1.0 User's manual

Table of contents
  1. Overview
  2. Overview of CJocrPrim class
  3. Subclasses of CJocrPrim class

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


    manual home page

    reference manual