Halcon 12.0 Solution Guide i

Embed Size (px)

Citation preview

  • 8/18/2019 Halcon 12.0 Solution Guide i

    1/344

    the power of machine vision

    Solution Guide IBasics

  • 8/18/2019 Halcon 12.0 Solution Guide i

    2/344

  • 8/18/2019 Halcon 12.0 Solution Guide i

    3/344

    Contents

    1 Guide to HALCON Methods 191.1 Color Inspection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201.2 Completeness Check . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201.3 Identication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201.4 Measuring and Comparison 2D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211.5 Measuring and Comparison 3D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211.6 Object Recognition 2D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221.7 Object Recognition 3D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221.8 Position Recognition 2D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221.9 Position Recognition 3D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231.10 Print Inspection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231.11 Quality Inspection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241.12 Robot Vision . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241.13 Security System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241.14 Surface Inspection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251.15 Texture Inspection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

    2 Image Acquisition 272.1 Basic Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

    2.1.1 Open Image Acquisition Device . . . . . . . . . . . . . . . . . . . . . . . . . . 272.1.2 Acquire Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282.1.3 Close Image Acquisition Device . . . . . . . . . . . . . . . . . . . . . . . . . . 282.1.4 A First Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

    2.2 Extended Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292.2.1 Open Image Acquisition Device . . . . . . . . . . . . . . . . . . . . . . . . . . 292.2.2 Set Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302.2.3 Acquire Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

    2.3 Programming Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302.4 Selecting Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

    2.4.1 Open Image Acquisition Device . . . . . . . . . . . . . . . . . . . . . . . . . . 312.4.2 Set Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312.4.3 Acquire Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312.4.4 Close Image Acquisition Device . . . . . . . . . . . . . . . . . . . . . . . . . . 31

    2.5 Tips & Tricks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312.5.1 Direct Access to External Images in Memory . . . . . . . . . . . . . . . . . . . 31

  • 8/18/2019 Halcon 12.0 Solution Guide i

    4/344

    2.5.2 Unsupported Image Acquisition Devices . . . . . . . . . . . . . . . . . . . . . 3

    3 Region Of Interest 333.1 Basic Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    3.1.1 Create Region . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.1.2 Create ROI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.1.3 A First Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    3.2 Extended Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2.1 Segment Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2.2 Draw Region . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2.3 Create Region . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2.4 Process Regions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2.5 Align ROIs Or Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2.6 Create ROI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2.7 Visualize Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    3.3 Programming Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.3.1 Processing inside a User Dened Region . . . . . . . . . . . . . . . . . . . . . 3

    3.3.2 Interactive Partial Filtering of an Image . . . . . . . . . . . . . . . . . . . . . . 33.3.3 Inspecting the Contours of a Tool . . . . . . . . . . . . . . . . . . . . . . . . . 3

    3.4 Selecting Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.4.1 Segment Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.4.2 Draw Region . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.4.3 Create Region . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.4.4 Process Regions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.4.5 Align ROIs Or Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.4.6 Create ROI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.4.7 Visualize Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    3.5 Relation to Other Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    3.6 Tips & Tricks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.6.1 Reuse ROI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.6.2 Effect of ROI Shape on Speed Up . . . . . . . . . . . . . . . . . . . . . . . . . 4

    3.7 Advanced Topics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.7.1 Filter masks and ROIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.7.2 Binary Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.7.3 Problems caused by Gray Values outside of the Image Domain . . . . . . . . . . 43

    4 Blob Analysis 454.1 Basic Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    4.1.1 Acquire Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.1.2 Segment Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.1.3 Extract Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.1.4 A First Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    4.2 Extended Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.1 Use Region Of Interest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.2 Align ROIs Or Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.3 Rectify Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.4 Preprocess Image(s) (Filtering) . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

  • 8/18/2019 Halcon 12.0 Solution Guide i

    5/344

    4.2.5 Extract Segmentation Parameters . . . . . . . . . . . . . . . . . . . . . . . . . 484.2.6 Segment Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 494.2.7 Process Regions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 494.2.8 Extract Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 494.2.9 Transform Results Into World Coordinates . . . . . . . . . . . . . . . . . . . . 494.2.10 Visualize Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

    4.3 Programming Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 504.3.1 Crystals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 504.3.2 Atoms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 514.3.3 Analyzing Particles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 524.3.4 Extracting Forest Features from Color Infrared Image . . . . . . . . . . . . . . . 524.3.5 Checking a Boundary for Fins . . . . . . . . . . . . . . . . . . . . . . . . . . . 544.3.6 Bonding Balls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 554.3.7 Surface Scratches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

    4.4 Selecting Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 574.4.1 Acquire Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 574.4.2 Use Region Of Interest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 574.4.3 Align ROIs Or Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 574.4.4 Rectify Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 574.4.5 Preprocess Image(s) (Filtering) . . . . . . . . . . . . . . . . . . . . . . . . . . . 584.4.6 Extract Segmentation Parameters . . . . . . . . . . . . . . . . . . . . . . . . . 584.4.7 Segment Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 584.4.8 Process Regions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 584.4.9 Extract Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 594.4.10 Transform Results Into World Coordinates . . . . . . . . . . . . . . . . . . . . 594.4.11 Visualize Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59

    4.5 Relation to Other Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 594.5.1 Methods that are Useful for Blob Analysis . . . . . . . . . . . . . . . . . . . . . 59

    4.5.2 Methods that are Using Blob Analysis . . . . . . . . . . . . . . . . . . . . . . . 604.5.3 Alternatives to Blob Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . 60

    4.6 Tips & Tricks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 604.6.1 Connected Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 604.6.2 Speed Up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60

    4.7 Advanced Topics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 614.7.1 Line Scan Cameras . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 614.7.2 High Accuracy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

    5 1D Measuring 635.1 Basic Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

    5.1.1 Acquire Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 645.1.2 Create Measure Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 645.1.3 Measure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 655.1.4 Destroy Measure Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

    5.2 Extended Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 655.2.1 Radiometrically Calibrate Image(s) . . . . . . . . . . . . . . . . . . . . . . . . 655.2.2 Align ROIs Or Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 655.2.3 Rectify Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

  • 8/18/2019 Halcon 12.0 Solution Guide i

    6/344

    5.2.4 Create Measure Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2.5 Transform Results Into World Coordinates . . . . . . . . . . . . . . . . . . . . 65.2.6 Visualize Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    5.3 Programming Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.3.1 Inspecting a Fuse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.3.2 Inspect Cast Part . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.3.3 Inspecting an IC Using Fuzzy Measuring . . . . . . . . . . . . . . . . . . . . . 65.3.4 Measuring Leads of a Moving IC . . . . . . . . . . . . . . . . . . . . . . . . . 75.3.5 Inspect IC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    5.4 Selecting Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.4.1 Acquire Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.4.2 Radiometrically Calibrate Image(s) . . . . . . . . . . . . . . . . . . . . . . . . 75.4.3 Align ROIs Or Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.4.4 Rectify Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.4.5 Create Measure Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.4.6 Measure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.4.7 Transform Results Into World Coordinates . . . . . . . . . . . . . . . . . . . . 75.4.8 Visualize Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.4.9 Destroy Measure Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    5.5 Relation to Other Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.5.1 Alternatives to 1D Measuring . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

    5.6 Tips & Tricks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.6.1 Suppress Clutter or Noise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75.6.2 Reuse Measure Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.6.3 Use an Absolute Gray Value Threshold . . . . . . . . . . . . . . . . . . . . . . 7

    5.7 Advanced Topics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.7.1 Fuzzy Measuring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.7.2 Evaluation of Gray Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

    6 Edge Extraction (Pixel-Precise) 776.1 Basic Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    6.1.1 Acquire Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.1.2 Filter Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.1.3 Extract Edges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.1.4 A First Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    6.2 Extended Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2.1 Use Region Of Interest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2.2 Filter Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2.3 Extract Edges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2.4 Process Edges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2.5 Visualize Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    6.3 Programming Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3.1 Aerial Image Interpretation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86.3.2 Segmenting a Color Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

    6.4 Selecting Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.4.1 Acquire Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.4.2 Use Region Of Interest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

  • 8/18/2019 Halcon 12.0 Solution Guide i

    7/344

    6.4.3 Filter Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 836.4.4 Extract Edges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 846.4.5 Process Edges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 846.4.6 Visualize Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84

    6.5 Relation to Other Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 846.5.1 Alternatives to Edge Extraction (Pixel-Precise) . . . . . . . . . . . . . . . . . . 84

    6.6 Tips & Tricks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 846.6.1 Speed Up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84

    7 Edge Extraction (Subpixel-Precise) 877.1 Basic Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87

    7.1.1 Acquire Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 887.1.2 Extract Edges Or Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 887.1.3 A First Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88

    7.2 Extended Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 897.2.1 Radiometrically Calibrate Image(s) . . . . . . . . . . . . . . . . . . . . . . . . 897.2.2 Use Region Of Interest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90

    7.2.3 Extract Edges Or Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 907.2.4 Determine Contour Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . 907.2.5 Process XLD Contours . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 907.2.6 Transform Results Into World Coordinates . . . . . . . . . . . . . . . . . . . . 917.2.7 Visualize Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91

    7.3 Programming Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 917.3.1 Measuring the Diameter of Drilled Holes . . . . . . . . . . . . . . . . . . . . . 917.3.2 Angiography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92

    7.4 Selecting Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 947.4.1 Acquire Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 947.4.2 Radiometrically Calibrate Image(s) . . . . . . . . . . . . . . . . . . . . . . . . 94

    7.4.3 Use Region Of Interest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 947.4.4 Extract Edges Or Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 947.4.5 Determine Contour Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . 947.4.6 Process XLD Contours . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 947.4.7 Transform Results Into World Coordinates . . . . . . . . . . . . . . . . . . . . 957.4.8 Visualize Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95

    7.5 Relation to Other Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 957.5.1 Alternatives to Edge Extraction (Subpixel-Precise) . . . . . . . . . . . . . . . . 95

    8 Contour Processing 978.1 Basic Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98

    8.1.1 Create XLD Contours . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 988.1.2 Process XLD Contours . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 988.1.3 Perform Fitting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 988.1.4 Extract Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 998.1.5 A First Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99

    8.2 Extended Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1008.2.1 Create XLD Contours . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1008.2.2 Process XLD Contours . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101

  • 8/18/2019 Halcon 12.0 Solution Guide i

    8/344

    8.2.3 Perform Fitting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.2.4 Transform Results Into World Coordinates . . . . . . . . . . . . . . . . . . . . 108.2.5 Extract Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.2.6 Convert And Access XLD Contours . . . . . . . . . . . . . . . . . . . . . . . . 108.2.7 Visualize Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

    8.3 Programming Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.3.1 Measuring Lines and Arcs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108.3.2 Close gaps in a contour . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108.3.3 Calculate Pointwise Distance between XLD Contours . . . . . . . . . . . . . . 1068.3.4 Extract Roads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

    8.4 Selecting Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.4.1 Create XLD Contours . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108.4.2 Process XLD Contours . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108.4.3 Perform Fitting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.4.4 Transform Results Into World Coordinates . . . . . . . . . . . . . . . . . . . . 108.4.5 Extract Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.4.6 Convert And Access XLD Contours . . . . . . . . . . . . . . . . . . . . . . . . 118.4.7 Visualize Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

    8.5 Relation to Other Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.5.1 Alternatives to Contour Processing . . . . . . . . . . . . . . . . . . . . . . . . . 11

    8.6 Advanced Topics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.6.1 Line Scan Cameras . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

    9 Matching 1139.1 Basic Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

    9.1.1 Acquire Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19.1.2 Create (Train) Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19.1.3 Find Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

    9.1.4 Destroy Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19.1.5 A First Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19.2 Extended Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

    9.2.1 Radiometrically Calibrate Image(s) . . . . . . . . . . . . . . . . . . . . . . . . 119.2.2 Rectify Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19.2.3 Use Region Of Interest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19.2.4 Determine Training Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . 129.2.5 Create (Train) Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19.2.6 Find Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19.2.7 Visualize Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

    9.3 Programming Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19.3.1 Creating a Model for the “Green Dot” . . . . . . . . . . . . . . . . . . . . . . . 129.3.2 Locating “Green Dots” . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19.3.3 Distinguishing coins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19.3.4 Locate Components on a PCB . . . . . . . . . . . . . . . . . . . . . . . . . . . 129.3.5 Check the State of a Dip Switch . . . . . . . . . . . . . . . . . . . . . . . . . . 129.3.6 Locating a Pipe Wrench in Different States . . . . . . . . . . . . . . . . . . . . 139.3.7 Creating a Mosaic Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139.3.8 Locate Brochure Pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

  • 8/18/2019 Halcon 12.0 Solution Guide i

    9/344

    9.3.9 Locate Road Signs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1369.4 Selecting Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138

    9.4.1 Acquire Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1389.4.2 Radiometrically Calibrate Image(s) . . . . . . . . . . . . . . . . . . . . . . . . 1389.4.3 Rectify Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1399.4.4 Use Region Of Interest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1399.4.5 Determine Training Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . 1399.4.6 Create (Train) Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1399.4.7 Find Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1409.4.8 Visualize Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1419.4.9 Destroy Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141

    9.5 Relation to Other Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1429.5.1 Methods that are Using Matching . . . . . . . . . . . . . . . . . . . . . . . . . 1429.5.2 Alternatives to Matching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142

    9.6 Tips & Tricks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1429.6.1 Speed Up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142

    9.7 Advanced Topics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1439.7.1 High Accuracy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1439.7.2 Use Timeout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143

    10 3D Matching 14510.1 Basic Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146

    10.1.1 Access 3D Object Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14610.1.2 Create Approach-Specic 3D Model . . . . . . . . . . . . . . . . . . . . . . . . 14710.1.3 Destroy 3D Object Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14810.1.4 Acquire Search Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14810.1.5 Find Approach-Specic 3D Model . . . . . . . . . . . . . . . . . . . . . . . . . 14810.1.6 Destroy Approach-Specic 3D Model . . . . . . . . . . . . . . . . . . . . . . . 148

    10.1.7 A First Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14910.2 Extended Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15010.2.1 Inspect 3D Object Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15110.2.2 Inspect Approach-Specic 3D Model . . . . . . . . . . . . . . . . . . . . . . . 15110.2.3 Re-use Approach-Specic 3D Model . . . . . . . . . . . . . . . . . . . . . . . 15110.2.4 Use Region Of Interest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15110.2.5 Visualize Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152

    10.3 Programming Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15210.3.1 Recognize 3D Clamps and Their Poses in Images . . . . . . . . . . . . . . . . . 15210.3.2 Recognize Pipe Joints and Their Poses in a 3D Scene . . . . . . . . . . . . . . . 155

    10.4 Selecting Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15710.4.1 Access 3D Object Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15710.4.2 Inspect 3D Object Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15810.4.3 Create Approach-Specic 3D Model . . . . . . . . . . . . . . . . . . . . . . . . 15810.4.4 Destroy 3D Object Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15810.4.5 Inspect Approach-Specic 3D Model . . . . . . . . . . . . . . . . . . . . . . . 15810.4.6 Re-use Approach-Specic 3D Model . . . . . . . . . . . . . . . . . . . . . . . 15810.4.7 Acquire Search Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15910.4.8 Use Region Of Interest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159

  • 8/18/2019 Halcon 12.0 Solution Guide i

    10/344

    10.4.9 Find Approach-Specic 3D Model . . . . . . . . . . . . . . . . . . . . . . . . . 1510.4.10 Visualize Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110.4.11 Destroy Approach-Specic 3D Model . . . . . . . . . . . . . . . . . . . . . . . 15

    10.5 Relation to Other Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110.5.1 Alternatives to 3D Matching . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

    11 Variation Model 16111.1 Basic Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

    11.1.1 Acquire Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111.1.2 Create Variation Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111.1.3 Align ROIs Or Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111.1.4 Train Variation Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111.1.5 Prepare Variation Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1611.1.6 Compare Variation Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1611.1.7 Destroy Variation Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1611.1.8 A First Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

    11.2 Extended Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

    11.2.1 Check Model Quality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111.2.2 Clear Training Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111.2.3 Visualize Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

    11.3 Programming Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111.3.1 Inspect a Printed Logo Using a Single Reference Image . . . . . . . . . . . . . 16611.3.2 Inspect a Printed Logo under Varying Illumination . . . . . . . . . . . . . . . . 16

    11.4 Selecting Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111.4.1 Acquire Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111.4.2 Create Variation Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111.4.3 Align ROIs Or Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111.4.4 Train Variation Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

    11.4.5 Check Model Quality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111.4.6 Prepare Variation Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1711.4.7 Clear Training Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111.4.8 Compare Variation Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1711.4.9 Visualize Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111.4.10 Destroy Variation Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

    12 Classication 17312.1 Basic Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

    12.1.1 Acquire Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112.1.2 Create Classier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112.1.3 Train Classier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112.1.4 Classify Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112.1.5 Destroy Classier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112.1.6 A First Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

    12.2 Extended Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112.2.1 Train Classier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112.2.2 Re-use Training Samples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1712.2.3 Re-use Classier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

  • 8/18/2019 Halcon 12.0 Solution Guide i

    11/344

    12.2.4 Evaluate Classier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18012.2.5 Visualize Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180

    12.3 Programming Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18012.3.1 Inspection of Plastic Meshes via Texture Classication . . . . . . . . . . . . . . 18012.3.2 Classication with Overlapping Classes . . . . . . . . . . . . . . . . . . . . . . 183

    12.4 Selecting Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18612.4.1 Acquire Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18612.4.2 Create Classier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18612.4.3 Train Classier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18612.4.4 Re-use Training Samples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18612.4.5 Re-use Classier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18712.4.6 Evaluate Classier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18712.4.7 Classify Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18712.4.8 Visualize Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18712.4.9 Destroy Classier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187

    12.5 Relation to Other Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18812.5.1 Methods that are Useful for Classication . . . . . . . . . . . . . . . . . . . . . 18812.5.2 Methods that are Using Classication . . . . . . . . . . . . . . . . . . . . . . . 18812.5.3 Alternatives to Classication . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188

    12.6 Tips & Tricks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18912.6.1 OCR for General Classication . . . . . . . . . . . . . . . . . . . . . . . . . . 189

    12.7 Advanced Topics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18912.7.1 Selection of Training Samples . . . . . . . . . . . . . . . . . . . . . . . . . . . 189

    13 Color Processing 19113.1 Basic Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192

    13.1.1 Acquire Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19213.1.2 Decompose Channels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192

    13.1.3 Process Image (Channels) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19213.1.4 A First Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19213.2 Extended Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193

    13.2.1 Demosaick Bayer Pattern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19313.2.2 Transform Color Space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19313.2.3 Train Colors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19413.2.4 Use Region Of Interest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19513.2.5 Classify Colors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19513.2.6 Compose Channels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19513.2.7 Visualize Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195

    13.3 Programming Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19513.3.1 Robust Color Extraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19513.3.2 Sorting Fuses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19713.3.3 Completeness Check of Colored Game Pieces . . . . . . . . . . . . . . . . . . . 19813.3.4 Inspect Power Supply Cables . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20113.3.5 Locating Board Components by Color . . . . . . . . . . . . . . . . . . . . . . . 202

    13.4 Selecting Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20413.4.1 Acquire Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20413.4.2 Demosaick Bayer Pattern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204

  • 8/18/2019 Halcon 12.0 Solution Guide i

    12/344

    13.4.3 Decompose Channels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213.4.4 Transform Color Space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2013.4.5 Train Colors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213.4.6 Use Region Of Interest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2013.4.7 Process Image (Channels) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2013.4.8 Classify Colors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213.4.9 Compose Channels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213.4.10 Visualize Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    13.5 Tips & Tricks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213.5.1 Speed Up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    13.6 Advanced Topics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213.6.1 Color Edge Extraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2013.6.2 Color Line Extraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

    14 Texture Analysis 20714.1 Basic Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    14.1.1 Acquire Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    14.1.2 Apply Texture Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214.1.3 Compute Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214.1.4 A First Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    14.2 Extended Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214.2.1 Rectify Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214.2.2 Scale Down Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214.2.3 Use Region Of Interest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214.2.4 Align ROIs Or Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214.2.5 Apply Texture Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214.2.6 Compute Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214.2.7 Visualize Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    14.2.8 Use Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214.3 Programming Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214.3.1 Detect Defects in a Texture with Novelty Detection . . . . . . . . . . . . . . . . 2114.3.2 Detect Defects in a Web Using Dynamic Thresholding . . . . . . . . . . . . . . 21314.3.3 Classication of Different Types of Wood . . . . . . . . . . . . . . . . . . . . . 21

    14.4 Selecting Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214.4.1 Acquire Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214.4.2 Rectify Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214.4.3 Scale Down Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214.4.4 Use Region Of Interest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214.4.5 Align ROIs Or Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214.4.6 Apply Texture Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214.4.7 Compute Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214.4.8 Visualize Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214.4.9 Use Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    14.5 Relation to Other Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214.5.1 Methods that are Using Texture Analysis . . . . . . . . . . . . . . . . . . . . . 22

    14.6 Advanced Topics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214.6.1 Fast Fourier Transform (FFT) . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

  • 8/18/2019 Halcon 12.0 Solution Guide i

    13/344

    14.6.2 Texture Analysis in Color Images . . . . . . . . . . . . . . . . . . . . . . . . . 22114.7 More Information About Texture Features . . . . . . . . . . . . . . . . . . . . . . . . . 221

    14.7.1 Entropy and Anisotropy ( entropy_gray ) . . . . . . . . . . . . . . . . . . . . . 22114.7.2 Cooccurrence Matrix ( gen_cooc_matrix ) . . . . . . . . . . . . . . . . . . . . 22414.7.3 Features of the Cooccurrence Matrix . . . . . . . . . . . . . . . . . . . . . . . . 224

    14.8 More Information About Texture Filtering . . . . . . . . . . . . . . . . . . . . . . . . . 22814.8.1 The Laws Filter (texture_laws ) . . . . . . . . . . . . . . . . . . . . . . . . . 228

    15 Bar Code 23115.1 Basic Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231

    15.1.1 Acquire Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23215.1.2 Create Bar Code Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23215.1.3 Read Bar Code(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23215.1.4 Destroy Bar Code Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23215.1.5 A First Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232

    15.2 Extended Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23215.2.1 Use Region Of Interest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233

    15.2.2 Preprocess Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23315.2.3 Rectify Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23315.2.4 Create Bar Code Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23415.2.5 Adjust Bar Code Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23515.2.6 Read Bar Code(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23715.2.7 Check Print Quality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24115.2.8 Visualize Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242

    15.3 Programming Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24315.3.1 How to Read Difcult Barcodes . . . . . . . . . . . . . . . . . . . . . . . . . . 24315.3.2 Reading a Bar Code on a CD . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24615.3.3 Checking Bar Code Print Quality . . . . . . . . . . . . . . . . . . . . . . . . . 247

    15.4 Selecting Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24815.4.1 Acquire Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24815.4.2 Use Region Of Interest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24815.4.3 Preprocess Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24915.4.4 Rectify Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24915.4.5 Create Bar Code Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24915.4.6 Adjust Bar Code Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24915.4.7 Read Bar Code(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24915.4.8 Destroy Bar Code Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24915.4.9 Check Print Quality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25015.4.10 Visualize Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250

    15.5 Relation to Other Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25015.5.1 Alternatives to Bar Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250

    15.6 Advanced Topics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25015.6.1 Use Timeout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250

    16 Data Code 25116.1 Basic Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251

    16.1.1 Acquire Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251

    http://../reference/reference_hdevelop.pdfhttp://../reference/reference_hdevelop.pdfhttp://../reference/reference_hdevelop.pdfhttp://../reference/reference_hdevelop.pdfhttp://../reference/reference_hdevelop.pdfhttp://../reference/reference_hdevelop.pdfhttp://../reference/reference_hdevelop.pdf

  • 8/18/2019 Halcon 12.0 Solution Guide i

    14/344

    16.1.2 Create Data Code Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2516.1.3 Read Data Code(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216.1.4 Destroy Data Code Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2516.1.5 A First Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    16.2 Extended Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216.2.1 Acquire Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216.2.2 Rectify Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216.2.3 Create Data Code Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2516.2.4 Optimize Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216.2.5 Train Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216.2.6 Use Region Of Interest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216.2.7 Read Data Code(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216.2.8 Inspect Data Code(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216.2.9 Check Print Quality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216.2.10 Visualize Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    16.3 Programming Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216.3.1 Training a Data Code Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2516.3.2 Reading 2D Data Codes on Chips . . . . . . . . . . . . . . . . . . . . . . . . . 25

    16.4 Selecting Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216.4.1 Acquire Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216.4.2 Rectify Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216.4.3 Create Data Code Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2516.4.4 Optimize Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216.4.5 Train Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216.4.6 Use Region Of Interest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216.4.7 Read Data Code(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216.4.8 Inspect Data Code(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216.4.9 Check Print Quality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    16.4.10 Visualize Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216.4.11 Destroy Data Code Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

    16.5 Advanced Topics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216.5.1 Use Timeout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    17 OCR 26317.1 Basic Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    17.1.1 Acquire Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217.1.2 Segment Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217.1.3 Train OCR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217.1.4 Read Symbol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217.1.5 Destroy Classier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217.1.6 A First Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    17.2 Extended Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217.2.1 Use Region Of Interest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217.2.2 Align ROIs Or Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217.2.3 Rectify Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217.2.4 Preprocess Image(s) (Filtering) . . . . . . . . . . . . . . . . . . . . . . . . . . . 2617.2.5 Extract Segmentation Parameters . . . . . . . . . . . . . . . . . . . . . . . . . 26

  • 8/18/2019 Halcon 12.0 Solution Guide i

    15/344

    17.2.6 Segment Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26817.2.7 Train OCR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27017.2.8 Read Symbol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27217.2.9 Visualize Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272

    17.3 Programming Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27317.3.1 Generating a Training File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27317.3.2 Creating and Training an OCR Classier . . . . . . . . . . . . . . . . . . . . . 27417.3.3 Reading Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27617.3.4 "Best Before" Date . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27617.3.5 Reading Engraved Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27717.3.6 Reading Forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27817.3.7 Segment and Select Characters . . . . . . . . . . . . . . . . . . . . . . . . . . . 27917.3.8 Syntactic and Lexicon-Based Auto-Correction of OCR Results . . . . . . . . . . 282

    17.4 Selecting Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28517.4.1 Acquire Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28517.4.2 Use Region Of Interest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28517.4.3 Align ROIs Or Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28517.4.4 Rectify Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28517.4.5 Preprocess Image(s) (Filtering) . . . . . . . . . . . . . . . . . . . . . . . . . . . 28517.4.6 Extract Segmentation Parameters . . . . . . . . . . . . . . . . . . . . . . . . . 28517.4.7 Segment Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28617.4.8 Train OCR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28617.4.9 Read Symbol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28617.4.10 Visualize Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28617.4.11 Destroy Classier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287

    17.5 Relation to Other Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28717.5.1 Alternatives to OCR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287

    17.6 Tips & Tricks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287

    17.6.1 Composed Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28717.7 Advanced Topics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288

    17.7.1 Line Scan Cameras . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28817.7.2 Circular Prints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28817.7.3 OCR Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288

    17.8 Pretrained OCR Fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28817.8.1 Pretrained Fonts with Regularized Weights and Rejection Class . . . . . . . . . 28917.8.2 Nomenclature for the Ready-to-Use OCR Fonts . . . . . . . . . . . . . . . . . . 28917.8.3 Ready-to-Use OCR Font ’Document’ . . . . . . . . . . . . . . . . . . . . . . . 28917.8.4 Ready-to-Use OCR Font ’DotPrint’ . . . . . . . . . . . . . . . . . . . . . . . 29017.8.5 Ready-to-Use OCR Font ’HandWritten_0-9’ . . . . . . . . . . . . . . . . . . 290

    17.8.6 Ready-to-Use OCR Font ’Industrial’ . . . . . . . . . . . . . . . . . . . . . 29117.8.7 Ready-to-Use OCR Font ’OCR-A’ . . . . . . . . . . . . . . . . . . . . . . . . . 29117.8.8 Ready-to-Use OCR Font ’OCR-B’ . . . . . . . . . . . . . . . . . . . . . . . . . 29217.8.9 Ready-to-Use OCR Font ’Pharma’ . . . . . . . . . . . . . . . . . . . . . . . . 29317.8.10 Ready-to-Use OCR Font ’SEMI’ . . . . . . . . . . . . . . . . . . . . . . . . . 294

    18 Stereo Vision 29518.1 Basic Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296

  • 8/18/2019 Halcon 12.0 Solution Guide i

    16/344

    18.1.1 Acquire Calibration Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . 2918.1.2 Calibrate Stereo Camera System . . . . . . . . . . . . . . . . . . . . . . . . . . 2918.1.3 Acquire Stereo Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2918.1.4 Rectify Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218.1.5 Reconstruct 3D Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

    18.2 Extended Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218.2.1 Use Region Of Interest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2918.2.2 Transform Results Into World Coordinates . . . . . . . . . . . . . . . . . . . . 2918.2.3 Visualize Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    18.3 Programming Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218.3.1 Segment the Components of a Board With Binocular Stereo . . . . . . . . . . . 29918.3.2 Reconstruct the Surface of Pipe Joints With Multi-View Stereo . . . . . . . . . . 302

    18.4 Selecting Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318.4.1 Calibrate Stereo Camera System . . . . . . . . . . . . . . . . . . . . . . . . . . 3018.4.2 Acquire Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318.4.3 Rectify Image(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318.4.4 Use Region Of Interest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3018.4.5 Reconstruct 3D Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3018.4.6 Transform Results Into World Coordinates . . . . . . . . . . . . . . . . . . . . 3018.4.7 Visualize Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

    18.5 Relation to Other Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318.5.1 Methods that are Using Stereo Vision . . . . . . . . . . . . . . . . . . . . . . . 30

    18.6 Tips & Tricks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318.6.1 Speed Up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

    18.7 Advanced Topics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318.7.1 High Accuracy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

    19 Visualization 307

    19.1 Basic Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319.1.1 Handling Graphics Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3019.1.2 Displaying . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319.1.3 A First Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

    19.2 Extended Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319.2.1 Handling Graphics Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3019.2.2 Displaying . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319.2.3 Mouse Interaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319.2.4 Gnuplot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

    19.3 Programming Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319.3.1 Displaying HALCON data structures . . . . . . . . . . . . . . . . . . . . . . . 31

    19.4 Selecting Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319.4.1 Handling Graphics Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3119.4.2 Displaying . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319.4.3 Mouse Interaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319.4.4 Gnuplot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

    19.5 Tips & Tricks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319.5.1 Saving Window Content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319.5.2 Execution Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

  • 8/18/2019 Halcon 12.0 Solution Guide i

    17/344

  • 8/18/2019 Halcon 12.0 Solution Guide i

    18/344

    21.4.1 Open Connection to I/O device . . . . . . . . . . . . . . . . . . . . . . . . . . . 3321.4.2 Set Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321.4.3 Read/Write Value(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321.4.4 Close Connection to I/O device . . . . . . . . . . . . . . . . . . . . . . . . . . 33

    21.5 Tips & Tricks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321.5.1 Unsupported I/O Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

    Index 339

  • 8/18/2019 Halcon 12.0 Solution Guide i

    19/344

    Guide to HALCON Methods

    Chapter 1

    Guide to HALCON Methods

    This manual introduces you to important machine vision methods. To guide you from your specicapplication to the sections of the documentation to read, this section lists common application areas andthe methods used for them.

    Generally, a lot of applications use the following methods:

    • Image Acquisition on page 27 for accessing images via an image acquisition device or via le.

    • Visualization on page 307 for the visualization of, e.g., articially created images or results of animage processing task.

    • Region of interest on page 33 for reducing the search space for a following image processing task.

    • Morphology (Reference Manual, chapter “Morphology” ), e.g., for the elimination of small gapsor protrusions from regions or from structures in gray value images.

    Other methods are more specic and thus are suited for specic application areas. Additionally, someapplication areas are part of another application area. To make the relations more obvious, for thefollowing application areas the corresponding methods and related application areas are listed:

    • Color Inspection ( page 20 )

    • Completeness Check ( page 20)

    • Identication ( page 20 )

    • Measuring and Comparison 2D (page 21 )

    • Measuring and Comparison 3D (page 21 )

    • Object Recognition 2D (page 22 )

    • Object Recognition 3D (page 22 )

    http://../reference/reference_hdevelop.pdfhttp://../reference/reference_hdevelop.pdf

  • 8/18/2019 Halcon 12.0 Solution Guide i

    20/344

    20 Guide to HALCON Methods

    • Position Recognition 2D ( page 22)

    • Position Recognition 3D ( page 23)

    • Print Inspection ( page 23 )

    • Quality Inspection ( page 24 )

    • Robot Vision ( page 24)

    • Security System (page 24 )

    • Surface Inspection ( page 25 )

    • Texture Inspection (page 26 )

    To speed up some applications, compute devices can be used. When and how to use compute devices isexplained in the chapter Compute Devices on page 319.

    1.1 Color Inspection

    For color inspection, see the descriptions for Color Processing on page 191.

    1.2 Completeness Check

    Completeness checks can be realized by different means. Common approaches are:

    • Object and position recognition 2D/3D (see page 22 ff), which is suitable, e.g., when inspectingobjects on an assembly line.

    • Variation Model on page 161, which compares images containing similar objects and returns thedifference between them considering a certain tolerance at the object’s border.

    1.3 Identication

    Dependent on the symbols or objects you have to identify, the following methods are suitable:

    • Identify symbols or characters– Bar Code on page 231

    – Data Code on page 251

    – OCR on page 263

    • Identify general objects

    – Object and position recognition 2D/3D (see page 22 ff)

  • 8/18/2019 Halcon 12.0 Solution Guide i

    21/344

    1.4 Measuring and Comparison 2D

    1.4 Measuring and Comparison 2D

    For measuring 2D features in images, several approaches are available. In the Solution Guide III-B, sec-tion 3.1 on page 33, a graph leads you from the specic features you want to measure and the appearanceof the objects in the image to the suitable measuring approach. Generally, the following approaches are

    common:

    • Blob Analysis on page 45 for objects that consist of regions of similar gray value, color, or texture.

    • Contour Processing on page 97 for objects that are represented by clear-cut edges. The contourscan be obtained by different means:

    – Edge Filtering on page 77 if pixel precision is sufcient.– Edge and Line Extraction on page 87 if subpixel precision is needed.

    • Matching on page 113 for objects that can be represented by a template. Matching comprisesdifferent approaches. For detailed information about matching see the Solution Guide II-B .

    • 1D Measuring on page 63 if you want to obtain the positions, distances, or angles of edges thatare measured along a line or an arc. More detailed information can be found in the Solution GuideIII-A.

    1.5 Measuring and Comparison 3D

    For measuring in 3D, the following approaches are available:

    • The approaches used for measuring and comparison 2D (see page 21) in combination with a cam-era calibration (see Solution Guide III-C, section 3.2 on page 68) for measuring objects that areviewed by a single camera and that lie in a single plane.

    • Pose estimation (Solution Guide III-C, chapter 4 on page 105) for the estimation of the poses of 3D objects that are viewed by a single camera and for which knowledge about their 3D model(e.g., known points, known circular or rectangular shape) is available.

    3D reconstruction is an important subcategory of 3D measuring and comprises the following methods:

    • Stereo for measuring in images obtained by a binocular or multi-view stereo system on page 295.Further information can be found in the Solution Guide III-C, chapter 5 on page 139.

    • Laser triangulation using the sheet-of-light technique (Solution Guide III-C, chapter 6 on page

    177) for measuring height proles of an object by triangulating the camera view with a projectedlight line.

    • Depth from focus (Solution Guide III-C, chapter 7 on page 199) for getting depth informationfrom a sequence of images of the same object but with different focus positions.

    • Photometric Stereo (Reference Manual, chapter “3D Reconstruction Photometric Stereo” ) forgetting information about an object’s shape because of its shading behavior (e.g., by the operatorphot_stereo ).

    http://../solution_guide/solution_guide_iii_b_2d_measuring.pdfhttp://../solution_guide/solution_guide_iii_b_2d_measuring.pdfhttp://../solution_guide/solution_guide_iii_b_2d_measuring.pdfhttp://../solution_guide/solution_guide_iii_b_2d_measuring.pdfhttp://../solution_guide/solution_guide_ii_b_matching.pdfhttp://../solution_guide/solution_guide_ii_b_matching.pdfhttp://../solution_guide/solution_guide_iii_a_1d_measuring.pdfhttp://../solution_guide/solution_guide_iii_a_1d_measuring.pdfhttp://../solution_guide/solution_guide_iii_a_1d_measuring.pdfhttp://../solution_guide/solution_guide_iii_c_3d_vision.pdfhttp://../solution_guide/solution_guide_iii_c_3d_vision.pdfhttp://../solution_guide/solution_guide_iii_c_3d_vision.pdfhttp://../solution_guide/solution_guide_iii_c_3d_vision.pdfhttp://../solution_guide/solution_guide_iii_c_3d_vision.pdfhttp://../solution_guide/solution_guide_iii_c_3d_vision.pdfhttp://../solution_guide/solution_guide_iii_c_3d_vision.pdfhttp://../solution_guide/solution_guide_iii_c_3d_vision.pdfhttp://../solution_guide/solution_guide_iii_c_3d_vision.pdfhttp://../solution_guide/solution_guide_iii_c_3d_vision.pdfhttp://../solution_guide/solution_guide_iii_c_3d_vision.pdfhttp://../reference/reference_hdevelop.pdfhttp://../reference/reference_hdevelop.pdfhttp://../reference/reference_hdevelop.pdfhttp://../reference/reference_hdevelop.pdfhttp://../reference/reference_hdevelop.pdfhttp://../reference/reference_hdevelop.pdfhttp://../reference/reference_hdevelop.pdfhttp://../reference/reference_hdevelop.pdfhttp://../solution_guide/solution_guide_iii_c_3d_vision.pdfhttp://../solution_guide/solution_guide_iii_c_3d_vision.pdfhttp://../solution_guide/solution_guide_iii_c_3d_vision.pdfhttp://../solution_guide/solution_guide_iii_c_3d_vision.pdfhttp://../solution_guide/solution_guide_iii_c_3d_vision.pdfhttp://../solution_guide/solution_guide_iii_c_3d_vision.pdfhttp://../solution_guide/solution_guide_iii_c_3d_vision.pdfhttp://../solution_guide/solution_guide_iii_c_3d_vision.pdfhttp://../solution_guide/solution_guide_iii_c_3d_vision.pdfhttp://../solution_guide/solution_guide_iii_c_3d_vision.pdfhttp://../solution_guide/solution_guide_iii_a_1d_measuring.pdfhttp://../solution_guide/solution_guide_iii_a_1d_measuring.pdfhttp://../solution_guide/solution_guide_ii_b_matching.pdfhttp://../solution_guide/solution_guide_iii_b_2d_measuring.pdfhttp://../solution_guide/solution_guide_iii_b_2d_measuring.pdfhttp://../solution_guide/solution_guide_iii_b_2d_measuring.pdf

  • 8/18/2019 Halcon 12.0 Solution Guide i

    22/344

    22 Guide to HALCON Methods

    1.6 Object Recognition 2D

    For nding specic objects in images, various methods are available. Common approaches comprise:

    • Blob Analysis on page 45 for objects that are represented by regions of similar gray value, color,o