Method of matching patterns and apparatus therefor
BACKGROUND OF THE INVENTION 
     1. Field of the Invention 
     The present invention relates to a method of matching patterns and an apparatus therefore used in a checking system for checking the quality of offset sheet-fed printing or screen process printing performed on a molded product. 
     2. Description of the Related Art 
     A technique of checking the quality of a printed pattern or the like performed on a product by means of pattern matching is conventionally known, and this technique is performed as follows. 
     First, a product determined to be a good product by eye inspection or the like is prepared, and a to-be-checked object such as a printed pattern formed on the product is imaged by a television camera. An image signal from the camera is signal-processed, and outline data of the to-be-checked object is extracted. Enlarged outline data obtained by performing an enlargement process for the outline in the vertical and horizontal directions is stored as master pattern data in a memory. A slight error based on variations in to-be-checked objects or conveyance precision of products can be allowed by this enlargement process. Thereafter, a to-be-checked object of a to-be-checked product is imaged by the television camera. Outline data is extracted from an image signal corresponding to the to-be-checked object by an outline extraction circuit and compared with the master pattern data stored in the memory, thereby performing pattern matching. By such a conventional method of matching patterns, information for determining the quality of a to-be-checked object such as a printed pattern is obtained. 
     Defects encountered in a printed pattern are roughly classified into a short-defect and a splashing defect. In the short-defect, a portion of a printed pattern is omitted or becomes faint. In the splashing defect, splashed ink, dirt, or foreign matters are adhered on a portion other than a predetermined printed portion. 
     The above conventional technique is suitably used in detection of splashing defect information. Since, however, this conventional technique is based on the master pattern obtained by performing an enlargement process for the outline and an omitted portion of a printed pattern may be included in the master pattern, the technique is unsuitable to recognize short-defect information. 
     SUMMARY OF THE INVENTION 
     It is an object of the present invention to provide a method of matching patterns, which allows recognition of both a short-defect and a splashing defect. 
     According to the method of matching patterns of the present invention, image data of a prepared master is fetched in an outline extraction circuit, and outline data of the image is extracted. Master outline data obtained by the extraction is stored in a memory, and outline data of an image of a to-be-recognized object is extracted by the outline extraction circuit. A pattern enlargement process is performed for the extracted outline data to form a to-be-recognized pattern. This to-be-recognized pattern data and the master outline data are collated with each other. 
     According to the present invention, in order to detect both a short-defect and a splashing defect, image data of a prepared master is fetched in the outline extraction circuit, and outline data of the image is extracted. Master outline data obtained by the extraction is stored in the memory, and outline data of an image of a to-be-recognized object is extracted by the outline extraction circuit. This extracted outline data is enlargement-processed to form a first to-be-recognized pattern. Enlarged master pattern data obtained by performing an enlargement process for the master outline data of the master image extracted from the outline extraction circuit is stored in a second memory, and the outline data of the image of the to-be-recognized object is extracted by the outline extraction circuit to form a second to-be-recognized pattern. A first pattern matching process for collating the first to-be-recognized pattern with the master outline data and a second pattern matching process for collating the second to-be-recognized pattern data with the enlarged master pattern data are performed parallel to each other. 
     An apparatus of matching patterns according to the present invention comprises an outline extraction circuit for independently fetching image data of a prepared master and image data of a to-be-recognized object and extracting outline data of the images, a pattern enlargement circuit, connected to the output terminal of the outline extraction circuit, for performing an enlargement process for the extracted outline data, a first memory, connected to the output terminal of the outline extraction circuit, for storing the outline data extracted for the master image as master outline data, a first pattern matching circuit, connected to the output terminals of the first memory and the pattern enlargement circuit, for collating the master outline data with first to-be-recognized pattern data of the to-be-recognized object obtained by the pattern enlargement circuit, a second memory, connected to the output terminal of the pattern enlargement circuit, for storing enlarged master pattern data of the master image obtained by the pattern enlargement circuit, and a second pattern matching circuit, connected to the output terminals of the second memory and the outline extraction circuit, for collating the enlarged master pattern data of the master image with second to-be-recognized pattern data of the to-be-recognized object obtained by the outline extraction circuit. 
     In the present invention, master outline data serving as a comparison reference is outline data extracted from prepared master image data, and this master outline data is stored in the memory without being enlargement-processed. Subsequently, to-be-recognized pattern data to be compared with the master outline data is formed by performing an enlargement process for outline data of a to-be-recognized object. The two pattern data are collated with each other, and a portion of the master outline projecting from the to-be-recognized pattern in this collation is recognized as short-defect information. 
     In the present invention, when pattern matching is executed, splashing defect information is recognized parallel to recognition of short-defect information. In the recognition of splashing defect information, master enlarged pattern data formed by performing an enlargement process for the master outline data extracted from the master image data and stored in the memory is collated with outline (to-be-recognized pattern) data of the to-be-recognized object. In this collation, a portion of the to-be-recognized pattern projecting from the master enlarged pattern is recognized as splashing defect information. 
     In the present invention, after the outline extraction circuit extracts the outline data of the prepared master image, the pattern enlargement circuit pattern-enlarges the outline data to form enlarged master pattern data. This enlarged pattern data is stored in the second memory. Since the outline data of the master image is supplied to the first memory without being enlargement-processed parallel to the storage of the pattern data, the first memory stores the outline data of the master image as master outline data. After this storage, the outline extraction circuit extracts outline data of an image of a to-be-recognized object. This outline data is supplied to the second pattern matching circuit without being enlarged by the pattern enlargement circuit. This matching circuit collates the to-be-recognized outline data with the enlarged master pattern data read out from the second memory, thereby recognizing the presence/absence of splashing defect information. Since the outline data of the image of the to-be-recognized object is enlargement-processed by the pattern enlargement circuit and supplied to the first pattern matching circuit parallel to the collation, this matching circuit collates the to-be-recognized outline data with the outline data of the master image read out from the first memory, thereby recognizing the presence/absence of short-defect information. 
     Additional objects and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objects and advantages of the invention may be realized and obtained by means of the instrumentalities and combinations particularly pointed out in the appended claims. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate presently preferred embodiments of the invention and, together with the general description given above and the detailed description of the preferred embodiments given below, serve to explain the principles of the invention. 
     FIG. 1 is a block diagram showing an apparatus for carrying out a method of matching patterns according to an embodiment of the present invention; 
     FIG. 2 is a block diagram showing a relationship between an arrangement of a short-defect recognizing unit for recognizing short-defect information and various types of patterns; 
     FIG. 3 is a block diagram showing a relationship between an arrangement of a splashing defect recognizing unit for recognizing splashing defect information and various types of patterns; and 
     FIG. 4 is a block diagram of a pattern matching apparatus according to another embodiment of the present invention. 
    
    
     DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS 
     Referring to FIG. 1, a conveyor 1 for a to-be-recognized object conveys a to-be-recognized object 2 having a printed pattern formed by, e.g., screen process printing on its surface in a direction indicated by an arrow. A television camera 3 is arranged to oppose a portion of the conveyor 1, and a field of view of the camera 3 is illuminated by a lighting device 4 as needed. 
     An electronic camera incorporating a linear array image sensor is used as the camera 3 and scans the printed pattern on the object 2 along a direction perpendicular to a conveyance direction of the conveyor 1. Picture (image) information output from the camera 3 is processed by a defect detecting device 5 shown in FIG. 1, and the quality of the printed pattern on the object 2 is checked accordingly. 
     The defect detecting device 5 comprises a AGC circuit 6, an outline extraction circuit 7, a short-defect recognizing unit 8, a short-defect determining circuit 9, a splashing defect recognizing unit 10, a splashing defect determining circuit 11, and a control circuit 12. 
     The AGC circuit 6 is connected to the output terminal of the television camera 3 and used to maintain a transmission output constant with respect to a gain variation in the entire defect detecting device 5. The outline extraction circuit 7 is connected to the output terminal of the AGC circuit 6. The outline extraction circuit 7 constituted by a differentiation circuit fetches all of signals output from the camera 3 and emphasizes changes in signals, thereby extracting outline data of the image. 
     As shown in FIGS. 1 and 2, the short-defect recognizing unit 8 is constituted by a first pattern enlargement circuit 15, a first master pattern memory 16, and a first pattern matching circuit 17. The first pattern enlargement circuit 15 is connected to the output terminal of the outline extraction circuit 7. The pattern enlargement circuit 15 performs an enlargement process for data concerning an outline of an image in the vertical and horizontal directions in order to allow an error based on a variation in printed pattern of the to-be-recognized object 2 and precision of the conveyor 1, and its enlargement size can allow a slight error based on an initial variation or conveyance precision of products. This enlargement size is designated upon initialization. The pattern enlargement circuit 15 performs an enlargement process of the outline pattern to form a to-be-recognized pattern. Note that the outline extraction circuit, the pattern enlargement circuit, and the like are described in U.S. patent application No. 07/208,097 (patented). 
     The first master pattern memory 16 is connected to the output terminal of the outline extraction circuit 7 and can be subjected to both write and read operations. The pattern memory 16 stores master outline data extracted by the outline extraction circuit 7 from a product determined as a good product by eye inspection or another suitable inspection. While to-be-recognized objects 2 of the same type are inspected, the memory 16 does not change but keeps the stored outline data. 
     The first pattern matching circuit 17 is connected to the output terminals of the first pattern enlargement circuit 15 and the first master pattern memory 16. The matching circuit 17 collates the master outline data read out from the first master pattern memory 16 with the to-be-recognized pattern data obtained by the first pattern enlargement circuit 15 and checks whether the two patterns coincide with each other. 
     The short-defect determining circuit 9 is connected to the output terminal of the first pattern matching circuit 17. The short-defect determining circuit 9 checks whether the size of defect information recognized by the short-defect recognizing unit 8 indicates a defect. Note that the size of a defect is set in the determining circuit 9 upon initialization. 
     As shown in FIGS. 1 and 3, the splashing defect recognizing unit 10 is constituted by a second pattern enlargement circuit 21, a second master pattern memory 22, and a second pattern matching circuit 23. 
     The second pattern enlargement circuit 21 is connected to the output terminal of the outline extraction circuit 7. The second pattern enlargement circuit 21 has the same arrangement as that of the first pattern enlargement circuit 15 and performs an enlargement process for outline data to enlarge an outline, thereby forming enlarged master pattern data. 
     The second master pattern memory 22 is connected to the output terminal of the second pattern enlargement circuit 21. This memory 22 can also be subjected to both write and read operations. The memory 22 stores enlarged master pattern data extracted from a product determined as a good product by eye inspection or another suitable inspection and processed by the circuit 21. While to-be-recognized objects 2 of the same type are inspected, the enlarged master pattern data stored in the memory 16 is kept unchanged. 
     The second pattern matching circuit 23 is connected to the output terminals of the outline extraction circuit 7 and the second master pattern memory 22. The matching circuit 23 collates the enlarged master pattern data read out from the second master pattern memory 22 with the outline data of the to-be-recognized object 2 obtained by the outline extraction circuit 7 and checks whether the two pattern data coincide with each other. 
     The splashing defect determining circuit 11 is connected to the output terminal of the second pattern matching circuit 23. The second pattern matching circuit 23 checks whether the size of defect information recognized by the splashing defect recognizing unit 10 indicates a defect. Note that the size of a defect is set in the determining circuit 11 upon initialization. 
     The control circuit 12 controls operations of the entire apparatus, i.e., the AGC circuit 6, the outline extraction circuit 7, the short-defect recognizing unit 8, the short-defect determining circuit 9, the splashing defect recognizing unit 10, and the splashing defect determining circuit 11. 
     An operation of detecting a defect by using the apparatus having the above arrangement will be described below. 
     After a necessary initialization operation e.g. setting of the defect size and so on is performed, a printed pattern of a product determined as a good product by eye inspection or another suitable inspection is imaged by the television camera 3, and outline data is extracted from image data of the good product (master) by the outline extraction circuit 7. The extracted outline data is stored in the short-defect recognizing unit 8 and the splashing defect recognizing unit 10, as shown in FIGS. 2 and 3. 
     More specifically, in the short-defect recognizing unit 8, master image data output from the outline extraction circuit 7 and indicated by reference symbol a in FIG. 2, e.g., outline (b) data of a character A is stored as master outline data in the first master pattern memory 16. In the splashing defect recognizing unit 10, the outline (b) data of the master image A output from the outline extraction circuit 7 and indicated by a in FIG. 3 is enlargement-processed by the second pattern enlargement circuit 21, and enlarged master pattern (c) data obtained by this enlargement process is stored in the second master pattern memory 22. 
     After pattern setting according to the master image is performed, to-be-recognized objects 2 are sequentially conveyed to the field of view of the television camera 3 by the conveyor 1 and imaged. When defect image (d) data output from the camera 3 is input to the outline extraction circuit 7 via the AGC circuit 6, outline (e) data is extracted from the image (d) data by the outline extraction circuit 7 and supplied to the short-defect recognizing unit 8 and the splashing defect recognizing unit 10. 
     In the short-defect recognizing unit 8, therefore, the outline (e) data according to the to-be-recognized object 2 output from the outline extraction circuit 7 as shown in FIG. 2 is enlargement-processed by the first pattern enlargement circuit 15. To-be-recognized pattern (f) data obtained by the enlargement process is supplied to the first pattern matching circuit 17. The to-be-recognized pattern (f) data is input to the circuit 17 in synchronism with a read operation of the master outline (b) data corresponding to the master image A from the first master pattern memory 16 to the first pattern matching circuit 17, and the two patterns are collated with each other. 
     As a result, if the image d has a short-defect X (this defect X is larger than an enlargement size set in the enlargement circuit 15) as shown in FIG. 2, a portion of the outline b corresponding to the master image projects from the enlarged to-be-recognized pattern f. The first pattern matching circuit 17 recognizes this projecting portion as short-defect information. 
     This defect information is supplied to the short-defect determining circuit 9, and the circuit 9 checks whether the defect information is a true defect. This determination is performed on the basis of whether the input defect information has a size larger than a predetermined size. 
     The outline (e) data of the image (d) corresponding to the to-be-recognized object 2 supplied to the splashing defect recognizing unit 10 is directly supplied to the second pattern matching circuit 23 without being enlargement-processed. Outline (e&#39;) data corresponding to the object 2 is input to the circuit 23 in synchronism with a read operation of the enlarged master pattern (c) data corresponding to the master image A from the second master pattern memory 22 to the second pattern matching circuit 23, and the two patterns are collated with each other. 
     If the image d has a splashing defect Y as shown in FIG. 3, therefore, a portion of an outline e&#39; corresponding to the to-be-recognized object 2 projects from the enlarged master pattern c. The second pattern matching circuit 23 recognizes this projecting portion as splashing defect information. This defect information is supplied to the splashing defect determining circuit 11, and the circuit 11 checks whether the defect information is a true defect. Similar to the determination of short-defect information, the determination of splashing defect information is performed on the basis of whether the input defect information has a size larger than a predetermined size. 
     Although the pattern enlargement circuit is provided for each recognizing unit corresponding to the type of defect in the above embodiment, a single pattern enlargement circuit 15 may be commonly used for the two recognizing units 8 and 10 as shown in FIG. 4. According to this embodiment, a single pattern enlargement circuit 15 is connected to a selector switch 25. The contacts a and b of the selector switch 25 are connected to the first pattern matching circuit 17 of the short-defect recognizing unit 8 and the second master pattern memory 22 of the splashing defect recognizing unit 10, respectively. 
     In this pattern matching apparatus, at first the selector switch 25 is switched to the contact b, and the outline (b) data of the master image is enlargement-processed by the pattern enlargement circuit 15. The enlarged master pattern (c) output from the pattern enlargement circuit 15 is stored in the second pattern memory 22 through the selector switch 25. The stored master pattern (c) data is used for collating with each of the to-be-recognized pattern (e&#39;) data sequentially input from the outline extraction circuit 7. 
     After the enlarged master pattern (c) data is stored in the second master pattern memory 22, the selector switch 25 is switched to the contact a. Then, the pattern enlargement circuit 15 enlargement-processes the to-be-recognized pattern (e) data sequentially input from the outline extraction circuit 7. The enlarged to-be-recognized pattern (f) data is input to the first pattern matching circuit 17 through the switch 25 and collated with the first master pattern (b) data stored in the first pattern memory 16. 
     According to the embodiment of FIG. 4, the single pattern enlargement circuit 15 enlargement-processes once the master outline (b) data for storing in the second master pattern memory 22, and then is used for enlargement-processing the outline (e) data of the to-be-recognized image data sequentially produced from the outline extraction circuit 7. 
     According to the pattern matching method of the present invention described above, an outline pattern extracted from a prepared master image is stored as a master outline, and this master outline is collated with a to-be-recognized pattern formed by performing an enlargement process for an outline pattern obtained for a to-be-recognized object. In this collation, since a portion of the master outline projecting from the to-be-recognized pattern is recognized as defect information, a short-defect can be recognized. 
     An outline extracted from a prepared master image is stored as a master outline and collated with a to-be-recognized pattern formed by enlarging the outline of a to-be-recognized object, and a portion of the master outline projecting from the to-be-recognized pattern is recognized as defect information in this collation. In addition, parallel to this process, an enlarged master pattern formed by enlarging the outline extracted from the master image is stored, and the outline of the to-be-recognized object is directly collated with the stored enlarged master pattern. In this collation, a portion of the to-be-recognized pattern projecting from the enlarged master pattern can be recognized as defect information. Therefore, both the short-defect and splashing defect information can be recognized parallel to each other. 
     Since the pattern matching apparatus the present invention comprises the outline extraction circuit, the pattern enlargement circuit, the first and second memories, and the first and second pattern matching circuits, it is capable of recognizing both of short-defect and splashing defect information parallel to each other. 
     Additional advantages and modifications will readily occur to those skilled in the art. Therefore, the invention in its broader aspects is not limited to the specific details, representative devices, and illustrated examples shown and described. Accordingly, various modifications may be made without departing from the spirit or scope of the general inventive concept as defined by the appended claims and their equivalents.