Shape Matching

Table of contents:

(Binary) shape matching is a tool that can be used if a Machine Vision application has to detect corresponding or similar shapes ; for example, if different parts in a production process have to be sorted or defective parts should be detected .

The image, which is the base for the shape matching process, has to be binary; so it has to be converted from a gray-level or color image. An example is on the attached CD-ROM; the color image is called shapes1.png . The following script can be used to convert the image to a binary one.

Figure 5.53. Shape Matching with IMAQ Vision Builder


IMAQ Vision Builder 6.0 List of functions generated : Tuesday, 15. October 2002 14:15 STEP #1 Extract Color Planes : HSL “ Saturation Plane IMAQ Vision VI IMAQ ExtractSingleColorPlane C Function imaqExtractColorPlanes Visual Basic Methods CWIMAQVision.ExtractColorPlanes Parameters: Color Plane Long (I32) 4 STEP #2 Threshold : Manual Threshold IMAQ Vision VI IMAQ Threshold C Function imaqThreshold Visual Basic Methods CWIMAQVision.Threshold Parameters: Range.Lower value Float (SGL) 34,133858 Range.Upper value Float (SGL) 255,000000 IMAQ Vision VI IMAQ Cast Image C Function imaqCast Visual Basic Methods CWIMAQVision.Cast Parameters: Image Type Long (I32) 0 Connections: Connect output "Image Dst Out" of "IMAQ Threshold" to input "Image Src" of "IMAQ Cast Image". Connect output "error out" of "IMAQ Threshold" to input "error in (no error)" of "IMAQ Cast Image". Comment: Display your image with a Binary palette.

Figure 5.53 shows a shape matching result of the shapes image. The entire process is divided into two parts:

  • First, we specify a template that defines the shape to be searched. We do this either by drawing a region of interest in the image or by loading a previously saved template file.
  • For the search process itself (see Figure 5.53), we can specify the minimum score value, which is a number from 0 to 1000 and is used to indicate the quality of the matching process (a perfect match would score 1000), and we can specify whether objects with the same shape but of different size from the template should be detected (scale invariance).

You can try this example with a number of different templates. Note that the conversion from color to gray-level uses the saturation plane of the HSL color model, leading to optimal results in the subsequent threshold operation.

Pattern Matching

Image Processing with LabVIEW and IMAQ Vision
Image Processing with LabVIEW and IMAQ Vision
ISBN: 0130474150
EAN: 2147483647
Year: 2005
Pages: 55 © 2008-2020.
If you may any questions please contact us: