Cognex Gsinsight

  • Upload
    dollare

  • View
    139

  • Download
    0

Embed Size (px)

Citation preview

  • Copyright, Trademarks, Patents

    The software described in this document is furnished under license, and may be used or copiedonly in accordance with the terms of such license and with the inclusion of the copyright noticeshown on this page. Neither the software, this document, nor any copies thereof may beprovided to or otherwise made available to anyone other than the licensee. Title to andownership of this software remains with Cognex Corporation or its licensor. CognexCorporation assumes no responsibility for the use or reliability of its software on equipment thatis not supplied by Cognex Corporation. Cognex Corporation makes no warranties, eitherexpress or implied, regarding the described software, its merchantability, or its fitness for anyparticular purpose.The information in this document is subject to change without notice and should not beconstrued as a commitment by Cognex Corporation. Cognex Corporation is not responsible forany errors that may be present in either this document or the associated software.

    Copyright 2000-2001 Cognex Corporation.All Rights Reserved.

    This document may not be copied in whole or in part, nor transferred to any other media orlanguage, without the written permission of Cognex Corporation.

    Cognex P/N 590-6368March 2001

  • The hardware and portions of the software described in this document may be covered by oneor more of the following U.S. patents. Other U.S. and foreign patents are pending.

    In-Sight Patents pending

    Hardware 4,972,359; 5,526,050; 5,657,403; 5,793,899

    Vision Tools 5,495,537; 5,548,326; 5,583,954; 5,602,937;5,640,200; 5,717,785; 5,742,037; 5,751,853;5,768,443; 5,796,868; 5,818,443; 5,825,483;5,825,913; 5,845,007; 5,859,466; 5,872,870;5,909,504

    The following are registered trademarks of Cognex Corporation:CognexCognex, Vision for Industry

    The following are trademarks of Cognex Corporation:The Cognex logoIn-Sight

    Other product and company names mentioned herein are the trademarks, or registeredtrademarks, of their respective owners.

  • CE Compliance Statement

    CE Declaration of ConformityManufacturer Cognex Corporation

    One Vision DriveNatick, MA 01760 USA

    Declares this CE-marked productProduct Number In-Sight 3000

    Complies With 73/23/EEC Low Voltage Directive89/336/EEC Electromagnetic Compatibility Directive

    Compliance Standards EN 60950:1992 Electrical Safety A1:1993, A2:1993, A3:1995EN 55022 RF Emissions Information Technology

    EN 50082-1 EMC Immunity Standard

    European Representative Cognex FranceImmeuble le Patio104 avenue Albert 1er92563 Rueil MalmaisonFrance

  • Table of Contents

    Introduction................................................................................................................... xiWho Should Read This Book? ................................................................................xiHow to Use This Book.............................................................................................xiFor More Information .............................................................................................. xii

    Part 1: Using the Interface ............................................................................................ 1Chapter 1: Acquiring a Working Image ....................................................................... 2

    Acquiring a Working Image ..................................................................................... 2Step 1 Start In-Sight ................................................................................... 2Step 2 Adjust the Camera .......................................................................... 3

    Chapter 2: Moving Around the Interface..................................................................... 6What is the Spreadsheet? ....................................................................................... 6Navigating the In-Sight Interface ............................................................................. 6

    Main Menus..................................................................................................... 8Using the Control Pad ................................................................................... 10Using the Keyboard....................................................................................... 12Using the Mouse ........................................................................................... 13Using Interactive Graphics ............................................................................ 13

    Chapter 3: Saving & Loading Jobs............................................................................ 15What is a Job?....................................................................................................... 15

    Lesson: Saving a Job.................................................................................... 15Lesson: Loading a Job.................................................................................. 16

    Chapter 4: Entering Formulas.................................................................................... 17What is a Formula? ............................................................................................... 17

    Cell References............................................................................................. 17The Formula Editor................................................................................................ 18

    Cell Section Mode ......................................................................................... 20Lesson: Entering Simple Formulas ............................................................... 21Lesson: Entering Formulas with Cell References......................................... 21Lesson: Entering Simple Functions .............................................................. 23Lesson: Editing Formulas.............................................................................. 24

    Chapter 5: Working With Blocks................................................................................ 25What is a Block?.................................................................................................... 25

    Lesson: Marking a Block............................................................................... 25Lesson: Editing Blocks.................................................................................. 26

  • Chapter 6: Using Property Sheets ............................................................................. 30What is a Property Sheet? .................................................................................... 30What is a Structure?.............................................................................................. 31

    Lesson: Opening A Property Sheet .............................................................. 31Lesson: Changing Parameter Values ........................................................... 31Lesson: Using Interactive Graphics .............................................................. 32Lesson: Inserting Cell References in Values ................................................ 34Lesson: Inserting Formulas in Values........................................................... 34

    Part 2: Vision Processing ........................................................................................... 37Chapter 7: Acquiring Images ..................................................................................... 38

    How Does the Spreadsheet Update?.................................................................... 38Lesson: Acquiring From Manual Triggers..................................................... 38Lesson: Acquiring from External Triggers..................................................... 39

    Chapter 8: Finding Features....................................................................................... 41Why Do I Need to Find Features?......................................................................... 41Finding Connected Regions .................................................................................. 42

    Lesson: Finding Connected Regions Using ExtractBlobs ............................ 42Lesson: Finding Connected Regions Using FindBlobs................................. 45Lesson: Finding Connected Regions Using SortBlobs................................. 47

    Finding Edges........................................................................................................ 49Lesson: Finding Edges Using FindLine ........................................................ 50Lesson: Finding Edges Using FindSegment................................................. 53Lesson: Finding Edges Using FindMultiLine................................................. 54Lesson: Finding Edges Using FindCurve ..................................................... 56Lesson: Finding Edges Using FindCircle...................................................... 59

    Finding Patterns .................................................................................................... 62Lesson: Finding Patterns Using FindPatterns .............................................. 62

    Chapter 9: Using Features to Find Objects .............................................................. 66Why Combine Features?....................................................................................... 66

    Lesson: Using PointToLine ........................................................................... 67Lesson: Using LineToLine ............................................................................ 70Lesson: Using PointToPointAngle ................................................................ 73Lesson: Creating a Fixture............................................................................ 75

    Chapter 10: Making Measurements........................................................................... 79What is a Measurement? ...................................................................................... 79

    Lesson: Counting Pixels ............................................................................... 79Lesson: Counting Features........................................................................... 84Lesson: Measuring Distances....................................................................... 84

  • Chapter 11: Creating Decision Points ....................................................................... 88What is a Decision Point? ..................................................................................... 88Converting Measurements into Decision Points ................................................... 88

    Comparison................................................................................................... 89Logical ........................................................................................................... 89Conditionals .................................................................................................. 89

    Decision Point Formula Examples ........................................................................ 89Chapter 12: Communicating Results ........................................................................ 91

    Using Discrete Output ........................................................................................... 91Lesson: Configuring Discrete Output Options............................................... 92Lesson: Writing Discrete Outputs ................................................................. 93

    Using Serial Output ............................................................................................... 95Lesson: Configuring Serial Output Options................................................... 95Lesson: Writing Serial Outputs ..................................................................... 96

    Chapter 13: Making a Run-time Interface.................................................................. 98What is a Custom View? ....................................................................................... 98

    Lesson: Understanding Graphics Functions................................................. 99Lesson: Defining a Custom View ................................................................ 102

    Chapter 14: Configuring for Startup........................................................................ 105Lesson: Selecting the Startup Job....................................................................... 105

    Appendix A: The Profiler .......................................................................................... 106Appendix B: Remote Job Selection......................................................................... 107

    Lesson: Initiating a Job Load............................................................................... 107Lesson: Responding to a Job Load..................................................................... 108

    Appendix C: Sample Images .................................................................................... 110

  • List of Figures

    Figure 1-1. System Menu............................................................................................. 3Figure 1-2. Unfocused Image in Live Mode................................................................. 4Figure 1-3. Focused Image Beneath the Transparent Spreadsheet Overlay.............. 5Figure 2-1. Enter, Edit, and System Menus................................................................. 8Figure 2-2. In-Sight Interface Control Pad ................................................................. 10Figure 3-1. Save & Load Dialog................................................................................. 15Figure 3-2. Save Job Dialog ...................................................................................... 16Figure 4-1. Formula Editor ......................................................................................... 18Figure 4-2. Cell Selection Mode................................................................................. 20Figure 4-3. Simple Arithmetic Formula in the Formula Editor.................................... 21Figure 4-4. Formula with Cell Reference in Formula Editor....................................... 22Figure 4-5. Cell Reference Formula in Spreadsheet ................................................. 22Figure 4-6. Simple Function in Formula Editor .......................................................... 23Figure 5-1. Edit Menu................................................................................................. 26Figure 5-2. Hiding Rows............................................................................................. 28Figure 6-1. Typical Property Sheet ............................................................................ 30Figure 6-2. Typical Structure...................................................................................... 31Figure 6-3. Options within the Enter Menu ................................................................ 32Figure 6-4. Defining a Move Region .......................................................................... 33Figure 6-5. Inserting Formulas in Values................................................................... 35Figure 7-1. Triggering Options within the AcquireImage Property Sheet .................. 39Figure 8-1. Different Types of Features ..................................................................... 41Figure 8-2. ExtractBlobs Property Sheet ................................................................... 43Figure 8-3. Defining a Region .................................................................................... 44Figure 8-4. ExtractBlobs Function Inserted in Spreadsheet ...................................... 45Figure 8-5. FindBlobs Property Sheet........................................................................ 46Figure 8-6. FindBlobs Function Inserted in Spreadsheet .......................................... 47Figure 8-7. SortBlobs Property Sheet ........................................................................ 48Figure 8-8. SortBlobs Function Inserted in Spreadsheet........................................... 49Figure 8-9. FindLine Property Sheet.......................................................................... 50Figure 8-10. Defining a FindLine Region ................................................................... 51

  • Figure 8-11. FindLine Function Inserted in Spreadsheet........................................... 52Figure 8-12. FindSegment Property Sheet ................................................................ 53Figure 8-13. FindSegment Function Inserted in Spreadsheet ................................... 54Figure 8-14. FindMultiLine Property Sheet ................................................................ 55Figure 8-15. FindMultiLine Function Inserted in Spreadsheet ................................... 56Figure 8-16. Defining a FindCurve Region ................................................................ 57Figure 8-17. FindCurve Function Inserted in Spreadsheet........................................ 58Figure 8-18. FindCircle Property Sheet ..................................................................... 59Figure 8-19. Defining a FindCircle Region................................................................. 60Figure 8-20. FindCurve Function Inserted in Spreadsheet........................................ 61Figure 8-21. FindPatterns Property Sheet ................................................................. 62Figure 8-22. Defining a Model Region ....................................................................... 63Figure 8-23. Defining a Find Region .......................................................................... 64Figure 8-24. FindPatterns Function Inserted in Spreadsheet .................................... 65Figure 9-1. PointToLine Function............................................................................... 67Figure 9-2. PointToLine Property Sheet .................................................................... 68Figure 9-3. PointToLine Function Inserted in Spreadsheet ....................................... 69Figure 9-4. LineToLine Function ................................................................................ 70Figure 9-5. LineToLine Property Sheet...................................................................... 71Figure 9-6. LineToLine Function Inserted in Spreadsheet......................................... 72Figure 9-7. PointToPointAngle Function .................................................................... 73Figure 9-8. PointToPointAngle Property Sheet.......................................................... 74Figure 9-9. PointToPointAngle Function Inserted in Spreadsheet............................. 75Figure 9-10. Fixture in the Spreadsheet .................................................................... 76Figure 9-11. PlotCross Property Sheet ...................................................................... 77Figure 9-12. PlotCross Function Inserted in Spreadsheet......................................... 78Figure 10-1. ExtractHistogram Property Sheet .......................................................... 80Figure 10-2. Defining an ExtractHistogram Region ................................................... 81Figure 10-3. ExtractHistogram Function Inserted in Spreadsheet............................. 82Figure 10-4. FindMultiLine Function .......................................................................... 85Figure 10-5. PairEdges Property Sheet ..................................................................... 86Figure 10-6. PairEdges Function Inserted in Spreadsheet........................................ 87

  • Figure 12-1. Discrete Output Dialog .......................................................................... 92Figure 12-2. Output Details Dialog............................................................................. 93Figure 12-3. WriteDiscrete Property Sheet ................................................................ 94Figure 12-4. Serial Port 1 Dialog................................................................................ 95Figure 12-5. WriteSerial Property Sheet .................................................................... 97Figure 13-1. Custom View.......................................................................................... 98Figure 13-2. Graphics Control Functions................................................................. 100Figure 13-3. Graphics Display Functions................................................................. 101Figure 13-4. Configuring a Custom View in the Spreadsheet.................................. 102Figure 13-5. Custom View Dialog ............................................................................ 103Figure 13-6. Custom View of the Spreadsheet........................................................ 104Figure 14-1. Startup Dialog...................................................................................... 105Figure A-1. In-Sight Profiler ..................................................................................... 106Figure B-1. Discrete Input Dialog............................................................................. 107Figure C-2. Discrete Output Dialog.......................................................................... 108Figure C-3. Discrete Output Details Dialog.............................................................. 109Figure C-1. Image1A.bmp........................................................................................ 110Figure C-2. Image1B.bmp........................................................................................ 111Figure C-3. Image1C.bmp ....................................................................................... 111Figure C-4. Image2A.bmp........................................................................................ 112Figure C-5. Image2B.bmp........................................................................................ 112

    List of Tables

    Table 2-1. In-Sight Interface Navigation Configurations .............................................. 7Table 2-2. Basic Keyboard Navigation Keystrokes.................................................... 12Table 2-3. Basic Mouse Navigation Actions .............................................................. 13Table 2-4. Accessing Interactive Graphics ................................................................ 13

  • IntroductionWelcome to In-Sight, a compact, stand-alone machine vision sensor for automatedinspection and process control. In-Sights innovative, built-in spreadsheet interface greatlysimplifies the task of developing, operating, and maintaining vision applications.

    Who Should Read This Book?You should read Getting Started with In-Sight to quickly learn the most important features ofIn-Sights spreadsheet-based user interface. It is written primarily for engineers andprogrammers who are configuring In-Sight systems, though novice users will also find it helpful.Getting Started with In-Sight does not assume an in-depth knowledge of machine vision, but byreading it you will become familiar enough with In-Sight to start creating your own machinevision applications.This book is not a comprehensive reference to every detail of the interface; nor is it ageneralized tutorial on machine vision. Its goal is to make you comfortable enough with theIn-Sight interface to explore it on your own, and to prepare you for understanding its moreadvanced features.

    How to Use This BookGetting Started with In-Sight consists primarily of a series of lessons designed to introduce youto the fundamentals of the In-Sight spreadsheet interface. Some lessons depend on conceptsintroduced in previous lessons, so it is generally best to read them in order, particularly if youare new to machine vision.To assist you in following along with the lessons, bitmap images of the part used for this bookslessons are included on the CD-ROM that came with your In-Sight (Image1A.bmp,Image1B.bmp, Image1C.bmp, Image2A.bmp, and Image2B.bmp). Alternatively, you can setupthe In-Sight camera to acquire images directly from the images in Appendix C: Sample Images.

    NOTE: The screen captures shown and the features described in this book are currentas of version 2.00 of the In-Sight firmware. Visit the In-Sight Online SupportCenter at www.cognex.com/inSight to download updated documentation, ifavailable.

  • For More InformationOther resources available to help you learn about the In-Sight vision sensor and itsspreadsheet interface include:

    The following documents describe how to connect the vision processor, digital camera,control pad, and other components. They also contain specifications, mechanicaldrawings, and other hardware details:

    Installing the In-Sight 1000Cognex P/N 590-6346 (English)Cognex 590-6346F (French)Cognex 590-6346J (Japanese)

    Installing the In-Sight 3000Cognex P/N 590-6348 (English)Cognex 590-6348F (French)Cognex 590-6348J (Japanese)).

    In-Sight Guide and Reference, an HTML Help file provided on the In-Sight CD-ROM. In-Sight computer-based tutorials, which are included on CD-ROM with In-Sight Starter

    Accessories Kits. The In-Sight Online Support Center at

    http://www.cognex.com/insight/support/support.asp.

  • 1Part 1: Using the InterfaceThe chapters in this part of the book introduce the basic components of the spreadsheetinterface. You will learn how to acquire an image from the In-Sight camera and how to navigatethe interface.

  • 2Chapter 1: Acquiring a Working ImageIn this chapter, you will see how to start In-Sight and capture a working image to use in learningthe In-Sight graphic user interface.

    Acquiring a Working ImageBefore you can learn how to use the In-Sight interface, you will need to capture a workingimage. The following describes this procedure.

    Step 1 Start In-SightTo start the In-Sight system:

    1. Ensure that the hardware is connected properly as described in your In-Sight installationmanual.

    2. For the In-Sight 3000, switch on the VGA monitor, then apply power to the In-Sightprocessor.

    3. Ensure that the In-Sight spreadsheet overlay is visible on the VGA monitor. If not, refer toyour In-Sight installation manual.

  • Chapter 1: Acquiring a Working Image

    3

    Step 2 Adjust the CameraThe first time you use the system, you will need to adjust the cameras focus and aperture toproduce a clear image on your monitor.

    NOTE: For specific information on navigating within the In-Sight interface, refer toNavigating the Interface in the In-Sight Guide & Reference contained on yourIn-Sight CD-ROM.

    To adjust the camera:1. Open the System menu (see Figure 1-1).

    Figure 1-1. System Menu

  • Getting Started with In-Sight

    4

    2. Select Live from the System menu to put the system into live video mode. This willtemporarily remove the semitransparent spreadsheet overlay (see Figure 1-2).

    Figure 1-2. Unfocused Image in Live Mode3. Adjust the cameras position, focus ring, and lens aperture until you get a clear image on

    the monitor.

  • Chapter 1: Acquiring a Working Image

    5

    4. Press any key or button to return to the spreadsheet (see Figure 1-3).

    Figure 1-3. Focused Image Beneath the Transparent Spreadsheet Overlay

    You now have a working image to use as you learn about the In-Sight spreadsheet interface inthe following chapters.

  • 6Chapter 2: Moving Around the InterfaceIn this chapter, youll learn the basics of navigating in the In-Sight interface using the controlpad, a keyboard, or a mouse.

    What is the Spreadsheet?The In-Sight graphical user interface (GUI) consists of a semitransparent spreadsheetsuperimposed on a 640x480-pixel video image.The spreadsheet is a table of cells arranged in 400 rows (0 to 399) and 26 columns (labeled Athrough Z). Individual cells are referred to by column letter and row number: for example, cellC4 is at the intersection of column C and row 4. In most respects, the In-Sight spreadsheetworks much like other spreadsheets you may be familiar with.You will use the spreadsheet to configure vision applications by inserting expressions calledformulas into its cells (Formulas are discussed in Chapter 4: Entering Formulas). Since thespreadsheet is semitransparent, the image will always be in view.You configure the spreadsheet one cell at a time. When a cell is highlighted, its formula isdisplayed in the Formula Bar at the top-left corner of the spreadsheet. If you attempt to moveoff the edge of the screen, the spreadsheet will automatically scroll to keep the selected cell inview.

    Navigating the In-Sight InterfaceThe In-Sight user interface may be configured using the In-Sight control pad, a keyboard andmouse connected to a Windows PC, or any combination of the three input devices. Whichinput device(s) you can use depends on the type of In-Sight system you are configuring.

  • Chapter 2: Moving Around the Interface

    7

    Table 2-1 lists the methods by which each type of In-Sight Interface can be navigated:

    Table 2-1. In-Sight Interface Navigation ConfigurationsInput Device In-Sight 1000 In-Sight 3000 In-Sight PC Host

    Local No Yes Yes1Control Pad

    Network Yes1 Yes2 Yes2

    Local No No YesKeyboard

    Network Yes3 Yes3 Yes

    Local No No YesMouse

    Network Yes1 Yes3 Yes1 PC must have a standard, 15-pin game port and joystick driver installed or an available USB port for a

    third-party control pad.2 From any In-Sight 3000 on the network.

    3 From any In-Sight PC Host on the network.

    The specific actions necessary for navigating the In-Sight interface are context-sensitive, andvary according to the input device that is used.

  • Getting Started with In-Sight

    8

    Main MenusThe In-Sight interface has three main menus, as shown in Figure 2-1: System, Enter, and Edit.

    Figure 2-1. Enter, Edit, and System Menus

    The System menu contains selections for acquiring live images, saving and loading files,configuring network and serial communications, discrete I/O, user names and logonpermissions, and more. The Settings menu is accessed from the System Menu.

    The Enter menu is used throughout the interface to enter formulas and values intospreadsheet cells and parameters in property sheets.

    The Edit menu provides block-editing operations for spreadsheet cells, disables selectedcells to prevent them from updating, and configures the Custom View of the spreadsheet.The edit menu is also used to access the property sheets for Graphics Controls functionsafter they have been inserted into the spreadsheet.

    NOTE: Selections on the menus are context-sensitive. Unavailable selections are grayedout.

  • Chapter 2: Moving Around the Interface

    9

    To open the menus from anywhere in the main spreadsheet:

    The System menuControl Pad Keyboard Mouse

    Press the button. Press or + Right-click with mouse pointerover any cell not highlighted. The Enter menu

    Control Pad Keyboard Mouse

    Press and hold the button. Not directly accessible usingthe keyboard. Left-click and hold on any cell.

    The Edit menuControl Pad Keyboard Mouse

    Press the button. Press or + Right-click with mouse pointerover highlighted cell.

  • Getting Started with In-Sight

    10

    Using the Control PadUnlike a traditional vision system that requires programming from a PC and a keyboard,In-Sight can be configured using only a simple, 10-button control pad (see Figure 2-2).NOTE: For a comprehensive list of control pad actions by context within the interface,

    refer to Navigating the Interface in the In-Sight Guide & Reference contained onyour In-Sight CD-ROM.

    DirectionButtons

    ActionButtons

    Shortcut Buttons

    Figure 2-2. In-Sight Interface Control Pad

    Direction ButtonsThe four Direction Buttons are used in many common operations, including interfacenavigation, manipulating graphic regions of interest, incrementing/decrementing numericvalues, and selecting ranges of cells. The exact behavior of the direction buttons is context-sensitive.

    The up direction button moves the on-screen highlight up, decreases the size of agraphic region, and increments numeric values. In the spreadsheet, pressing holding the button selects an entire column of cells.The down direction button moves the highlight down, increases the size of a graphicregion, and decrements numeric values.The left direction button moves the highlight left, decreases the width of a graphicregion, rotates a graphic region counter-clockwise, curves a graphic region up, andselects a digit to increment in a numeric value.The right direction button moves the highlight right, increases the width of a graphicregion, rotates a graphic region clockwise, curves a graphic region down, and selects adigit to increment in a numeric value. In the spreadsheet, pressing

    button selects an entire row of cells.

  • Chapter 2: Moving Around the Interface

    11

    Action ButtonsThe four Action Buttons are used to open menus, enter formula and values, and manipulateinteractive graphics.

    In the spreadsheet, the up action button opens the System menu. In all other contextsthroughout the interface, the button cancels changes and escapes to the previousmenu or dialog. It works much like pressing the ESC key on a computer keyboard.The down action button selects the highlighted item and performs an action. The button also opens the Enter menu, but only if it is pressed and held. Otherwise, ifpressed and immediately released the button automatically selects the highlighteditem, or accepts any changes you have just made. Its function is similar to pressingENTER on a computer keyboard.The left action button accesses various editing shortcuts, including backspace in theformula editor, and zeroing numbers when in numeric edit mode. However, the mostcommon use of the left action button is to access Interactive Graphics mode.The right action button opens the Edit menu in the spreadsheet and in property sheets,and maximizes numbers when in numeric edit mode.

    Shortcut ButtonsThe two buttons in the center of the control pad perform two shortcuts:A The left-center button labeled "A" manually triggers an image acquisition and updates

    the spreadsheet.B The right-center button labeled "B" switches between the default view and the Custom

    View of the current spreadsheet job.

  • Getting Started with In-Sight

    12

    Using the KeyboardTable 2-2 shows you the basic keyboard keystrokes needed to navigate within In-Sight.

    NOTE: For a comprehensive list of keyboard actions by context within the interface,refer to Navigating the Interface in the In-Sight Guide & Reference contained onyour In-Sight CD-ROM.

    Table 2-2. Basic Keyboard Navigation KeystrokesKeystrokes Action

    Navigate the spreadsheet, menus, and dialogs. Adjust interactivegraphics.

    and

    Selects spreadsheet rows, columns, and cell ranges for block editingoperations.

    Opens the Enter menu, selects highlighted items, and accepts changes. Opens the System menu. Switches into Interactive Graphics mode. Opens the Edit menu. Manually triggers an image acquire and spreadsheet update.

    Switches between the default and the Custom View of the spreadsheet.

    Any alphanumericcharacter or symbol. Inputs values, strings, and formulas.

  • Chapter 2: Moving Around the Interface

    13

    Using the MouseTable 2-3 shows you the basic mouse actions needed to navigate within In-Sight.

    NOTE: For a comprehensive list of mouse actions by context within the interface, referto Navigating the Interface in the In-Sight Guide & Reference contained on yourIn-Sight CD-ROM

    Table 2-3. Basic Mouse Navigation ActionsMouse Action Action

    Left-click Selects/opens items throughout the entire interface. Also accepts changes madeto values.

    Left-click and hold Opens the Enter menu in the spreadsheet and in property sheets, and adjustsinteractive graphics.

    Right-clickIn the spreadsheet, opens the Edit menu and the System menu, depending onwhether the right-click action occurs on a selected cell, or outside the selection.Opens the Edit menu in property sheets. Cycles between interactive graphicsmodes.

    Right-click and drag Selects spreadsheet rows, columns, and cell ranges for block editing operations.

    Using Interactive GraphicsThe parameters for many Vision Processing, and other In-Sight functions, can be configured byadjusting an overlay graphic on top of the image. For example, an interactive graphic can beused to easily set the size, position, and rotation for a region of interest, or for training a modelregion. Interactive graphics can be accessed from any cell in the spreadsheet (while instandard or Custom View as permitted by the users Access level), or from any parameter valuein a property sheet.As shown in Table 2-4, the actions necessary for using interactive graphics depends on whichinput device you are using.

    Table 2-4. Accessing Interactive GraphicsControl Pad Keyboard Mouse

    Press . Or, press and hold to open the Enter menu, thenchoose Graphics.

    Left-click and hold to open theEnter menu, then chooseGraphics.

    When you access an interactive graphic, the semitransparent spreadsheet or property sheetoverlay will disappear, and the graphic will be displayed on top of the image. If the highlightedcell or value has an associated graphic, the graphic will appear in red on the image beneath thesemitransparent spreadsheet or property sheet overlay (If a cell or value does not have anassociated graphic, then the default interactive graphics mode will be Zoom).

  • Getting Started with In-Sight

    14

    There are 5 types of interactive graphics: regions, circles, crosses, points, and lines. The typeof graphic displayed depends on the type of input required by the cell or value.

    NOTE: For a comprehensive list of interactive graphic actions for each input device,refer to the In-Sight Guide & Reference contained on your In-Sight CD-ROM.

  • 15

    Chapter 3: Saving & Loading JobsIn this chapter, you will learn how to save and load In-Sight Jobs.

    What is a Job?A Job file (*.JOB) is an In-Sight spreadsheet containing formulas and text which performs aspecific set of machine vision tasks. Job file storage is limited to the amount of available flashmemory on the In-Sight 1000 and In-Sight 3000 sensor. File storage is virtually unlimited on anIn-Sight PC Host. The name of the job currently loaded is displayed in the lower-left corner ofthe Save & Load dialog. If the current job has not been saved, it will be "Unnamed."NOTE: All work entered in the spreadsheet remains in memory as long as the processor

    has power or the In-Sight PC Host is open. However, if the processor losespower or you close the In-Sight PC Host, you will lose all unsaved data.Therefore, make sure you save your jobs.

    Lesson: Saving a JobTo save a job:

    1. From the spreadsheet, open the System menu.2. Select Save & Load to open the Save & Load dialog (see Figure 3-1).

    Figure 3-1. Save & Load Dialog

  • Getting Started with In-Sight

    16

    3. Highlight < New >, then select Save to open a Text Entry dialog (see Figure 3-2).

    Figure 3-2. Save Job Dialog4. Enter a name for the job using the onscreen keypad.

    TIP: If you make a mistake entering your job name, backspace over the last characterentered. If you need to start over, Select Cancel.

    5. Select the Save button to accept your changes and return to the Save & Load dialog.6. In the Save & Load dialog, select Close to accept your changes and return to the

    spreadsheet.

    Lesson: Loading a JobLoading a job retrieves it from memory or disk storage (In-Sight PC Host). The steps for loadinga job are similar to the steps for saving a job:

    1. From the spreadsheet, open the System menu.2. Select Save & Load to open the Save & Load dialog.3. Select the job that you want to load, then select the Load button.4. After you have loaded the job, select Close to return to the spreadsheet.

  • 17

    Chapter 4: Entering FormulasIn this chapter, you will learn how to enter formulas into In-Sight spreadsheet cells.

    What is a Formula?A formula is a mathematical expression consisting of values and references to values,connected by mathematical operators, and resulting in a new value or set of values. In-Sightconsiders everything you enter into a cellwhether a single constant or a complex vision-processing functionto be a formula. All formulas contained in an In-Sight job spreadsheet areconstructed using the formula editor (see below).Formulas can return three types of results:

    Values Numbers, such as 1.00 or 1.00.Strings Alphanumeric characters, such as PASS or FAIL.Structures A vision-processing function (structures are discussed Chapter 6: Using

    Property Sheets).

    Cell ReferencesFormulas can refer to other cells in the spreadsheet by using absolute and relative cellreferences.Relative cell references point to cells relative to the position of the formula. When copied ormoved to a new location in the spreadsheet, these references automatically adjust to maintainthe same position relative to the formula, as in the following examples:

    A5=A3+A4 If this formula is copied to cell B5, it becomes B5=B3+B4.A5=A3+A4 If this formula is copied to cell A6, it becomes A6=A4+A5.

    Absolute cell references point to fixed locations in the spreadsheet, regardless of the formulaslocation. They do not change when the formula is copied or moved. Absolute cell referencesare designated by a dollar sign ($) preceding the cells row or column label. By placing thedollar sign appropriately, you can refer to a fixed row, column, or cell, as in the followingexamples:

    A5=$A$3+$A$4 If this formula is copied to cell B5, it becomes B5=$A$3+$A$4.A5=A$3+A$4 If this formula is copied to cell B5, it becomes B5=B$3+B$4.

  • Getting Started with In-Sight

    18

    The Formula EditorAs shown in Figure 4-1, In-Sight includes a formula editor that is used to enter formulas intothe spreadsheet. As mentioned earlier, all formulas contained in an In-Sight job spreadsheetare constructed using the formula editor.

    NOTE: The formula editor is accessed from the Enter menu.

    Formula Bar

    Onscreen Keypad

    Function Categories

    Functions & FunctionSubcategories

    Context-Sensitive Help

    Figure 4-1. Formula Editor

    The formula editor is divided into four main sections: Formula Bar: The formula bar appears at the top of the formula editor dialog and shows

    the formula that is being edited. The formula editor automatically checks the formula forcorrect syntax. If a formula is not valid, the invalid syntax will be highlighted in red; theformula will not be accepted until the syntax error is corrected. A colored cursor indicatesthe current insertion point in the formula, where changes will be made.

  • Chapter 4: Entering Formulas

    19

    Onscreen Keypad: The onscreen keypad occupies the left side of the formula editordialog. In addition to the keys for inserting numeric characters and mathematical operatorsinto formulas, the onscreen keypad provides keys for inserting cell references and text intoa formula, as follows:

    Inserts an Absolute cell reference symbol into the formula. Complete the cellreference by manually inserting an alpha character for the Column, and a numericcharacter for the Row, after the $ character (for example, $A1).

    Activates Cell Selection mode, for choosing an Absolute cell reference to insert intothe formula.

    Activates Cell Selection mode, for choosing a Relative cell reference to insert intothe formula.

    Opens the Text Entry dialog for inserting strings of alphanumeric characters andSymbols into the formula.

    Function List: A list of tool categories and subcategories occupies the center and rightsections of the formula editor. As a tool category is highlighted in the center, a list of thatcategorys functions appears in the right section, organized within subcategories. Thecurrent category and function selections are indicated by a

    Context Sensitive Help: The bottom part of the formula editor dialog contains context-sensitive help text for quick reference.

  • Getting Started with In-Sight

    20

    Cell Section ModeThe most convenient method for inserting absolute and relative cell references into formulas isto use the In-Sight Cell Selection mode. In cell selection mode, cell references are entered byhighlighting and selecting the cells to reference directly in the spreadsheet; the references donot have to be typed in manually.While in cell selection mode, the display temporarily switches from the property sheet or dialoginto a unique view of the In-Sight spreadsheet. In this view, the spreadsheet is opaque (theimage is not visible beneath the spreadsheet), and a dashed line surrounds the first cell that ishighlighted, as shown in Figure 4-2:

    Figure 4-2. Cell Selection Mode

    When cells have been highlighted and selected, the display switches back to the property sheetor dialog from which cell selection mode was initiated, and the references for those cells areinserted.In Figure 4-2, references for cells C7 and D7 will be inserted into the formula contained in cellA11. If more cells were selected than can be used as references at the insertion point of theformula, then only the first cell of the selection, cell C7, will be inserted and the reference to cellD7 will be discarded.

  • Chapter 4: Entering Formulas

    21

    Lesson: Entering Simple FormulasThis procedure describes the general procedure for entering simple formulas that do notcontain cell references.To enter a simple formula into the spreadsheet:

    1. Highlight an empty cell where you want to insert the formula.2. Open the formula editor.3. You can enter numbers and basic arithmetic operators (+, -, /, *) with the onscreen

    keypad or with the keyboard, if using the In-Sight PC Host, to create a simple formula.Figure 4-3 shows an example of a simple arithmetic formula in the formula editor.

    Figure 4-3. Simple Arithmetic Formula in the Formula Editor4. Once you have entered a formula, select OK to insert the formula into the spreadsheet.

    Lesson: Entering Formulas with Cell ReferencesThis lesson shows how cell references are included in formulas.To enter a formula that includes cell references:

    1. Highlight an empty cell where you want to insert the formula.2. Open the formula editor.3. Select Absolute Cell Reference or Relative Cell Reference from the onscreen keypad.4. Highlight a cell containing a formula and select that cell to insert the cell reference into

    the formula.5. Select a basic math operator from the onscreen keypad to insert it into the formula.

  • Getting Started with In-Sight

    22

    6. Repeat step 3, but select a different cell reference to insert in the formula.

    Figure 4-4. Formula with Cell Reference in Formula Editor7. Select OK to insert the formula into the spreadsheet (see Figure 4-5).

    Figure 4-5. Cell Reference Formula in Spreadsheet

  • Chapter 4: Entering Formulas

    23

    Lesson: Entering Simple FunctionsIn-Sight includes many standard math, statistic, and trigonometric functions. This lessondescribes the general procedure for entering these functions into a formula.To enter a simple function:

    1. Highlight an empty cell where you want to insert the formula.2. Open the formula editor.3. Select the Mathematics function category.4. Select the Trigonometry subcategory and expand that function list.5. Select the function you want to insert into the Formula Bar.6. Select Absolute Cell Reference or Relative Cell Reference from the onscreen keypad.7. Highlight a cell containing data and select that cell to insert a cell reference into the

    formula (see Figure 4-6).

    Figure 4-6. Simple Function in Formula Editor

    8. Select the

    button in the formula editor to complete the formula.9. Select OK to enter the formula in the spreadsheet.

  • Getting Started with In-Sight

    24

    Lesson: Editing FormulasAfter youve entered a formula into a spreadsheet cell, you can return to it and edit it asneeded.To edit a formula string:

    1. Highlight the cell containing the formula you want to edit, and open the formula editor.2. Move to the Formula Bar on the top of the formula editor. A text cursor will show the

    editing position on the Formula Bar.3. With the text cursor, you are able to move right and left within the formula string as well

    as backspace over existing alphanumeric characters and functions.4. When you are finished editing the formula, select OK to return to the spreadsheet.

  • 25

    Chapter 5: Working With BlocksIn this chapter, you will learn how to manipulate blocks of cells in a spreadsheet.

    What is a Block?A Block is a contiguous, rectangular group of cells in a spreadsheet. You can cut, copy, paste,clear, hide, insert, and remove blocks using functions in the Edit menu.

    Lesson: Marking a BlockBefore you can copy, cut, hide, or perform other operations on a block of cells, you need tomark the block.To mark a block of cells:

    Control Pad Keyboard Mouse

    1. Press and hold the button.

    2. Press down ( (

    Press + to markcells in rows.

    Press + to markcells in columns.

    1. Right-click and hold on anyhighlighted cell.

    2. Drag in any direction.

  • Getting Started with In-Sight

    26

    Lesson: Editing BlocksThis lesson describes each of the block-editing functions accessible from the Edit menu, asshown in Figure 5-1.NOTE: The procedures in this section can be applied to a single cell as well as to

    blocks of cells.

    Figure 5-1. Edit Menu

    CopyCopies a block of cells and stores its formulas in the systems internal clipboard, leaving theoriginal formulas in place in the spreadsheet.To copy a block of cells:

    1. Mark the block you want to copy, as described in the previous lesson.2. Select Copy from the Edit menu.

    CutCuts a block of cells and stores its formulas in the systems internal clipboard, removing theformulas from the spreadsheet.To cut a block of cells:

    1. Mark the block you want to cut, as described in the previous lesson.2. Select Cut from the Edit menu.

  • Chapter 5: Working with Blocks

    27

    PastePastes previously copied formulas contained in the systems internal clipboard back to thespreadsheet.To paste a block of cells:

    1. Highlight the upper-left cell of the blocks new location.2. Select Paste from the Edit menu.

    ClearClearing cells permanently deletes their contents. Cleared cells cannot be pasted back into thespreadsheet.To clear a block of cells:

    1. Mark the block of cells you want to clear.2. Select Clear from the Edit menu.

    Hide/Unhide Rows & ColumnsHiding rows and columns in the spreadsheet removes them from view. Their data remains inthe spreadsheet, however, and becomes visible again when you unhide them.

    NOTE: You cannot select rows and columns at the same time.To select columns of cells:

    Control Pad Keyboard MousePress and hold button. Press up (

    button to mark currentcolumn.

    Press right ( button to mark additionalcolumns.

    Press + to markcurrent column.

    Press to mark adjacentcolumns to the right.

    Left-click on a column labelat the top of thespreadsheet.

    Right-click and hold whiledragging right or left tomark additional columns.

    To select a rows of cells:Control Pad Keyboard Mouse

    Press and hold button. Press up (

    button to mark currentcolumn.

    Press right ( button to mark additionalcolumns.

    Press + to markcurrent column.

    Press to mark adjacentcolumns to the right.

    Left-click on a row label tothe left of the spreadsheet.

    Right-click and hold whiledragging up or down tomark additional rows.

  • Getting Started with In-Sight

    28

    To hide rows or columns of cells:1. Select the rows or columns you want to hide, as described above.2. Select Hide Rows or Hide Cols from the Edit menu, as shown in Figure 5-2.

    Figure 5-2. Hiding Rows

    To unhide rows and columns:1. Mark, as described above, the rows or columns that fall on both sides of the hidden rows

    or columns.2. Select Unhide Rows or Unhide Cols from the Edit menu.

    NOTE: You can find hidden rows and columns by looking for gaps in the row andcolumn label sequence. For example, if column A appears next to column D, thencolumns B and C are hidden.

  • Chapter 5: Working with Blocks

    29

    Inserting and Removing RowsYou can also insert rows into, or delete rows from, the spreadsheet.To insert rows:

    1. Mark a block that includes the number of rows that you want to insert. The new rows willbe inserted immediately above the block you mark.

    2. Select Insert Rows from the Edit menu.To remove rows:

    1. Mark a block that includes the rows you want to delete.2. Select Remove Rows from the Edit menu.

    NOTE: In-Sight cannot insert or delete columns.

  • 30

    Chapter 6: Using Property SheetsIn this chapter, you will learn how to use functions by configuring arguments in property sheets.

    What is a Property Sheet?A property sheet is a table that allows you to easily configure parameters for a particularIn-Sight function. Whenever a function returns a structure (see next section) or has a largenumber of input parameters, the In-Sight user interface provides a property sheet to simplify thetask of configuring the function. Figure 6-1 shows an example of a typical property sheet.

    Figure 6-1. Typical Property Sheet

    NOTE: This property sheet contains a Vision Processing function calledExtractHistogram, which is discussed in Chapter 10: Making Measurements. Fornow, ExtractHistogram provides a convenient example of a property sheet.

    When opened, the property sheet temporarily replaces the spreadsheet with a table that liststhe default parameters and values. Each row of a property sheet consists of a parametername and a value, or a group of expanded/collapsed parameters and values. Although valuesare usually numbers, references to cells in the spreadsheet, or text strings, they may also berepresented by checkboxes or drop-down lists.

  • Chapter 6: Using Property Sheets

    31

    What is a Structure?In-Sight functions that return structures differ from conventional spreadsheet functions. Insteadof returning a single value or text string to a cell, most functions that return structuresautomatically insert an array of additional functions and values into adjacent cells. Figure 6-2shows an example of a typical structure.

    Function

    Structure Name

    Array ofFunctions/Values

    Figure 6-2. Typical Structure

    NOTE: Structure functions cannot be combined in a single formula with conventionalvalues and operators. When a structure function is inserted in a cell, it must bethe only entity in that cell. The In-Sight formula editor enforces this restriction byactivating and deactivating selections as necessary.

    Lesson: Opening A Property SheetTo see an example of a property sheet:

    1. Highlight an empty cell in the spreadsheet and open the formula editor.2. Select the Vision Processing category.3. Select the Histogram subcategory4. Select ExtractHistogram. The ExtractHistogram property sheet will open.5. Select OK. A structure called Hist will appear in the spreadsheet.

    Lesson: Changing Parameter ValuesProperty sheets are initially configured with the default parameter values for the selectedfunction. You can edit these values as necessary to configure the property sheet for yourapplication.To change the values in a property sheet:

    1. Highlight the cell in the spreadsheet containing the Hist structure created in the lastlesson, and open its property sheet.

    2. Select the value you want to change.

  • Getting Started with In-Sight

    32

    3. Open the Enter menu (see Figure 6-3), which includes the following items:Number: Inserts a constant value into an edit box, check box, list box, or Interactive

    Graphic.Relative: Switches to Cell Selection mode for selecting a cell from the spreadsheet

    to use as a relative reference.Absolute: Switches to Cell Selection mode for selecting a cell from the spreadsheet

    to use as an absolute reference.Formula: Activates the formula editor.Graphics: Switches to Interactive Graphics mode for changing the size and position

    of the interactive graphic, if available.

    Figure 6-3. Options within the Enter Menu4. Select a menu option (i.e., Number).5. Change the value as needed.6. Select OK to accept your changes, or select Cancel to leave the property sheet

    unchanged.

    Lesson: Using Interactive GraphicsSome property sheet values are contained in an expandable parameter group. Theseparameter groups are common in structure functions that include a graphical representation,such as an image region.A region consists of a set of image coordinates that define a contiguous section of the image forprocessing. Since adjusting region coordinates one value at a time would be tedious, property

  • Chapter 6: Using Property Sheets

    33

    sheets allow you to adjust most image-related parameter groups as a single InteractiveGraphic.

    NOTE: For a comprehensive list of interactive graphic actions for each input device,refer to the In-Sight Guide & Reference contained on your In-Sight CD-ROM.

    To use an Interactive Graphic:1. Highlight the cell in the spreadsheet containing the Hist structure, which was created

    earlier.2. Open the ExtractHistogram property sheet.3. Expand the Region group. Highlight the X parameter value and switch to Interactive

    Graphics mode (see Figure 6-4).

    Figure 6-4. Defining a Move Region

    4. Accept or cancel changes that were made to the interactive graphic. This will return youto the ExtractHistogram property sheet.

    5. Select OK to accept your changes, or select Cancel to leave the property sheetunchanged.

  • Getting Started with In-Sight

    34

    Lesson: Inserting Cell References in ValuesFunction parameters can include references to other cells in the spreadsheet.To insert a cell reference as a function parameter:

    1. Highlight a cell in the property sheet where you want to insert a cell reference.2. Open the Enter menu.3. Select Relative or Absolute to Cell Selection mode.4. Select the cell you want to refer to, then accept your selection.

    TIP: You can replace multiple function arguments with cell references by marking ablock of cells in the spreadsheet while in Cell Selection mode.

    Lesson: Inserting Formulas in ValuesSpreadsheet formulas that compute a single value can also be used as parameter values in aproperty sheet.To use the formula editor to insert a formula:

    1. Highlight a row in the property sheet where you want to insert a formula.2. Open the Enter menu, and select Formula to open the formula editor, as shown in

    Figure 6-5.NOTE: You can also activate the formula editor by opening the Edit menu, then selecting

    Formula. This method is useful for overriding property sheet check boxes, listboxes, and other embedded controls.

  • Chapter 6: Using Property Sheets

    35

    3. Use the formula editor to insert your formula directly into the parameter value, as shownin Figure 6-5.

    Figure 6-5. Inserting Formulas in Values4. Select OK to accept your changes, or select Cancel to leave the property sheet

    unchanged.

  • 37

    Part 2: Vision ProcessingIn the previous chapters you learned how to navigate the In-Sight interface. In the followingchapters, you will learn the basic techniques for configuring a vision application in thespreadsheet.

  • 38

    Chapter 7: Acquiring ImagesIn this chapter, youll learn how to acquire images, set image acquisition parameters, andtrigger processing.

    How Does the Spreadsheet Update?Cell dependencies drive spreadsheet updates. For example, in the formula A1 = B1 + C1, cellA1 is said to be dependent on cells B1 and C1. In this case, A1 automatically updateswhenever B1 or C1 changes.In-Sight dedicates cell A0 to the AcquireImage function. When AcquireImage receives atrigger from any source, it takes a digital image from the camera and assigns it to cell A0. Andbecause the results of a visual inspection are always dependent on the input image in A0, thespreadsheet updates, or runs, whenever the input image changes.

    Lesson: Acquiring From Manual TriggersManually triggered image acquisition is useful during development and testing. In-Sight has twomanual modes for acquiring images: Live and Single acquire.

    Live ModeLive video mode acquires and displays images in rapid succession while the spreadsheetoverlay is temporarily disabled. This is useful when making camera adjustments.To initiate Live video mode:

    1. Open the System menu.2. Select Live to enter Live mode.3. Press any button to exit live mode and return to the spreadsheet.

    NOTE: Any spreadsheet function that depends on the acquired image updatesautomatically when Live mode terminates.

    Single Acquire ModeTo manually acquire one image at a time:

    Control Pad Keyboard Mouse

    Press A button once totrigger single acquisition. Press to trigger single

    acquisition.

    Not available.

    NOTE: Disabling the Manual trigger checkbox in the AcquireImage Property sheet alsodisables the single acquisition trigger from the control pad.

  • Chapter 7: Acquiring Images

    39

    Lesson: Acquiring from External TriggersFor In-Sight to run a machine vision application automatically, the system must haveautomatically triggered image acquisitions. This trigger is typically supplied by an externalsignal.To select an acquisition trigger source:

    1. Highlight cell A0 in the spreadsheet.2. Open the AcquireImage property sheet.3. Highlight the value for the Trigger parameter, and open the drop-down list of trigger

    sources (see Figure 7-1).

    Figure 7-1. Triggering Options within the AcquireImage Property SheetCamera Acquires an image upon receiving a pulse to the trigger input located directly

    on the camera.Continuous Acquires images as fast as the camera will allow.External Acquires images on either a native-mode serial command or on the rising

    edge applied to a discrete input bit configured as an Acquisition Trigger(In-Sight 3000 only).

    Manual Acquires images when pressing the A button on the control pad (In-Sight3000 only), or on the keyboard (In-Sight PC Host only).

    NOTE: All external trigger sources are disabled when the system is Offline. To goOnline, return to the spreadsheet, open the System menu, and check the Onlineoption.

  • Getting Started with In-Sight

    40

    Acquisition ParametersOther parameter values in the AcquireImage function also control important image acquisitionparameters. These parameters include:

    Exposure Image exposure time can be set in milliseconds. A smaller number reducesthe blurring of an object in motion. A larger numbers allows more light on theimaging sensor.

    Light Power Light power parameters can be set to control the current on up to fourindependent LED light sources (In-Sight 3000 only).

    Gain/Offset Analog gain and offset parameters can be set to adjust the voltage of theanalog video signal before it is converted a digital signal.

    To adjust any of these parameters go to cell A0 and open the AcquireImage property sheet.Changes will take effect when you accept your changes.

  • 41

    Chapter 8: Finding FeaturesIn this chapter, you will learn several techniques for locating individual object features in thefield of view.

    Why Do I Need to Find Features?An object can be represented by the location of its coordinates in the image: row, column, andtheta (angle of rotation). But objects are also composed of a variety of individual features. Forexample, an object can include simple features such as holes, curved edges, and straightedges, or more complex features such as irregular shapes or grayscale patterns, as shown inFigure 8-1.

    Curved Edge

    Hole

    Straight Edge

    Irregular Shape

    Figure 8-1. Different Types of Features

    While In-Sight can find and report the position of an object in its entirety, you will generally wantto identify and find the objects most important features first; finding individual features issometimes easier than finding the object itself.This approach not only allows you to extract data about individual features, but also enablesyou to efficiently combine those features to locate the object or to evaluate its quality relative toa known specification.

  • Getting Started with In-Sight

    42

    This chapter discusses In-Sights primary tools for finding these types of features: Connected regions (Blobs) Edges Patterns

    Subsequent chapters describe basic techniques for combining features to find objects, makemeasurements, and create decision points based on those measurements.

    Finding Connected RegionsMany object features can be distinguished from their backgrounds according to how bright ordark they appear in the image. These bright or dark features, commonly known as Blobs, canbe described by a set of statistical characteristics.In-Sight provides several functions for extracting and identifying Blob features in an image:

    ExtractBlobs Extracts Blobs from an image.FindBlobs Compares extracted Blobs to a reference Blob.SortBlobs Sorts extracted Blobs by coordinates.

    Lesson: Finding Connected Regions Using ExtractBlobsTo insert an ExtractBlobs function into the spreadsheet:

    1. In column A, select a cell in an empty row that also has an empty row immediately above.2. Open the formula editor.

  • Chapter 8: Finding Features

    43

    3. Under Vision Processing, select ExtractBlobs from the Blob subcategory to open theExtractBlobs property sheet (see Figure 8-2).

    Figure 8-2. ExtractBlobs Property Sheet

  • Getting Started with In-Sight

    44

    4. Expand the Region group. Highlight the X parameter value and switch to InteractiveGraphics mode (see Figure 8-3).

    Figure 8-3. Defining a Region5. Position the region so that it completely encloses the Blobs you want to locate, then

    accept your changes.6. Complete the remainder of the property sheet.7. Select OK to accept your changes.

  • Chapter 8: Finding Features

    45

    The ExtractBlobs function inserts a Blobs structure in the spreadsheet (see Figure 8-4), alongwith the Vision Data Access function GetNFound:

    GetNFound Returns the number of Blobs found.

    Figure 8-4. ExtractBlobs Function Inserted in Spreadsheet

    NOTE: You can configure ExtractBlobs to return more detailed data about each of theBlobs it extracts by entering a value for Number to Sort in the property sheet.

    Lesson: Finding Connected Regions Using FindBlobsTo insert a FindBlobs function into the spreadsheet:

    1. In the spreadsheet, verify that a Blobs structure containing the ExtractBlobs function ispresent.

    2. In column A, select a cell in an empty row that also has one empty row immediatelyabove and below for each Blob you expect to report. For example, if you expect fiveBlobs, you would insert FindBlobs into a cell with one empty row immediately above andfive empty rows immediately below.

    3. Open the formula editor.4. Under Vision Processing, select FindBlobs from the Blob subcategory to open the

    FindBlobs property sheet.

  • Getting Started with In-Sight

    46

    5. Highlight the Blobs parameter value, and switch to Cell Selection mode. Select the cellcontaining the Blobs structure (see Figure 8-5).

    Figure 8-5. FindBlobs Property Sheet

    NOTE: The cell you select in the spreadsheet will provide the source Blob data for theFindBlobs function.

    6. Complete the property sheet by specifying the number of Blobs to find.7. Select OK to accept your changes.

  • Chapter 8: Finding Features

    47

    The FindBlobs function inserts a Blobs structure in the spreadsheet (see Figure 8-6), plusseveral Vision Data Access functions that return data describing each Blob found. The mostsignificant of these functions are these:

    GetRow Returns the row centroid (Row).GetCol Returns the column centroid (Col).GetAngle Returns the Blob angle (Angle).GetScore Returns the magnitude of the match (Score).

    NOTE: Our objective in this lesson is simply to find Blob objects. We are not concernedabout Blob Color, Area, Elongation, Perimeter, or Spread at this point.

    Figure 8-6. FindBlobs Function Inserted in Spreadsheet

    Lesson: Finding Connected Regions Using SortBlobsTo insert a SortBlobs function into the spreadsheet:

    1. In column A, select a cell in an empty row that also has one empty row immediatelyabove and below for each Blob you expect to report. For example, if you expect fiveBlobs, you would insert FindBlobs into a cell with one empty row immediately above andfive empty rows immediately below.

    2. Open the formula editor.3. Under Vision Processing, select SortBlobs from the Blob subcategory to open the

    SortBlobs property sheet.4. Highlight the Blobs parameter value in row 0, and switch to Cell Selection mode.

  • Getting Started with In-Sight

    48

    5. Select the Blobs structure cell containing the ExtractBlobs function (see Figure 8-7).

    Figure 8-7. SortBlobs Property Sheet6. Complete the remainder of the property sheet by specifying how many Blobs to report,

    and the sorting method.7. Select OK accept your changes.

  • Chapter 8: Finding Features

    49

    8. The SortBlobs function inserts a Blobs structure in the spreadsheet (see Figure 8-8), plusseveral Vision Data Access functions that return data describing the sorted Blobs:GetRow Returns the row centroid (Row).GetCol Returns the column centroid (Col).GetAngle Returns the Blob angle (Angle).GetScore Returns the magnitude of the match (Score).

    Figure 8-8. SortBlobs Function Inserted in Spreadsheet

    Finding EdgesEdges are places in the image where the brightness changes abruptly from dark-to-light orlight-to-dark. Edges found by In-Sight are referred to as line segments, and can be straight orcurved, or can form a complete circle.The In-Sight interface provides a variety of functions for locating straight and curved edges:

    FindLine Finds a single straight line segment.FindSegment Finds a pair of straight line segments.FindMultiLine Finds multiple straight line segments.FindCurve Finds an arc segment.FindCircle Finds a complete circular edge.

  • Getting Started with In-Sight

    50

    Lesson: Finding Edges Using FindLineTo insert a FindLine function into the spreadsheet:

    1. In column A, select a cell in an empty row that also has an empty row immediately above.2. Open the formula editor.3. Under Vision Processing, select FindLine from the Edge subcategory to open the

    FindLine property sheet (see Figure 8-9).

    Figure 8-9. FindLine Property Sheet4. Expand the Region group. Highlight the X parameter value and switch to Interactive

    Graphics mode.

  • Chapter 8: Finding Features

    51

    5. Position the region so that the Y axis is perpendicular to the edge to be located, thenaccept your changes. An example is shown in Figure 8-10.

    Figure 8-10. Defining a FindLine Region

    NOTE: The FindLine region box has two direction arrows, one initially pointing downand the other pointing right. The arrow pointing down is on the X axis, and thearrow pointing right is on the Y axis. Scanning for straight edges occurs in thedirection indicated by the arrow on the regions Y axis.

    6. Adjust the remaining parameters as necessary.NOTE: When parameters in the FindLine property sheet refer to black-to-white or white-

    to-black polarity, they are referring to brightness transitions occurring in thescan direction.

    7. Select OK to accept your changes.

  • Getting Started with In-Sight

    52

    The FindLine function inserts an Edges structure in the spreadsheet (see Figure 8-11), alongwith several Vision Data Access functions that return data about the edge segment found:

    GetRow Returns the starting and ending row coordinates (Row0 and Row1).GetCol Returns the starting and ending column coordinates (Col0 and Col1).GetScore Returns the magnitude of the edge peak (Score).

    NOTE: The reported score is positive when the FindLine region is oriented to scan fromdark to bright features, and negative when scanning from bright to dark features.

    Figure 8-11. FindLine Function Inserted in Spreadsheet

  • Chapter 8: Finding Features

    53

    Lesson: Finding Edges Using FindSegmentThe FindSegment function is similar to FindLine, but instead of finding and reporting a singlestraight edge, FindSegment locates a pair of edges and computes the distance between them.You configure the FindSegment function in the same way as the FindLine function. Figure 8-12gives an example of the FindSegment property sheet.

    Figure 8-12. FindSegment Property Sheet

  • Getting Started with In-Sight

    54

    The FindSegment function inserts an Edges structure in the spreadsheet (see Figure 8-13),along with two additional Vision Data Access functions:

    PairDistance Returns the distance between the two edge segments (Distance).GetScore Returns the average magnitude of the two edge peaks (Score).

    Figure 8-13. FindSegment Function Inserted in Spreadsheet

    Lesson: Finding Edges Using FindMultiLineThe FindMultiLine function is also similar to FindLine, but instead locates multiple straightedges. Edges found by FindMultiLine can be sorted into edge pairs, and their statisticscomputed. The lessons that follow discuss functions you can use to pair edges and computeedge pair statistics.

  • Chapter 8: Finding Features

    55

    You configure the FindMultiLine function in the same way as the FindLine function. Figure 8-14gives an example of the FindMultiLine property sheet.

    Figure 8-14. FindMultiLine Property Sheet

  • Getting Started with In-Sight

    56

    The FindMultiLine function inserts an Edges structure in the spreadsheet (see Figure 8-15),along with the Vision Data Access function GetNFound:GetNFound Returns the number of edges found.

    Figure 8-15. FindMultiLine Function Inserted in Spreadsheet

    NOTE: Unlike FindLine, FindMultiLine does not automatically place row and columncoordinate access functions into the Edges structure for all straight edges found.If you need to access the coordinates of a specific edge or pair of edges, you canmanually insert the GetRow and GetCol functions into the spreadsheet.

    Lesson: Finding Edges Using FindCurveTo insert a FindCurve function into the spreadsheet:

    1. In column A, select a cell in an empty row that also has an empty row immediately above.2. Open the formula editor.3. Under Vision Processing, select FindCurve from the Edge subcategory to open the

    FindCurve property sheet.4. Expand the Region group. Highlight the X parameter value and switch to Interactive

    Graphics mode.5. Cycle through the available Interactive Graphics modes, stopping on the Curved mode.

  • Chapter 8: Finding Features

    57

    6. Adjust the region so that its Y axis is concentric with the curved edge to be located (seeFigure 8-16), and accept your changes.

    Figure 8-16. Defining a FindCurve Region

    NOTE: The FindCurve region box has two direction arrows, one initially pointing downand the other pointing right. The arrow pointing down is on the X axis, and thearrow pointing right is on the Y axis. Scanning for curved edges occurs in thedirection indicated by the arrow on the regions X axis.

    7. Adjust the remaining parameter values as needed.NOTE: When parameters in the FindCurve property sheet refer to black-to-white or

    white-to-black polarity, they are referring to brightness transitions occurring inthe scan direction.

    8. Select OK to accept your changes.

  • Getting Started with In-Sight

    58

    The FindCurve function inserts an Edges structure in the spreadsheet (see Figure 8-17), alongwith several Vision Data Access functions that return data about the curved edge that wasfound:

    GetRow Returns the center, starting, and ending row coordinates (CentRow,StartRow, and EndRow).

    GetCol Returns the center, starting, and ending column coordinates (CentCol,StartCol, and EndCol).

    GetRadius Returns the Radius.GetScore Returns the magnitude of the edge peak (Score).

    NOTE: The reported score is positive when the FindCurve region is oriented to scanfrom dark to bright features, and negative when scanning from bright to darkfeatures.

    Figure 8-17. FindCurve Function Inserted in Spreadsheet

  • Chapter 8: Finding Features

    59

    Lesson: Finding Edges Using FindCircleThe FindCircle function is similar to FindCurve, but instead of finding and reporting an arcsegment, it reports an edge along a complete 360-degree circle (see Figure 8-18).

    Figure 8-18. FindCircle Property Sheet

  • Getting Started with In-Sight

    60

    You configure a FindCircle function in the same way as other edge finding functions, exceptthat instead of defining a region with Curve and Angle, you define a Torus with an Inner Radiusand Outer Radius (see Figure 8-19).

    Figure 8-19. Defining a FindCircle Region

  • Chapter 8: Finding Features

    61

    The FindCircle function inserts an Edges structure in the spreadsheet (see Figure 8-20), alongwith several Vision Data Access functions that return data about the circular edge that wasfound:

    GetRow Returns the center row coordinate (CentRow).GetCol Returns the center column coordinate (CentCol).GetRadius Returns the radius (Radius).GetScore Returns the magnitude of the edge peak (Score).

    NOTE: Scanning for circular edges occurs from the center of the circle outward. Whenparameters in the FindCircle property sheet refer to black-to-white or white-to-black polarity, they are referring to brightness transitions occurring in the scandirection.

    Figure 8-20. FindCurve Function Inserted in Spreadsheet

  • Getting Started with In-Sight

    62

    Finding PatternsIn-Sight can locate objects and other image features in the field of view by training a model ofa pattern, then searching subsequent images for matching patterns. The In-Sight FindPatternsfunction combines model training and pattern matching into a single function.

    Lesson: Finding Patterns Using FindPatternsTo insert a FindPatterns function into the spreadsheet:

    1. In column A, select a cell in an empty row that also has one empty row immediatelyabove and below for each pattern you expect to report. For example, if you expect to findtwo patterns, you would insert FindPatterns into a cell with one empty row immediatelyabove and two empty rows immediately below.

    2. Open the formula editor.3. Under Vision Processing, select FindPatterns from the PatFind subcategory to open

    the FindPatterns property sheet (see Figure 8-21).

    Figure 8-21. FindPatterns Property Sheet4. Expand the Model Region group. Highlight the X parameter value and switch to

    Interactive Graphics mode.

  • Chapter 8: Finding Features

    63

    5. Position the region so that it completely encloses the model you intend to train, thenaccept your changes. An example is shown in Figure 8-22.

    Figure 8-22. Defining a Model Region6. Expand the Find Region group. Highlight the X parameter value and switch to Interactive

    Graphics mode.

  • Getting Started with In-Sight

    64

    7. Position the region so that it completely encloses the section of the image containing thepattern to be located, then accept your changes. An example is shown in Figure 8-23.

    Figure 8-23. Defining a Find Region8. Complete the remainder of the property sheet.

    NOTE: You can press the Run button to observe crosses positioned on pattern matchesfound in the image.

    9. Select OK to accept your changes.

  • Chapter 8: Finding Features

    65

    The FindPatterns function inserts a Patterns structure in the spreadsheet (see Figure 8-24),along with several Vision Data Access functions that return data about the pattern that wasfound:

    GetRow Returns the row coordinate (Row).GetCol Returns the column coordinate (Col).GetScale Returns the pattern scale offset (Scale).GetAngle Returns the pattern angle offset (Angle).GetScore Returns the magnitude of the match (Score).

    Figure 8-24. FindPatterns Function Inserted in Spreadsheet

  • 66

    Chapter 9: Using Features to Find ObjectsIn this chapter, youll learn how to use the results of the features found in Chapter 8 to reliablyfind objects.

    Why Combine Features?When an object appears in the field of view, its position is never perfectly aligned in theexpected location. In other words, there is always some degree of positional uncertainty. Tocompensate, you will sometimes need to create a fixture using one or more located features.You can then use this fixture to help track the object in the field of view, and to reliably positiontools for subsequent inspections and measurements.You can create a fixture from any set of coordinates consisting of a row, column, and theta.However, individual features are often impractical sources for fixture coordinates. Consider thefollowing:By the very nature of the edge algorithm, edge-finding routines such as FindLine can only workover a limited range of rotation.Not all Connected regions found by ExtractBlobs have well-defined orientations, and so mostBlobs cannot by themselves return the data needed for a fixture. For example, you could notcreate a fixture from a hole, because it has no reliable orientation, and therefore it cannotprovide the theta coordinate that is needed.The FindPatterns function has the fewest theoretical limitations, but can be limited byperformance requirements. Searches for rotated or scaled patterns within large image regionsdemand significant computational resources, and require a geometrically stable grayscalepattern with a clearly recognizable orientation.Combining features helps overcome the limitations that all feature-locating functions have intheir ability to report orientation. In-Sights flexible spreadsheet environment enables you to useany convenient combination of edge-, pattern-, and Blob-finding functions to establish thelocation and orientation of an object relative to a fixture.For convenience in combining the results of feature locating functions, In-Sight also suppliesseveral standard geometry functions. The most important of these functions are the following:

    PointToLine LineToLine PointToPointAngle

    The following lessons show how to use these functions, and the chapters final lesson showshow to create a fixture from combined feature results.

  • Chapter 9: Using Features to Find Objects

    67

    Lesson: Using PointToLineAs shown in Figure 9-1, the PointToLine function takes two inputs: a point, defined by (Row,Col), and a line segment, defined by (Row0,Col0,Row1,Col1) to create a structure called Dist(short for distance) that returns the coordinates, angle, and distance of a line segment that liesperpendicular to the input line segment, and passes through the input point.

    Input Line Segment

    Input Point

    Figure 9-1. PointToLine Function

    To insert a PointToLine function into the spreadsheet:1. In column A, select a cell in an empty row that also has an empty row immediately above.2. Open the formula editor.

  • Getting Started with In-Sight

    68

    3. Under Geometry, select PointToLine from the Measure subcategory to open thePointToLine property sheet (see Figure 9-2).

    Figure 9-2. PointToLine Property Sheet4. Expand the Point parameter group.5. Highlight the X parameter value, and switch to Cell Selection mode.6. Select the spreadsheet cells that contain the row value and column value of the point you

    want, and accept your selection.7. Expand the Line parameter group.8. Highlight the X 0 parameter value, and switch to Cell Selection mode.9. Select the spreadsheet cells that contains the row and column values for the starting and

    ending points of the line segment, and accept your selection.10. Select OK to accept your changes.

  • Chapter 9: Using Features to Find Objects

    69

    The PointToLine function automatically inserts a Dist structure in the spreadsheet (see Figure9-3), along with several Vision Data Access functions that return data about the newly createdline segment between the input point and the input line segment:

    GetRow Returns the starting and ending row coordinates (Row0 and Row1).GetCol Returns the starting and ending column coordinates (Column0 and

    Column1).GetAngle Returns the Angle between the input point and line segment.GetDistance Returns the Distance between the input point and the line segment.

    Figure 9-3. PointToLine Function Inserted in Spreadsheet

  • Getting Started with In-Sight

    70

    Lesson: Using LineToLineThe LineToLine function takes as its inputs a pair of line segments defined by (Row0, Col0,Row1, Col1). From these, it creates a Dist structure (see Figure 9-4). The starting and endingpoints of the Dist line segment are the points of intersection with the two input lines.

    Input LineSegment 1

    Input LineSegment 0

    Figure 9-4. LineToLine Function

    To insert a LineToLine function into the spreadsheet:1. In column A, select a cell in an empty row that also has an empty row immediately above.2. Open the formula editor.

  • Chapter 9: Using Features to Find Objects

    71

    3. Under Geometry, select LineToLine from the Measurements subcategory to open theLineToLine property sheet (see Figure 9-5).

    Figure 9-5. LineToLine Property Sheet4. Expand the Line 0 parameter group.5. Highlight the X 0 parameter value, and switch to Cell Selection mode.6. Highlight the spreadsheet cells that contain the row and column values for the starting

    and ending points of the first line segment, and accept your selection.7. Expand the Line 1 parameter group.8. Highlight the X 1 parameter value, and switch to Cell Selection mode.9. Select the spreadsheet cells that contain the row and column values for the starting and

    ending points of the first line segment, and accept your selection.10. Select OK to accept your changes.

  • Getting Started with In-Sight

    72

    The LineToLine function inserts a Dist structure in the spreadsheet (see Figure 9-6), along withseveral Vision Data Access functions that return data about newly created line segment:

    GetRow Returns the starting and ending row coordinates (Row0 and Row1).GetCol Returns the starting and ending column coordinates (Column0 and

    Column1).GetAngle Returns the Angle between the two input lines.GetDistance Returns the Distance between the two lines.

    NOTE: The GetDistance function returns a 0 if the two input lines intersect. If the linesare parallel, GetDistance returns a positive value and GetAngle returns a 0.

    Figure 9-6. LineToLine Function Inserted in Spreadsheet

  • Chapter 9: Using Features to Find Objects

    73

    Lesson: Using PointToPointAngleOne of the more common methods of combining results is to find two features of an object, thenuse the angle between them to define the objects orientation.The PointToPointAngle function takes as its inputs two points defined by (Row0,Col0,Row1,Col1), and from these creates a Dist structure that returns the angle of a line segmentthat runs between the two input points (see Figure 9-7).

    Input Point 0 Input Point 1

    Figure 9-7. PointToPointAngle Function

    To insert a PointToPointAngle function into the spreadsheet:1. In column A, select a cell in an empty row that a