Method and means of matching documents based on spatial region layout

Abstract: A method for matching objects based on spatial layout of regions based on a shape similarity model for detecting similarity between general 2D objects. The method uses the shape similarity model to determine if two objects are similar by logical region generation in which logical regions are automatically derived from information in the objects to be matched, region correspondence, in which a correspondence is established between the regions on the objects, pose computation in which the individual transforms relating corresponding regions are recovered, and pose verification in which the extent of spatial similarity is measured by projecting one document onto the other using the computed pose parameters. The method of the invention can be carried out in a microprocessor-based system capable of being programmed to carry out the method of the invention.

Description: This invention is related to object matching based on shape similarity and, more particularly, to a method and means by which spatial layout of regions can be captured for purposes of matching documents. In today's world, increasing numbers of documents are being scanned in large quantities or are being created electronically. To maintain and manage these documents requires new methods that analyze, store and retrieve the documents. Current document management systems can support document database creation from scanned documents and indexing based on text queries. A need for allowing more visual queries has been felt, particularly in retrieving documents when text keywords are unreliably extracted (from scanned documents due to OCR errors), or retrieve too many choices for a user to select from. In such cases the intention of the user is best captured by either allowing more flexible queries making reference to a document genre or type (say, find me a "letter" from "X" regarding "sales" and "support"), or by simply pointing to an icon or example, and asking "find me a document looking similar to it in visual layout." Performing either requires an ability to automatically derive such document genre or type information from similarity in the visual layouts of documents rather than their precise text content, which may be quite different. An example illustrating this can be seen from Figures 1A and 1B which are two similar-looking documents with very different text content. Matching based on spatial layout similarity is a difficult problem, and has not been well-addressed. The above examples also illustrate the outstanding difficulty. The two documents in Figure 1A and 1B are regarded as similar even though their logically corresponding regions (text segments) shown in Figures 2A and 2B, respectively, differ in size. Furthermore, some of the corresponding regions have moved up while others have moved down and by different amounts. It is known to extract a symbolic graph-like description of regions and perform computationally intensive subgraph matching to determine similarity, as seen in the work of Watanabe in "Layout Recognition of Multi-Kinds of Table-Form Documents", IEEE Transactions Pattern Analysis and Machine Intelligence. Furthermore, US-A Patent No. 5,642,288 to Leung et al. entitled "Intelligent document recognition and handling" describes a method of document image matching by performing some image processing and forming feature vectors from the pixel distributions within the document. From Bohnacker U et al: "Matching form lines based on a Heuristic Search" Proceedings of the Fourth International Conference on Document Analysis and Recognition (Cat. No. 97TB100138), proceedings of the fourth international conference on document analysis and recognition, Ulm, Germany, 18 to 20 August, 1997, pages 86 to 90 Vol. 1, XP002165325 1997, Los Alamitos, CA, USA, IEEE Computer. Society, USA. a form identification method based on the A* algorithm is known. From a reference form and a filled form to be compared, two sets of horizontal and vertical lines are built which are searched for pairs of corresponding lines. Spatial metrics are computed and a search tree is built in which corresponding lines of the two forms are stored. After an evaluation of the local certainty of a matched pair of lines it is decided whether the two forms being compared match each other. Another related document is Niyogi D et al: "An Integrated Approach to Document Decomposition and Structural Analysis" International Journal of Imaging Systems and Technology, US, Wiley and Sons, New York, Vol. 7, No. 4, 21 December 1996 (1996-12-21), pages 330 to 342, XP000637454. The document describes document decomposition and structural analysis, which constitutes one of the major processes involved in document image understanding. Decomposition and structural analysis includes logical grouping and read-order determination on complex multi-articled documents. The system uses bottom-up segmentation techniques to identify the block structure of a document and layout rules to classify and group these blocks into logical units that represent meaningful subdivisions of the document. Summary of the Invention The invention as defined in claims 1 and 8 is a method and corresponding system for matching objects, with specific examples of matching documents, based on spatial layout of regions that addresses the above difficulties. It employs a shape similarity model for detecting similarity between 2D objects. The shape similarity model is general enough to encompass the individual region shape variations between members of a shape class, and yet specific enough to avoid mismatches to objects with perceptually different appearance. That is, the shape model models the change in shape of corresponding regions on objects by a set of separate affine deformations, with constraints on the transforms that are intended to capture perceptual shape similarity between objects. Using the shape model, two objects are taken to match if one of them can be found to belong to the shape class of the other document. Specifically, the "document" matching proceeds in 4 stages, namely, (1) pre-processing, in which logical regions are automatically derived from information in the documents to be matched, (2) region correspondence, in which a correspondence is established between the regions on the documents, and (3) pose computation, in which the individual transforms relating corresponding regions are recovered, and finally (4) verification, in which the extent of spatial similarity is measured by projecting one document onto the other using the computed pose parameters. The document matching method specifically described herein can be suitably combined with other text-based retrieval methods to enhance the capability of current document management systems. Such a document matching method has several applications. It can be used to describe document genres (such as letters, memos) based on spatial layout. Other uses of the document matching method include the clustering of documents based on similarity for purposes of document database organization. The "object" matching method includes the following features: 1. The underlying shape model and the associated recognition method is general and is intended to capture perceptual shape similarity in a variety of 2D shapes (besides documents) that consist of regions, such as engineering drawings, MRI brain scans, video, outdoor natural scenes, house layout plans in real-estate databases, etc. 2. It is a fast method of obtaining region correspondence that avoids exponential search. 3. It has an ability to group similar shaped objects into shape categories or genres. 4. It provides a way of finding similar-looking objects under changes in object orientation, skew (rotation and shear (misfed pages)) that is fast and does not require pixel-based computations as in object image matching methods. 5. It provides an ability to retrieve documents based on spatial layout information (through query by example) which can be a suitable complement to text-based retrieval. 6. Finally, each of the operations in object matching are computationally simple. Description of the Drawings Figures 1A and 1B illustrates two similar-looking documents. Figure 2A and 2B illustrate the similarities and differences in the layout of the logical regions of Figure 1A and 1B respectively. Figure 3 illustrates an example illustrating region correspondence for objects. Figure 4 illustrates a flow diagram of the document matching method. Figure 5 illustrates an example application of the shape matching method to two diagrams. Figures 6A illustrates a prototype document used for the comparison of other documents. Figure 6B illustrates a document of the same category of the prototype document of 6A. Figure 6C illustrates a document of a different category than the prototype document of 6A. Figure 7A illustrates the projection of the document regions of the document of Figure 6B onto regions of the prototype. Figure 7B illustrates the projection of document regions of the document of Figure 6C onto regions of the prototype. Figure 8 illustrates a block diagram of main components for the invention. Detailed Description of the Invention The invention disclosed here is a method of object matching based on a shape model to capture shape layout similarity. In modeling shape similarity, objects are characterized by a collection of regions representing some logical entity of the object, such as say, a logical text region like a paragraph. The methods to obtain such regions are expected to be domain-specific and frequently involve some image pre-processing. Although the term "document" is used throughout this disclosure, it is not meant to limit the application of the invention to documents, but rather this method is intended to apply broadly to "object" matching. The document matching method described herein generally proceeds in 4 stages after documents containing logical regions to be matched are identified. The steps are: Pre-processing 1, in which logical regions are automatically derived from information in the documents to be matched; Region correspondence 2, in which a correspondence is established between the regions on the documents; Pose computation 3, in which the individual transforms relating corresponding regions are recovered, and finally, Verification 4 is conducted, in which the extent of spatial similarity is measured by projecting one document onto the other using the computed pose parameters. These steps will be discussed in more detail in Section B of this disclosure, below The document matching method is based on the following shape similarity model that is intended to capture spatial layout similarity of logical regions in 2d objects and, in particular, logical regions of a document image. A. The shape similarity model The shape similarity model describes the characteristics of the shape class of an object M consisting of a set of m regions R mi, i = l to m . According to the shape model, the object M is said to be similar to another object I characterized by the set of regions R Ij,j = 1,..n. if enough pairs of corresponding regions can be found such that the shape deformations of the corresponding regions can be specified by a set of affine transforms ( A ij , T ij ) that obey the following three constraints: 1. Direction of residual translation constraint: The first constraint specifies that object regions displace along a common direction, called the reference direction. That is, the direction of residual translation of corresponding regions must be the same which is denoted by: γ ijy = γ ijx tan , ∀ i, j where ( γ ijx ,γ ijy ) T = γ ij = C lj - C Mi is the residual translation and C Ij and C Mi are the centroids of the regions R ij in object I and R Mi of object M . When  = 90 degrees, γ ijx = 0. The direction of residual translation can be either manually specified or can be automatically derived by computing the direction of residual motion for all pairs of regions, and recording the commonality in direction using a Hough transform. 2. Extent of translation constraint: The second constraint restricts the amount of displacement each of the regions can undergo to maintain perceptual similarity. The extent of residual translation of all corresponding regions is bounded by δ so that | 1 + tan 2  γ ijx | ≤ δ or equivalently: |γ ijx |≤|δcos| |γ ijy | ≤ |δ sin| For  = 90, the bound on the extent of translation is given by |γ ijy | ≤ δ . Note that included in the constraint on the extent of residual translation, is the case when some regions don't move at all from their original positions while others do along a common direction. When ( A ij , T ij ) is the same for all regions j for an object i , this reduces to a rigid-body shape model. 3. Ordering of regions constraint: The final constraint restricts the displacement of regions such that relative ordering is maintained. That is, the ordering of corresponding regions on objects with respect to the reference direction  be the same. The ordering of regions is obtained by projecting the centroids of regions onto the reference direction using a direction of projection (orthogonal or oblique). Such a region ordering for an object can be conveniently represented by a sequence R = ( R j 1 , R j 2 ,.. R jm ). Regions of the same rank appear in this sequence ordered along the direction of projection. The above constraints have been carefully chosen through studies that observe that such constraints perceptual shape similarity for a wide variety of objects, including faces, MRI scans, etc. B. The method of document matching The method of document matching disclosed in this invention involves the following stages: 1. Logical region extraction from document segments. 2. Region correspondence between the two documents to be matched using the constraints of the shape model. 3. Pose computation between corresponding regions. 4. Pose verification by projecting one of the documents onto the other using the computed pose. 1. Logical region extraction To use the shape similarity model for document matching, a set of logical regions need to be derived. While the document matching methods admits several methods of obtaining logical regions, we chose to obtain them by a grouping algorithm that uses text segments given by a conventional text segmentation algorithm (we used a version of software in Xerox's TextBridge ™ for extracting text segments). The grouping algorithm performs the following operations: 1. Text segment regions whose bounding boxes are left aligned, right aligned, or centrally aligned are noted. 2. Among the regions in Step-1, those that are vertically spaced by a small distance are retained. The distance thresholds is chosen relative to the page image size. One way to derive the threshold is to record the inter-region separation over a large training set of documents of a certain genre and record the pixel-wise separation in the image versions of documents. 3. Text regions retained in Step-2 are used to form groups of regions. The grouping is done as follows: a. Initially put all text segments into their own groups. b. For each text segment, determine the text segments that fall within the logical region distance constraint (given above). Merge all such regions into one group. c. Successively merge groups using step b, until the set of groups cannot be further reduced. The above algorithm can be efficiently implemented using a data structure called the union-find data structure as described in a book by Cormen, Leisersen and Rivest entitled "Introduction to algorithms", MIT Press, 1994, to run in time linear in the number of text regions in the document. The above algorithm has been found particularly useful for grouping consecutive paragraphs of text into single logical regions, as well as for grouping centrally aligned information such as author information in a journal article. 2. Region correspondence The method of obtaining region correspondence is again meant for general objects, and can be easily adapted to logical regions of documents. The correspondence between logical regions is obtained by using the constraints in the shape similarity model. Thus starting with all pairs of regions on the two objects, all those pairs whose direction of residual translation is not in the specified direction  are pruned (this is checked within a threshold to allow some robustness against segmentation errors and deviations from the shape similarity model in individual documents). Next, the extent of residual translation constraint is used to further prune the pairs. The distinct regions in the pairs on each object can now be ordered with respect to the reference direction . The region orderings can be denoted by the sequences R M and R I respectively. Using the region ordering, and collecting the set of candidate matching regions in object M for each region of object I by S i the result can be denoted by the set sequence S P = ( S 1 , S 2 ,.. S p ) where p is the number of regions in object I that found a match to a region in object M . The best region correspondence is taken as the longest subsequence of R M that is also a member sequence of S p . A member sequence of S p is a sequence of regions with at most one region taken from the set S i . It can be easily shown that the problem of finding the longest common subsequence (LCS) has optimal substructure property, thus admitting solutions by dynamic programming. In fact, we adapted the dynamic programming algorithm for computing an LCS described in Introduction to algorithms by T.Cormen, Leiserson, and R. Rivest, to give region correspondence by LCS using the following simple procedure: Let m = length of sequence R M and n = length of set sequence S p . The LCS of R M and S p is determined by first computing the length of LCS and backtracking from the indices contributing to the longest sequence to derive an LCS. The intermediate results are recorded in a dynamic programming table c[0..m,0..n] , where entry c[i,j] denotes the length of LCS based on the prefixes of R M and S p of length i and j respectively. The table is initialized by c[i,0] = 0 = c[0,j] for all i,j . The code is given below: By keeping a record of which of the three values c[i-1,j-1],c[i-1,j],c[i,j-1] actually contributed to the value of c[i,j] in the above procedure, we can reconstruct an LCS in linear time. The above steps give the largest set of corresponding regions between query and prototype that move along the same direction within bounds of the shape model, have a match in individual content, and retain the spatial layout ordering specified. Although the number of possible LCS for general sequences can be exponential in the worst case, for typical spatial layouts of regions in documents, only a few distinct LCS have to be tried to discover shape similarity. Region Correspondence Example: Figures 3A and 3B is used to illustrate the region correspondence for a simple example. The figures are two objects to be matched some of whose regions meet the constraints of the shape similarity model. Their respective region orderings with respect to the reference direction shown in the figure, are given by (ABCD) and (EFGHIJK). The set sequence of candidate matches is given by ({A},{B},{A},{B},{C},{},{D}) , where S 1 = {A} , S 2 = {B} , and so on. There are two LCS that have length with respective region correspondences as {(A,E)(B,H)(C,I)(D,K)} and {(A,G)(B,H)(C,I)(D,K)} . The correctness of these correspondences can be judged in the recognition stage to be described next. 3. Pose computation Using the correspondence between logical regions, the individual region transforms can be recovered in a variety of ways including feature matching or direct region matching as mentioned in a paper entitled "Object recognition by region correspondence" in Proceedings Intl. Conference on Computer Vision (ICCV), Boston, 1995 by R. Basri and D. Jacobs. For the domain of documents, since the logical regions are rectangular, the pose parameters of interest are the four elements of the linear transform matrix A and the residual translation T . For a pair of corresponding regions R Mi and R Ij , these are denoted by where s 1 ij = Δ x j / Δ x i s 2 ij = Δ y j / Δ y i T ij = C Mj - C Ij where (Δ x ,Δ y ) are the width and height of the rectangular region. 4. Pose Verification Pose verification involves determining if the two documents register under the shape similarity model. For this the computed residual translation given in the above equation is corrected such that the resulting residual translation is forced to be exactly along the reference direction and within the stated bounds on the extent of such displacement. This is done by perpendicularly projecting the point representing the computed residual translation onto the line of direction  and taking the point of such projection as the new residual translation T ijnew for each pair of corresponding regions. Each rectangular region R i on object M can now be projected onto the object I to give the projected rectangular regionl R' i as follows. The centroid of the region C Mi is moved to the position C Ii ' = C Mi + T ijnew Verification is then done by seeing the extent of overlap between R ' / i region and the corresponding rectangular region R Ij of the correspondence pair. The verification score is given by V(M,I) where ∩ and ∪ are done over the region areas. The above formula accounts for the extent of match as measured by the extent of spatial overlap of corresponding regions, and the extent of mismatch as measured by the areas of regions that do not find the match (included in the denominator term). C. Examples Referring to Figure 4, a flow chart representing the four major steps of document recognition employing the invention, after logical regions of documents to be matched are identified. Logical region extraction occurs within the first two blocks where First 1 all region pairs are formed, and then the documents are pruned 2 based on unary constraints discussed in further detail below. Region correspondence is then determined between documents 3. A pose is computed 4 for the documents and match verification is determined based a matching score. Figure 5 is another diagram depicting a more specific scenario where two documents (1 and 2) are scanned, and enter a region segmentation module 7 to establish a correspondence between the regions on the documents. A logical region grouping module 8 is then allowed form region pairs, and unary constraints are then applied to the documents in a layout shape matching module 9 resulting is a matching score between the documents. Referring back to Figures 1A and 2A, illustrated is the logical region grouping for documents. Figure 1A shows text regions given by a conventional text segmentation algorithm. Figure 2A shows the result of logical grouping on the document image of Figure 1A. Next, we illustrate region correspondence. Figure 6A depicts a model document by its logical regions. Figures 6B and C are two other documents only one of which is similar (Figure 6B) in spatial layout to the document in Figure 6A. This can be observed from the higher number of corresponding regions (labeled R1 through R5 in Figure 7) obtained when the document of Figure 6B is matched to Figure 6A. Here we assume a vertical reference direction, and the matching regions are indicating by identical colors. As can be seen, the poor correspondence of object in Figure 6C indicates a mismatch. This can also be seen during the verification stage where the pose parameters computed (and corrected) from region correspondences defined by overlap as the document of Figure 6A is overlayed onto the documents of Figures 6B and C. The extent of overlap in such overlay is indicated in Figures 7A and B, respectively, as R1 through R5. D. Document matching System The method of the invention can be carried out in a microprocessor-based system 10 as shown generally in Figure 8. The microprocessor 11 would be programmed to carry out the four main steps of the invention. A memory 12 would be utilized by the microprocessor 11 for storing document templates and tested documents during matching operations. A scanner 13 may be used to scan the test documents into the document matching system; however, as known in the art, documents may be delivered to the system via electronic networks, or the like. Results of testing can be output 14 to the user with indicating means known in the art. The method of document matching by spatial region layout can be a useful complement to existing methods for document matching based on text keywords or pixel-wise image content. As can be seen from the examples above, the capturing of spatial layout similarity allows the matching of documents that have greater variations in pixel-wise image content. In addition, the matching method is a general formulation that can be applied to other classes of 2D objects besides documents.

Claims: A method to detect similarities in two objects which are represented as images in regard to their two-dimensional spatial layout, said method comprising the steps of: recognizing logical regions in each of the objects, forming possible combinations of logical region pairs, each pair consisting of one logical region of the first object and one logical region from the second object, pruning those pairs which in consideration of a shape similarity model defining constraints comprising the translation of regions do not represent a possible mapping of a logical region from the first object onto a logical region of the second object, selecting the largest possible number of pairs out of the remaining pairs such that as many logical regions of the first object as possible find a match in a logical region of the second object; and each logical region in the pairs of this selection only occurs once, computing pose parameters for the pairs in said selection by recovering individual logical region transforms using a linear transform matrix and a linear translation for each pair contained in the selection and detecting the similarity of said two objects based on the result of a verification score calculated by utilizing said computed pose parameters, characterised in that the selection of the largest number of possible pairs is carried out by means of a dynamic programming algorithm. The method according to claim 1, wherein said method is used to match documents and is combined with a text-based retrieval method to enhance document management system capabilities. The method according to claim 1 or 2, wherein said method is used to describe document genres based on spatial layout. The method according to one of claims 1 to 3, wherein said method is used for clustering a plurality of objects based on similarity in a database. The method according to one of claim 1 to 4, wherein said method used to capture object similarities in a plurality of 2-dimensional objects that comprise of regions. The method of claim 5, wherein said method groups similar shaped objects into shape categories or genres. The method according to one of claims 1 to 6, wherein said method matches shapes regardless of orientation and skew. A system for detecting similarities in two objects which are represented as images in regard to their two-dimensional spatial layout, comprising: recognition means for recognizing logical regions in each of the objects, combination means for forming possible combinations of logical region pairs, each pair consisting of one logical region of the first object and one logical region from the second object, pruning means pruning those pairs which in consideration of a shape similarity model defining constraints comprising the translation of regions do not represent a possible mapping of a logical region from the first object onto a logical region of the second object, selection means for selecting the largest possible number of pairs out of the remaining pairs such that as many logical regions of the first object as possible find a match in a logical region of the second object; and each logical region in the pairs of this selection only occurs once, pose computation means for computing pose parameters for the pairs in said selection by recovering individual logical region transforms using a linear transform matrix and a linear translation for each pair contained in the selection and verification means for detecting the similarity of said two objects based on the result of a verification score calculated by utilizing said computed pose parameters, characterised in that the selection means are adapted to carry out a dynamic programming algorithm for the selection of the largest number of possible pairs.

Inventors: SYEDA-MAHMOOD TANVEER F, SYEDA-MAHMOOD, TANVEER F.
Applicants: XEROX CORP, XEROX CORPORATION
Application year: 1998
Main classification: G06K9
IPC codes: G06K9, G06F17