Home

HDevelop User's Guide - Image Understanding and Knowledge

image

Contents

1. pin listing advanced autocompletion execute on lt Return gt new tab editing mode browse hiigtory procedure name edit procedure intertace X hogar et B 3 Si main MEA IES clip hdev Orientation of clips PC 3 dev_update window off read_image Clip clip 7 get_image_size Clip Width Height 5 dev_close_ window dev_open window 0 0 Width 2 Height 2 black Win dev_display Clip bookmark YY set_display font WindowID 14 mono true false disp continue message WindowID black true stop 12 bin threshold Clip Dark Ajset_lut WindowID rainbow connection Dark Single m ic warning BP select_shape Single Selected area and 5000 1 dev_set_draw fill e 4 w t Figure 6 38 Program window 6 4 1 Program Window Actions 139 6 4 1 types can be modified See section 6 4 5 on page 150 for a detailed description The remaining tool bar buttons affect the editing behavior Program Window Actions Action Shortcut Description t i A FARR 3 O Alt Shift Left Alt Shift Right Back in History Forward in History Show Previous Tab Card Show Next Tab Card Alt Left Alt Right New Tab y eu Edit Interface Set Editor Mode Set Enter Execute Mode Set Auto Ctrl Shift P I or Ctrl Shift P Ctrl S ift T Ctrl Sh
2. 184 Graphical User Interface AR Graphics Window 3600 Texturedimage Es JJ E craphics Window 3600 Texturedimage oc fee B AAAA Ft gt mos der E g AAA texture y best Figure 6 67 a Default image display b 3D plot mode Mode Quality Step Axes Grid _ B EIA texture y best HL a A Visualization Parameters eje Pen Lut Paint Zoom default pes Mode texture M column Plot Quality best X contourline 3d_plot_lines Step 1 3d_plot_hidden_lines 3d_plot_point 3d_plot b Display Axes Display Grid Y Update Reset Use settings for new windows Figure 6 68 3D plot mode settings a tool bar b visualization parameters Plot Quality allows to set the rendering quality in four steps On systems without proper display hardware acceleration a lower quality should be selected to speed up the display 6 7 Graphics Window 185 Step sets the level of detail In general the lower the step value the higher the level of detail However 1f the rendering mode is set to contour_lines increasing the step value increases the level of detail Display Axes If this is enabled the axes of the 3D coordinate system are displayed in the 3D view Display Grid If this is enabled the floor of the 3D plot is painted as a grid See also section Paint settings on page 113 for the other paint modes that may be selected in this
3. 6 2 3 7 Stop Synopsis Stop program execution Shortcut HDevelop continues processing until the current operator has completed its computations This may take a long time if the operator is taking a lot of time to execute There is no way of interrupting a HALCON operator The procedure and procedure call in which the program execution was stopped becomes the current procedure and procedure call respectively After interrupting a program you may continue it by selecting Run or Step Over or Step Into if the next program line is a procedure call You may also edit the program before continuing it e g by parameter modification by exchanging operators with alternatives or by inserting additional operators Clicking Stop stops the program immediately if the current operator is wait_seconds 6 2 3 8 Stop after Procedure Synopsis Stop program execution after current procedure Shortcut Same as Stop but finishes the current procedure if any first 6 2 3 9 Call Stack Synopsis Visualize the calling hierarchy Shortcut Ctrl Shift 0 C Or Ctri Shift 0 Ctrl Shift C Selecting this item depicts a dialog that contains a list of the names of all procedures that are currently called on HDevelop s internal call stack The top most procedure call belongs to the most recently called procedure the bottom most procedure call always belongs to the main procedure Clicking on a procedure call in the dialog makes the sele
4. 0 148 Graphical User Interface Action Shortcut Description bal as ES M E El Run Until Here Open Operator Window Help Show Procedure Show Procedure in New Tab Show Procedure in New Window Show Caller Cut Copy Paste Delete Activate Shift FS Ctrl Shift Space Alt Return Alt Enter Alt Ctrl Return Alt Ctrl Enter Alt Shift Return Alt Shift Enter Ctrl X Or Shift Del g Ctrl C Or Ctrl V Or g B De F 3 Ctrl Ins Shift Ins or or or Execute the lines from the PC to the line under the mouse cursor Open the current operator or procedure call in the operator window for editing If the line under the mouse cursor contains an operator call the corresponding page will be opened in the online help window This is a shortcut to double clicking the program line and clicking Help in the op erator window If the line under the mouse cursor contains a procedure call the corresponding pro cedure will become the current procedure i e it is displayed for editing If the line under the mouse cursor contains a procedure call the corresponding pro cedure will be displayed as a new tab in the current program window If the cor responding procedure tab exists already it will be activated If the line under the mouse cursor contains a procedure call the corresponding proce dure will be displayed in
5. Connect Live continuous display Figure 3 4 Browsing the selected images Generate Code Switch to the tab card Code Generation and specify a variable name in the text field Image Object You can later access the image in the program by this name If multiple images or a directory were selected in the tab card Source the image acquisition assistant will read the images in a loop In this case the following additional variable names need to be specified 3 3 1 Acquiring Images From Files or Directories 27 Loop Counter The name of the loop index variable While looping over the images in the program this variable will contain the object number of the current image Image Files The name of the variable that will contain the names of the selected images Source Connection Parameters Inspect Code Generation Control Flow Acquire Images in Loop Insert Code Acquisition Mode Asynchronous Acquisition v Auto Disconnect Variable Names Connection Handle AcgHandle Loop Counter Index Image Object Image Image Files ImageFiles Code Preview g 2 a 5 y lt o a Figure 3 5 Specifying variable names for code generation Click Code Preview to inspect the code that would be generated from the currently specified parame ters Click Insert Code to generate the code and insert it at the position of the IC in the current program The following piece of code is an example generate
6. S K Password Choose new protection state for the procedure E a only if all local procedures have been locked at once Lock Remove New Password Cancel Figure 6 54 Changing the status of a protected procedure Warning When working with protected procedures be aware that the password cannot be reconstructed so be very careful not to forget it and not to repeat a typing error when assigning it Further in some situ ations protected procedures behave differently from common procedures In particular as they cannot be viewed and modified by unauthorized users they also cannot be copied printed or exported to any programming language however they can be duplicated using the menu entry Menu Procedures gt Duplicate Additionally if a protected procedure contains a call to another procedure for which the interface was changed the procedure call is not adapted to the changes but is disabled for the current program 6 4 10 Profiler The built in profiler analyzes the runtime behavior of HDevelop programs It counts operator and pro cedure calls and measures the processing times of operator calls referred to as operator time in the following The operator time plus the additional overhead of each operator call inside HDevelop is measured as well referred to as execution time in the following The operator time is the appropriate measure if you plan to export your HDevelop program to a programming language On the other
7. User Interface gt Program Listing Program Listing Fonts Language Layout Font Courier 10 Indent Size 4 Colors HALCON operators III lt internal operators MEM DeFout Classic Internal Procedures E Pastel Black External Procedures User defined Control Statements Comments Deactivated Lines Invalid Lines Line Numbers Background Editor Settings Editor Mode 9 Full Text Editor Dialog based Editor ToolTip Mode Always Only on Control key Autocompletion Advanced show after ms 300 Figure 6 15 User Interface gt Program Listing Font Specifies the font that is used in the program window Indent Size Specifies the number of spaces an indenting level in the program window accounts for In HDevelop the bodies of loops and conditionals are indented automatically Colors Specifies the colors used for syntax highlighting in the program window You can choose one of the predefined color schemes or set up your own by clicking on the colored buttons Changing any color automatically switches to the color scheme User defined g la c i E 2 5 0 80 Graphical User Interface Editor Settings HDevelop supports two methods for editing programs e Dialog based Editor Specifies the classical dialog based editing mode In this mode program lines are edited in the operator window by double clicking them in the program win
8. 7 4 6 6 The Tab Edges The Edges tab includes e Edge Extraction page 296 e Edge Selection page 297 e Display Parameters page 298 7 4 6 7 The Tab Fuzzy The Fuzzy tab includes the following subdivisions e General Options page 301 e Fuzzy Contrast page 303 e Fuzzy Edge Position page 303 e Fuzzy Pair Center Position page 303 e Fuzzy Pair Width page 304 e Fuzzy Pair Gray Mean page 304 312 HDevelop Assistants 7 4 6 8 The Tab Results The Results tab consists of the following subdivisions Feature Selection page 298 Feature Processing page 299 Edge Data page 299 7 4 6 9 The Tab Code Generation The Code Generation tab includes the following subdivisions Measuring page 305 Variable Names General page 300 Variable Names ROI coordinates page 300 Variable Names Measurement results page 300 Code Preview page 300 7 5 OCR Assistant 7 5 1 Introducing the OCR Assistant of HDevelop The OCR Assistant of HDevelop is a front end to HALCON s optical character recognition Using the OCR Assistant you can for example easily and quickly set parameters for optical character recognition OCR with the Quick Setup page 314 segment text by choosing parameters suitable for the characters appearance page 316 choose a pretrained classifier or train your own classifier page 320 choose the kind of results you need page 326 and generate code for your OCR application pa
9. Ctrl I il Ctrl Shift G 4 Ctrl Shift G 2 Ctrl Shift G 1 Ctrl Shift G 5 Ctrl Shift G Ctrl Shift G Ctrl Shift G Ctrl Shift G Home Ctrl Shift G Right Ctrl Shift G Left Hl Ctrl Shift G Ctrl Shift P S Ctrl Shift P C Ctrl Shift P I Ii Ctrl Shift P Del Ctrl E Ctrl R Ctrl Shift 0 S Ctrl Shift O G Ctrl Shift O P Ctrl Shift O V Ctrl Shift 0 0 EHR Ctrl Shift F Ctrl Shift S Ctrl Shift G Ctrl Shift P Ctrl Shift G Ctrl Shift O Ctrl Shift G Ctrl Shift Del Ctrl Shift G Ctrl Shift Q Ctrl Shift G Ctrl Shift S Ctrl Shift G Ctrl Shift l Ctrl Shift G Ctrl Shift 4 Ctrl Shift G Ctrl Shift 2 Ctrl Shift G Ctrl Shift 1 Ctrl Shift G Ctrl Shift 5 Ctrl Shift G Ctrl Shift Ctrl Shift G Ctrl Shift Ctrl Shift G Ctrl Shift Ctrl Shift G Ctrl Shift Home Ctrl Shift G Ctrl Shift Right Ctrl Shift G Ctrl Shift Left Ctrl Shift G Ctrl Shift Ctrl Shift P Ctrl Shift S Ctrl Shift P Ctrl Shift C Ctrl Shift P Ctrl Shift I Ctrl Shift P Ctrl Shift Del Ctrl Shift O Ctrl Shift S Ctrl Shift O Ctrl Shift G Ctrl Shift O Ctrl Shift P Ctrl Shift O Ctrl Shift V Ctrl Shift O Ctrl Shift O Miscellaneous Fu
10. Import Using this menu entry you can import a selection of preferences which were previously saved using the menu entry Export see below The dialog is displayed in figure 6 14 In the import dialog you can select a file with saved HDevelop preferences default file extension hdp The check boxes allow to import groups of settings selectively They correspond to the categories of the dialog The runtime settings are not persistent and can neither be exported nor imported Export The export dialog is identical to the import dialog Using the check boxes you can specify which settings will be saved to the selected file Reset Selecting this menu entry resets all preferences except the window geometry and layout to the default settings If you want to reset the window geometry as well you can start HDevelop with the following command line switch hdevelop reset_preferences K Import Preferences Ea File Name E V User Interface v External Procedures V General Options y Visualization Settings Tool Properties V Layout o D 2 Q a 0 Figure 6 14 Import 78 Graphical User Interface The preferences dialog contains a list of categories on the left and several related tab cards on the right The size and orientation of these elements are controlled by a splitter The available categories of pref erences are described in the following sections 6 2 2 Menu Edit
11. To compile and link the new program called e g test c under UNIX you can use the example makefile which can be found in the directory HALCONEXAMPLES c by calling make TEST_PROG test Alternatively you can set the variable TEST_PROG in makefile to test and then just type make You can link the program to the HALCON XL libraries by calling make TEST_PROG test XL 1 or just type make XL 1 if you set the variable TEST_PROG as described above For more details see the Programmer s Guide chapter 24 on page 197 9 6 General Aspects of Code Generation In the following general differences in the behavior of a HDevelop program and its exported versions are described 9 6 1 Arbitrary Program Code It is possible to embed arbitrary code into HDevelop programs This code is ignored inside HDevelop When you export the program to a programming language the embedded code is passed through verba tim How to enter arbitrary code inside your programs depends on your editing mode In the full text editor lines starting with as the first character mark an arbitrary code line The marker and the first space character following it are discarded when exporting the program For example the line Call MsgBox Press button to continue vbYes Program stop 1000 in HDevelop will result in 9 6 2 Assignment 393 Call MsgBox Press button to continue vbYes Program stop 1000 in Visual Basic 6 The may be followed b
12. V Replace selected program lines l Cancel Apply Help Figure 6 41 Dialog for creating a new procedure 152 Graphical User Interface Name init_image El Password Type E HDevelop 10 0 Procedure File hdvp y Public y Directory C Users Public Documents MVTec HALCON 11 0 procedures common 6 V Activated _ Keep Explicitly Opened Add Path Figure 6 42 Settings for an external procedure Name init_image E Password Type Library Procedure hdpl X Public X Library visualization C Users Public Documents MVTec HALCON 11 0 procedures pr y S V Activated Keep Explicitly Opened Add Path Figure 6 43 Settings for a library procedure Keep Explicitly Opened existing external procedures only If checked the selected procedure will be kept open for editing even if its path is not configured in the preferences Procedures marked this way can always be selected from the drop down list of the program window Add Path existing external procedures only Add the directory of the selected procedure to the list of procedure directories see section 6 2 2 16 on page 82 The addition may either be permanent or for the current session only This is further explained in section 5 4 on page 47 6 4 5 2 Setting Up the Procedure Parameters This part of the dialog is used for the definition of procedure parameters HDevelop procedure interfaces have the same structur
13. e A runtime error has occurred An input variable without a value or values outside a valid range might be typical reasons In this case the PC remains in the line of the erroneous operator or procedure call e A stop instruction is executed The PC remains on the line containing the stop instruction Note that stop instructions inside locked procedures see Protected Procedures on page 49 are obeyed However the code of the locked procedure will only be visible if the correct password is entered in the program window The procedure and procedure call in which program execution was stopped automatically become the current procedure and procedure call Clicking Run continues the program immediately if the current operator is wait_seconds 6 2 3 2 Run to Insert Cursor Synopsis Run from PC to IC Shortcut The menu entry starts executing the program at the line next to the PC The execution continues until the line before the IC is executed Any breakpoints or stop instructions in between cause the program execution to be stopped Clicking Run to Insert Cursor continues the program immediately if the current operator is wait_seconds 6 2 3 3 Step Over Synopsis Execute the next operator in the current program Shortcut This entry enables you to run a program even if it is not complete step by step HDevelop executes the operator or procedure call directly to the right of the PC After the operator or procedure call h
14. gt Le o o e a 48 HDevelop Procedures e Session directories HDevelop can also be started from the command line with a set of directories that are searched for procedures in the current session only Calling hdevelop external_proc_path lt path name s gt adds the directories given in path name s to the list of searched procedure directories Multiple 66 99 directories may be specified by using the system dependent separator i e on Windows systems and on Linux Mac OS X systems The procedure locations are searched in the following order e session directories if any e user defined directories e standard procedure path This order is important if a procedure of the same name exists in different locations For example If a program uses external procedures and you run HDevelop with session directories any duplicate procedures in the session directories will block the path to the intended procedures 5 5 Procedure Resolution A procedure can only be called if it can be resolved from the point of insertion of the procedure call Because duplicate procedure names are allowed in HDevelop understanding the order of resolution is very important Procedures are resolved based on their name only and not on the matching of the signature Thus in the following a matching procedure refers to a procedure of the name given in the procedure call If the resolved procedure has a different signature
15. 293 7 4 2 How to Use the Measure Assistant of HDevelop 294 TAS MESS sio ii a haa oe 298 TAA Code Genero lt era ba Se ea Se eS BEES ee ae eG 300 7 4 5 Advanced Measuring Tasks o e 301 746 Meastite Assistant Reference os ccc ocene ae cir raros eo a 306 73 OUR ASSMAN 24 5 2 eee ee Oe Bee ee hb we ee eae AS 312 7 5 1 Introducing the OCR Assistant of HDevelop 312 Fo DOME Gand oS AR E aera Pel esd 4 Ade ee BE ee 314 Foot ACETONA A At 316 fot DER Classiller es aba mopa e a a ES Be as lc BS 320 Pow MESS ee nerede a A e e Ra ee ee 326 230 AAA eh ER AG Se a eR RS 328 TAF UCR Assistant Reterest e condes Pa mae ee eS 329 8 HDevelop Language 337 Sil Basic Types Ob Parietal e dE SAE EG A AIN 337 8 2 Control Types and Constants lt s e soi s kh a 338 B S Vatiablek 3 lt 6 4406 bees bead ae boa AE Oe Eh ERA ES 341 8 3 1 Scope of Variables local or global o o 341 84 Operations on Iconic Objects lt serne o eses ee 342 8 5 Expressions for Input Control Parameters gt lt o c c cec ee 343 8 5 1 General Features of Tuple Operations oc 0 343 S52 ARSIENMBAL lt lt ra dd aa ORE EES 345 6 5 5 Basic Tuple Operations os 6c es aan e AO pee es DER S 347 SSA TUPIS CACI N ai E A wee Gee bee eee ae 4 348 33 Type OpenDOS 0 agusto rr aE ee Pe a ee eS 350 5 6 Bask Arithmetic Operations yo os 04 6 202
16. 6 2 9 6 Open Program Line View Synopsis Manage program lines based on certain criteria Shortcut Ctrl Shift O R OF Ctrl Shift O Ctrl Shift R The program line view window contains a listing of program lines that share a common property Click ing an entry focuses the corresponding program line in the active program window If the selected procedure is already displayed in a program window tab the corresponding tab is activated Otherwise the current view switches to the selected procedure Furthermore it is possible to activate deactivate copy cut or delete one or more of the selected program lines directly from the program line view The common properties are available as tab cards e Invalid Lines Provides a listing of invalid program lines see page 74 e Find All Provides a listing of program lines that match a previous find all operation see page 70 If the Find Replace dialog is not open click the button Open Find Replace Dialog e Breakpoints Provides a listing of program lines marked with a breakpoint see page 102 e Bookmarks Provides a listing of bookmarked program lines see page 73 g la c i E 2 5 0 132 Graphical User Interface ES W Program Line View ce of Invalid Lines Find All I Breakpoin ints Bookm kmarks Scope Program Current Procedure Refresh Procedure Line Context Problem main 5 read_i
17. 6 4 2 3 Special Operator Handling o o lt D d 2 Q a 0 Some operators provide additional functionality when being edited This functionality is available via an action button next to the parameter field when using the dialog based editor or as an action button in the advanced autocompletion suggestion list when using the full text editor If an operator contains a parameter that specifies a file name the parameter value can be specified in a file selection dialog page 221 See the previous section for an example read_image in the full text editor 146 Graphical User Interface r N Program Editor son ea 4 m gt main JE EA proc main 2 first B W Program Editor Loles E frst JE EMAR F5 Ti proc first gt 2 second return Fr W Program Editor Lalea gt 85 El secono Je EI n proc second 2 thira Y calistak o E sz return El second El first Ab main K Program Editor El third G proc third return Figure 6 40 PC positioning The operators info_framegrabber and open_framegrabber provides a button to detect the available image acquisition interfaces automatically see also Image Acquisition Assistant page 225 6 4 3 Program Counter Insert Cursor and Breakpoints The column t
18. 8 7 Control Flow Operators 367 i is set to O and j is set to 1 The loop can be restarted and terminated immediately with the operator continue and break respectively see below Please note that in older versions of HDevelop prior to HALCON 11 the expressions for start and termination value were evaluated only once when entering the loop A modification of a variable that appeared within these expressions had no influence on the termination of the loop The same applied to the modifications of the loop index It also had no influence on the termination The loop value was assigned to the correct value each time the for operator was executed See the reference manual of the for operator for more information If the for loop is left too early e g if you press Stop and set the PC and the loop is entered again the expressions will be evaluated as if the loop were entered for the first time o te iv te c l In the following example the sine from 0 up to 67 is computed and printed into the graphical window file name sine hdev old_x 0 old_y 0 dev_set_color red dev_set_part 0 0 511 511 for x 1 to 511 by 1 y sin x 511 0 2 3 1416 3 255 disp_line WindowID old_y 256 old_x y 256 x old_x x old_y y endfor In this example the assumption is made that the window is of size 512x312 The drawing is always done from the most recently evaluated point to the curre
19. Bor K EC ET 4 E TR arapi window 3602 iaa BAIAA Arty Mimx Pose of topmost cylinder P cme 0 EA alize StatusWi e gi r sition StatusWindowHandle Row Col Butte heck or CampsmouerExIstS p_sh mCount 2 wait_seconds a StatusWindowHandle 3600 ee Row 0 if CookieModelExists an Canto TV Tiser V Global 7 z 4 m 4 r 34 Running Run continuously 0 ImageMapped2 1 678x537x1xbyte lz tto o Figure 2 2 Explore the power of HALCON The example programs have been categorized by application area industry method and operator usage A special category New in version groups examples by their appearance in specific HALCON releases Browsing these categories you can quickly find example programs that cover image processing problems 2 2 Running Example Programs 19 that you may wish to solve with HALCON These programs may serve as a foundation for your own development projects g K Browse HDevelop Program Examples Es JLS sa Category 2 Find measure Pharmaceutical nm zl Photogrammetry and remote sensing Example Short Description Precision engineering and optics fuzzy_measure_ Measure pins of an IC Printing using fuzzy measuring Rubber synthetic material foil measure_ball_bo Semiconductors Solar renewable energy recyding Inspect the position of ball bonds o
20. Classifier Figure 7 5 Process of an OCR application In this online help the following special terms are used Optical Character Recognition OCR Optical Character Recognition is the technical term for read ing i e identifying symbols In HALCON OCR is defined as the task to assign an interpretation to regions of an image These regions typically represent single characters and therefore we con sider this as reading single symbols Sample A sample is the smallest individual object that is detected during segmentation and typically represents a simple character It belongs to a certain class a symbol Segmentation Both for the training and for the online reading process samples must be extracted from the image This step is called segmentation This means that the OCR operators like do_ocr_single_class_svm do not search for the characters within a given region of interest but expect a segmented region which then will be assigned to a symbol class with a classifier Training The training consists of two important steps First for each character a number of samples is selected and stored in so called training files In the second step these files are input to create a new OCR classifier HALCON provides pretrained OCR classifiers i e ready to use classifiers which already solve many OCR applications These OCR classifiers can be found in the subdirectory ocr of the folder where you have installed HALCON Font A font des
21. If an error occurs in a watched block of program lines surrounded by try catch the user may choose to cancel the program execution or to throw an exception i e continue the execution at the corresponding catch endtry block Activate this option if you always want exceptions to be thrown without any user intervention Stop execution at invalid program lines If enabled a dialog will be displayed if an invalid program line is reached allowing to stop the program and edit the corresponding line or to ignore it and continue execution If disabled invalid program lines will always be ignored Suppress warnings for HALCON operators that are replaced by dev operators Some operators are deprecated in HDevelop and issue a warning message when selected in the operator window Activating this option suppresses the warning message Disable parameter detection for acquisition operators In the operator window the parameter suggestions for the operators open_framegrabber set_framegrabber_param and get_framegrabber_param depend on the selected image ac quisition interface This behavior can be disabled by ticking the check box See also Parameter Display on page 168 Ignore semantic type By default the parameter suggestions in the operator window and the full text editor with ad vanced autocompletion enabled include only variable names that match the semantic type of the corresponding parameter If Ignore semantic type is ch
22. In HDevelop every exception normally causes the program to stop and report an error message in a dialog window This might not be useful in Visual Basic NET The standard way to handle this in Visual Basic NET is by using the Try Catch mechanism This allows to access the reason for the exception and to continue accordingly Thus for HDevelop programs containing error handling dev_ set_check give_error the corresponding code is automatically included Every op erator call for which it is assumed that the HALCON error mechanism is turned off is enclosed in a Try block followed by a Catch block The latter handles the exception and assigns the corresponding HALCON error number to the error variable activated by dev_error_var or to a local error variable otherwise Please note that a call of dev_ set_check give_error has no influence on the operator call The exception will always be raised This is also true for messages like H_MSG_FAIL which are not handled as exceptions in C for example 9 3 3 3 Memory Management The NET Framework s runtime environment CLR Common Language Runtime has a mechanism called garbage collector which is used by the CLR to remove no longer needed NET objects from memory As mentioned earlier in the exported Visual Basic NET code every iconic object is represented by a NET HObject object From the garbage collector s point of view a NET HObject object is rather small Thus it might not be
23. Next Bookmark F11 Previous Bookmark Shift F11 Set Bookmark Ctrl F11 Activate Profiling Ctrl Shift E F Ctrl Shift F Ctrl Shift F Number of Calls Ctrl Shift EN Ctrl Shift F Ctrl ShiftN Total Cirl ShifttEL Ctrl Shift F Ctrl Shift L Average Ctrl Shift F A Ctrl Shift F Ctrl Shift A Minimum Ctrl Shift F I Ctrl Shift F Ctrl Shift 1 Maximum Cirl Shift F X Ctrl Shift F Ctrl Shift X Execution Time Cirl ShifttFE Ctrl Shift F Ctrl Shift E Operator Time Ctrl Shift BO Cul Shift F Ctrl Shift O Time Cirl Shift ET Cul Shift F Ctrl Shift T Percentage Ctrl Shift F P Ctrl Shift F Ctrl Shift P Reset Profiler Ctrl Shif ER Ctrl Shift F Ctrl Shift R 10 1 1 HDevelop 399 Function Shortcut Alternative Show Runtime Statistics Set Parameters Open Graphics Window Clear Graphics Window Close Graphics Window Save Window Insert Code Record Interactions Window Size400 Window Size200 Window Sizel00 Window Size50 Window SizeDouble Window SizeHalf Window SizeAspect Fit Window Double Half Aspect Ratio 1 1 Save Procedure As Create New Procedure Edit Interface Delete Current Browse HDevelop Program Examples Read Image Preferences Open Graphics Window Open Program Listing Open Variable Window Open Operator Window Ctrl Shift F S Ctrl Shift G P Ctrl Shift G O iii Ctrl Shift G Del Ctrl Shi F Q gt Ctrl Shift G S Ctrl Shift G I
24. browse button Click the Password button to protect the entire library with a password see also section 6 4 9 on page 162 The fields Short Description and Detailed Description allow to describe the new library in multiple languages select the desired language first and then enter the description g la c i E 2 5 0 88 Graphical User Interface W Create Procedure Library L e 5 fats Name E Password Directory x C Users Public Documents MVTec HAL E Language English en_US Y Short Description Detailed Description a Cn a rs Figure 6 19 Create a new procedure library Procedures gt Manage Passwords Using this tab card you can conveniently manage the status and passwords of all procedures local and external The procedures are divided into three categories from left to right Procedures without a password unprotected procedures for which the password has already been entered in this session un locked protected and procedures that are locked with a password locked protected For an explanation of the different states see section 5 6 on page 49 Using the arrow buttons between the columns or the left and right cursor key you can move the selected procedures to a different status If you move procedures from the first to the second column a password dialog is displayed which is described in section 6 4 9 on pag
25. e Multiple windows If you use the operator dev_open_window to open multiple graphics windows in HDevelop these calls will be converted into corresponding calls of open_window only if the export option Use HALCON Windows is selected 396 Code Export In the export of Visual Basic Visual Basic NET and C programs using the option Use Export Template all window operations are suppressed because the exported code is intended to work together with the corresponding template If you want to use more than one window in programs exported in this mode you have to modify the code and project manually Note that the export of programs containing multiple windows using the option Use HALCON Windows might be incorrect if the active graphics window was changed using the mouse during program execution It is recommended to use the operator dev_set_window explicitly to achieve the same functionality Window size In exported Visual Basic Visual Basic NET and CA programs the size of the window on the form is predefined 512 x 512 thus it will normally not fit your image size Therefore you must adapt the size interactively or by using the properties of the window Displaying results Normally the result of every operator is displayed in the graphics window of HDevelop This is not the case when using an exported program It behaves like the HDevelop program running with the option update window off We recommend to insert the o
26. on Linux Mac OS X This is a temporary setting for the current session only See also page 47 o a 3 G E E e oO 408 Command Line Usage Open the protected program secret hdev for editing password crypt hdevelop unlock crypt secret hdev Convert the old procedure example dvp to the default procedure format hdevelop convert example dvp example hdvp Convert the procedure example hdvp for use in older versions of HDevelop hdevelop convert example hdvp example dvp Convert the protected procedure secret hdvp password crypt to an unprotected pro cedure hdevelop unprotect crypt convert secret hdvp nosecret hdvp Protect the procedure example hdvp with the password crypt hdevelop protect crypt convert example hdvp example hdvp Export the program example hdev and all used procedures to C hdevelop convert example hdev example cpp HDevelop accepts the following command line switches hdevelop options HDevelop options lt program gt hdev dev load the program for editing converting or running lt procedure_file gt lt procedure_library_file gt load the procedure or procedure library for editing protect unprotect unlock lt password gt modify the protection state of an HDevelop program or procedure run start execution of the passed program lt image_file gt load an image file with read_image help show this help info in a message box help show this help informati
27. tween iterations default 0 01 One vs All One vs One default One vs All The Gamma parameter of the radial basis kernel function 0 01 0 02 0 05 0 1 0 5 default 0 02 Regularization constant of an SVM default 0 05 Number of trees in a tree structure default 4 Select a sufficient number of iterations to create an MLP classifier that performs well in the subse quent application Choose a realistic value for Weight Tolerance If this value is chosen too small in the training the training will take longer If Weight Tolerance 1s set very high the training will abort quickly and the classification results will not be very useful ei ther Choose a realistic value for Error Tolerance If this value is chosen too small in the training the training will take longer If Error Tolerance is set very high everything is accepted which means that the results may not be useful either The voting method used to combine the binary support vector machine classifiers One vs A11 creates a classifier where each class is compared to the rest of the training data During testing the class with the largest output is chosen One vs One creates a binary classifier between each single class During testing a vote is cast and the class with the majority of the votes is selected It specifies the amount of influence of a support vector upon its surroundings A big value means a small influence of surroundings each t
28. v Update l Reset Use settings for new windows Figure 6 32 Visualization Parameters Zoom settings This tab card specifies which part of an image region XLD or other graphic item is going to be dis played The four text fields of Set part specify the coordinate system Upper Left Corner defines the pixel which will be displayed at the upper left corner of the window Lower Right Corner defines the pixel which will be displayed at the lower right side of the window Below the coordinates of the rectangle you can specify its center The buttons Zoom Out and Zoom In activate a zooming with factor 0 5 or 2 respectively To get the image s full view back on your graphics window you simply click the button Reset The button Aspect adjusts the parameters so that the aspect ratio of the image is maintained 6 2 4 16 Reset Parameters Synopsis Reset the visualization parameters of the active graphics window to the default settings Here the display parameters of the active graphics window are set to their initial state as defined in the preferences see page 76 The only exception is the size of the window To clear the history of previously displayed objects use Clear Graphics Window To set the size use Window Size 6 2 4 Menu Visualization 115 6 2 4 17 Record Interactions Synopsis Record visualization changes in the current program at the IC Shortcut If this entry is enabled any subsequent changes to the
29. 224 Load Assistant Settings 224 matching 223 measure 223 OCR 223 Release Generated Code Lines 224 Save Current Assistant Settings 224 Show Code Preview 224 assistant settings load 249 263 assistant settings save 249 263 Assistants menu 128 412 Index assure success 283 Attention 160 Auto Disconnect 230 Auto 173 Auto Indent 149 Autocompletion 80 autocompletion 143 AVI 29 Back 196 Back in History 139 basic features 322 Basics 158 beginner 228 Bit Depth 226 Bookmark 196 Bookmarks 73 boolean 405 boolean operations 359 breakpoint 17 97 activate deactivate 101 clear all 101 manage 102 set 101 Breakpoints 102 Browse HDevelop Program Examples 19 Browse HDevelop Program Examples 55 136 button 405 C 11 391 compile and link UNIX 392 compile and link Windows 392 C export 391 C 11 compile and link UNIX 382 compile and link Windows 382 C export 381 CH 11 C export 384 Calibrate 250 Calibration menu Image Acquisition Assistant 230 Snap 225 calibration 237 Calibration Assistant 223 Calibration menu Live 225 calibration plate 233 calibration plate extraction parameters 243 Calibration Source 267 calibration source 299 calibration source choose 267 calibration task 233 Call Stack 100 camera parameters 233 camera parameters load 263 camera pose load 263 Camera Type 226 Cascade Windows 132 catch 36
30. 227 Source 225 Image Acquisition Interface 225 image coordinates status bar 53 Image File s 225 Image Files 229 Image Object 229 image properties status bar 53 image pyramid display 266 Image Size 106 image source 236 295 315 Import 77 In Single 116 Increase Font Size 196 Indent Size 79 Input Window 200 Insert Code 230 Insert All As Local 120 Insert All 57 Insert Code 224 250 293 310 333 Insert Code 115 insert cursor 17 Insert dev_display into program 175 Insert Mainbody 58 Insert operator into program 196 Insert Procedures 57 Insert Program 57 Insert Used As Local 120 Inspect 180 290 Index 417 Image Acquisition Assistant 228 inspect matching results 260 inspection 318 Interface Library 227 Invalid Lines 74 Jump to Link 196 Keep dialog open 56 62 keyboard 13 keyboard menu access 54 keyboard shortcuts 397 Keywords 127 LANG 81 Language 81 158 Last Pyramid Level 287 LC_ALL 81 LC_COLLATE 81 LC_CTYPE 81 Library 158 line continuation 142 Line Profile 117 137 line profile 117 210 Line Width 107 204 List Open Tabs 139 Live 227 Load Assistant Settings 224 249 263 308 331 Load Camera Parameters 263 308 Load Camera Pose 263 Load Image 307 331 Load Model 262 Load Model Image 262 Load OCR Classifier 331 Load ROI from File 310 333 Load Test Images 281 Load Training File 331 local procedure 58 lo
31. 5 3 Procedure Scope The scope of a procedure defines its visibility to other procedures If a procedure is visibile 1t can be called and thus executed The scope can be either private or public e Private scope The procedure is only visible from procedures in the same directory or the same library The scope of local procedures is always private to the current program 1 e external procedures or procedures from libraries can never see them e Public scope The procedure is visible to all other procedures 5 4 Procedure Locations HDevelop looks for procedures in a set of directories Please note that subdirectories are always searched recursively e Standard procedure path By default HDevelop is set up to look for procedures in a predefined directory which contains several useful procedures The standard procedure path is 4HALCONROOT procedures under Windows and HALCONROOT procedures under UNIX Mac OS X Because many example pro grams shipped with HALCON rely on these procedures the standard procedure path cannot be removed but it can be disabled to make the corresponding procedures unavailable e User defined directories Other arbitrary directories can be added or removed in the preferences of HDevelop Just like the standard procedure path each user defined directory can be enabled or disabled independently The user defined directories and their settings are persistent i e they survive a restart of HDevelop N o
32. 6 2 2 Menu Edit 95 Runtime Settings gt Runtime Settings The settings in this category affect the runtime behavior of HDevelop Please note that the runtime settings are not persistent between sessions The runtime settings are reset to their default values when a new HDevelop program is started with Menu File gt New Program Give Error This check box specifies the behavior of HDevelop if an error occurs If it is checked HDevelop stops the program execution and displays an error message Otherwise the error is ignored See also dev_set_check Show Processing Time This check box indicates whether the required runtime of the last operator or procedure call should be displayed after the execution has stopped It is a measurement of the needed time for the current Operator or procedure call without output and other management tasks of HDevelop Along with the required runtime the name of the operator or procedure is displayed in the status bar at the bottom of the main window Please note that the displayed runtime can vary considerably This is caused by the inaccuracy of the operating system s time measurement procedure See also dev_update_time This option can also be toggled from the context menu of the status bar see page 53 Update Program Counter This option concerns the display of the current position while running the program The PC always indicates the line of the currently executing operator or
33. 7 4 4 Code Generation Code Generation produces the code that is necessary to perform the chosen measurement tasks within an HDevelop program On the Code Generation tab you can choose between several options and change parameter names which has a direct effect on the code that is generated First you can choose to Initialize Acquisition or Initialize Calibration automatically in your code Depending on whether you have previously used the Image Acquisition Assistant or the Cali bration Assistant to acquire images or get calibration data respectively you can now decide whether you want the generated code from these assistants integrated in your code Such an automatic integration of code results e g in the automatic opening of the framegrabber if Image Acquisition Assistant is acti vated If code for image acquisition or calibration already exist the checkboxes should be deactivated If Image Acquisition Assistant or Calibration Assistant are not in use Initialize Acquisition and Initialize Calibration are grayed out Under General Options you can decide on the Alignment Method i e whether an alignment is needed for your application To learn more about this advanced setting please refer to the description in the section Alignment page 305 You can furthermore change variable names for e General parameters e ROI coordinates and e Measurement results Once you are finished changing parameters click the Insert Code button under
34. Again typing ahead updates the list of suggestions accordingly The remaining entries are suggestions for the first parameter of the operator call At this point press to select the first suggestion read image Image fabrix or press or to step through the list entries read image image Image filename read FileName fabrik Image Image and press or to select the highlighted entry Then enter a comma or press again to get suggestions for the second parameter read image Image read_image image Image filename read FileName fabrik a B Browse fabrik die2 fuse Note the browse button in the suggestion list Double clicking it opens up a file selection dialog page 221 to specify the file name parameter These browse buttons are included in the suggestions lists of all parameters that specify a file name In this example we want to load the image clip so none of the suggestions fits Just type the file name in single quotes clip and press to complete the parameter list The closing parenthesis is inserted automatically read_image Image clip 6 4 2 Editing Programs 145 When entering expressions the advanced autocompletion also suggests operations functions supported by the HDevelop language see section HDevelop Language on page 337 Col Width co any Result any Input Please note that the advanced autoc
35. D 2 Q a 0 160 Graphical User Interface Suggestions The first field on this tab card allows to associate keywords with the procedure Enter a comma separated list of keywords into this field The tab card Index of the online help may be used as a reference for keyword suggestions Furthermore you can specify suggested successors predecessors and alternatives to the current pro cedure Enter comma separated lists of operator or procedure names into the fields See Menu Suggestions for the meaning of these fields Advanced The text boxes in this tab card are for advanced usage only It is recommended to search the online reference manual for usage examples Attention Notes about special observances when using the procedure Complexity Notes about intricate details about the procedure usage Warning Usually used to indicate obsolete or deprecated procedures that are kept for backward com patibility The warning text should indicate the recommended alternative If the procedure is selected in the operator window the warning text will be displayed as a re minder References Bibliographic references with recommended reading about certain aspects of the proce dure 6 4 8 2 Parameter Documentation This section of the dialog provides tab cards for all parameters of the current procedure The documenta tion consists of a fine grained specification of the parameters and a short description The spec
36. Image Width and Image Height in pixels They also include Kappa in 1 m or instead of Kappa the distortion parameters Radial 2nd Order K1 in 1 m Radial 4th Order K2 in 1 mf Radial 6th Order in m Tangential 2nd Order P1 and Tangential 2nd Order P2 in 1 m for the polynomial area scan camera model If you have a line scan camera additionally to the values of the area scan camera division model values for the motion parameters Motion x Vx Motion y Vy and Motion z Vz in micrometer pixel will be returned 7 2 3 3 Camera Pose The 3D pose of the world coordinate system relative to the camera is described by the external camera parameters X Y and Zin mm and Rotation X Rotation Y and Rotation Z in degrees 7 2 3 4 Display Results Via radio buttons you can choose Original Reference Image to see the previously chosen refer ence image and Simulated Reference Image to display a synthetic reference image which has been calculated using the internally known measures of the calibration plate and the pose of the plate in the reference image You can also decide whether or not you want to Display Coordinate Axes of the coordinate system of the calibration plate 7 2 4 Generating Code This tab helps you to generate and insert code for calibrating and for using the calibration results in your HDevelop program The tab is subdivided into four parts e Calibration e Sample Usage e Variable Names page 247 e Code Previe
37. Once you are satisfied with the results continue to the Code Generation page 335 tab to receive the code for your application Otherwise go back to adapt your edge extraction page 296 or calibrate your system 7 4 3 1 Feature Selection Feature selection lets you choose the features that are relevant for your application The results of those features are measured and displayed below All features are activated by default It is however useful to deactivate those which are not needed in order to improve performance and readability You can choose between 7 4 3 Results 299 e Position e Amplitude e Distance e Pair Width and e Fuzzy Score Once you have chosen your features you can either continue to Feature Processing if you want your results transformed into world coordinates or proceed to Edge Data to view the results for each ROI 7 4 3 2 Feature Processing Here you can decide whether you want to receive your results in world coordinates and if so you can choose a suitable Unit This step will be unavailable if you have not calibrated your setup If you want to transform your measurement results into world coordinates you should now choose a calibration source or calibrate your camera system and load the data into the Measure Assistant page 230 and then go back to Transform Image into World Coordinates under Feature Processing Calibration Source If you need results in world coordinates
38. Pull down menus File Calibration page 250 Code Generation page 250 Help page 251 Tool bar with a selection of important buttons Load Assistant Settings Save Current Assistant Settings Insert Code page 250 Calibrate page 235 Help page 251 Tabs with the dialogs for most of the tasks that can be done with the Calibration Assistant 7 2 5 Calibration Assistant Reference 249 e Setup page 251 e Calibration page 251 e Results page 251 e Code Generation page 245 Furthermore it provides a status bar at the bottom in which messages are displayed The status bar also displays the calibration results page 244 i e if the calibration was successful Please note that the status bar does not provide a scrolling mechanism if the displayed message is too long move the mouse over it so that a tool tip displaying the full message pops up Alternatively if the message is only slightly larger than the status bar you can also drag the left or right border of the Calibration Assistant window to enlarge it Images are displayed in the graphics window of HDevelop 7 2 5 1 The Menu File Via the menu File you can e load formerly used and saved settings of the Calibration Assistant e save the current settings of the Calibration Assistant for later use e close the Calibration Assistant dialog while retaining the current settings as long as the HDevelop session is active and e exit the Calibration
39. Rubber synthetic material foil measure_ball_bo a bonds on a pad E Semiconductors bl Reconstruct the height of Solar ee are recycling measure_bga_dff a solder ball on a BGA Surveillance and security using depth from focus Transport logistics trade ee Measure the width of pcb Wood and timber measure_circuit_ bads Method measure_ic_lead Measure leads of an IC mir a Measure the dimensions of New in version v measure_pads_s X F Keep dialog open Open in new HDevelop Figure 6 3 Browse HDevelop Program Examples the list is updated to contain only example programs matching the string in either the file name or the short description field The filtering is case insensitive Loading an Example Program Double click an example program in the list or select it and click the button Open Clicking Open in new HDevelop opens the program in a new instance of HDevelop which is useful if there are unsaved changes in the current program Either way you can keep the dialog open by checking the corresponding box beforehand This can be useful if you wish to scan through several example programs quickly 6 2 1 4 Recent Programs Synopsis Load recently used HDevelop programs Checks for Unsaved changes page 222 This submenu contains a list of the most recently used HDevelop programs Simply click on a program name to load it The number of entries in this menu may be customized in the preferences se
40. Show Code Preview 224 250 293 311 333 Show frames per second during live acquisition 229 Show main 140 Show Min Mean Max 229 Show Next Tab Card 139 Show Previous Tab Card 139 Show Procedure 148 Show Procedure in New Tab 148 Show Procedure in New Window 148 Show Processing Time 53 95 Show Runtime Statistics 104 single document interface 54 Snap 227 Sort by Name 175 181 228 Sort by Occurence 176 181 Source Image Acquisition Assistant 225 speed up descriptor based matching 259 speed up matching 257 speed up matching correlation based 258 speed up matching deformable 259 speed up matching shape based 257 split 355 standard model parameters 269 standard search parameters 284 Start Angle 273 status bar 53 Step 183 Step Forward 99 Step Into 99 136 Step Out 99 136 Step Over 98 136 Stop 100 136 227 stop HDevelop program 97 program 97 Stop after Procedure 100 strchr 355 string 406 concatenation 344 355 operations 352 special characters 339 strlen 355 strrchr 355 strrstr 355 strstr 355 Subpixel 286 Successors 127 Suggestions 160 Alternatives 127 Keywords 127 Predecessors 127 See also 127 Successors 127 suppress error messages 93 symbol appearance 316 symbol fragmentation 317 symbol shape 317 symbol size 317 Syntax 196 syntax 337 tab results 298 326 teaching 321 terminology 12 test image sequence remove 281 test ima
41. Then move your mouse cursor over the image of the model in the graphics window Selected contours are highlighted when the mouse cursor moves over them To remove a contour simply click the left mouse button while it is activated Note that Auto Selection is activated as default under Specify Standard Model Parameters and therefore will automatically adapt to the new model characteristics which might even lead to a deleted contour that is found again after the automatical adaption lt gt Repair Edges If a contour is interrupted where it should be continuous Repair Edges can be used to draw a linear Modification ROI that connects the two ends of the existing contour and therefore replaced the missing edges First choose the necessary Edge Thickness either by directly adjusting the values in the box or by using the slider Then draw a modification ROI into the gap within the contour Finally save your modifications of the model image Note that if the default Auto Selection is ac tivated the thresholds will be adapted to the new image features If this leads to unfavorable results either deactivate Auto Selection or change the parameter once the modification is finished Possible ways to continue setting your matching parameters are e for ALL matching methods specify standard model parameters page 269 e for shape based matching set parameters for viewing image pyramid levels e for descriptor based matching and deformable matching ch
42. There is no further adaption possible Rectify Image First the desired width of the visible area in world coordinates in mm is chosen and converted to m Then set_origin_pose adjusts the origin so the plate is roughly centered The HALCON operator gen_image_to_world_plane_map generates the rectification map Finally images can be rectified using the rectification map by map_image To adapt this code to your application you typically change the scale and origin of the new image coordinate system 7 2 4 4 Variable Names For each calibration default variable names are chosen You can however use your own variable names and change variable names for 248 HDevelop Assistants Note These are variables which you might set before the generated code or use after the generated code Connection Handle Image Object Camera Parameters Start Parameters Loop Counter Image Files Camera Pose Window Intermediate variables have fixed names starting with TmpCtr1 or Tmp0bj Once you are finished check the position of the insert cursor and click Insert Code page 250 to insert the code into your HDevelop program 7 2 4 5 Code Preview Here you can e g edit or replace individual operators of the code lines proposed by the Calibration Assistant For details see also Code Generation page 250 in the menu 7 2 5 Calibration Assistant Reference The Calibration Assistant consists of the following elements
43. This menu enables you to modify your model image such that only wanted contours are left or existing contours are improved Enable the menu item Modify Model Image by activating the checkbox With Modify Model Image you can e inpaint regions e smooth regions e remove unwanted contours and e repair interrupted edges For these modification purposes so called modification ROIs are used also referred to as regions in this context as opposed to normal ROIs or regions these regions are simply there to mark areas for modification to improve the model You can draw modification ROIs by positioning the mouse cursor as explained in the section about the menu ROI page 264 Use the right mouse button to conclude the choice and view the effects of the inpainting To place your modification ROI even more precisely you can view the modification ROPs region primitives with the corresponding button that is located at the same height as the modification ROI buttons and also adapt the values in the list For deleting all modification ROIs use the corresponding button next to the modification ROI buttons The checkboxes Display unmodified Model Image and Display modification ROIs can be ac tivated during the modification process to view the image as it was before it was modified and display the modification ROIs respectively In order to keep the data of the modifications you can save the modified image as well as the modification ROIs Fo
44. before its dismissal K HDevelop Warning 52 i The current program has been modified Do you want to save the changes _ save Saves Discard Cancel Figure 6 86 Confirmation dialog Save Save the current program under its current name and proceed If no name has been specified yet a file dialog pops up to enter the name Save As Save the current program under a different name and proceed Discard Discard unsaved changes and proceed Cancel Abort the current action HDevelop Assistants 223 Chapter 7 HDevelop Assistants HDevelop contains assistants for specific machine vision tasks Each assistant provides a user interface tailored to the requirements of its task Using this interface you can interactively set up and configure the assistant to solve a specific machine vision problem Once the configuration is working satisfactorily the assistant can be instructed to generate HDevelop code into the current program You can also save an assistant s configuration for later use The following assistants are available Image Acquisition Using this assistant you can generate code to acquire images from different sources files directories image acquisition interfaces The assistant is described in section Image Acquisition Assistant on page 225 A tutorial about using this assistant is available in section 3 3 on page 25 Calibration Using this assistant you can calibrate you
45. can return H_MSG_FAIL dev_error_var This operator specifies a variable that contains the return value error code of an operator after execution This value can be used to continue depending on the given value dev_error_var is normally used in connection with dev_set_check Note that as the proce dure concept in HDevelop only allows for local variables the variable set by dev_error_var will only be valid in calls to the relevant procedure Furthermore every corresponding procedure call will have an own instance of the variable i e the variable might have different values in different procedure calls For an example how to use dev_error_var in connection with dev_set_check see HALCONEXAMPLES hdevelop Graphics Mouse get_mposition hdev dev_open_dialog dev_open_tool dev_close_tool dev_show_tool dev_set_tool_geometry dev_open_file_dialog These operators perform GUI operations from an HDevelop program dev_get_window This operator returns the handle of the active graphics window Please note that operations concerning graphics windows and their corresponding operators have addi tional functionality in comparison to HALCON operators with corresponding names without dev_ graphics windows in HDevelop are based on HALCON windows see open_window in the HALCON reference manual but in fact they have an enhanced functionality e g history of displayed objects interactive modification of size and control buttons This is also true
46. o a 5 9 216 Graphical User Interface Training File Window pa E OCR Training File Browser Fie Edit View Classifier a ze eee pnn Display only incorrectly classified samples i g Symbol Name Width Height Read Symbol Confidence 20 E 1 000000 E 1 000000 E M a b d e h i n r s t Zoomed Sample Window Sample Inspection Window Figure 6 84 The OCR Training File Browser 6 14 1 3 Sample Inspection Window The Sample Inspection Window enables you to view and edit samples page 219 It displays a table containing the following information about each sample that belongs to a symbol or a training file that is selected in the Training File Window The column e Image displays the iconic sample e Symbol Name displays the class the sample was assigned to e Width displays the width of the iconic sample in pixels e Height displays the height of the iconic sample in pixels e Read Symbol displays the result of reading the sample with the selected OCR classifier 6 14 2 Steps for working with the OCR Training File Browser 217 Confidence displays the confidence 1 e a measure for the reliability of the read symbol 0 no confidence 1 highest confidence and Correct displays if a sample has been read correctly and has two states true means that the values of Symbol and Read Symbol are identical and false means that those values differ If the sample has not been cl
47. page 118 or select the corresponding entry from the context menu of the program window The new procedure can now be setup in the procedure interface dialog 6 4 5 1 Setting Up the General Settings of a Procedure See also Procedures gt Create New Procedure page 118 Edit Interface page 119 Name The procedure name must start with a letter and may consist of alphanumeric characters and underscores If you enter an invalid name i e an operator name a reserved word or a name that contains invalid characters the text field will be highlighted You will not be able to close the dialog and apply the changes until a valid name is provided Operator names cannot be used because operators and procedures share the same namespace However procedures with the same name but different locations are allowed in HDevelop see section 5 5 on page 48 Password You can optionally protect procedures by a password Protected procedures may be used in HDevelop programs without restrictions However to view and modify them the correct password needs to be provided See section 5 6 on page 49 for more information 6 4 5 Creating Procedures 151 Type This check box determines the procedure type see section 5 1 on page 45 By default a local pro cedure is created Local procedures are saved within the HDevelop program External procedures are saved as stand alone files Libraries may contain multiple procedures in a single file The file type
48. page 275 and Fern Depth page 275 on the tab Parameters have to be adjusted Few ferns with a large depth enable a fast online matching which however requires more memory Search Parameters can also be automatically improved via the menu item Use Model gt Optimize Recognition Speed page 289 which can be accessed also via the tab Usage If the reached recognition speed is not sufficient you can try to modify parameters manually However please be aware that such a modification may result in a lower accuracy of the calculated position orienta tion or scale or even prevent the Matching Assistant from finding the object Therefore we recommend to check whether the matching still succeeds in all test images page 253 after each modification 7 3 2 How to Use the Matching Assistant of HDevelop 257 How the different parameters influence the recognition speed is described below Please note that when ever you modify a model parameter the internally stored model must be created anew you must start this creation and the search explicitly using the button Find Model or the button Detect A11 in the tab Usage After each modification determine the resulting recognition speed using the dialog Optimize Recognition Speed page 289 There are different ways of speeding up the matching process depending on the matching method Learn more about speeding up your matching application 7 3 2 5 Speed up matching One or more of the fo
49. use this variable for HDevelop specific operators chapters Control and Develop in the HALCON reference manual It is not recommended to use the variable _ in programs that will later be exported to a foreign programming language Instantiated variables contain tuples of values Depending on the kind of the variable the data items are either iconic objects or control data The length of the tuple is determined dynamically by the performed operation A variable can get new values any number of times but once a value has been assigned the variable will always keep being instantiated unless you select the menu item Menu Execute gt Reset Program Execution The content of the variable is deleted before the variable is assigned new values The concept of different kinds of variables allows a first coarse typification of variables control or iconic data whereas the actual type of the data e g real integer string etc is undefined until the variable gets assigned with a concrete value Therefore it is possible that the type of a new data item differs from that of the old 8 3 1 Scope of Variables local or global HDevelop supports local and global variables All variables are local by default i e they exist only within their procedure Therefore local variables with the same name may exist in different procedures without interfering with each other In contrast global variables may be accessed in the entire program They have t
50. 1 Operator Name Field The operator name field allows to select operators or procedures by entering part of their name After pressing or pressing the button of the combo box the system is looking for all operators or procedures that contain the entered name The order of the listed result is as follows Operators and o D 2 Q a 0 168 Graphical User Interface W Operator Window Insert select_characters Lo J 3 Enter Operator or Procedure select_characters select characters RAE select_contours_xld E select_gray select_grayvalues_from_channels amp Region select_lines select_lines_longest select_matching_lines fg RegionCharacters R select obj select_region_point es select_region_spatial les DotPrint shape StrokeWidth medium v string CharWidth 25 v integer CharHeight 25 v integer oox Jl eer J _ ay J _ can Heo Figure 6 57 Selecting an operator after typing select _ procedures whose names begin with the given substring are listed first followed by all operators and procedures that contain the substring elsewhere Both parts of the list are sorted in alphabetical order If there is an unambiguous search result the parameters are displayed immediately in the operator win dow If there are several matching results a combo box opens and displays all operators or procedures containing the specified substring By clicking the left mouse button yo
51. 11 0 procedure disp_continue_message C Program Files MVTec HALCON 11 0 procedure disp_message C Program Files MVTec HALCON 11 0 procedure gen_arrow_contour_xld C Program Files MVTec HALCON 11 0 procedure init C Users Public Documents MVTec HALCON 11 C init C Users Public Documents MVTec HALCON 11 C init C Users Public Documents MVTec HALCON 11 C init C Users Public Documents MVTec HALCON 11 C init C Users Public Documents MVTec HALCON 11 C list_image_files C Program Files MVTec HALCON 11 0 procedure El local_a C Users Public Documents MVTec HALCON 11 C El laral a C A leara Pihli Man mente MVTer HAI rotar g m il Figure 6 17 Procedures gt External Procedures 6 2 2 Menu Edit Column Meaning Number of the external procedure Visibility The check box toggles the visibility of the corresponding procedure i e whether the procedure can be resolved It can be used to temporarily disable procedures e g to make concealed procedures of the same name available Procedure Name Name of the external procedure State Loaded The external procedure has been loaded successfully It can be used in any HDevelop program Unloaded An error occurred while trying to load the external procedure e g the file permissions are wrong or the external procedure file is cor rupted Search Directory Directory name from the tab card Directories where this procedure is found Relative Path Path name of the e
52. 21119 21120 21121 21122 21123 21124 21125 21200 21201 21202 21203 21204 21205 21206 21207 21208 21209 21210 21211 21212 21213 21214 21215 Two function arguments in parentheses expected Three function arguments in parentheses expected Four function arguments in parentheses expected Five function arguments in parentheses expected Right parenthesis expected Right curly brace expected Right square bracket expected Unmatched right parenthesis found Unmatched right curly brace found Unmatched right square bracket found Second bar expected Function name expected before parentheses Unterminated string detected Invalid character in an expression identifier detected Parameter expression expected Syntax error in operator expression Identifier operator or variable name expected Syntax error in parameter list Parenthesis expected No parenthesis expected List of parameters in parenthesis expected Wrong number of parameters Unexpected characters at end of line Assign operator expected Expression after assign operator expected Expression in brackets for the assign_at index expected In for statement after keyword by expression for parameter Step expected In for statement after keyword to expression for parameter End expected In for statement after assign operation expression for parameter S
53. 226 Restrictions 383 385 388 390 results 327 results tab 298 326 ROI Type 189 row 53 Row Scale Step 277 Run 97 136 Run to Insert Cursor 98 Run Until Here 148 runtime status bar 53 Save 58 136 save local procedure 58 Save A11 59 136 Save Current Assistant Settings 224 249 263 309 331 Save Model 263 Save Procedure As 59 Save Program As 58 Save ROI to File 310 333 Save Training File 331 Save Window 118 scale range 273 scale step size 277 scope of variables 341 Score Type 288 SDI 133 SDI 54 Search Documentation 135 search object 282 search parameters advanced 285 search parameters standard 284 See also 127 Select a Procedure 140 Select Directory 225 select edges 297 select features 298 Select File s 225 Select Graphics Window 109 select method 254 select test image 282 Select 226 semantics 337 sequence file 29 set up 295 Set 2D Calibration 191 Set Auto Completion Mode 139 Set Editor Mode 139 Set Enter Execute Mode 139 Set Insert Cursor 139 149 Set Parameters 108 137 Set Program Counter 139 149 Set Reference 282 Set Clear Bookmark 73 149 Set Clear Breakpoint 101 139 149 set_system 395 setup 314 Shape 108 shape model load 262 shape model save 263 Index 421 Shape models may cross the image border 288 Short Description 159 shortcuts 13 Show Caller 148
54. 263 e Insert Code page 293 e Save Model page 263 e Display Model page 264 e Reset Model page 254 e Optimize Recognition Speed page 289 e Determine Recognition Rate page 290 e a drop down menu that lets you select your matching method page 254 e Help page 293 Tabs with the dialogs for most of the tasks that can be done with the Matching Assistant e Creation page 264 e Parameters page 268 e Usage page 280 e Inspect page 290 e Code Generation page 291 Furthermore it provides a status bar at the bottom in which messages are displayed The status bar also displays the matching results i e the number of found instances the needed time and for each found instance the position orientation scale and score Please note that the status bar does not provide a scrolling mechanism if the displayed message is too long move the mouse over it so that a tool tip displaying the full message pops up Alternatively if the message is only slighly larger than the status bar you can also drag the left or right border of the Matching Assistant window to enlarge it Images and models are displayed in the graphics window of HDevelop 262 HDevelop Assistants 7 3 3 1 The Menu File Via the menu File you can e load the model image e load an already existing shape correlation descriptor deformable or DXF model e save a model e load camera parameters for descriptor based or deformable matching e load a camera pose
55. 6 2 Executed 440 program lines in 200 5 ms last dev_update_window 0 0 ms 0 Clip 1 830x822x1xbyte D 25 tt 142 373 1 run status 2 messages runtime information 3 image details 4 gray value 5 coordinates Figure 6 2 The status bar 1 Status icon Shows the current run status of the program 2 Messages and runtime information For example if you select an operator from the menu the corresponding short description is displayed here The runtime information depends on the run mode When single stepping through the program the runtime of the last operator or procedure call is displayed In continuous run mode a runtime summary of the executed program lines is displayed when the program stops A history of the most recent messages is also kept see below 3 Information about the image in the active graphics window The display format is index variable name number of objects height x width x channels x type 4 Gray value of the image in the active graphics window at the mouse cursor position For multi channel images the gray values of all channels are displayed separated by commas 5 Image coordinates in the graphics window row column Right click in the message area to open the context menu It provides the following entries Show Processing Time Toggles whether execution messages are displayed in the status bar Copy History to Clipboard A history of the latest execution messages is displayed as a too
56. 8 Any changes to to f E E o o fo a 40 Programming HDevelop r K Graphics Window 3600 Selected Iconic Object e ES SAIAA Bert gt Bi0 Ky X ConnectedRegions Eiza Region 1 area 100 center 14 7 1 08 Reg He b TA Region 5 area 2 center 107 5 357 5 Region 6 area 2980 center 193 913 619 535 Region 7 area 2 center 137 406 5 Region 8 area 1 center 138 404 Region 9 area 8 center 159 375 107 125 Region 10 area 1 center 184 111 Region 11 area 23 center 192 478 118 522 Region 12 area 1 center 208 672 Nanian 19 farma DONE mantar IM ETA NE OM Figure 4 7 Interactive inspection of an iconic variable containing regions N Gray Histogram Clip s K Graphics Window 3600 Gray Histo ES Ja Fos v Input Window Active v Output Window Input v gz A 47QAQ Bt gt Biox fr 3 5 Y fe TY gt a gt e Ey Threshold 1 0 56 p Code none Z Connection Histogram Options A Output Color Draw Line Width visualize threshold operation colored 3 gt fil vii a Statistics Figure 4 8 Determining threshold bounds interactively using the gray histogram these values are immediately visualized in the active graphics window The values 0 and 56 seem suitable for the lower and upper bounds respectively 4 9 Edit Lines 41 4 9 Edit Lines To edit a l
57. 9 dev This is the default file format for HDevelop programs in HDevelop versions up to and including HALCON 9 It is not suitable for managing programs using revision control software This format 1s required if you want to be able to load HDevelop programs in older versions of HDevelop 5 2 2 External Procedures hdvp HALCON 10 or higher This is the default file format for external procedures It stores external procedures in XML format and is suitable for revision control software Procedures with the extension hdvp always override procedures with the same name but the extension dvp in the same directory 5 2 3 Libraries 47 dvp This is the default file format for external procedures in HDevelop versions up to and including HALCON 9 It is not suitable for managing external procedures using revision control software This format is required 1f you want to be able to use external procedures in older versions of HDevelop The file name without the extension determines the name of the contained external procedure see also section 5 1 on page 45 5 2 3 Libraries hdpl HALCON 11 or higher This is the file format for procedure libraries It stores libraries in XML format and is suitable for revision control software Libraries were introduced in HALCON 11 and cannot be used in older versions of HDevelop Library procedures have to be converted to external procedures in order to be accessible in older versions of HDevelop
58. Assistant Measure 01 gt as i sb DEE 200 300 381 Line Profile Options Y Smoothing 2 6 E Derivate Vertical 36 254 ladaptive v Horizontal 0 381 ladaptive v Output Statistics a 4 Edge Extraction View Line Profile Min Edge Amplitude 40 lt 0 b gt Smoothing Sigma 2 00 el P ROI Width 5 3 b b Figure 6 82 a Choosing a data source and options for the line profile b display and modification of the smoothing via the Measure Assistant 6 13 6 Statistics The Statistics section of the line profile window displays the values from the line profile display above It includes values for the position x Value as well as the gray values It therefore informs you where interesting gray values can be found Those gray values include e the Peak which marks the position of the highest gray value e the Range defining the length of the ROI as well as the range of gray values along the ROI e Value at Minand Value at Max defining the position and gray value of the above determined g la c i E 2 5 0 214 Graphical User Interface selection that was localized with the green and red line as can also be seen in the active graphics window e There are two further values that only concern the gray values Mean defines the mean gray value while Deviation is the average deviation 6 13 7 Focusing Your Camera How to Test Images for Sharpness When focusing you
59. Contrast page 270 and belonging to components larger than the Min Size page 272 are selected for the model page 253 and marked in the image For particularly large models i e models with a large number of model points it might be useful to reduce the number of points using the parameter Optimization in order to speed up the matching page 252 process and to reduce memory requirements You can select a low medium or high point reduction please note that regardless of your selection all points passing the contrast criterion are displayed i e you cannot check which points are part of the model You can also let the Matching Assistant select a suitable value automatically based on the model image Another possibility to reduce the memory requirements of the model is to switch off the complete pre generation of the model if it has been activated before default off If you already loaded test images page 281 you can quickly test the effect of the selected parameter value via the menu item Inspect gt Determine Recognition Rate page 290 Letting the Matching Assistant Select a Suitable Value for Optimization Shape based Matching Deformable Matching When you click the button Auto Select that is placed right beside the slider for the parameter Optimization the Matching Assistant optimizes i e reduces the number of model points based on the model image The Model Parameter Pregenerate Shape Model Shape based Matchin
60. GmbH Microsoft Windows Windows XP Windows Server 2003 Windows Vista Windows Server 2008 Win dows 7 Microsoft NET Visual C Visual Basic and ActiveX are either trademarks or registered trademarks of Microsoft Corporation Silicon Graphics SGI IRIX and OpenGL are either trademarks or registered trademarks of Silicon Graphics Inc Mac OS X and OpenCL are trademarks of Apple Inc All other nationally and internationally recognized trademarks and tradenames are hereby recognized More information about HALCON can be found at http www halcon com About This Manual This manual is a guide to HDevelop the interactive development environment for the HALCON machine vision library This manual is intended for users who want to use HDevelop as a convenient gateway to the HALCON library or who want to deploy and test machine vision applications with it It is not an introduction to the HALCON machine vision library A working knowledge of the concepts of HALCON is assumed Please refer to the Quick Guide to become acquainted with HALCON In depth knowledge of image processing is not required to start working with HDevelop The manual is divided into the following chapters Introducing HDevelop This chapter explains the basic concepts of HDevelop Getting Started This chapter explains how to start HDevelop It provides a quick overview of the graphical user interface and shows you how to run the supplied example programs
61. HDevelop or lock the procedure again manually 6 4 9 Protecting a Procedure 163 GC K Password Please enter your password to lock the procedure Password Confirm i Lock entire program induding all local procedures only in main procedure Figure 6 52 Entering a password to protect an procedure B W Program Editor cet faa de 2 Bl E nit image Image HLS This procedure is locked EX Password For displaying and editing this procedure you must enter the password Figure 6 53 A locked procedure Changing the Status of a Protected Procedure To change the status of a protected procedure you must first unlock it by entering the password Then you can use the procedure interface dialog page 150 to change the password or remove the password entirely Click the button Password to change the status The following options are available Lock You can lock the protected procedure so its body cannot be accessed in the current session without supplying the password again Remove Selecting this option removes the password When the procedure is saved it is no longer pro tected New password The password window is displayed and you can assign the new password by the same process you used for the old one Cancel The operation is canceled without altering the status g la c i E 2 5 0 164 Graphical User Interface
62. Here select the language C HALCON C and save it to a file A file will be created that contains the HDevelop program as C source code For every HDevelop procedure except the main procedure the exported file contains a C procedure with the corresponding name Iconic input and output parameters of a procedure are declared as HObject and HObject respectively while control input and output parameters are declared as HTuple and HTuplex respectively All procedures are declared at the beginning of the file The program body of the HDevelop main procedure is contained in a procedure action which is called in the function main action and main can be excluded from compilation by inserting the instruction define NO_EXPORT_MAIN at the appropriate position in the application Using the instruction define NO_EXPORT_APP_MAIN only the main procedure is excluded from compilation This can be useful if you want to integrate exported HDevelop code into your application through specific procedure interfaces In that case there is typically no need to export the main procedure which was probably used only for testing the functionality implemented in the corresponding real procedures Besides the program code the file contains all necessary include instructions All local variables iconic as well as control are declared in the corresponding procedures Iconic variables belong to the class HObject and all other variables belong to HTupl
63. Lines you can release the gener ated and inserted code lines After releasing the code lines all connections between the OCR Assistant and the program window of HDevelop are lost That is changes e g the deletion of code lines can only be applied directly in the program window and not from within the OCR Assistant any more Delete the Generated Code Lines Via the menu item Code Generation gt Delete Generated Code Lines you can delete the code lines that you have previously generated and inserted page 310 into the program window of HDevelop from within the OCR Assistant Note that this works only as long as you have not yet released the code lines Preview of the Generated Code Lines Via the menu item Code Generation gt Show Code Preview you can open the dialog for the Code Preview in the tab Code Generation 7 5 7 4 The Menu Help Via the menu Help you can access the online documentation 334 HDevelop Assistants 7 5 7 5 The Tab Setup The Setup tab consists of the following subdivisions Quick Setup page 314 Image Source page 315 Region of Interest page 315 7 5 7 6 The Tab Segmentation The Segmentation tab includes Symbol Appearance page 316 Symbol Size page 317 Symbol Shape page 317 Text Orientation page 317 Text Layout page 318 Inspection page 318 7 5 7 7 The Tab OCR Classifier The OCR Classifier tab includes the following subdivisions OCR Classif
64. Measuring to generate the code Finally integrate the code into your HDevelop program 7 4 4 1 Change Variable Names If desired you can change the default variable names for general parameters ROI coordinates and mea surement results or replace them with your own variable names Once you are finished changing your variable names proceed to the Code Preview 7 4 4 2 Code Preview Before clicking the Insert button to include your code into the HDevelop Program Listing you can preview the code in the Code Preview table You can now step through the table which consists of the columns e Insert Operator which shows the operator that will be inserted once you press the Insert button e Procedure which shows the corresponding procedure e Line referring to the line number within the code and e Replace Operator which shows previously generated code that will be replaced 7 4 5 Advanced Measuring Tasks 301 7 4 5 Advanced Measuring Tasks This section deals with more complicated measuring tasks Therefore you might find this section useful e if you need to handle images with more than 8 bit e if standard edge detection does not detect the edges in your image and you might want to learn more about fuzzy measuring or e if your object can appear shifted and or rotated in the image page 305 7 4 5 1 Expected Gray Value Range If your image data exceeds 8 bits it might be useful to choose a minimum and maximum gra
65. Move the current tab to the left left Move tab to the Ctrl Alt Shift Right Move the current tab to the right right Go to Line Alt G Move cursor to the specified line Go to Program Alt Move cursor to program counter Counter PC Down Ctrl Down Move program counter down PC Up Ctrl Up Move program counter up Show main _Alt Home Display main procedure 6 4 2 Editing Programs HDevelop provides two complementary editing modes e Full text editing mode with advanced autocompletion This is the default editing mode in which the program code is edited directly in the program window e Dialog based editing mode In this mode program lines are edited in the operator window This editing mode can be used complementary to the full text editor unless the operator window is closed The full text editing capability can be switched off in the tool bar of the program window see sec tion 6 4 1 on page 139 You can also set the default editing mode in the preferences see the option Editor Settings in section 6 2 2 16 on page 79 The two different editing modes are explained in the following sections 6 4 2 1 Dialog based Editor If the full text editor is disabled the program window is merely used to visualize program lines but not to modify them You cannot change the program body by modifying the text directly Instead program lines are edited in the operator window see section 6 5 on page 167 The main reason for this
66. Parameters and e Results Once you are satisfied with the results proceed to the Code Generation page 328 tab to receive the code for your application Otherwise go back to adapt your segmentation page 316 or OCR classifier parameters page 320 7 5 5 1 Word Processing To use word processing activate Enable on the right side of this dialog To correct the result of the OCR classification according to certain rules the assistants word processing offers two options e Use aRegular Expression that restricts the allowed text or e load a Dictionary File to compare the text with allowed words use the Browse button on the right to load a dictionary file Furthermore the maximum number of characters that will be corrected can be selected via Max Corrections For up to this number of characters if the word does not match the expression one ore more alternatives i e the second best class and so on are considered depending on the number set for Symbol Alternatives Note that if high numbers of Max Corrections and Symbol Alternatives are chosen the number of possible corrections may be very very high Therefore if the number of characters to be read is very high the number of allowed corrections is internally clipped to 5 3 or 1 if the alternatives multiplied with the number of characters are equal or greater than 30 60 or 90 respectively The necessary corrections also influence the Score the more corrections the lower
67. Q a 0 60 Graphical User Interface 6 2 1 13 Export Synopsis Export program code to a programming language or as a text file Shortcut Ctrl Shift O X or Ctrl Shift O Ctrl Shift X See also hdevelop convert command line switch page 407 Using this dialog you can select an export format and write parts of the current program to a file in that format The dialog is displayed in figure 6 5 The button next to the export file name opens a file selection dialog page 221 to select a file name and an export format The following formats are supported Format Syntax Extension More information Text File HALCON HDevelop Ext Plain text export C HALCON C aa section 9 5 on page 391 C HALCON C Cpp section 9 1 on page 381 C HALCON C HALCON 10 cpp section 9 1 on page 381 Visual Basic NET HALCON NET vb section 9 3 on page 386 CH HALCON NET CS section 9 2 on page 384 Visual Basic 6 0 HALCON COM bas section 9 4 on page 388 Esport sj Export File and Format yplications Position Recognition 2D cbm_dip_switch cs E c HALCON NET Export Range Program Current Procedure External Procedures Current Library Procedure Options 4 Export local procedures body V Export external procedures body 4 Export all referenced external procedures External Procedures Destination Single File y Export only if procedure is newer than export file Windo
68. ROI has been created with the Draw Line or Draw Circular Arc buttons those ROI creation buttons are grayed out because the line profile window can only handle one ROI at a time 6 13 2 Line Profile Display The main part of the tool is the area in which the gray value profile of the image along an ROI is displayed in blue The line profile window contains static parts and parts that can be interactively manipulated A static part is the horizontal axis which represents the length of the ROI in pixels and therefore gives the position of the gray values along the ROI The dynamic parts of the line profile area are the two colored lines which can be manipulated The verti cal green and red lines denote the minimum and maximum selected position along the ROI respectively Those lines are also displayed in the active graphics window Their visualization can be adapted under Dutput Another dynamic part is the vertical coordinate axis which displays the gray values in the image For byte images this ranges from 0 to 255 As it comprises only the gray value range between darkest and the brightest pixel these values do not usually start with O and end with 255 For all other image types e g real images the horizontal axis runs from the minimum to the maximum gray value of the image and the labeling of the axis is changed accordingly Initially the line profile is displayed at full vertical range i e up to the peak value With the buttons to the
69. Rectangle 332 Draw Circular Arc 309 Draw Line 309 Draw Rotated Rectangle 332 Drawl 190 Duplicate 119 edge data 299 edge selection 297 Edit menu 66 Edit program line 140 Edit Interface 119 139 Edit menu Activate 68 Bookmarks 73 Copy 67 Cut 67 Deactivate 68 Delete 68 Find Again 72 Find Replace 69 Invalid Lines 74 Next Bookmark 73 Paste 67 Preferences 76 Previous Bookmark 73 Redo Ctr1 Y 66 Set Clear Bookmark 73 Undo Ctr1 Z 66 Edit Procedure 121 editor dialog based 140 full text 142 Editor Mode 80 else 365 Emergency backup 403 Enable the context menu in the Graphics window 95 Enable the mouse wheel in the Graphics window 96 Enable tooltip showing coordinates and gray value at the mouse cursor position in the Graphics window 96 encoding 61 native 61 92 UTF 8 62 92 endfor 366 endif 364 365 endtry 369 endwhile 365 error handling 369 escape strings 339 Example 159 example programs 55 exception handling 370 throw directly 93 Exception handling 384 386 388 391 Execute Activate Deactivate Breakpoint 101 menu 97 Execute menu Abort Procedure Execution 103 Activate Profiler 103 Breakpoints 102 Call Stack 100 Clear All Breakpoints 101 Clear Breakpoint 101 Reset Procedure Execution 103 Reset Profiler 104 Reset Program Execution 103 341 Run 97 Run to Insert Cursor 98 Set Breakpoint 101 Show Runtime Statistics
70. See Menu Procedures gt Manage Procedures gt External Procedures page 84 to find out if your program contains hidden ex ternal procedures Insert Procedures Synopsis Insert local procedures of the selected program into the current program Via this menu item you can add local procedures from an HDevelop program to the current program All local procedures except the main procedure are loaded from the selected file If the names of inserted local procedures clash with those of existing local procedures the former are renamed by appending the suffix _COPY_1 or _COPY_2 _COPY_3 for subsequent insertions o D 2 Q a 0 Note that inserted local procedures will conceal loaded external procedures with the same name i e calls to the now hidden external procedures will have to be adapted See Menu Procedures gt Manage Procedures gt External Procedures page 84 to find out if your program contains hidden ex ternal procedures 58 Graphical User Interface Insert Mainbody Synopsis Insert only the main procedure of the selected program into the current program Insert the main body of the selected program at the IC No local procedures are imported If the current program does not provide the procedures used in the imported program the corresponding program lines are marked as invalid code and will not be executed Invalid code is turned into valid code by provid
71. Synopsis Delete all local procedures that are not used in the current program All local procedures that cannot be reached by any procedure call from the main procedure are deleted from the program If the current procedure is among the deleted procedures the main procedure becomes the current procedure 6 2 5 6 Insert Used As Local Synopsis Insert all used external procedures into the current program as local procedures The external procedures used in the current program are copied as local procedures The external proce dure files are left untouched 6 2 5 7 Insert All As Local Synopsis Insert all external procedures into the current program as local procedures All external procedures are copied to the current program as local procedures regardless if they are used or not The external procedure files are left untouched With this menu item you can change all of your procedures to become local If your program contains protected external procedures HDevelop issues a warning and inserts only the procedures that are not locked Individual procedures can be made local or external via the combo box in the procedures interface see section 6 4 5 1 on page 150 For changing the status of a procedure see section 5 6 on page 49 6 2 5 8 Make All External Synopsis Convert all local procedures into external procedures The formerly local procedures are now stored as external procedures in a selectable directory of the list of e
72. The details of the HDevelop language are explained in chapter 8 on page 337 4 14 Summary This is basically the way to create programs in HDevelop Select an operator specify its parameters try different settings using the button Apply add a new program line using Enter or Ok and edit it later by double clicking it in the program window Use the interactive tools provided by HDevelop to assist you e g to find appropriate values for the operators HDevelop Procedures 45 Chapter 5 HDevelop Procedures HDevelop offers a mechanism for the creation and execution of procedures Procedures are meant to increase the readability and modularity of HDevelop programs by encapsulating functionality of multiple operator calls in one or more procedure calls It also makes it easier to reuse program code in other HDevelop programs by storing repeatedly used functionality in external procedures An HDevelop procedure consists of an interface and a program body Procedure interfaces resemble the interfaces of HALCON operators i e they contain parameter lists for iconic and control input and output parameters The procedure body contains a list of operator and procedure calls Furthermore HDevelop provides extensive support to supplement procedures with structured documentation The documentation is automatically integrated into the online help system Every HDevelop program is made up of one or more procedures It always contains the main pro
73. Type Descriptor based Matching The interest points that build the model are extracted from the image by the so called detector The type of detector is selected via the parameter Detector Type Available types are e lepetit e harris or e harris_binominal lepetit can be used for a very fast extraction of significant points but the obtained points are not as robust as those obtained with harris Especially if a template or search image is very dark or has got a low contrast lepetit is not recommendend harris_binomial is a good compromise between lepetit and harris because it is faster than harris and more robust than lepetit Depending on the detector type that is chosen different values can be specified For the Detector Type lepetit the following value can be specified e Radius For the Detector Type harris the following values can be specified e Gradient Sigma and e Threshold For the Detector Type harris_binominal the following values can be specified e Gradient Mask Size and e Threshold 7 3 3 Matching Assistant Reference 275 For more information and recommended values please refer to the reference documentation of the oper ator create_uncalib_descriptor_model The Model Parameter Min Score Descriptor based Matching In most cases Min Score should be set to a value of at least 0 1 To speed up the search it should be chosen as large as possible but of course still as small as necessary for the s
74. User s Guide 90 HDevelop User s Guide 89 HDevelop User s Guide 87 HDevelop User s Guide 86 HDevelop User s Guide 84 HDevelop User s Guide 84 Self Calibration HALCON 84 HDevelop User s Guide 82 HDevelop User s Guide 82 Calibration Object HALC Filter calib acquire images for camera calibratic acquire images for uncalibrated mos calibrate binocular stereo camera pi calibrate camera parameters calibrate external camera paramete calibrate hand eye system paramet calibrate internal camera parameter calibrate line scan camera paramete calibrate sheet of light system parai calibrate stereo camera system calibration plate camera calibration corresponding points for camera cal corresponding points for hand eye m Tools Calibration chapter reference calibration plate Solution Guide III C camera calibration detailed description camera_calibration tle m r Bookmarks earch Index read_image HDevelop User s Guide 5 4 Program HDevelop User s Guide 9 1 Keyboarc a b Figure 6 76 Other tab cards of the online help Precede all mandatory words with a plus sign For example to find all documents that contain filter and gauss enter filter gauss You can exclude specific words from your search result To find all documents that say anything about filters
75. Without this information the samples in the image may not be segmented at all e g for characters that are printed bright on dark back ground the image has to be inverted first Check if characters are bright on dark background composed of individual dots or if the text is structured i e if letters digits or separators appear at fixed positions 7 5 2 Setup 315 5 Check if all information that was required so far is filled in correctly according to the features of the sample image and then click the Apply Quick Setup button when finished If the Quick Setup was successful the found characters are read and the Results tab page 326 is automatically opened Otherwise the segmentation tab opens and allows you to adapt parameters while simultaneously observing the segmentation results 7 5 2 2 Image Source The Image Source dialog on the Setup tab lets you choose images from different sources e If your image has already been opened in the Graphics Window you can activate Graphics Window to continue working with the currently displayed image e You can load an image file by activating Image File or choosing Load Image from the menu File and the toolbar respectively and either typing in the image path or using the Browse button on the right to select an image from a file e Another option is to activate the radio button for the Image Acquisition Assistant page 225 Being connected to this assistant you can acquire the ima
76. about HALCON is available in PDF and HTML format HDevelop provides an integrated online help window You can conveniently browse the HTML based documentation in this window or view the HTML files in your web browser In HDevelop you may call the online help window via the menu Help gt Help or by pressing Fi The functionality is described in section 6 8 on page 192 Besides HTML the documentation is available in PDF format as well If you click on a PDF document in the online help window the registered application for viewing PDF files starts up automatically 10 3 Emergency Backup In case HDevelop ever crashes during a program execution an emergency backup is started which saves the recent program status to your hard disk from where you can retrieve it after restarting HDevelop to continue your application 404 Miscellaneous The exact location of the data depends on the operating system you are using For Linux UNIX you can retrieve your data from tmp hdevelop_ login and for Windows the corresponding path is C Documents and Settings login Local Settings Temp hdevelop In both cases substitute lo gin with your login name Glossary 405 Appendix A Glossary Boolean is the type name for the truth values true and false as well as for the related boolean expres sions Body A body is part of a conditional instruction if or a loop while or for and consists of a sequence of operator calls If you consider the
77. action can be triggered by clicking the Apply button The third column is reserved for numeric parameters It contains a slider to quickly alter the parameter value within the defined range Please note that low level error messages are suppressed while dragging the slider If the minimum value is below 10000 or the maximum value is above 10000 or no range is defined at all no slider is displayed The fourth column contains a reset button for editable parameters Click it to reset altered parameters to their default value 7 1 4 Tab Inspect Synopsis Set display mode and show image acquisition statistics Display Display Image It is recommended to set the display mode to Normal unless you wish to make speed measurements Other modes are Volatile volatile grabbing and Disabled grabbing images without displaying them Output Window Specifies the graphics window for the image display either the active graphics win dows or a window ID from the list 7 1 5 Tab Code Generation 229 Statistics This area displays statistics for the acquisition time and the frame rate of all acquired images Ignore first image of live acquisition When the first image is acquired in live mode a cer tain amount of overhead is added Therefore it is recommended to check box to increase the accuracy of the results Status Bar Show frames per second during live acquisition Usually the number of grabbed images and the acquisition time of
78. are introduced by pressing Ctri Shitt G followed by another key e g Ctrl Shift G Del clears the graphics window Because it is often easier to keep Ctri shift pressed when hitting the second key the alternative Ctrl Shift G Ctrl Shift Del is also allowed On Mac OS X the command key is used instead of cu c 2 O El 3 o ba E Introducing HDevelop Windows and Window Managers In the default window mode of HDevelop windows can be freely moved inside the main window by dragging the title bar They can be resized by dragging the window border Windows can be focused by clicking inside the window area This also raises the corresponding window to the front Windows that are completely covered by other windows can be brought to the front by selecting them from the Window menu The window title provides some buttons with additional functionality Clicking the icon in the left edge of the window title opens a menu from which all window management functions move resize mini mize can be selected The buttons on the right edge of the window allow to 1 minimize restore 2 maximize restore and 3 close the corresponding window from left to right menu maximize E HDevelop unnamed minimize close Figure 1 1 Window title There is an alternative window mode called SDI see also section 6 1 on page 54 which delegates the functionality of handling the windows to the window man
79. are separated by a semicolon If an image with no path name or a relative path name is given the image files are searched in the directories specified by the environment variables HALCONROOT and HALCONIMAGES You can also enter the full path of an image directory to specify all images of the given directory If the check box Recursive is ticked the images of all subdirectories are specified as well Pressing will display the first of the specified images in the active graphics window The buttons Select File s andSelect Directory open a file browser to select multiple images or an image directory respectively After clicking OK in the file browser the text field is updated with the selected items and the first image is displayed in the active graphics window Use the entry Snap or Live in the menu Acquisition or the corresponding tool bar buttons to view the selected images one after another Image Acquisition Interface Activate this radio button to acquire images from an image acquisition interface The drop down list contains the list of all supported image acquisition interfaces Clicking Detect probes the image acquisition interfaces in turn and removes those interfaces from the list that do not respond It is recommended to save your program before probing the image acquisition interfaces 226 HDevelop Assistants 7 1 2 Tab Connection Synopsis Setup connection parameters for the image acquisition
80. are some editing functions to help you doing input deletes the character to the left and deletes the one to the right You may also se lect a sequence of characters in the text field using the mouse or holding and using the cursor keys If there is a succeeding input the marked region is going to be deleted first and afterwards the characters are going to be written in the text field See page 397 for a summary of the keyboard mappings Combo box selection Using this input method you can obtain rapid settings of variables and constants To do so you have to click the button on the text field s right side A combo box is opened in which you may select an item Thus you are able to choose a certain variable or value without risking erroneous typing Previous entries are deleted Afterwards the combo box is closed If there are no variables or appropriate values the combo box remains closed 6 5 3 Control Buttons Below the parameter display you find five buttons that comprise the following functions 6 6 Variable Window 171 OK By clicking OK you execute the operator or procedure call with the specified parameters When doing so the execution mode depends on the position of the PC If the PC is placed above the insertion position the system executes the program from the PC until the insertion position first Then the operator or procedure call that has been edited in the operator window is executed The reason for this is tha
81. be observed within this window which may be more helpful than just viewing the final result in the Graphics Window Choose from the combo box to view Orientation Correction Slant Correction Filtered Image Extracted Foreground Best Symbol Candidates Line Geometry and Symbol Results The following table can help you to solve segmentation problems by adapting the correct parameters 7 5 3 Segmentation 319 Intermediate Observation Possible Solution Step Orientation The text appears rotated Adapt the minimum and maximum angle Correction for Line Orientation in the dialog Text Orientation or clip the ROI Slant Correc The text appears slanted e g printed Adapt the minimum and maximum an tion in italics gle for Symbol Slant in the dialog Text Orientation Filtered Image The characters are hard to detect in There may be not enough contrast to segment the filtered image the characters Adapting the Stroke Width may help to solve this problem as well as it in fluences the filter size Try to enhance the im age quality Extracted Fore Not all characters are detected as Adapt the parameters in the dialogs Symbol ground foreground One character is de Size and Symbol Fragmentation until they tected as two parts of the foreground correspond to the appearance of the characters Try to enhance the image quality if e g the contrast is low Best Symbol No symbol candidates or not all Note that it is not nece
82. border of the Measure Assistant window to enlarge it Images are displayed in the graphics window of HDevelop 7 4 6 1 The Menu File Via the menu File you can e load an image e load camera parameters e load assistant settings e save current assistant settings page 309 e close a dialog page 309 and e exit the assistant page 309 Load Image You can load an image from a file by the menu item File gt Load Image or via the corresponding button of the tool bar To acquire images from a camera you can also use the Snap and Live buttons in the tool bar 308 HDevelop Assistants Load Camera Parameters If you have saved your camera parameters before you can load them by the menu item File gt Load Camera Parameters in order to use them for a calibration page 230 Load Assistant Settings If you have saved the settings of a former Measure Assistant session you can load them again by the menu item File gt Load Assistant Settings or via the corresponding button of the tool bar 7 4 6 Measure Assistant Reference 309 Save Current Assistant Settings You can save the current settings of a Measure Assistant using the menu item File gt Save Current Assistant Settings or the corresponding button of the tool bar Then you can load page 308 them again in a later session Close Dialog When closing the Measure Assistant dialog with the menu item Fil
83. can be changed in the preferences of HDevelop This time two program lines are executed The threshold operation and the connection operation As noted above Clicking Ok executes from the PC to the IC In the graphics window the contiguous regions calculated by the operator connection are now dis played in alternating colors 4 6 Understanding the Image Display After having executed the three lines of our program the graphics window actually displays three layers of iconic variables the image Clip the region Region and the tuple of regions ConnectedRegions from bottom to top Place the mouse pointer over the icons in the variable window to obtain basic information about the variables The display properties of images and the topmost region can be adjusted from the context menu of the graphics window For images the look up table henceforth called LUT and the display mode referred to as paint can be set The LUT specifies gray value mappings Experiment with different settings Right click in the graphics window and select some values from the menus Lut and Paint Make sure the menu entry Apply Changes Immediately is checked Notice how the display of the image changes while the regions remain unchanged The menu entries Colored Color Draw Line Width and Shape change the display properties of the topmost region Set Draw to margin Color to cyan and Shape to ellipse The display of ConnectedRegions whi
84. can be deleted from the file system or kept e g as a security copy What shall be done with the original procedure file on the file system 0 Keep the original file untouched in addition to the current procedure Remove the original file and keep only the current procedure Figure 6 48 Procedure type changed from external to local 6 4 8 Providing Procedure Documentation HDevelop supports the preparation of procedure documentation in the procedure interface dialog Since procedures are treated like operators the same documentation slots are available The procedure docu mentation is seamlessly integrated into the online help system For example if you select a procedure in the operator window clicking the help button will take you to the corresponding page in the help window The documentation of the procedure may be entered in multiple languages The language used for displaying the procedure documentation in the online help depends on the language set in the preferences of HDevelop To edit the procedure documentation in a specific language select the corresponding entry from the drop down list Language 6 4 8 1 General Documentation Basics Procedures can be grouped by Library and Chapters chapter and section Library This is the top level element of the content hierarchy in the procedure online help It could be used to apply a vendor specific tag to a group of procedures The external procedures supplied with HALCON
85. can freeze the histogram by unchecking Input Window The currently displayed histogram is preserved until Input Window is checked again in which case the histogram will be re calculated from the selected graphics window Gray Histogram Display The main part of the tool is the area in which the histogram of the image is displayed in blue This area contains static parts and parts that can be interactively manipulated The first static part is the horizon tal coordinate axis which displays the gray values in the image For byte images this range is always 0 255 For all other image types e g real images the horizontal axis runs from the minimum to the maximum gray value of the image and the labeling of the axis is changed accordingly To the left of the display the vertical axis representing the frequency of the gray values is drawn The final static parts of the display are three gray arrows The two upward pointing arrows denote the maximum and minimum gray value of the image The two rightward pointing arrows denote the maximum and minimum fre quency of the displayed histogram This data is also displayed in textual form within the Statistics area of the display The peak of the histogram i e the gray value that occurs most frequently is also dis played in the statistics For int4 int8 or real images the peak value is displayed as a value range in the Statistics That is the range of input values is divided in quantization steps to ob
86. can select a visualization mode to display regions It can either be filled menu entry i11 or outlined menu entry margin If set to margin the line thickness of the displayed regions is specified using the menu item Line Width 6 2 4 10 Line Width Synopsis Line width used for the display of lines in active graphics window g la c i E 2 5 0 See also dev_set_line_width Here you determine the line width for painting XLDs borders of regions or other types of lines You can select between a wide range of widths using the submenu 108 Graphical User Interface 6 2 4 11 Shape Synopsis Specify representation shape for regions See also dev_set_shape Here you specify the representation shape for regions You can display not only the region s original shape but also its enclosing rectangle or its enclosing circle 6 2 4 12 Lut Synopsis Specify look up table for gray value mapping See also dev_set_lut This menu item activates different look up tables which can be used to display gray value images and color images in different intensities and colors In the case of a true color display the image has to be redisplayed due to the missing support of a look up table in the graphics hardware For color images only the gray look up tables can be used which change each channel separately with the same table 6 2 4 13 Paint Synopsis Specify image visualization See also dev_set
87. change your camera setup aperture focus pose either during the calibration process or during the subsequent application you have to restart your cali bration with the new setup Any changes will result in the failure of the calibration or even worse in wrong output values Note Due to special settings or unchangable specifications of your work environment it may be possible that you cannot fully avoid any quality reductions If you follow these instructions you should however be able to reach a feasible quality level to work with 7 2 2 How to Calibrate with the Calibration Assistant 241 Quality Issue Explanation Possible Solution Plate is overexposed Illumination is inhomogeneous Contrast is low Plate in image is too small Marks on plate are out of focus Quality assessment failed The image is too bright it reaches the highest gray value 255 in some parts This leads to a shifting of edges and there fore calculates a wrong center position The image is illuminated inho mogeneously i e the bright ness of the calibration plate changes within one image This condition makes it diffi cult to locate the calibration plate and consequently leads to a lower accuracy The difference between the gray values of the calibration plate and the calibration marks is not big enough The plate size is too small in re lation to the image size The marks are not completely focussed some of t
88. description of tuple_regexp_match you find further information about the used syntax a list of possible options and a link to suitable literature about regular expressions regexp_match See also tuple_regexp_match regexp_match s1 s2 searches for elements of the tuple s1 that match the regular expression s2 It returns a tuple with the same size as the input tuple exceptions exist when working with capturing groups see the description of tuple_regexp_match in the Reference Manual for details The resulting tuple contains the matching results for each tuple element of the input tuple For a successful match the matching substring is returned Otherwise an empty string is returned regexp_replace See also tuple_regexp_replace regexp_replace s1 s2 s3 replaces substrings in s1 that match the regular expression s2 with the string given in s3 By default only the first matching substring of each element in s1 is replaced To replace all occurrences the option replace_all has to be set in s2 see tuple_regexp_replace For example assign regexp_replace List jpg png List substitutes file names that look like JPEG images with PNG images regexp_select See also tuple_regexp_select regexp_select s1 s2 returns only the elements of the tuple s1 that match the regular expression s2 In contrast to regexp_match the original tuple elements instead of the matching substrings are returned Tuple elements that do n
89. device first connecting to the device if needed The image is dis played in the active graphics window unless Display Image is set to Disabled see Inspect Live Start stop live image acquisition mode The images are displayed in the active graphics window unless Display Image is set to Disabled see Inspect The live mode is stopped automatically if an error occurs Detect Clicking this button will attempt to redetect valid parameters for the current device Reset All Reset all connection parameters to their default values 7 1 3 Tab Parameters Synopsis Set parameters for the selected image acquisition device This tab card is available if the image source is set to an image acquisition interface and a connection to an image acquisition device has already been established Press for more information about the displayed parameters Interface Library The image acquisition interface library DLL or shared object used by the cur rent connection is displayed in this field Update Image If this check box is ticked a new image is acquired immediately after each parameter change Disable the check box if you want to change multiple parameters at once Refresh Refreshes the list of supported parameters and their value ranges This is useful for parameters with side affects Reset All Resets all parameters to their default values Individual parameters can be reset by clicking the corresponding button displayed to the right of each para
90. directory Changing the type local to library modifies the library file of the selected target library Conversely setting the type of a library procedure to local modifies the current program In all these cases the option Duplicate internal procedure determines what happens with the original procedure If Duplicate internal procedure is unchecked the local procedure is moved to the new location Otherwise the original local procedure is kept unmodified and the external procedure gets created along with other changes made in the dialog In this case the newly created external procedure cannot be called from the program because the internal procedure has a higher priority Changing the procedure type or name of external procedures If the type or name of an external procedure is changed you will have to decide whether the original file is kept The following options are available e Keep the original file untouched in addition to the current procedure e Remove the original file and keep only the current procedure o D 2 Q a 0 158 Graphical User Interface Name disp_3d_coord_system Password Type E Local Program Procedure hdev dev y Add Path Keep or remove the original procedure file Applying the changes will move the current procedure into the program Attention Modifying an external procedure like this impacts the original external procedure file too It
91. for operators that modify visualiza tion parameters dev_set_color dev_set_draw etc For example the new visualization parameter is registered in the parameter window when the operator has been executed You can easily check this by opening the dialog Menu Visualization gt Set Parameters gt Pen and apply the operator dev_set_color Here you will see the change of the visualization parameters in the dialog box You have to be aware of this difference if you export dev_ to C C Visual Basic Visual Basic NET and C code In contrast to the parameter dialog for changing display parameters like color the corresponding opera tors like dev_set_color do not change the contents of the graphics window i e they don t cause a redisplay They are used to prepare the parameters for the next display action o D 2 Q a 0 126 Graphical User Interface 6 2 6 3 1D Measuring 3D Measuring 3D Reconstruction Synopsis Select HALCON operators In the these menu entries you can find all HALCON operators arranged in chapters and sections This set of image analysis operators forms the most important part of HALCON the HALCON library HAL CON operators implement the different image analysis tasks such as preprocessing filtering or measure ment You may look for a detailed description of each operator in the HALCON reference manual Operators in the menus Control and Develop are special ope
92. global variables existing procedures cannot be broken by introducing global variables in other parts of the program By nature the names of global variables have to be unique in the entire HDevelop program i e all loaded external procedures the main procedure and all local procedures The variable window provides a special tab to list all global variables that are currently declared 8 4 Operations on Iconic Objects Iconic objects are exclusively processed by HALCON operators HALCON operators work on tuples of iconic objects which are represented by their surrogates in the HALCON data management The results 8 5 Expressions for Input Control Parameters 343 K Variable View main ls Iconic Variables Image Control Variables mee 7 File particle i a Ulitao ser _ Global Figure 8 2 Global variables of those operators are again tuples of iconic objects or control data elements For a detailed description of the HALCON operators refer to the HALCON reference manual and the remarks in section 8 5 3 on page 347 8 5 Expressions for Input Control Parameters In HDevelop the use of expressions like arithmetic operations or string operations is limited to control input parameters all other kinds of parameters must be assigned by variables 8 5 1 General Features of Tuple Operations This section intends to give you a short overview over the features of tuples an
93. gt colored 12 predefined colors Mbs white El red i En nreen E K Visualization Parameters o O mesa v Update Reset lUse settings for new windows Figure 6 27 Pen settings 6 2 4 Menu Visualization 111 wr Basic colors Custom colors IL O Y ia gt e DODOI IL Sat 214 Green 181 Blue 41 Val 255 Cox cms Add to Custom Colors Figure 6 28 Defining a new color Draw o fill margin Shape original Y Line Width 1 de Colors gt lt E Custom colors M medium sea green gt Ml red Ml yellow green M green medium aquamarine H bue Il ime green LJ srms29 E aquamarine mn wheat green yellow 4 srios29 e Figure 6 29 Custom color set The pen settings are also available from the corresponding menu entries in the menu Visualization A description of the functionality is provided there The preview shows the current settings which is helpful if the active graphics window does not contain any regions or XLDs o D 2 Q a 0 e Draw see also page 107 e Colored see also page 107 e Color see also page 107 112 Graphical User Interface e Shape see also page 108 e Line Width see also page 107 LUT settings channel separately with the same table See the d
94. hand the execution time is the appropriate measure if you run the program inside HDevelop or HDevEngine The profiling data may be used to evaluate the overall program execution to optimize its performance and to find bottlenecks Keep the following in mind when profiling your code e Run the code to be profiled a couple of times and use the average profiling data to get more accurate results e Reduce the number of concurrent background processes e Avoid stop and wait_seconds instructions or override these two operators see Override Operator Behavior page 96 6 4 10 Profiler 165 Program Editor ce C a da a E man Ml ZHR n EPA sE 7 color simple hdev segment yellow 2 dev_close window 6 945 ms 3 dev_open window 0 O 640 480 bl for i 1 to 2 by 1 0 056 ms 5 read image Image cable i ms decompose3 Image Red Green Bl 3 694 ms 7 trans_from_rgb Red Green Blue 5 140 ms threshold Saturation HighSatur 0 723 ms reduce domain Hue HighSaturati 1 873 ms 10 threshold HueHighSaturation Ye 0 465 ms connection Yellow ConnectedReg 0 339 ms select_shape std ConnectedRegio 0 220 ms closing circle SelectedRegions 0 284 ms reduce domain Image Yellow Im 1 436 ms dev_display HueHighSaturation a 1 873 ms l dev_display ImageReduced 0 684 ms gt stop 3lendfor m Figure 6 55 Profiling results of the first program execution
95. hierarchical tree Click on a node of the tree to display the associated document See figure 6 75 for an example Operators This tab card lists all operators in alphabetical order Click on an operator name to display the corre sponding page from the Reference Manual Enter any name into the text field Filter to show only operators matching that name See figure 6 76 on page 194 a for an illustration Search Enter a search query into the text field and click Find to start a full text search The check boxes below the text field indicate the search scope For example to make sure only HTML matches are 6 8 Help Window 193 displayed deselect the check box PDF The search result is displayed below the query The rank in percent indicates how well each found document satisfies the query The query may consist of one or multiple words HDevelop will find all documents that contain any of the specified words To search for a phrase enclose it in double quotes radiometric calibration K HDevelop Help read_image HALCON Operator Reference Version 11 0 Co JCE e Contents Operators KO Fe AA Y RU syntax HDevelop y Find E 4 Parti Generall a Chapter 1 B Chapter 2 P Chapter 3 T gt Part2 Program Part3 Program gt Part4 Program gt Part5 Program gt Part6 Using HD lata as read_image Operator 4 Reference Manuals Operators 4 HALCON Operator
96. i E 2 5 0 A Zoom in Click the small arrow next to the icon to switch to zoom out a Zoom out Click the small arrow next to the icon to switch to zoom in Set image size Clicking this icon sets the image size to the shown value The value can be selected from the menu attached to the small arrow See section Image Size on page 106 for additional information 186 Graphical User Interface Figure 6 69 Magnifying glass gt Set window size Clicking this icon sets the window size to the shown value The value can be selected from the menu attached to the small arrow See section Window Size on page 106 for additional information FA Draw ROIs and XLDs interactively See section Interactive Creation and Handling of ROIs and XLDs on page 187 Ja Toggle 3D plot mode see above page 183 he e Active graphics window e Non active graphics window Click the icon to activate the corresponding graphics window Only one graphics window may be active any given time If you want to specify display parameters for a window you may select the menu item Visualization in the menu Here you can set the appropriate parameters by clicking the desired item see section Menu Visualization on page 105 The parameters you have set this way are used for the active window The effects of the new parameters will be applied directly to the last object of the window history and alter its param
97. i e any changes to the parameters are undone Remove Using this button you can remove single parameters from the list Before clicking this button focus the corresponding parameter by clicking its text field Move Up Move Down Using these buttons you can alter the order of the parameters Select a parameter by clicking its text field and use the buttons to change its position 6 4 5 3 Committing the Procedure Interface Replace selected program lines If this option is enabled the selected program lines are replaced by an appropriate call to the newly created procedure see figure 6 45 for an illustration Otherwise the original program lines are kept and no procedure call is added In any case the selected program lines are copied to the body of the new procedure Adapt program existing procedures only This setting is not relevant for new procedures but very useful when modifying the interface of existing procedures When enabled all program lines calling the procedure in question will be adapted according to the interface changes i e changes to the procedure name or its parameters For example if you decide that a certain parameter is no longer necessary the corresponding expressions or variable names will be removed from all procedure calls in the program when you close the dialog and apply the changes If this is an input parameter the program will continue to run without further modifications If it is an output parameter sub
98. index position of a tuple Thus an array assignment here in C syntax ali v is entered as insert a v i a in the operator window and is displayed as ali v 6 2 6 Menu Operators 123 in the HDevelop program window Program termination The operators stop and exit are used to terminate the program More precisely stop interrupts an execution and exit terminates HDevelop Having interrupted the execution you may continue the pro gram by pressing Step Over or Run This is useful e g in demo programs to install defined positions for program interruption Under UNIX you can use exit in combination with a startup file and the command line switch run Thus HDevelop will not only load and run your application automatically but also terminate when reaching exit Comments The operator comment allows to add a line of text to the program This text has no effect on the execution of the program A comment may contain any sequence of characters 6 2 6 2 Develop Synopsis Select operators specific to HDevelop This menu contains several operators that help to adapt the user interface These operators offer the same functionality that you have using mouse interaction otherwise They are used to configure the environment from within a program Using these operators the program performs actions similar to the setting of a color in the parameter window opening a window in the menu or iconifying the program window with
99. is Good Tolerance so 1 0 0 0 20 0 40 0 Figure 7 4 How to use fuzzy measuring to improve the edge detection in an image The advanced features explained below enable you to adapt your fuzzy settings more easily to a different camera with a higher resolution a different distance between object and camera or in general an image that is larger or smaller The Normalized option can be activated for e Fuzzy Edge Position page 303 e Fuzzy Pair Center Position page 303 and e Fuzzy Pair Width page 304 which are then converted to factors and multiplied with Reference Pair Width The translation from regular to normalized values is automatically calculated when activating or deactivating the Normalized button Therefore corresponding graphs do not change Choose the Reference Pair Width corre sponding to the width of your reference pair When changing your setup adapt the Reference Pair Width to your new image size e g 1f your image is now double the previous size also double the reference Reference Pair Width 7 4 5 3 Alignment If the object in your image can appear shifted or rotated an alignment which can be chosen on the Code Generation tab under Alignment Method gt Affine Transformation is necessary An alignment 306 HDevelop Assistants allows you to automatically relocate your ROI in an image where the object occurrs in a different po sition Note however that the Measure Assistant does
100. left of the line profile display you can modify the displayed part E Zoom profile display to a selected area Click this button and drag an area inside the histogram to view that area Li Spread the line profile horizontally so that only the area between the lines is displayed ate l Display the full line profile b Reset the display of the profile vertically o D 2 Q a 0 212 Graphical User Interface ar Reset the display of the profile horizontally LS Force minimum histogram width Do not adjust the width of the line profile when resizing the window 6 13 3 Input This section lets you choose the source of your image and therefore the source of the ROI By default the active graphics window is chosen into which an ROI can be drawn using the ROI menu of the line profile window The ID of another graphics window can be selected from the drop down menu If a Measure Assistant page 293 is activated one assistant can be chosen from the drop down menu or it can be opened by activating the Use Measure Assistant as Data Source button 6 13 4 Line Profile Options Smoothing Display the profile smoothed You can smooth the profile before displaying 1t by specifying a smoothing factor with the slider in the spinner box and by clicking the checkbox If smoothing has been applied with the Measure Assistant page 293 those values are automatically adopted The smoothing can then be performed i
101. major difference between these approaches is the realm of application The first method handles errors inside the procedure in which they occur The latter method allows errors to work their way up in the call stack until they are finally dealt with o te iv te c l 370 HDevelop Language 8 8 1 Tracking the Return Value of Operator Calls The operator dev_set_check specifies if error message boxes are displayed at all To turn message boxes off use dev_set_check give_error HDevelop will then ignore any errors in the program Consequently the programmer has to take care of the error handling Every operator call provides a return value or error code which signals success or failure of its execution This error code can be accessed through a designated error variable dev_error_var ErrorCode 1 This operator call instantiates the variable ErrorCode It stores the error code of the last executed operator Using this error code the program can depend its further flow on the success of an operation if ErrorCode H_MSG_TRUE react to error endif continue with program The error message related to a given error code can be obtained with the operator get_error_text This is useful when reporting errors back to the user of the program If the error is to be handled in a calling procedure an appropriate output control variable has to be added to the interface of each participating procedure or the
102. measuring under difficult conditions with fuzzy measuring page 301 Using the Measure Assistant is simple all you need is to setup the measure task to detect all relevant edges and add the resulting code to your application When you start a project for the first time read How to Use the Measure Assistant of HDevelop When looking for an overview over all Measure Assistant elements please refer to the reference page 306 In this online help the following special terms are used Edge An edge defines a gray value transition that is either e positive which means that it changes from dark to bright or e negative which means that it changes from bright to dark Edge Pair An edge pair always consists of two edges one with a positive gray value transition and one with a negative gray value transition 1D Measuring also called 1D metrology or caliper This is a fast and easy to use method for mea suring objects in one dimension along a line or circular arc It is based on extracting edges perpendicular to a line of measurement and measuring e g positions and the distances between them Region of Interest ROD This region specifies where to look for edges and the direction needed to determine the gray value transition Fuzzy Measure Fuzzy Measuring allows a more detailed specification of the object parts to be measured by selecting edges according to different criteria This can also be useful for images that contain unwant
103. might not be collected from memory although the underlying iconic object e g an image might in fact occupy a large portion of memory In order to avoid memory leaks caused by this effect in the exported code every iconic object is deleted explicitly before it is assigned a new value 9 3 Code Generation for Visual Basic NET HALCON NET This section describes how to create a HALCON application in Visual Basic NET starting from a program developed in HDevelop HALCON can be used together with Visual Basic NET based on the NET interface of HALCON A detailed description of this interface can be found in the Programmer s Guide part IV on page 121 9 3 1 Basic Steps 9 3 1 1 Export The first step is to export the program using the menu File gt Export Here select the language Visual Basic NET HALCON NET and save it to file The result is a new file with the given name and the extension vb 9 3 1 2 The Visual Basic NET Template If the file has been exported using the option Use Export Template it is intended to be used together with the predefined Visual Basic NET project that can be found in the directory 9 3 2 Program Structure 387 HALCONEXAMPLES Avb netXHDevelopTemplate This project contains a form with a display window HWindowControl and a button labeled Run Add the file generated by HDevelop to the project in the Solution Explorer Add Existing Item Now the project is ready for execution
104. of a selected feature e g the area of an XLD or the mean gray value of the pixels within a region The feature histogram can also be used to select suitable thresholds for the operators select_shape and select_shape_xld interactively Similar to the gray histogram tool the interactive selection can be translated into generated HDevelop program code Upon opening the tool displays the histogram of the area default feature selection of the regions or XLDs that were displayed most recently in the currently active graphics window You can select various features in the combo box Feature Further information about region features can be found in section Feature Inspection Window on page 208 See figure 6 79 for an illustration First all objects regions of a certain size area are selected Then the selection is refined by adding further restrictions In this example the final selection should only include round objects i e regions with a high roundness feature The following code would be generated if you clicked the button Insert Code in this example select_shape Connection SelectedRegions area roundness and 2900 0 721 3900 0 79462 Most parts of the tool are built up similarly to the gray value histogram which is described in detail in section Gray Histogram Window on page 199 Menu Visualization gt Gray Histogram It is highly recommended to read that description beforehand in the following we con
105. of external procedures may be specified explicitly hdvp or dvp see section 5 2 on page 46 External and library procedures can be reused in other HDevelop programs You can change the procedure type at any time Directory For external procedures a target directory has to be specified The first directory specified in the procedure preferences see section 6 2 2 16 on page 82 is suggested as the target directory You can select an appropriate directory from the list or click the browse button to select an arbitrary directory Tf the selected directory is not currently contained in the configured directories HDevelop will ask you if you want to add it to the list when you commit the dialog Library For library procedures a target library has to be specified The list contains all currently avail able libraries The buttons next to the list allow to create a new procedure or browse for an existing procedure that is currently not configured Activated existing external procedures only This check box determines whether or not the selected procedure can be executed This option can also be toggled in the preferences see section 6 2 2 16 on page 84 W create Procedure c a P General Parameter ES Language Setting arameters Documentation Documentation English en_us y Name init_image El Password Type El Local Program Procedure hdev dev X Q 2 lt O i 2 O 5 0
106. of numbers as arguments The input can either be of type integer or real However the resulting type will be of type real The functions are applied to all tuple values and the resulting tuple has the same length as the input tuple For atan2 the two input tuples have to be of equal length table 8 18 shows the provided trigonometric functions For the trigonometric functions the angle is specified in radians Operation Meaning HALCON Operator sin a sine of a tuple_sin cos a cosine of a tuple_cos tan a tangent of a tuple_tan asin a arc sine of a in the interval 7 2 7 2 a 1 1 tuple_asin acos a arc cosine a in the interval 7 2 7 2 a 1 1 tuple_acos atan a arc tangent a in the interval 7 2 1 2 a oo 00 tuple_atan atan2 al a2 sinh a cosh a tanh a arc tangent a1 a2 in the interval 7 7 hyperbolic sine of a hyperbolic cosine of a hyperbolic tangent of a tuple_atan2 tuple_sinh tuple_cosh tuple_tanh Table 8 18 Trigonometric functions 360 HDevelop Language Operation Meaning HALCON operator exp a exponential function e tuple_exp log a natural logarithm In a a gt 0 tuple_log log10 a decadic logarithm log p a a gt 0 tuple_log10 pow ai a2 a12 tuple_pow ldexp a1 a2 al 2 tuple_ldexp Table 8 19 Exponential functions 8 5 13 Exponential Functions All these functions work on tuples of numbers as arguments The input can either be o
107. of special charac ters Precision for displaying real values This option sets the number of significant digits that are displayed in the variable window page 171 and variable inspection windows see Inspecting Variables on page 177 Precision for displaying mouse position values If set to a value greater than O subpixel mouse positions are enabled See Position Precision page 116 for more information Action when spinning the mouse wheel down The mouse wheel is used for zooming in and out in windows with graphical content This works consistently in the graphics window page 182 the zoom window page 197 the gray histogram window page 199 the feature histogram window page 206 and the line profile window page 210 The default setting is to zoom in when moving the mouse wheel down Depending on this setting the zoom direction can be reversed Default sort order in the Variable window Variables can be sorted by name or by occurrence See also variable window page 175 Return relative file paths when appropriate If enabled HDevelop will try to convert file names selected from file selection dialogs page 221 to relative path names HALCON uses several distinguished directories that act as the preferred search directories for certain operators For example read_image will at first search for image files in HALCONROOT images when given a relative file path For such operators HDevelop tries to turn the se
108. opens a pull down menu henceforth abbreviated as menu with optional submenus You open a menu by clicking a menu item or via the keyboard by pressing the key in combination with the underlined letter of the menu item In the following sections the menu entries are described in the order in which they appear 6 2 1 Menu File This menu provides functions to load existing programs and to save recently created or modified pro grams and procedures respectively See section File Types on page 46 for the supported file types Furthermore you may export HDevelop programs to C C Visual Basic Visual Basic NET C or plain text and also print them The menu also provides access to the supplied example programs and allows to read arbitrary images Please note that the file type of programs and external procedures is persistent If you load a program in the older dev format and save it again it will not be converted to the newer hdev format unless explicitly specified in the dialog Save Program As or in the dialog Save Procedure As for external procedures Additionally it is possible to convert HDevelop programs and procedures between the old and the new format by calling hdevelop convert from the command line For new programs the default file format hdev will be used When you save a program for the first time you can also select the older file format in the corresponding dialog If you want to use the older format all the
109. page 244 e generate code page 245 for the calibration or for using the calibration results and insert it into a program for further use in a subsequent application A reference to the elements of the Calibration Assistant can be found in the Calibration Assistant Refer ence page 248 For further information about camera calibration please refer to the corresponding chapter in the solution guide on 3D Vision ATTENTION Remember that it is essential to keep your camera setup aperture focus pose fixed once you have chosen it This applies to the calibration process itself as well as to the sub sequent application Any changes will result in the failure of the calibration or even worse in wrong output values In this guide the following special terms are used Calibration By calibrating page 235 a vision system you extract information about it e g its focal length or its position and orientation relative to the world However even with such information you cannot fully reconstruct the 3D world from a single image For example you can determine the 3D size of an object only if you know its distance from the vision system when using a standard lens Calibration is a preparation for all subsequent image processing applications The Calibration Assistant needs to grab a set of images of a special calibration object placed in front of your vision system You can choose between a Full Calibration and a User Defined Calibr
110. principle is the clear separation of the parameters and the advantage that it facilitates providing sophisticated help Thus many input errors can be avoided Please see section 4 2 on page 34 for an introduction of how to add new program lines Every program line starts with an operator or procedure name which is indented if necessary to show the nesting level created by control structures Following the operator or procedure name the parameters are displayed in parentheses Parameters are separated by commas To edit a program line double click it with the left mouse button In case of conditions and loops the operator line with the parameters has to be selected For example you have to double click for 6 4 2 Editing Programs 141 r Operator Window Edit dev_open_window in procedure main atline7 pee Enter Operator or Procedure dev_open_window X dev_open_window HDevelop operator Parameters a ls Row fj y rectangle origin y integer Column O v rectangle origin x integer Width Width 2 v rectangle extent x integer Height Height 2 vw rectangle extent y integer Background black v color string El WindowHande WindowID v window integer rece _ apy J _ came He Figure 6 39 Editing a program line in the operator window in a for endfor loop but until in a repeat until loop You may edit only one operator or procedure call at a time After double clicking a
111. procedures 1 12 31 31 Figure 6 16 Procedures gt Directories Libraries For each directory the number of libraries is displayed The number in parentheses sums up the number of procedures contained in libraries Procedures This column displays the total number of procedures i e the number of procedures found in libraries and all other external procedures Loaded The number of loaded procedures is usually equal to the total number unless the directory contains corrupted procedure files or files with the wrong permissions Procedures with the extension hdvp always override procedures with the same name but the extension dvp in the same directory Please note that HALCON comes supplied with a set of standard procedures These are general purpose procedures used by many of the supplied example programs The path cannot be altered or deleted Itis 6 2 2 Menu Edit 83 however possible to override the supplied external procedures by placing external procedures with the same name in one of the user defined directories The documentation of the supplied procedures is available in the online help of HDevelop under Proce dure Reference Manual Add Select an additional directory from the file selection dialog page 221 This directory will be added to the list All subdirectories of the selected directory will be scanned as well Add Library Explicitly add a library hdpl file to the list of direct
112. program line note the following e The program line is highlighted in a slanted font This serves as a reminder that you are altering an existing program line instead of adding a new one e The operator or procedure call of the program line is displayed in the operator window and can be edited there e The window title of the operator window clearly indicates that you are editing an existing program line It also displays the procedure name and the line number e Clicking OK or Replace in the operator window will replace the original program line This is even the case 1f the corresponding program line is no longer in view e g if a different procedure 1s selected in the program window o D 2 Q a 0 If the program line is deleted before the changes are committed in the operator window the edited line will be inserted as a new program line at the IC If you are in doubt about the current status check the window title of the operator window 142 Graphical User Interface Copy Paste Delete Besides editing the parameters of a single operator or procedure call single and multiple lines can be deleted cut or pasted in one step using simple mouse functions To use this feature you select one or more lines in the program window using the mouse e You select one line by clicking on it Previously selected lines will then become deselected e To select more than one line hold down key while clicki
113. q El local_a El local_b local_c E local_custom v 4 mm m Program Protection State bl Change Password Figure 6 20 Procedures gt Manage Passwords If all local procedures of the current program have been protected at once by protecting the main pro cedure and enabling the corresponding option see figure 6 52 on page 163 the local procedures will always move as a single group even if only one local procedure is selected The icon next to Program Protection State at the bottom of the dialog is marked with a lock if the entire program main procedure and all local procedures is protected The button Change Password is available if one or more procedures are selected in the middle column It assigns a new password to the selected procedures regardless if the previous passwords were different Please note that password changes or moving procedures from or to the first column require the corre sponding procedures to be saved See Save page 58 and Save A11 page 59 o D 2 Q a 0 Graphical User Interface Procedures gt Procedure Use This tab card lists the usage of procedures grouped by their calling procedures You can select a proce dure and the type of used procedures either local or external For the main procedure you can also list the unused procedures The tab card is displayed in figure 6 21 Dire
114. ranges from 1 to the number of elements o te iv te c l 348 HDevelop Language control iconic d gen_empty_obj O t1 t2 concat_obj p1 p2 q Itl count_obj p num t i select_obj p q i 1 t i1 i2 copy_obj p q 11 1 i2 i1 1 Table 8 7 Equivalent tuple operations for control and iconic data for i 0 to Tuplel 1 by 1 fwrite_string FileHandle Tuple i n endfor In the following examples the variable Var contains 2 4 8 16 16 32 1 Var 64 128 1 2 4 8 16 16 32 64 128 Var 6 Var 4 16 Var 2 4 8 16 16 subset Var 0 2 4 2 8 16 select_mask Var 1 0 0 1 1 11 2 16 16 32 remove Var 2 3 2 4 16 32 find Var 8 16 2 uniq Var 2 4 8 16 32 Further examples can be found in the program tuple hdev The HALCON operators that correspond to the basic tuple operations are listed in table 8 6 on page 347 Note that these direct operations cannot be used for iconic tuples i e iconic objects cannot be selected from a tuple using and their number cannot be directly determined using For this purpose however HALCON operators are offered that carry out the equivalent tasks In table 8 7 you can see tuple operations that work on control data and which are applied via assign or assign_at and their counterparts that work on iconic data and which are independent operators In the table the symbol t represents a control tuple and the symbols p and q represent ic
115. reference plane The distance in world coordinates is determined using distance_pp To adapt this code to your application you typically exchange the mark centers for real points of interest Transform XLD Contours into World Coordinates In the example code the XLD contours are transformed into world coordinates and this 3D distance is calculated The points are visualized by a line First an XLD in image coordinates which relates to some interesting features in the image is obtained Here we simply generate a contour connecting the mark center points of the plate by using the HALCON operator gen_contour_polygon_x1d Then a conver tion into world coordinates is performed with HALCON operator countour_to_world_plane_xld Using the operator get_contour_x1d mark center points are extracted in world coordinates To adapt this code to your application you typically exchange the mark centers for real points of interest and adapt or remove the visualization For further information about pose estimation please refer to the section Pose Estimation of known 3D Objects With a Single Camera in the Solution Guide ITI C Estimate Pose from Single Image First the position of mark centers on the calibration plate is determined With known camera parameters one image is enough to determine the new pose using the HALCON operator camera_calibration This sample code always determines the pose of the calibration plate
116. s1 s2 strstr s1 s2 convert v using specification s concatenate vi and v2 search character s2 in si search substring s2 in s1 strrchr s1 s2 search character s2 in s1 reverse strrstr s1 s2 search substring s2 in s1 reverse strlen s length of string s i select character at position i 0 lt i lt strlen s s ii i2 select substring from position i1 to position i2 split s1 s2 split s1 in substrings at s2 regexp_match s1 s2 regexp_replace s1 s2 s3 regexp_select s1 s2 regexp_test s1 s2 extract substrings of s1 matching the regular expression s2 replace substrings of s1 matching the regular expression s2 with s3 select tuple elements from s1 matching the regular expression s2 return how many tuple elements in s1 match the regular expression s2 Table 8 12 String operations 8 5 8 String Operations 353 string conversion See also tuple_string converts numbers to strings or modifies strings The operation has two operands The first one left of the is the number that has to be converted The second one right of the specifies the conversion It is comparable to the format string of the printf function in the C programming language This format string consists of the following four parts lt flags gt lt width gt lt precision gt lt conversion gt or as a regular expression 0 9 0 9 doxXfeEgGsb which roughly translates to zero or more of the characters
117. section 3 3 for further information Images from Selected Directories Apart from dragging and dropping images there is an equivalent method from within HDevelop Select Fileb gt Read Image to get the dialog described above Browse to and select the desired image from this dialog and click OK to add the selected image to your program 3 2 Viewing Images When images are read as described above they are automatically displayed in the active graphics win dow This is the default behavior in HDevelop but the automatic display of images can be suppressed if desired e g to speed up computationally intensive programs Initially the loaded image fills the graphics window entirely The window itself is not resized so the aspect ratio of the image might be skewed Using the tool box of the graphics window you can easily zoom the image or change the window size with regard to the image We recommend to adapt the window size to the size of the image because otherwise the display is slowed down The image size the window size and the displayed part of the image are set with the tool bar icons of the graphics window see figure 3 2 An iconic view of the loaded image is also displayed in the variable window When the image is cleared in the graphics window it can always be restored by double clicking this icon 3 3 Image Acquisition Assistant 25 a select magnify image size ROI tools E GAR Erat 100 Gr pan image zoom in out wi
118. selected pixels are displayed in red unless you changed the default settings The selected threshold values are not perfect but we will correct this later For now click Enter to add the operator to the program window Contrary to clicking Ok this does not execute the operator Note that the variable Region keeps its value but is no longer displayed in the graphics window Also the PC is not advanced indicating that the second line of the program is yet to be executed Adding program lines with Enter is especially useful if some of the input parameters use variable names that will be added to the program at a later time Successor Click on the just inserted program line to select it You can let HDevelop suggest operators based on the selected line Open the menu Suggestions gt Successors This menu is filled dynamically to show typical successors of the currently selected operator We want to split the selected pixels into contiguous regions Move the mouse pointer over the menu entries The status bar displays a short description of the highlighted operator Looking through the menu entries the operator connection looks promising so we click on it Any operator selected through this menu is transferred to the operator window to f E E o o fo a 38 Programming HDevelop Again the variable names suggested by HDevelop look reasonable so press Return This is equivalent to clicking the Ok button though this
119. selection of bookmarks with and shift F11 If the selected procedure is already displayed in a program window tab the corresponding tab is activated Otherwise the current view switches to the selected procedure 74 Graphical User Interface E Program Line View ice C fa Invalid Lines al Find All _ Breakpoints _ Bookmarks var i Procedure Line Context main 23 for img 1 to Num main 53 dosing_rectangle main 77 append_ocr_trair dev_display_shape_matching_results 17 get_shape_mo disp_3d_coord_system 21 pose_to_hom_mat3 scale_image_range 44 scale_image Image 4 m b Figure 6 12 Managing bookmarks in the program line view window a Clear the bookmarks of the selected program lines and immediately remove the corresponding entries from the list This action can also be triggered from the context menu or by pressing ba iia Clear all bookmarks and remove all entries from the list leaving you with an empty window 6 2 2 15 Invalid Lines Synopsis Manage invalid program lines Shortcut Ctrl Shift O F12 or Ctrl Shift O Ctrl Shift F12 The program line view window see section Open Program Line View on page 131 contains a tab card to manage invalid lines in your program Examples of invalid lines are unresolved procedure calls operator or procedure calls with a wrong number or type of parameters or syntax errors The tab card lists all invalid program lines
120. selects a suitable value for the minimum component size based on the model image The Model Parameter Pyramid Levels Shape based Matching Correlation based Matching Deformable Matching To speed up the matching process a so called image pyramid is created both for the model image and for the search images The pyramid consists of the original full sized image and a set of downsampled images For example if the original image first pyramid level has the size 600x400 the second level image has the size 300x200 the third level 150x100 and so on The object is then searched for first on the highest pyramid level i e in the smallest image The results of this fast search are then used to limit the search in the next pyramid image whose results are used on the next lower level until the lowest level is reached Using this iterative method the search is both fast and accurate You can inspect the model image pyramid together with the corresponding models via the menu item File gt Display Image Pyramid page 266 which opens the corresponding dialog of the tab Creation We recommend to choose the highest pyramid level at which the model contains at least ten pixels and still resembles the original shape You can enter the value directly in the text field or by using the slider next to it Alternatively you can let the Matching Assistant select a suitable value automatically Note that the Matching Assistant can check whether the mode
121. subset tanh type while asin atan2 break ceil continue default elseif endtry exp find gen_tuple_const H_MSG_TRUE H_TYPE_MIXED ifelse is_int is_real ldexp max min ord rand regexp_select replace select_mask sinh sqrt strrchr sum throw type_elem xor Table 8 23 Reserved words if endif This control flow structure executes a block of code conditionally The operator if takes a condition as its input parameter If the condition is true the body is executed Otherwise the execution is continued at the operator call that follows the operator endif 8 7 Control Flow Operators 365 To enter both if and endif at once select the operator if in the operator window and make sure the check box next to the operator is ticked if lt condition gt endif ifelse if else endif Another simple control flow structure is the condition with alternative If the condition is true the block between if and else is executed If the condition is false the part between else and endif is executed To enter all three operators at once select the operator ifelse in the operator window and make sure the check box next to the operator is ticked o te iv te c l if lt condition gt aiue endif elseif This operator is similar to the else part of the previous control flow structure However it allows to test for an additional condition The block between elseif and endif is e
122. test images via the menu item Usage gt Test Images gt Load Test Images page 281 These images should be representative images from your matching application i e the object should appear in all allowed variations of its position orientation occlusion and illumination 254 HDevelop Assistants Score When comparing a detected match in a test image with the model the Matching Assistant cal culates a measure of similarity the so called score which ranges between 0 no similarity and 1 perfect similarity 7 3 2 How to Use the Matching Assistant of HDevelop By using the Matching Assistant you can set up and optimize your matching application quickly and easily in four steps e Select a matching method e Create the model e Test the model and e Optimize the matching speed page 256 We recommend to reset all model and search parameters via the toolbar button Reset before starting with a new matching application This way the parameters are reset to their default settings and the model image the model ROI and the test images are deleted 7 3 2 1 Selecting a Matching Method Within the toolbar of the Matching Assistant as well as on the Parameters tab the matching method can be selected The assistant currently supports the following methods e shape based matching page 252 e correlation based matching page 252 e descriptor based matching page 253 and e deformable matching page 252 7 3 2 How to Us
123. the angle range is sampled Note that each time you create a model ROT page 253 or change the parameter Contrast page 270 the Matching Assistant automatically selects a suitable value for Angle Step to obtain the highest pos sible accuracy You can select a higher value manually This may be useful to speed up the search 7 3 3 Matching Assistant Reference 277 process in special cases please note however that a large value may decrease the accuracy of the esti mated orientation and even prevent the Matching Assistant from finding the object You can restore the automatically selected value by clicking the button Auto Select If you already loaded test images page 281 you can quickly test the effect of the selected parameter value via the menu item Inspect gt Determine Recognition Rate page 290 Letting the Matching Assistant Select a Suitable Value for Angle Step Shape based Matching Correlation based Matching Deformable Matching When you click the button Auto Select that is placed right beside the slider for the parameter Angle Step page 276 the Matching Assistant selects a suitable value for the angle step size to obtain the highest possible accuracy The Model Parameters Row Scale Step and Column Scale Step Shape based Matching De formable Matching The standard model parameters for the scale range page 273 specify how much the object is allowed to be scaled in row and column direction Note that ea
124. the dialog for determining the options for the code generation inside the tab Code Generation The dialog con sists of the following parts radio buttons for selecting whether the model is created at run time from the model image page 253 Create model from a model image at run time In this case you can additionally select whether to use the model image and the ROI page 253 that were specified inside the Matching Assistant Create ROI as in assistant or whether a new ROI has to be drawn at run time Generate Code for drawing an ROI at run time Alternatively a radio button Load modified image allows the selection of an already existing model radio buttons that allow you to create a shape model from file or load a saved shape model file a check box Initialize Acquisition to generate code for initializing an image acquisition device a check box Generate display code to select whether to display the detected model instances in a loop available for shape based matching and correlation based matching a check box Generate affine transformation code to generate code for an affine transformation that can be used for Alignment in the code of the Matching Assistant which is useful if the following image pro cessing step is not invariant against rotation e g OCR a check box Generate rectification code that generates code for rectifying the image for detected models which may be necessary if an object then appears distorted due
125. the dialog Test Images page 281 in the tab Usage e Check the box Always Find page 282 e Step through the test images page 282 to determine the images where the matching fails e If an object is not found check whether one of the following situations causes your problem e Is the object crossing the image border i e does it lie partially outside the test image Solution for shape based matching By default the objects must lie completely within the test image in order to be found For shape based matching his behavior can be changed in the dialog Advanced Use Parameters page 285 in the tab Usage via the parameter Shape models may cross the image border page 288 e Is the Matching Assistant too greedy Solution for shape based matching and de formable matching By default the Matching Assistant uses a fast search heuristic which might overlook an object Therefore try reducing the corresponding parameter Greediness page 286 in the dialog Advanced Use Parameters page 285 manually or automatically via the menu item Inspect gt Optimize Recognition Speed page 289 284 HDevelop Assistants e Is the object partially occluded Solution for shape based matching deformable match ing correlation based matching and descriptor based matching If the object is to be recognized in this state nevertheless try reducing the parameter Minimum Score in the dialog Standard Use Parameters in the tab Usage manually or
126. the first calibration image is used as the reference image However you can choose any other image of the calibration sequence Standard Lenses A standard lens is similar to the one in the human eye It performs a perspective projection hence objects become smaller in the image the further they are away Telecentric Lenses Telecentric lenses perform a parallel projection Therfore objects have the same size in the image independent of their distance to a camera This means that they can lie in different planes only the orientation of the planes relative to the camera must be identical User Defined Calibration The setup step Calibration Task provides a User Defined Calibration which enables you to perform calibrations with special setups or re use parameters from previous calibrations World Coordinates Measurements and XLD contours can after finishing the calibration be trans formed into 3D world coordinates meaning the coordinates of the world e g in millimeters as opposed to those of an image in pixels Example code is available from the Code Generation tab under Sample Usage page 246 Quality Issues A high quality of the calibration images is essential not only for the calibration itself but for the quality of the calibration results Examples for bad image quality are overexposure of the calibration plate bad mark contrast or very small mark size These quality issues are listed under Quality Issues page 239 on the Calib
127. the last image are displayed in the status bar of the window Tick ing this check box causes the frame rate frames per second to be displayed in live mode Show Min Mean Max If selected the image acquisition statistics are also displayed in the status bar of the window This way you can watch the acquisition statistics in any tab card of the assistant 7 1 5 Tab Code Generation Synopsis Preview generate HDevelop program lines The settings made in the tab cards Source Connection and Parameters can be distilled to program lines that perform the desired image acquisition in your current program The fields in this tab card specify the code generation details You can preview the code lines in the panel Code Preview This panel can be toggled between hidden and displayed state by clicking the button next to the panel label Acquisition The settings of this section are available if images are acquired from an image acquisition interface Control Flow The initialization code for the selected image acquisition interface is always generated setting Initialize Only It opens a connection to the specified image acquisition device and sets all changed parameters You can also generate code to acquire a single image setting Acquire Single Image or to acquire images in a loop setting Acquire Images in Loop Acquisition Mode You can switch between synchronous and asynchronous acquisition The latter runs in the background and is recommen
128. the same constant as 55 Examples for tuples are 4711 0 815 Text 16 100 0 100 0 200 0 200 0 FileName Extension 4711 0 815 Hugo Constant Meaning Value H_MSG_TRUE No error for tests true H_MSG_FALSE For tests false H_MSG_VOID No result could be computed H_MSG_FAIL Operator did not succeed a A WwW Table 8 2 Return values for operators 8 3 Variables 341 8 3 Variables Names of variables are built up as usual by composing letters digits and the underscore _ The max imum length of a variable name is limited to 256 characters The kind of a variable iconic or control variable depends on its position in the parameter list in which the variable identifier is used for the first time see also section 8 1 on page 337 The kind of the variable is determined during the input of the Operator parameters whenever a new identifier appears a new variable with the same identifier is cre ated Control and iconic variables must have different names The value of a variable iconic or control is undefined until the first assignment defines it the variable has not been instantiated yet A read access to an undefined variable leads to a runtime error Variable lt x gt not instantiated HDevelop provides a pre defined variable named _ single underscore You can use this variable for output control parameters whose value you are not interested in Please note that it is not allowed to
129. the score of the result that can be viewed in the Results tab For more information on how to use the word processing parameters please refer to the reference docu mentation of the operators do_ocr_word_ 7 5 5 Results 327 7 5 5 2 Feature Selection You can select one or more of the following features depending on whether you have enabled Word Processing or not The results for this feature are then displayed in the Results section Without word processing page 326 you can enable e Symbol to view the class determined for the symbol e Confidence to see with which confidence the class of the symbol was determined and e Alternatives to view which classes best match the symbol With word processing page 326 enabled you can select e Word to display the text that was read including corrections e Uncorrected Word to see the text that was read without corrections and e Score to see how well the uncorrected text matched the expected format on a scale from 0 to 1 0 where 0 is failure to correct and 1 is a match without corrections 7 5 5 3 Display Parameters To adapt the visualization several display parameters can be adjusted The two combo boxes Symbol Color and Text Color let you select colors for text visualization Via Symbol Color a color or color scheme that will be used to mark the extracted characters can be selected Text Color on the other hand lets you choose the color of the text that is read Use the
130. the settings are lost also for the current HDevelop session Exit Assistant When you exit the OCR Assistant with the menu item File gt Exit Assistant the assistant s dialog 1s closed and the current settings are lost unless you have stored them via the menu item File gt Save Current Assistant Settings page 331 If you want to close the dialog but keep its settings for the current HDevelop session you should use the menu item Close Dialog page 331 instead 7 5 7 2 The Menu OCR Via the menu OCR you can e draw an axis aligned rectangle e draw a rotated rectangle e browse training files page 215 e train a classifier e delete a selected ROI items e delete all ROIs e load a ROI from file and e save a ROI to file Draw Axis aligned or Rotated Rectangle To create either an axis aligned or a rotated rectancle select the menu items OCR gt Draw Axis aligned Rectangle or Draw Rotated Rectangle also accessible as tool bar button respectively For more information about how to draw a rectangular ROL please refer to the section Create ROI page 315 You can also check the ROI data via the button View ROI Data in the Region Of Interest section on the Setup page 314 tab read more about ROI data in the section Create ROI page 315 Train Now Train a classifier for OCR once you have loaded training data via the menu item Train Now or the corresponding button on the OCR Classifie
131. though the camera model Area Scan Division typically returns good results for your appli cation you can improve the accuracy and lower the error rate by using the Area Scan Polynomial camera model We therefore recommend for you to use the Area Scan Polynomial model if the Mean Error on the Results page 244 tab under Calibration Status page 244 is too high If you decide for the Area Scan Polynomial model it is especially important that you thoroughly cover the field of view with calibration plate images and do not leave out the edges Note that a higher Mean Error might be caused by inappropriate calibration images Set Parameters for Full Calibration If you choose a full calibration for an area scan camera you must specify approximate values for Cell Width Sx Cell Height Sy and Focal Length Please have a look at the data sheet of your camera for suitable values Information about the Focal Length can be found on the lens itself If your lens is telecentric choose Telecentric and the Focal Length will be grayed out If you have a line scan camera you must additionally specify approximate values for the motion param eters Motion x Vx Motion y Vy and Motion z Vz Set Parameters for User Defined Calibration In the user defined mode for the area scan camera division you can also choose Center Column Cx Center Row Cy and Kappa The area scan camera polynomial model al lows you to also choose the l
132. to detect the right edges If you want to learn more about fuzzy measuring please refer to the Solution Guide HI on 1D Measuring All different fuzzy features are explained in the section Features that Can Be Used to Control the Selection of Edges and Edge Pairs In order to use the fuzzy measuring function of the Measure Assistant you first have to enable it by activating the Use Fuzzy Measure Advanced checkbox on top of the Fuzzy tab You can then proceed to select the following fuzzy membership criteria These options apply to both edges and edge pairs e Fuzzy Contrast evaluates the amplitude of the edges and e Fuzzy Edge Position lets you choose good positions When working with edge pairs additionally the following criteria can be activated e Fuzzy Pair Center Position chooses edge pairs with a center of a certain position e Fuzzy Pair Width page 304 chooses pairs of a certain width e Fuzzy Pair Gray Mean page 304 selects pairs of a certain mean gray value Fuzzy Threshold and Reference Pair Width are two general settings that can be specified and will then be applied for all activated criteria Both settings are grayed out until at least one criterion is activated The Fuzzy Threshold is a value between 0 1 and 1 that selects the minimum fuzzy score Each active fuzzy set i e the values added to a fuzzy membership criterion after enabling it will be evaluated The final Fuzzy Score is the geometric mean of the
133. two buttons become available to select an image file or an image directory respectively The File interface also supports AVI files or sequence files seq The latter are special to HALCON they contain a list of image file names that will be loaded in succession Specify the desired connection parameters and click Connect to establish or update the connection to the actual device The connection status can also be toggled in the tool bar see figure 3 4 on page 26 You can grab single images with the button Snap or switch to continuous grabbing mode using the button Live Live mode can be stopped by clicking the same button again which is now labeled Stop Clicking the button Detect attempts to re detect valid parameters for the currently selected image ac quisition interface Usually this is done automatically when the interface is selected from the list on the tab card Source The button Reset A11 sets all connection parameters back to their default values c 2 a 5 y lt o a 30 Acquiring Images with HDevelop Set Device Parameters The tab card Parameters contains a list of parameters specific to the selected device It becomes available once the connection to the device has been activated See figure 3 8 for an example parameter list Please refer to the HTML page of the selected interface for detailed information You can click the help button of the assistant to get to the corresponding page automa
134. use the library tag MVTec Standard Procedures Chapters The text fields next to Chapters can be used to specify chapter and section so that your procedures can be grouped thematically in the list at the bottom of the menus Menu Procedures and Menu Operators 6 4 8 Providing Procedure Documentation 159 Select Procedure dev_open_window_fit_image xX Edit Procedure Interfaces dev_open_window_fit_image General General Parameter la Language Settings Parameters lia Documentation English en_US v Basics Example Suggestions Advanced Library MVTec Standard Procedures v Chapters Develop X bd Short Description Open a new graphics window that preserves the aspect ratio of the given image Detailed Description This procedure opens a new graphics window with a given minimum and maximum extent such that it preserves the aspect ratio of the given image The position of the new graphics window is given by the parameters Row and Column which define the position of the upper left corner of the graphics window m The size of the new graphics window is determined such that the limits given in WidthLimit and HeightLimit are fulfilled and that the aspect ratio of the given image is preserved To restrict only the maximum size of the new graphics window only one value must be passed in WidthLimit and HeightLimit respectively To restrict both the minimum
135. variable after exiting the loop In the program ming languages it has the value with which the condition becomes false for the first time In HDevelop it contains the end value which was calculated when the loop was entered Looking at the mentioned points we recommend to program according to the following rules 1 Don t modify the loop variable or the step value inside the loop If you need this behavior use the while loop 2 Don t use the loop variable after the loop 9 6 5 Protected Procedures 395 9 6 5 Protected Procedures As described for the different programming languages HDevelop procedures are exported automatically to procedures or subroutines of the selected programming language This does not hold for the protected procedures described in section 5 6 on page 49 These procedures are protected by a password so that they cannot be viewed and modified by unauthorized users Thus as long as they are locked by the password they can not be exported to any programming language 9 6 6 System Parameters You should know that HDevelop performs some changes of system parameters of HALCON by calling the operator set_system see the reference manual This might cause the exported program not to produce identical output If such a problem arises you may query the system parameters by means of get_system in HDevelop after or while running the original HDevelop version of the program Depending to the problem you can now m
136. with the program execution click Execute gt Run again until the end of the program is reached e Click Reset Program Execution to reset the program to its initial state see figure 2 5 e Using the button Step Over you can execute the program line by line and inspect the immediate effect of each instruction 2 2 Running Example Programs 21 Run Step Over Stop Reset Program Execution gt b ieie PEE Figure 2 5 The basic execution buttons 22 Getting Started Acquiring Images with HDevelop 23 Chapter 3 Acquiring Images with HDevelop Image acquisition is crucial for machine vision applications It will usually be an early if not the first step in your programming projects This chapter explores the different ways of image acquisition in HDevelop 3 1 Reading Images From Files Especially in the prototyping phase you often have a set of sample image files to work from HDevelop or rather the underlying HALCON library supports a wealth of image formats that can be loaded directly see read_image in the Reference Manual Drag and Drop The easiest way to read an image is to simply drag it from a file browser to the HDevelop window and drop it there When the file is dropped HDevelop opens the dialog Read Image see figure 3 1 la W Read Image File Name C Program Files MVTec HALCON images rings_and_nuts png y Ok Variable Name RingsAndNuts Image Info Width 640 Height
137. you should set the starting angle to 5 and the angle extent to 10 The Model Parameter Angle Extent Shape based Matching Correlation Based Matching De formable Matching With the parameter Angle Extent you can specify how much the object is allowed to rotate unit With another parameter you can specify the starting angle of this allowed range Note that the range of rotation is defined relative to the model image i e a starting angle of 0 corresponds to the orientation the object has in the model image Therefore to allow rotations up to 5 e g you should set the starting angle to 5 and the angle extent to 10 We recommend to limit the allowed range of rotation as much as possible in order to speed up the search process and to minimize the required memory If the loaded test images page 281 show the object in its extreme orientations you can let the Matching Assistant determine the range of rotation i e the Pose Bounds page 291 by pressing the Run button of the tab Inspect and viewing the result in the Statistics output of the same tab Furthermore you must limit the allowed range if the object is almost symmetrical Otherwise the search process will find multiple almost equally good matches on the same object at different angles which match at which angle is returned as the best can therefore jump from image to image The suitable range of rotation depends on the symmetry For a cross shaped or sq
138. 00 636 Mean 181 178 Deviation 68 6157 Figure 6 81 The Line Profile Window When opening the line profile without using the Measure Assistant nothing is displayed in the line profile until an ROI is drawn in the graphics window using the corresponding buttons in the line profile window There are various options for linking the line profile to different windows e Make another graphics window active select another window ID in the Input drop down menu or display another image in the active graphics window Whenever you do so the line profile of 6 13 1 ROI Menu of the Line Profile Window 211 the ROI in this image is computed and visualized and the tool stores the graphics window from which the image was sent the originating window e A Measure Assistant can be selected as data source by activating the checkbox Measure Assistant under Input within the line profile window and choosing the correct assistant from the drop down menu if several assistants are open at the same time e The line profile can be opened from the Measure Assistant window by clicking on the View Line Profile button on the Edges tab 6 13 1 ROI Menu of the Line Profile Window If the Measure Assistant page 293 is not selected as source of an ROI a new ROI can be created and edited using the ROI menu buttons above the line profile display Those buttons allow to draw either a linear or a circular ROI delete all ROIs or view the ROI shape Once a
139. 1 false default NickName 0 1 AcqHandle grab_image_start AcqHandle 1 while true grab_image_async Image AcqHandle 1 Do something endwhile close_framegrabber AcqHandle 3 3 3 Modifying the Generated Code After the generated code has been inserted into the program window HDevelop internally keeps the code linked to the corresponding assistant This link is kept until the assistant is quit using the menu entry File gt Exit Assistant If you close the assistant using the menu entry File gt Close Dialog or using the close icon of the window the assistant can be restored from the top of the menu Assistants You can change the settings inside the assistant and update the generated code accordingly The code preview will show you exactly how the generated code lines will be updated Furthermore you can delete the generated code lines or release them When code lines are released the internal links between the assistant and those lines is cut off Afterwards the same assistant can generate additional code at a different place in the current program Programming HDevelop 33 Chapter 4 Programming HDevelop This chapter explains how to use HDevelop to develop your own machine vision applications It is meant to be actively followed in a running instance of HDevelop In the following it is assumed that the preferences of HDevelop are set to the default values This is always the case after a fresh installation
140. 1 Is 10s wait_seconds 20 10s 20s 6 2 3 Menu Execute 97 6 2 3 Menu Execute In this menu item you find all necessary functions to execute an HDevelop program In HDevelop program execution is always continued at the top most procedure call which in most cases corresponds to the current procedure call The procedure body displayed in the program window belongs to the current procedure 6 2 3 1 Run Synopsis Execute the current program from the PC Shortcut The program line marked by the PC is the first line that is executed All following program lines are going to be performed until the end of the current program After the execution is finished the main procedure becomes the current procedure Note that a breakpoint stop instruction or runtime error may interrupt the execution of your program If the HDevelop program waits for the user to draw something in the graphics window a notification message is printed in the status bar The program halts until the user finishes the draw operation and confirms this by clicking the right mouse button During the execution of operator or procedure calls the following special behavior occurs e You may initiate limited activities For example if you double click variables in the variable window page 171 they will be visualized you may modify parameters for the graphics windows as described in the Menu Visualization you may even modify the current procedure body Note that all us
141. 100 5964 A ecos ano ja y get rid of this region 5 Histogram Options 5 Output visualize feature selection Color Draw Line Width ES CLIO Statistics Figure 4 9 Selecting regions with a similar area in the feature histogram 4 13 Looping Over the Results 43 variable View main oo Iconic Variables IR Variable inspect Phi Area Row Column eco nC fa Phi Area Row Column 4 4876 126 439 182 198 las IS Ss 2 SAVAY AAT AAN 1 2 4989 5091 167 206 438 396 SIs ES SES 2 0 671646 5172 197 761 621 874 Gp Region a RA 3 0 36226 5212 271 818 238 464 l 4 1 98853 4804 370 505 533 539 AZ 5 1 86347 4767 399 981 339 445 6 1 98853 gt 6 1 47322 4916 450 672 667 683 Copy Ctrl C 1916 5309 3 7 0 117317 5309 428 429 131 406 Clear Variable 370 505 8 0 148027 5964 503 389 461 329 4 533 539 3 9 0 295232 5416 544 808 262 795 Add to User Tab Find Variable 1 71117 5011 664 751 427 176 11 2 55278 5265 660 569 590 18 t o Sort by Name aL tuto JW User TV Gt y sort by occurrence Types real integer real real Figure 4 10 Inspecting control variables 4 13 Looping Over the Results Being an integrated development environment HDevelop provides features found in other programming languages as well Variable assignment expressions and control flow Variable assignment and control fl
142. 104 Step Forward 99 Step Into 99 Index 415 Step Out 99 Step Over 98 Stop 100 Stop after Procedure 100 Exit Assistant 224 250 264 309 332 expected gray value range 301 expert 228 exponential functions 360 Export 60 77 136 UTF 8 encoding 62 external procedure modified 58 extract edges 296 false 405 Feature Histogram 117 137 Feature Inspection 117 137 feature processing 299 feature selection 298 327 Fern Depth 275 Fern Number 275 Field 226 File 188 249 262 307 330 menu 54 file history 55 File menu Browse HDevelop Program Examples 55 Cleanup 63 Close all Procedures 57 Close Procedure 57 Export 60 Insert All 57 Insert Mainbody 58 Insert Procedures 57 Insert Program 57 New Program 54 Open Procedure for Editing 56 Open Program 55 Print 65 Properties 64 Quit 66 Read Image 62 Recent Programs 56 Save 58 Save A11 59 Save Procedure As 59 Save Program As 58 file types 46 Find 196 Find Again 72 Find Model 282 Find Variable 175 180 Find Replace 69 136 Font 79 for loop 366 for 394 405 Forward 196 Forward in History 139 frames per second Image Acquisition Assistant 229 Full Screen 133 Full Screen 133 Full Text Editor 80 full text editor 142 fuzzy contrast 303 fuzzy edge position 303 fuzzy measuring 301 fuzzy pair center position 303 fuzzy pair gray mean 304 fuzzy pair wid
143. 4 2 Clear Graphics Window Synopsis Clear active graphics window Shortcut Ctrl Shift G Del or Ctrl Shift G Ctrl Shift Del See also dev_clear_window The history previously displayed objects of the window is also cleared 6 2 4 3 Close Graphics Window Synopsis Close active graphics window Shortcut Ctrl Shift G Q or Ctrl Shift G Ctrl Shift Q See also dev_close_window 6 2 4 4 Display Synopsis Select iconic variable to be displayed in active graphics window See also dev_display This submenu lists all instantiated iconic variables for quick selection The submenu is split in three parts from top to bottom images regions and XLDs 6 2 4 5 Window Size Synopsis Set window size of active graphics window See also dev_set_window_extents This submenu offers a list of fixed percentages to resize the graphics window with respect to the size of the most recently displayed image The entries Double and Half change the size of the graphics window to half and double its current window size respectively independent of the size of the displayed image The entry Aspect Ratio 1 1 scales down the current window size so that the aspect ratio of the displayed image is maintained 6 2 4 6 Image Size Synopsis Zoom image size of active graphics window The entry Fit Window scales the image to completely fill the graphics window A list of fixed percentages scales the image with respect
144. 44 Procedure parameters A11 In All input variables inside the selected lines are suggested as input parameters in the procedure A11 Out All output variables inside the selected lines are suggested as output parameters of the proce dure The classification of variables in the selected program lines is performed separately for iconic and control variables If a variable is an input as well as an output variable it is assigned to the first category i e the corre sponding procedure parameter becomes an input parameter If according to the above rules a variable name would be suggested as an input as well as an output parameter it becomes an input parameter of the procedure In addition an output parameter with the variable name extended by Out is created o D 2 Q a 0 As an illustration the following program lines are selected for a new procedure threshold Image Region 128 255 connection Region ConnectedRegions 154 Graphical User Interface Then based on the selection scheme A11 In A11 Out the procedure body will read copy_obj Region RegionOut 1 1 threshold Image Region0ut 128 255 connection Region0ut ConnectedRegions To the right of the parameter list the following buttons are provided Reset If you are creating a new procedure clicking this button removes all entered parameters If you are editing an existing procedure the original interface is restored
145. 45243 2 Mean 23 7757 308 288 211 417 Deviation 1 1159 19 6102 67 7589 Types integer real real Number 214 214 214 Semantics integer point y point x variable names m list of tuple values _ statistics select from context menu Figure 6 62 Control variable inspection 6 6 2 Control Variables 179 3 rows 3 columns Figure 6 63 Inspection of a matrix control variable 1 2 22 222 3 Do not forget to include the original value 2 if you want to extend the tuple To delete a variable value enter an empty tuple Variable Inspect 1 2 gt 11 3 results in the following tuple 1 Inspecting Matrix Variables Control variables that reference a matrix are displayed in a tabular format as displayed in figure 6 63 Inspecting Pose Variables Control variables that reference a pose are displayed in a tabular format as displayed in figure 6 64 Inspecting Image Acquisition Device Handles For an image acquisition device handle a dialog representing basic image acquisition device parameters is opened Here you find the size name device port and other features of the image acquisition device The toggle button Online allows to grab images continuously and to display them in the active graphics window Multiple online inspections from different image acquisition devices at the same time are also supported by opening additional graphics windows before clicking the corresponding button On
146. 48 Se be eee eae es 350 5 2 BilOperauons socorro eS ee es 351 8 9 Sirning Operations 264656 i etess rak Teher ee A es 352 8 3 9 Comparison Operations 2 2er e RS 357 8 5 10 Elementwise Comparison Operations e e e 357 8 5 1 Boolean Operations nc a eS eR Se a gS 359 8212 Trigonomeme PUAGIONE s s c oe aven a Ve ee Ae 359 313 Exponential Funcions lt a wee Gee be eS Se ae eed 360 32 14 Numerical Funcuans omo ee a nda AAA 360 8 5 15 Miscellaneous Pumctions 5 4 io do Se Aa 362 33 10 Operation Precedence sor a A e TN 363 sO Korned WOR 6 6 ee ek be thee teehee dt i eh obe babs wR SE Ye Sh 363 3 2 Control Flow Operators o oa kb e e a eee ae ee a i 363 39 Emor Handing ooo con CRE EGA ee eee ES 369 8 8 1 Tracking the Return Value of Operator Calls o 370 8 9 2 Erception Handling c sa cess eere RE ee ee ee es 370 3 9 Summary of HDevelop operations s scs 02 8 a scream 372 3 10 HDevelop Ermar Cades ociosos ee ara aa E 376 9 Code Export 381 21 Code Generation EE E 2 oe NN 381 LLLI Basie Sps csa aa eh a aS aA a E Bas 382 912 Optimizado cios ee bee eee ERA wee EES 383 9 13 Used Classes oa o k e ee GR Rd Boe kod ol bk bo Beeb 383 9 1 4 Limitations and Troubleshooting 2 000 383 9 2 Code Generation for C HALCON NET 2 200000 eee eee 384 OO Bast Seps o be s en hee Pe ee be eee Rae bee Pad es 384 G22 Program SOME 2 2 26 see eh ee SAE BAS ESS ee
147. 480 Color type byte Channel number 1 10 o O mem 9 Insert Cursor Program Counter Cox Figure 3 1 After dragging an image file onto the HDevelop window c 2 a 5 y lt o a 24 Acquiring Images with HDevelop This dialog displays the full path of the image and automatically proposes a variable name derived from the file name This name can be edited or another iconic variable name from the current program may be selected from the drop down list Furthermore a preview of the image and basic image properties are displayed in the dialog width height color type and number of channels If you picked the wrong image you can select another one from the same directory by pressing the button next to the file name This will open a file browser native to the operating system i e on Windows you may be able to switch to thumbnail view in this dialog When another image is selected the dialog is updated accordingly When you click the button OK the instruction read_image is added to the current program With the setting of Insert Position you determine where the instruction will be put At the IC or the PC If you changed your mind about reading the selected image at all click Cancel Drag and Drop of Multiple Images You can also drag multiple images or directories containing multiple images to HDevelop HDevelop will then open an image acquisition assistant with the images preselected See
148. 5 Line Profile 117 210 Line Width 107 Lut 108 New Zoom Window 117 OCR Training File Browser 118 215 Open Graphics Window 105 Paint 108 Position Precision 116 Reset Parameters 114 Save Window 118 Set Parameters 108 Shape 108 Update Window 116 Window Size 106 Zoom Window 116 197 Volatile 228 Warning 160 warning 222 while loop 365 while 394 405 Window Cascade Windows 132 menu 128 Open Graphics Window 128 Open Operator Window 129 Open Output Console 129 Open Program Line View 131 Open Program Listing 128 Open Variable Window 128 Organize Windows 132 Window Size 106 window title 51 Windows 382 392 word processing 326 X 226 XLD 406 colors 107 Index 423 line width 107 Y 226 Zoom 197 Zoom Window 116 137
149. 5 6 14 2 Steps for working with the OCR Training File Browser 217 6 14 3 Actions within the Training File Browser o 217 GUS DIGS os cms a E DA E E BR A E RO 221 GHJ Pile Sekcion alos 42 44 ca E a it a eg Se 221 6 182 Unsaved Changes pe cosida da a dd 222 HDevelop Assistants 223 7 1 Image Acquisition Assistant lt s s cessere ceske etta kett ee ee 225 LLI ROCCE eeg eaa A A a a 225 FAZ Tab CommechidA sn bei eee ke A Ab e R eS 226 L3 Tab Parsmetere orana die nipa a a a e EAE ew eS 227 Tle Web Inpec oo kp oe ke Ee ee ee E e RA 228 TAI Thh Code Generation lt 6 a e EA we ane SE Be ae A 229 FAG Menu Bar os oa ee eR GE RRR ESR SRE eR EE GES 230 2 Cabhpraton ASSISE cosida Hee ee bd He eA 230 7 2 1 Introducing the Calibration Assistant of HDevelop 230 7 2 2 How to Calibrate with the Calibration Assistant 233 7 23 Results of the Calibration s ss sonram E ES ee 244 Tat Generating Code o os e sts esoe ee ea A 245 7 2 5 Calibration Assistant Reference o o e eti 248 Ta Matching Assistant oo a A A ae ere 252 7 3 1 Introducing the Matching Assistant of HDevelop 252 7 3 2 How to Use the Matching Assistant of HDevelop 254 7 33 Matching Assistant Reference 2 i we be ee eS ES ee es 261 T l Mesme ASISTE pe 5 cS ee ME EHS OO RE ER ER eS 293 7 4 1 Introducing the Measure Assistant of HDevelop
150. 636ms 2 636ms 5 dev_dose_window 1 6 917ms 6 917ms 6 917ms 6 917ms 6 dev_display 2 2588ms 1 294ms 0 732ms 1 856ms 7 dev_open_window 1 25 432ms 25 432ms 25 432ms 25 432ms 8 endfor 0 0 000ms 0 000ms 0 000ms 0 000ms 9 for 1 0 057ms 0 057ms 0 057ms 0 057ms 10 main 1 218 570 ms 218 570 ms 218 570ms 218 570 ms 11 read_image 1 113 323ms 113 323ms 113 323ms 113 323 ms 12 reduce_domain 2 3 152ms 1 576ms 1 012ms 2 140ms 13 select_shape_std 1 0 284ms 0 284ms 0 284ms 0 284ms 14 stop O 0 000ms 0 000ms 0 000ms 0 000ms 15 threshold 2 1265ms 0 632ms 0 525ms 0 740 ms 1 5 606ms 5 606ms 5 606ms 5 606ms 16 trans_from_rgb Figure 6 56 Runtime statistics 6 5 Operator Window This window is used to edit and display an operator or procedure call with all its parameters Here you will obtain information about the number of the parameters of the operator or procedure the parameter types and parameter values You can modify the parameter values according to your image processing tasks For this you may use the values proposed by HDevelop or specify your own values The operator window consists of the following three parts e At the top you find the operator name field with which you can select operators or procedures e The large area below the operator name field is called the parameter display it is used to edit the parameters of an operator or procedure e The row of buttons at the bottom allows to control the parameter display 6 5
151. 80 o o x o Smoothing Sigma page 279 o o xX o Alpha page 279 o o X o Smoothing Mask Size page 279 o o x o Specifying Standard Model Parameters Via the menu item Parameters gt Standard Model Parameters the tab Parameters is opened and you can specify basic parameters for the model which describe the appearance of the object to recognize e g the contrast of significant points or the allowed range of rotation By default these parameters are set to values which work well for most tasks by modifying them you can optimize the model for your application and speed up the search process For shape based matching the following parameters can be specified e the Contrast which points must have in order to be included in the model e theMin Component Size page 272 of model components e the number of Pyramid Levels page 272 on which the model is created e the Starting Angle page 273 of the allowed range of rotation e the allowed range of rotation Angle Extent page 273 and 270 HDevelop Assistants e the scale range page 273 For correlation based matching the following parameters can be specified e the number of Pyramid Levels page 272 on which the model is created e the Starting Angle page 273 of the allowed range of rotation and e the allowed range of rotation Angle Extent page 273 For deformable matching the following parameters can be specified e the Contrast which points must have in or
152. 88 Pixel Column 1 326 066 Pixel Row2 284 229 Pixel Column2 398 269 Pixel Figure 6 72 An ROI made of two rectangles Delete Elements From the Figure To delete the selected element press Det or click All figures can be deleted by clicking You can also add additional geometric elements to the figure by clicking the corresponding icons on the tool bar Add Additional Figures to the Tool Box As already mentioned the tool box supports the creation of multiple figures Click Fl to add a new empty figure to the tool box When you subsequently draw new elements they will be added to the new figure Multiple figures are converted to an object tuple when generating code Mode Selection The tool box supports three modes of operation The modes can be selected from the drop down button of the tool bar or from the menu ROI Type E ROD Select this mode if you want to generate a pixel based region of interest The ROI consists of geometric elements The faces defined by these elements are connected by set operations see below Furthermore for each element a masking mode may be toggled independently by clicking the corresponding icon in the tool box me The default masking mode selects the inside of the element e g the inner area of a circle o D 2 Q a 0 190 Graphical User Interface The complement masking mode Ed selects the outside of the element e g everything out
153. 9 categories example programs 55 Category 228 channel gray value 116 197 channel number 198 channel selection gray histogram 203 Chapters 158 check box Always Find 282 check box Pregenerate Shape Model 278 check box Shape models may cross the image border 288 choose calibration source 267 choose good values 302 Cleanup 63 176 181 Clear Display 175 Clear All Breakpoints 101 149 Clear Graphics Window 106 Clear Variable 175 180 click 13 clipboard 67 Close all Procedures 57 Close Assistant 249 263 Close Dialog 224 309 331 Close Graphics Window 106 Close Procedure 57 Code Generation 250 291 300 328 Image Acquisition Assistant 229 Code Generation 310 333 Code generation 381 code generation Index 413 file 26 image acquisition interface 31 code generation preview 250 293 311 333 code lines delete 250 293 311 333 code lines insert 250 293 310 333 code lines release 250 293 310 333 code options 292 Code Preview 229 code preview 300 329 code variables 292 Color 107 204 color graphics window 107 Color Space 226 Colored 107 Colors 79 column 53 Column Scale Step 277 COM 388 comment 68 123 393 393 393 HF 393 HF 393 comparison operations 357 Complexity 160 Connect 227 Connection 204 Image Acquisition Assistant 226 Connection Handle 229 Context Help 134 continuation line 142 Contrast 270 Control 121 control da
154. ALCON Reference Manual is available with extensive documentation of each operator An other possibility of requesting information about the current operator is pressing the button Help inside the operator window see section Operator Window on page 167 The help window is described in section Help Window on page 192 6 2 10 2 Context Help Synopsis Provide context sensitive online help Shortcut Based on the currently focused window or tab card the corresponding page in the online help is openend 6 2 10 3 HALCON Reference Synopsis Display the HALCON Reference Manual in the online help window Shortcut Ctrl Shift H R Or Ctrl Shift H Ctrl Shife R 6 2 10 4 HDevelop User s Guide Synopsis Display the HDevelop User s Guide in the online help window Shortcut Ctri Shift H U Or Ctrl Shift H Ctrl Shift U 6 2 10 5 HDevelop Language Synopsis Display the HDevelop Language chapter in the online help window Shortcut Ctrl Shift H L Or Ctrl Shift H Ctrl Shift L 6 2 10 Menu Help 135 6 2 10 6 Search Documentation Synopsis Open the online help window and show the search tab to enter search queries Shortcut ctrl Shift H F Or Ctrl Shift H Ctrl Shift F The online help provides an integrated search engine You can enter search queries there and search the HALCON documentation suite The search syntax is described in section Help Window on pa
155. ALCON startup error HALCON operator error Format error file is not a valid HDevelop program or procedure File is no HDevelop program or has the wrong version Protected procedure could not be decompressed Protected procedure could not be compressed and encrypted for saving The program was modified inconsistently outside HDevelop The program was modified outside HDevelop inconsistent procedure lines The program was modified outside HDevelop unmatched control statements renaming of procedure failed Unable to open file Unable to read from file Unable to write to file Unable to rename file Unable to open file invalid file name Old program version Not supported for hdevelop_demo Wrong program check sum HDevelop DEMO cannot open the program or proce dure if it was changed outside HDevelop This is not allowed for HDevelop DEMO Program was saved without a check sum This is not supported by HDevelop DEMO Inserting procedures is not supported in hdevelop_demo Iconic variable is not instantiated Control variable is not instantiated no value Wrong number of control values Wrong value type of control parameter 8 10 HDevelop Error Codes 377 21064 21065 21066 21067 21068 21069 21070 21071 21072 21073 21074 21075 21076 21077 21078 21079 21080 21081 21082 21083 21100 21101 21102 21103 21104 21105 21106 21107 21108 21109 21110 Wrong value of control parameter Control parameter does n
156. ALL UPPER CASE for a text containing numbers and upper case letters only 7 5 3 4 Symbol Fragmentation Adjustments in this dialog help distinguish clutter from character fragments Set the Min Fragment Size to define the minimum size of a connected structure that is not regarded as clutter either by entering a value in the text field or using the slider on the right This value can be reset to the default value by clicking on the button on the right side of the slider Symbol Fragmentation also contains two checkboxes that should be deactivated if the settings are not helpful for a special application By default fragments are connected to form characters Border fragments i e fragments extending from outside into the region of interest are eliminated 7 5 3 5 Text Orientation If the orientation of the text is unknown i e it appears in variable orientations during the application activate Line Orientation Select an angle range by adjusting the minimum and maximum angle in degrees to automatically correct for text that is rotated within a given range Note that not only the orientation but also the reading direction is also relevant for setting a value for Text Orientation This is especially important for vertical text If text may appear slanted activate Symbol Slant to automatically correct for text that is printed in slant or italics Each value can be reset to the default value by clicking on the corresponding buttons on the ri
157. Acquiring Images with HDevelop This chapter explains the fundamental part of machine vision applications how to acquire images Programming HDevelop This chapter explains how to develop applications in HDevelop HDevelop Procedures This chapter introduces the concepts of breaking a large program into small maintainable and reusable units Graphical User Interface This chapter explains the graphical user interface of HDevelop and how to interact with it HDevelop Assistants This chapter describes how to use the machine vision assistants of HDevelop HDevelop Language This chapter explains the syntax and semantics of the language used in HDevelop expressions Code Export This chapter explains the export of a HDevelop program to C C Visual Basic Visual Basic NET or C e Miscellaneous This chapter describes keycodes warning and error windows and provides miscellaneous infor mation Contents 1 Introducing HDevelop LI acts about HDevelop oo ados a a a A L2 HBevelop XL o 64 5 cor e a Ra 13 Terminology amp Usage ne ee oe e 2 Getting Started 2 1 Rumning Hleyelop 2 6225655 po ee pede EY ERR OER EE ee Re eS 2 2 Running Example Programs 2 2 4 5424 8 80 Nd ee Aw ee be be ee ee es 3 Acquiring Images with HDevelop 31 Readine Images From Files e gee Ae ek ee ok Ga edo ee GO Bo eos Sa Viewing Images o e ee he eee ea a Shee ee Gas 3 3 Image Acquisition Assistant gt o c ac ss ceceo rs A pa u pE 3 3 1 A
158. Ally A dim gray A gray gt light gray i yellow medium slate blue d v Update Reset luse settings for new windows Figure 4 6 Changing the display parameters ConnectedRegions The selected region of this inspection window is displayed in the graphics win dow using the current visualization settings Set Draw to margin and Shape to ellipse and select some regions from the list An example is illustrated in figure 4 7 on page 40 For now close the variable inspection window The large number of regions is due to the coarse setting of the bounds of the threshold operator In the following we will use one of HDevelop s visual tools to find more appropriate settings interactively 4 8 Improving the Threshold Using the Gray Histogram Click Visualization Tools gt Gray Histogram to open a tool for the inspection of gray value his tograms One of its uses is to determine threshold bounds visually Because the graphics window cur rently displays only regions the gray histogram is initially empty Double click the Clip icon in the variable window to re display the original image and watch its gray histogram appear Select Threshold in the column Operation of the gray histogram window and click the icon next to Threshold to visualize the operation Now you can try different threshold bounds by altering the values in Min and Max or by dragging the lines in the histogram area see figure 4
159. Assistant dialog discarding the settings Loading Assistant Settings If you have saved the settings of a former Calibration Assistant session you can load them again by the menu item File gt Load Assistant Settings or via the corresponding button of the tool bar Save Current Assistant Settings You can save the current settings of a Calibration Assistant session using the menu item File gt Save Current Assistant Settings or the corresponding button in the tool bar Then you can load them again in a later session Close the Calibration Assistant Dialog When closing the Calibration Assistant dialog with the menu item File gt Close Dialog the current settings are stored for the duration of the current HDevelop session That is as long as you do not exit HDevelop you can again open the Calibration Assistant with the same settings In contrast to this when you exit the Calibration Assistant the settings are lost also for the current HDevelop session 250 HDevelop Assistants Exit the Calibration Assistant When you exit the Calibration Assistant with the menu item File gt Exit Assistant the assistant s dialog is closed and the current settings are lost unless you have stored them via the menu item File gt Save Current Assistant Settings page 263 If you want to close the dialog but keep its settings for the current HDevelop session you should use the menu item Close Di
160. C You can also add or remove break points in the current program in this column These will halt the program execution at user defined places so that intermediate results may be examined The program source can be edited directly in this window provided that the full text editor is en abled see section 6 4 on page 138 When adding new lines or modifying existing lines advanced autocompletion features speed up typing and help keeping the program consistent Program lines can also be modified by double clicking them and editing them in the operator window This is the classical way to edit HDevelop programs It is a more form based approach to program editing Furthermore different parameters can be easily tested in the operator window without changing the program Both the full text editor and the operator window can be used interchangeably for program editing 4 Variable window Program variables can be watched in this window It displays all variables of the current procedure and their current values Iconic variables are displayed as thumbnails whereas control variables are displayed as text The layout of this window can be switched between horizontal and vertical splitting by double clicking the separator You can double click iconic variables to display them in the active graphics window Double clicking control variables opens an inspection window with a nicely formatted list of the current values and statistical data There are many oth
161. Develop Status Bar 236 HDevelop Assistants Figure 7 1 Example for suitable calibration images 5 The contrast between the foreground and the background of the calibration plate 1 e its bright and dark parts respectively should be better than 100 gray values 6 Use an illumination where the calibration plate is represented with homogeneous gray values 7 The images must not be overexposed which means that they should not have a peak at 255 in the histogram You can use the Live mode and run the tests which can be found under Quality Issues to check that no part of the calibration plate is totally white Another option is checking the gray values in the status bar as described above If your image is too bright close the lens aperture a bit more or use an illumination that is less bright If your image is too dark use a brighter illumination or open the lens aperture a bit more until you achieve a satisfying image from which the marks can be segmented easily Then push the Snap button to keep your image 8 In this way cover the whole field of view with multiple images i e position the calibration plate in all areas of the field of view upper left corner upper right corner lower left corner lower right corner and image middle Do not forget to also take images right in the corners and along the margins of the field of view 9 Use various orientations of the calibration plate Use at least four images with diff
162. Develop will not be able to access the saved procedure unless the directory is later added to the external procedure locations manually This is one method to make an internal procedure external If you do not change the name of the procedure the internal procedure will conceal the external procedure W HDevelop Directory not in List y The directory H project procedures J selected for saving the procedure is not in the list of external procedure directories Without adding the directory to that list the saved procedure cannot be used and will immediatly be removed from the list of external procedures Do you want to add the directory to the list of external procedure paths Yes No Cancel Figure 6 4 Adding a new directory to the list of external procedure directories e HDevelop local procedure hdev or dev If this file type is selected an empty main procedure is added to the target file and the procedure is added to the program as a local procedure This menu item is disabled if the main procedure is selected in the program window 6 2 1 12 Save All Synopsis Save the current program and all modified external procedures Shortcut If no name has been specified for the current program yet the behavior is similar to that of Save Program As In addition all modified external procedures marked with an asterisk in the pro gram window s combo box are saved o D 2
163. HALCON the Power of Machine Vision HDevelop User s Guide Y AA Y Y A A gt LD j ay EC M f MVTec Software GmbH Building Vision for Business HDevelop the interactive development environment of HALCON Version 11 0 All rights reserved No part of this publication may be reproduced stored in a retrieval system or transmitted in any form or by any means electronic mechanical photocopying recording or otherwise without prior written permission of the publisher Edition 1 July 1997 Edition 2 November 1997 Edition 3 March 1998 HALCON 5 1 Edition 4 April 1999 HALCON 5 2 Edition 5 October 2000 HALCON 6 0 Edition 6 June 2002 HALCON 6 1 Edition 6a December 2002 HALCON 6 1 1 Edition 7 December 2003 HALCON 7 0 Edition 7a July 2004 HALCON 7 0 1 Edition 8 July 2005 HALCON 7 1 Edition 8a April 2006 HALCON 7 1 1 Edition 8b December 2006 HALCON 7 1 2 Edition 9 June 2007 HALCON 8 0 Edition 9a October 2007 HALCON 8 0 1 Edition 9b April 2008 HALCON 8 0 2 Edition 10 December 2008 HALCON 9 0 Edition 10a June 2009 HALCON 9 0 1 Edition 11 October 2010 HALCON 10 0 Edition lla April 2011 HALCON 10 0 1 Edition 11b November 2011 HALCON 10 0 2 Edition 12 May 2012 HALCON 11 0 EC Copyright 1997 2012 by MVTec Software GmbH M nchen Germany Protected by the following patents US 7 062 093 US 7 239 929 US 7 751 625 US 7 953 290 US 7 953 291 Further patents pending MVTec Software
164. IX to paste text from the clipboard into text fields mouse wheel Most recent three button mice combine the middle mouse button with a scrolling wheel HDevelop supports the mouse wheel in many places The mouse wheel operates the GUI ele ment under the mouse cursor Using the mouse wheel you can for instance quickly scroll large program listings select values from lists or perform continuous zooming of displayed images In general windows that provide a scroll bar can be quickly scrolled with the mouse wheel Further more the values of spinner boxes text fields that expect numerical data can be decremented and incremented with the mouse wheel Keyboard Usage HDevelop is very keyboard friendly Most functions of the graphical user interface that can be operated using the mouse can be accessed from the keyboard as well Many of the most important functions are available through keyboard shortcuts which are worthwhile memorizing When programming with HDevelop keeping both hands on the keyboard can increase the productivity Therefore many naviga tional tasks like selecting parameter fields or selecting values from lists can easily be done using just the keyboard The most common keyboard functions are listed in the section 10 1 on page 397 To make it easier for you to memorize the keyboard shortcuts many of them are introduced by a com mon combination to indicate the context For example many shortcuts related to the graphics window
165. LCON Operators R 1D Measuring Name 2D Metrology e di 3D Matching read_image Read an image with different file formats 3D Object Model 3D Reconstruction Si gn ature Calibration Classification Control Develop a 4 File Description 4 Images deseriali The operator read_image reads the indicated image files from the background read_im read_image Image FileName Figure 4 4 The online help window showing the documentation of the operator read_image tab card Contents presents the hierarchical structure of the documentation The tab card Operators lists all operators for direct access Enter any desired substring into Find to quickly find an operator In the remainder of this chapter try to use the online help as much as possible to get information about the used operators The online help window is described in section 6 8 on page 192 4 5 Add Additional Program Lines Select the clips by thresholding Now we want to separate the clips from the background i e select them They clearly stand out from the background thus a selection based on the gray value is appropriate This operation is known as thresholding Enter threshold into the operator window This is both the full name of an operator and part of other operator names Thus you get a list of matching operators with threshold pre selected when you press Return Press once more to confirm the selected
166. Normally the coordinate system of the graphics window corresponds to the most recently displayed im age which is automatically zoomed so that every pixel of the image is visible The coordinate system can be changed interactively using the tool bar of the graphics window or the menu Menu Visualization gt Set Parameters gt Zoom see section Menu Visualization on page 105 or with the oper ator dev_set_part see section Develop on page 123 Every time an image with another size is displayed the coordinate system is adapted automatically Each window has a history that contains all e objects and e display parameters that have been displayed or changed since the most recent clearing or display of an image This history is used for redrawing the contents of the window The history is limited to a maximum number of 30 redraw actions where one redraw action contains all objects of one displayed variable Other output like text or general graphics like disp_line or disp_circle or iconic data that is dis played using HALCON operators like disp_image or disp_region are not part of the history and are not redrawn Only the object classes image region and XLD that are displayed with the HDevelop operator dev_display or by double clicking on an icon are part of the history You may change the size of the graphics window interactively by gripping the window border with the mouse Then you can resize the window by dragging t
167. Run the project and then press the button Run on the form which will call the exported code Additional information about using the template can be found in the Programmer s Guide section 17 4 1 on page 153 9 3 2 Program Structure If the program has been exported using the option Use Export Template the file created by HDevelop contains a subroutine with the corresponding name for every HDevelop procedure except the main pro cedure which is contained in the subroutine action Otherwise the file is exported as a standalone application Iconic input and output parameters of a procedure are passed as ByVal HObject and ByRef HObject respectively while control input and output parameters are passed as ByVal HTuple and ByRef HTuple respectively The subroutine RunHalcon contains a call to the subroutine action and has a parameter Window which is of type HTuple This is the link to the window on the form to which all output operations are passed In addition another subroutine is created with the name InitHalcon This subroutine applies the same initializations that HDevelop performs Most of the variables iconic as well as control are declared locally inside the corresponding subroutines Iconic variables belong to the class HObject and control variables belong to HTuple Depending on the program additional subroutines and variables are declared 9 3 2 1 Stop The HDevelop operator stop is translated into a subroutine in Visua
168. Save button on the Results tab It can be used in order to create file names into which the calibration results can then be written when choosing the option Calibration Results File 7 2 4 3 Sample Usage Sample Usage shows you what is possible with your calibration data and provides code which you can adapt to your own purposes Choose the action you are interested in and the example code will be inserted into your program You have the choice between e Transform Measurements into World Coordinates e Transform XLD Contours into World Coordinates e Estimate Pose from Single Image and e Rectify Image Once you are finished check the position of the insert cursor and click Insert Code page 250 to insert the code into your HDevelop program 7 2 4 Generating Code 247 Transform Measurements into World Coordinates In the example code the image coordinates of the first two mark center points are transformed into world coordinates and this 3D distance is calculated First the image coordinates of some points of interest lying in the reference plane are obtained Here simply the first two mark center points of the plate are chosen and a line is drawn between the two points for visualization Then image coordinates are converted into world coordinates using HALCON operator image_points_to_world_plane The Z coordinates will be 0 by definition because the measurement plane is the plane with the world coordinate Z 0 on
169. Size Bookmark Print Insert operator into program Syntax Find Next Previous Next Link Next Link Jump to Link Ctrl L Alt Left Alt Right Alt Home Cul D Ctrl Ctrl Ctrl D Ctrl P Alt Return Alt Enter Ctrl F 3 5 5 Ye a hift Tab Return n gt or Display the location of the current page in the tree of the contents tab Go back in the browse history Go forward in the browse history Go to the starting page of the HALCON Reference Manual Increase the font size of the help window Decrease the font size of the help window Add the currently displayed document to the tab card Bookmarks page 195 Open the operating system dependent printer selection dialog to print the cur rently displayed page If the currently displayed document is the reference page of a HALCON operator en ter this operator into the operator window The online pages of the HALCON Ref erence Manual are available for the lan guage interfaces HDevelop C C NET and COM The displayed variant can be se lected through this list box Enter a word or substring to find it in the currently displayed document The first match is highlighted as you type If no match is found the text field blinks shortly You can use the cursor keys down and up to highlight the next match or the previous match respectively Alternatively you can use the following two buttons Hi
170. Tests either to Quick which performs less tests or None which does not perform any tests at all If the defects are too severe e g if the calibration marks or the even the calibration plate are not found the Calibration button will be grayed out making 1t impossible to calibrate unless all images of such poor quality are deleted from the list The test results referring to the calibration plate s tilting may be ignored if later measurements are always conducted in exactly the same plane In this case however the values for the Focal Length and Z are not correct each for itself but only in their combination The reason for this is that neither of these values can be determined for itself which leads to the result that if you get for example a Focal Length that is double the value that it should be Z will be half as high and vice versa Besides the further you place 240 HDevelop Assistants an object above the plane in which you have performed the calibration the less precise the result will be Note that poor image quality leads to poor calibration results and subsequently causes bad or wrong measuring values However acceptable results are usually achieved even with quality warnings in the range of 40 to 70 If necessary check the following tables for suggestions about improving your image quality When trying to improve your image quality do not forget to check other error sources page 239 ATTENTION Remember that once you
171. The documentation may include a detailed description of the functionality of the procedure example code links to other procedures or operators and concise documentation of each parameter In order to manage a large collection of procedures the procedures can be ordered in a hierarchical way i e procedures can be ordered by chapters and sections just like operators See section 6 4 8 on page 158 for details Graphical User Interface 51 Chapter 6 Graphical User Interface This chapter is the reference to the graphical user interface of HDevelop 6 1 Main Window The main window handles HDevelop programs It comprises the following components Window Title The main window of HDevelop is identified by the title HDevelop followed by the name of the current program or unnamed if no file name has been specified yet Unsaved changes in the current program are indicated with a trailing asterisk in the window title Menu The menu at the top provides access to the functionality of HDevelop The menus and their entries are described in the section Menu on page 54 Tool Bar The tool bar icons provide convenient shortcuts for frequently used functions It is described in the section Tool Bar on page 136 o o o d o 2 o a 5 9 52 Graphical User Interface window title menu tool bar K HDevelop unnamed e z File Edit Execute Visualization Pro
172. This number is displayed in the title of the graphics window and can be different in your environment The notation Row Index is another operation of the HDevelop language It provides access to a single value of a tuple to f E E o o fo a 44 Programming HDevelop rn r gt Operator Window Insert for boa Program Editor ole Enter Operator or Procedure for Y Insert endfor automatically E El man A ESE e for read _ image Clip clip HDevelop control statement threshold Clip Region 0 56 connection Region ConnectedRegions Parameters select_shape ConnectedRegions SelectedRegions area El orientation region SelectedRegions Phi area center SelectedRegions Area Row Column Start 0 y number integer 7 for Index 0 to Phij 1 by 1 End Phi 1 v number integer endfor Step 1 v number integer a Index Index number integer lr 3 Figure 4 11 Entering a loop in HDevelop The instruction write_string outputs a given string at the current text cursor position in the graph 1cs window The function deg is part of the HDevelop language It converts its argument from radi ans to degrees In this example the operation performs a string concatenation because the argument degrees isa string value Before the two operands of are concatenated an automatic type con version double to string of the numeric argument takes place
173. To activate the profiler click Execute gt Activate Profiler page 103 Once the profiler is activated each program execution collects profiling data The profiler data can be reset by clicking Execute gt Reset Profiler page 104 To deactivate the profiler click Execute gt Deactivate Profiler page 103 The profiling results are displayed in the program window In addition a summarized view of the runtime statistics is also available 6 4 10 1 Profiler Display The profiling data is displayed in a separate column of the program window The display area can be resized by dragging its left edge To illustrate the way the profiler works the HDevelop program solution_guide basics color_simple hdev is loaded and executed In figure 6 55 the execution times of the individual program lines are displayed after the first program execution The gray bars illustrate the execution times in relation to the largest value la c i E 2 5 0 The following display options are available Baro H Display the total number of calls amp Display the execution time The drop down menu provides the following options 166 Graphical User Interface e total execution time e average execution time e minimum execution time e maximum execution time El Switch between execution and operator time Switch between absolute values and percentage If percentages are selected 100 refers to the accumulated times
174. _paint This menu item defines the mode to display gray value images For more information see the menu item Set Parameters below 6 2 4 14 Apply Changes Immediately Synopsis Update behavior of visualization changes in active graphics window If this menu entry is checked any changes to the visualization settings are applied immediately to the active graphics window Otherwise the changes are deferred until the next object is displayed in the active graphics window 6 2 4 15 Set Parameters Synopsis Set visualization parameters of the active graphics window with interactive preview He Shortcut ctrl shift G P or Ctrl Shift G Ctrl Shift P 6 2 4 Menu Visualization 109 This menu entry opens the window Visualization Parameters which allows convenient access to the visualization settings of the active graphics window Most of the settings are also available as indi vidual menu entries in the menu Visualization but some more advanced settings are only provided in this window Furthermore an interactive preview is provided which visualizes the current settings Select Graphics Window only with multiple graphics windows Each graphics window keeps its own private set of visualization settings When multiple graphics windows are opened in the current session you can switch between the settings of the different graphics windows by selecting the corresponding window handle number K Visualization Parame
175. a calibration is necessary The Input tab lets you load calibra tion data if available or opens the Calibration Assistant to calibrate live Choosing Calibration Files allows you to load calibration data from file which is useful if you have already performed a calibration for your application You can either type in the path to the parameter names cal and the camera pose dat or use the Browse buttons next to the input boxes to load them from file Choosing Calibration Assistant page 230 allows you to use calibration data from a calibration assistant that quickly guides you through a calibration A new assistant will be opened unless there is already one available If you are just finished with your Input page 295 continue by creating an ROI page 295 If you have already extracted your edges proceed to examine your results under Edge Data 7 4 3 3 Edge Data Edge Data displays the measurement results In order to see the different results for multiple ROIs choose the ROI you want to view the results of by clicking on the name of that ROI in the Active ROI field The results can then be examined below If you want to use measurement results in other documents you can simply mark entries use Ctrl C to copy those entries to the global clipboard and subsequently paste them into any other document Once you are satisfied with the measuring results proceed to the Code Generation tab page 335 300 HDevelop Assistants
176. a new program window This menu item lists all the places in the current program where the currently se lected procedure is called Clicking on an entry takes you to the corresponding pro gram line Cut selected lines dialog based editor or selected text full text editor Copy selected lines dialog based editor or selected text full text editor Paste clipboard content at insert cursor dialog based editor or replace selected text with clipboard content full text edi tor Delete selected lines dialog based editor or selected text full text editor Activate selected lines 6 4 4 Context Menu 149 Action Shortcut Description Deactivate F4 Auto Indent Ctrl Shift I Create New Ctrl Shift P C or Procedure Ctrl Shift P Ctrl Shift C Set Program Counter E Set Insert Cursor Update Program Counter Ww Set Clear Bookmark GD Set Clear Breakpoint Activate Deactivat shifi F10 Breakpoint Clear All Breakpoints Add Watch Print Ctrl P Deactivate selected lines If the full text editor is enabled the indent ing level of all selected program lines is in dented in the same way as in the dialog based editor i e nested program blocks are indented by the amount of spaces set in the preferences See Create New Procedure page 118 Set the PC to the selected line Set the IC to the selected line See preferences page 95 See Set Clear Bookmark p
177. able sort_index t inverse t is_number v number v environment s tuple_sort_index tuple_inverse tuple_is_number tuple_number tuple_environment character to ASCII number ord a tuple_ord ASCII number to character chr a tuple_chr tuple of strings to ASCII numbers ords s tuple_ords tuple of integers to string chrt i tuple_chrt random number rand a tuple_rand test for integer values is_int t tuple_is_int test for mixed values test for numerical values test for real values test for string values get type value is_mixed t is_number t is_real t is_string t type t tuple_is_mixed tuple_is_number tuple_is_real tuple_is_string tuple_type test for integer values elementwise test for real values elementwise test for string values elementwise get type value elementwise is_int_elem t is_real_elem t is_string_elem t type_elem t tuple_is_int_elem tuple_is_real_elem tuple_is_string_elem tuple_type_elem o te iv te c l 376 HDevelop Language 8 10 HDevelop Error Codes 21000 21001 21002 21003 21010 21011 21012 21020 21021 21022 21023 21030 21031 21032 21033 21040 21041 21042 21043 21044 21050 21051 21052 21053 21060 21061 21062 21063 HALCON operator error User defined exception throw User defined error during execution User defined operator does not implement execution interface HALCON license error H
178. age page 253 will be used used as basis for the alignment page 253 or rectfication page 233 Searching for the Object in a Test Image When you click the button Find Model in the dialog Test Images of the tab Usage the object is searched for in the currently selected test image the result is displayed in the graphics window Please note that 1f the button is clicked for the first time or after you changed a model parameter the internally stored model is actually created which takes some time If the model creation takes a long time i e if you have chosen a very large angle page 273 and scale range page 273 you may find it useful to reduce angle and scale range if possible or if you are using shape based matching switch off the complete pregeneration page 278 of the model You can also search for the object in the whole sequence of test images at once Searching for the Object in All Test Images When you click the button Detect A11 inside the dialog Test Images of the tab Usage the object is searched for in the complete sequence of test images that were loaded page 281 before The results are displayed successively in the graphics window This button also sets the maximum number of matches if it has not been set previously i e was set to 0 Please note that if the button is clicked for the first time or after you changed a model parameter the internally stored model is actually created which t
179. age 73 See Set Clear Breakpoint page 101 See Activate Deactivate Breakpoint page 101 See 101 Add the variable under the mouse cursor to the user tab of the variable window Clear All Breakpoints page See Print page 65 o o o d o 2 o a 5 9 150 Graphical User Interface 6 4 5 Creating Procedures Procedures may be created from scratch or from selected program lines in the currently displayed pro cedure When you start a new HDevelop program there is only the main procedure As the program grows you often find that chunks of code have to be reused or they constitute a functional unit In these cases it is good practice to relocate the corresponding lines to a new procedure As an example consider the following example program H RU Program Exitor jae fa gt E man JE BeBe 1 ImageFile clip vairead image Image ImageFile Biget image pointerl Image Pointer paidev close window 5 dev_open window 0 Ajdev display Image 7ithreshold Image Region 0 50 2 lconnection Region ConnectedRegions Type Width Height O Width Height black WindowHandle 9 select_shape ConnectedRegions SelectedRegions area and 150 In this example you want to reuse the selected program lines To create a new procedure from these program lines click the menu entry Procedures gt Create New Procedure
180. ager Abbreviations BP breakpoint IC insert cursor GUI graphical user interface MDI multi document interface PC program counter SDI single document interface XLD extended line description see also chapter A on page 405 Getting Started 15 Chapter 2 Getting Started 2 1 Running HDevelop In the following it is assumed that HALCON has already been installed as described in the Installation Guide Windows Under Windows HDevelop is usually started from the Windows Start menu Start gt Programs gt MVTec HALCON 11 0 HDevelop You can also start HDevelop from the Windows Command Prompt or from the Start gt Run menu making it easy to pass optional command line switches hdevelop Linux Under Linux HDevelop is started from the shell hdevelop 8 Mac OS X Under Mac OS X HDevelop is started from the Applications folder of the Finder Command line switches see below are passed by calling HDevelop from a terminal window in the following way Applications hdevelop app Contents MacOS hdevelop OPTIONS D o 2 y s n D o 0 16 Getting Started window title menu tool bar K HDevelop unnamed u t File Edit Execute Visualization Procedures Operators Suggestions Assistants Window Help FASS DS JAEL SISE BEG PDs PEE So E Eh netis X Graphics Window 3600 olels X Operator Window EEE RAYA Eljrt o fir Ja Fe E
181. airs or just want to detect the first or last edge pair If you are looking for single edges instead of edge pairs you can choose with Transition whether you want edges with a11 transitions i e positive and negative or just positive or just negative 298 HDevelop Assistants Using Position you can then determine whether you are looking for a11 edges or just want to detect the first or the last edge Once you are satisfied with your selection you can view your measuring results on the Results tab page 334 7 4 2 3 Display Parameters Changing display parameters on the Edges tab may help you to make the ROI in your image better visible and therefore easier to work with You can change e the Region Color and also activate Show Region in order to see the actual size of your region which may be convenient if you do not use the ROI width as edge length e the Edge Color and also activate Use Shadows if this is beneficial for the visibility e the Edge Length which is the ROI width in default mode to improve the visibility of the edges and e the Line Width Once you are satisfied with your detected edges as well as with the display parameters continue to the Results tab page 334 7 4 3 Results The Results tab lets you choose which results are relevant for your application and displays these results in a spreadsheet The tab consists of three parts e Feature Selection e Feature Processing and e Edge Data
182. akes some time If the model creation takes a long time i e if you have chosen a very large angle page 273 and scale range page 273 you may find it useful to switch off the complete pregeneration page 278 of the model You can also search for the object in a single test image Automatically Searching for the Object in the Test Images If you check the box Always Find in the dialog Test Images of the tab Usage also accessible via the menu item Usage gt Test Images gt Show Test Image Settings the object is searched for automatically whenever you select a new test image Please note that if the matching process is started for the first time or after you changed a model param eter the internally stored model is created which takes some time If the model creation takes a long time i e if you have chosen a very large angle and scale range you may find it useful to switch off the complete pregeneration page 278 of the model Selecting and Displaying a Test Image You can select a test image by clicking with the left mouse button onto its number index or path in the text box of the dialog Test Images of the tab Usage The selected image is automatically displayed in the graphics window of HDevelop 7 3 3 Matching Assistant Reference 283 If the checkbox labeled Always Find is checked the matching process is started automatically on the selected test image its result is displayed in the graph
183. all internal and external procedures in submenus grouped by chapter and section If no sectioning information is associated with a procedure it appears directly in the submenu Selecting a procedure inserts it into the operator window for editing 6 2 7 Menu Suggestions 127 6 2 7 Menu Suggestions Synopsis Let HDevelop suggest operators based on the current operator This menu shows you another possibility how to select HALCON operators But here they are proposed to you in a different manner It is assumed that you have already selected an operator in a previous step Depending on this operator five different suggestions are offered Suggestions are separated into groups as described below 6 2 7 1 Alternatives Since HALCON includes a large library this menu item suggests alternative operators Thus you may for example replace mean_image with operators such as gauss_image sigma_image or smooth_image 6 2 7 2 See also Contrary to Alternatives operators are offered here which have some connection to the current oper ator Thus the median filter median_image is not a direct alternative to the mean filter mean_image Similarly the regiongrowing operator regiongrowing is no alternative for a thresholding In any case they offer a different approach to solve a task References might consist of pure informative nature too the operator gen_lowpass which is used to create a lowpass filter in the frequency domain is a reaso
184. alog page 249 instead 7 2 5 2 The Menu Calibration Via the menu Calibrate you can run a calibration as described in the section Calibrating page 237 7 2 5 3 The Menu and Tab Code Generation Via the menu Code Generation you can e insert code to the program window of HDevelop according to the current settings of the Calibration Assistant e release the generated code lines in the program window e delete the generated code lines from the program window as long as you did not release them and e open the dialog for the code preview inside the tab Code Generation Insert the Generated Code Lines Via the menu item Code Generation gt Insert Code also accessible as tool bar button or as button inside the tab Code Generation you can insert the code that is generated according to the current settings of the Calibration Assistant into the program window Inserting code via menu or tool bar will generate code for calibration and samples Release the Generated Code Lines Via the menu item Code Generation gt Release Generated Code Lines you can release the gen erated and inserted code lines After releasing the code lines all connections between the Calibration Assistant and the program window of HDevelop are lost That is changes e g the deletion of code lines can then only be applied directly in the program window and not from within the Calibration Assistant anymore Delete the Generated C
185. am tool which helps to select regions based on common gray values HDevelop provides a feature histogram tool which helps to select regions based on common properties or features Click Visualization Tools gt Feature Histogram to open the tool The column Feature allows to select the feature that the region selection will be based on The default feature is area which is adequate in this case The actual clips are all the same size thus the area of the regions is a common feature In the feature histogram the horizontal axis corresponds to the values of the selected feature The vertical axis corresponds to the frequency of certain feature values Similar to the gray histogram window you can visualize the selected regions i e the regions whose area falls between the values Min and Max which are represented by the green and red vertical lines respectively Click the icon next to the selected feature area to enable the visualization Specify the parameters in the Output section of the feature histogram window as shown in figure 4 9 Drag the green and red line to see how this affects the selected regions In the histogram we can see to f E E o o fo a 42 Programming HDevelop that in order to cover all the clips we can safely select regions whose area is between say 4100 and the maximum value in the histogram When you are satisfied with the selection click the button Insert Code The following line wi
186. an also select a different classifier and change parameters that influ ence single classifiers via the dialog Advanced Training Parameters and Features page 324 If you want to save data for archival purposes during training you can activate Save Ground Truth If activated each time data is added to the training file a copy of the source image assistant settings and teach data will be stored in a subdirectory next to the training file 7 5 4 3 Training The Training Dialog gives you the opportunity to perform a training via the button Train Now and is connected to the more interactive Teaching dialog above Other than starting the training the status of the training can be viewed including e the Number of Samples that were used in the selected training file e the name and path of the Classifier e and the status of the classifier i e untrained not trained yet training during training trained after successful training outdated new training data is available that has not been trained yet read only classfier has been loaded and failed the last training has not been successful 322 HDevelop Assistants 7 5 4 4 Basic Features This dialog enables you to choose several basic features that affect the classification First you can adjust three features that influence the interpolation of symbols to a fixed pattern size to provide a pixel feature of constant dimension that is used for cla
187. an be changed by clicking the corresponding icon in the element s data block The following set operations are available see figure 6 73 for an illustration J union of A and B 6 7 1 Interactive Creation and Handling of ROls and XLDs 191 AE intersection of A and B zE difference 1 e A minus B H xor i e A or B exclusively Interactive Measurements Usually all dimensions in the tool box are given in pixels To convert pixel values to real world dimen sions a simple calibration can be performed i e a known dimension has to be specified See figure 6 74 for an example The length of the line is known so it can be used for the calibration e Click to open the 2D calibration panel e Select the desired unit from the drop down combo box Unit e Select Set 2D Calibration to start 2D calibration mode e Click on the Length value in the data block of the line and specify the known dimension e g 10 for 10mm e Click Modify Regions to leave 2D calibration mode Now any changes to the parameters of the data block will again modify the figure itself leaving the calibration untouched Now all dimensions are given in the selected unit A B Po CO CO O O union intersection difference i OX O O Figure 6 73 Set Operations g la c i E 2 5 0 192 Graphical User Interface K roi File ROIType Operations Draw Edit Tools AAA 240 aa As Unit mm 1Pi
188. and 0x20 to 32 If called with a string that does not represent a number or with a variable of the type integer or real number returns a copy of the input environment returns the value of an environment variable Input is the name of the environment variable as a string ord gives the ASCII number of a character as an integer chr converts an ASCII number to a character 8 5 16 Operation Precedence 363 band bxor bor and h unary minus not Table 8 22 Operation precedence increasing from top to bottom ords converts a tuple of strings into a tuple of ASCII integers chrt converts a tuple of integers into a string 8 5 16 Operation Precedence See table 8 22 for the precedence of the operations for control data Some operations like functions t etc are left out because they mark their arguments clearly 8 6 Reserved Words The identifiers listed in table 8 23 are reserved words and their usage is strictly limited to their predefined meaning They cannot be used as variable names 8 7 Control Flow Operators The operators introduced in this section execute a block of operators conditionally or repeatedly Usually these operators come in pairs One operator marks the start of the block while the other marks the end The code lines inbetween are referred to as the body of a control flow structure When you enter a control flow operator to start a block HDevelop also adds the corres
189. and saved an ROI you can reuse it by selecting Load ROI from the OCR menu 316 HDevelop Assistants In order to delete one or more ROIs you can either mark them and just press the delete button on your keybord or click on the buttons for Delete Selected ROI Item or Delete All ROIs on the Setup tab You can view and edit the ROI data which includes all the data about the exact position of the ROI s using the tool bar button View ROI Data Editing an ROI by changing the ROI data is useful if an ROI should be modified more precisely than is possible by drawing in the graphics window Once you are satisfied with the shape of your ROI proceed to adjust parameters on the Segmentation tab 7 5 3 Segmentation This section describes how to set segmentation parameters for an OCR application The tab Segmentation allows to adjust several kinds of parameters for optical character recognition The suc cess of these parameter adaptions can be viewed immediately in the image after the Setup page 314 has been completed i e if at least one image has been loaded page 315 and an ROI has been specified page 315 Adjusting parameter settings is also recommended when using the Quick Setup page 314 to achieve the highest possible character recognition quality Via the Segmentation tab you can e choose a special symbol appearance e set the parameters that define the symbol size e select special symbol shape features e set parameters
190. and the maximum size WidthLimit and HeightLimit must contain a tuple with two elements each The first element defines the minimum size and the second element defines the pa Y Adapt program ok J cancel apy Heb Figure 6 49 Editing the general documentation of a procedure Note that the logical structure created by the chapter and section information does not correspond to the automatically created directory structure At least for the external procedures you can create the corresponding directory structure afterwards outside of HDevelop The recognition of the procedures in HDevelop is still ensured as all subdirectories of the external procedure paths are scanned as well When editing already existing external procedures the changed procedures are stored in the paths they were originally found in Short Description Enter a short description Usually this should be a single sentence that describes the purpose of the procedure It appears in the overview sections of the online help of the proce dures Additionally the short description is displayed in HDevelop s status bar when the procedure 1s selected from the menu Detailed Description Enter a detailed description of the procedure Paragraphs are introduced with a blank line Example This section of the documentation is intended for code examples This could be a working program or some code fragments that illustrate the usage of the procedure o
191. ant to see a live image you can also activate Live Image on the Calibration tab and click the Snap button whenever you want to keep an image for calibration If you Load images from a file into the Calibration Assistant and then decide to acquire new images with the Image Acquisition Assistant you will be warned that the images from the file will be removed from the window With the Remove and Remove A11 buttons on the left you can remove either one or all images of the list The Save and Save A11 buttons will save one or all images of the list Click Update to control the time when camera parameters segmentation parameters or quality adjustments shall be transferred for the existing images Activate Auto Update to automatically update to the latest adjustments Quality Issues are updated with a little delay after adapting Calibration Plate Extraction Parameters page 243 Deactivating Auto Update enables you to change several parameters at once and speeds up the processing bigger data sets Select a Reference Image With the pose of the calibration plate in the reference image you specify the world coordinate system and the measurement plane for subsequent 3D measurements see figure 6 2 Thus in one calibration image typically the first one you should place the calibration plate such that it lies on top of the measurement plane If this is not possible place the calibration plate in a position parallel to the measurement plane and mov
192. ar you can also drag the left or right border of the OCR Assistant window to Setup page 314 Segmentation page 316 OCR Classifier page 320 Results page 326 Code Generation page 328 enlarge it Images are displayed in the graphics window of HDevelop 7 5 7 1 The Menu File Via the menu File you can load an image load an OCR classifier create a new training file load a training file save a training file load assistant settings save current assistant settings close a dialog and 7 5 7 OCR Assistant Reference 331 e exit the assistant page 332 Load Image You can load an image from a file by the menu item File gt Load Image or via the corresponding button of the tool bar To acquire images from a camera you can also use the Snap and Live buttons in the tool bar Load OCR Classifier If you have a pretrained classifier you want to use you can load this classifier by the menu item File gt Load OCR Classifier or via the corresponding button of the toolbar New Training File You can create a new training file that can be used to train a classifier by the menu item File gt Load OCR Classifier or via the corresponding button of the toolbar Alternatively press the button New in the dialog OCR Classifier on the OCR Classifier tab This automatically activates the radio button Training File which allows you to choose a file for the new training file or op
193. as terminated all computed values are assigned to their respective variables that are named in the output parameter positions Their graphical or textual representation in the variable window is also updated If iconic data has been computed you will see its presentation in the active graphics window In the status bar the runtime of the operator or procedure call is indicated unless the time measurement has been deactivated The PC is then moved to the next operator or procedure call to execute If the operators or procedure calls are specified in a sequential order this is the textual successor In case of control statements e g if endif or for endfor the PC is set on the end marker e g endif or endfor after the execution of the last operator or procedure call inside the statement s body After endfor and endwhile the PC is always set on the beginning of the loop If a condition like if or while evaluates to FALSE the PC is set behind the end marker ha Ie 6 2 3 Menu Execute 99 Suggestions in the menu Menu Suggestions are determined for the recently executed operator Finally HDevelop is available for further transactions Any user input which has been made during execution is handled now Clicking Step Over continues the program immediately if the current operator is wait_seconds 6 2 3 4 Step Forward Synopsis Execute the next line in the current program Shortcut This entry always steps forward i
194. as tool bar button or as button inside the tab Code Generation you can insert the code that is generated according to the current settings of the Measure Assistant into the program window Release the Generated Code Lines Via the menu item Code Generation gt Release Generated Code Lines you can release the gen erated and inserted code lines After releasing the code lines all connections between the Measure Assistant and the program window of HDevelop are lost That is changes e g the deletion of code lines can only be applied directly in the program window and not from within the Measure Assistant any more 7 4 6 Measure Assistant Reference 311 Delete the Generated Code Lines Via the menu item Code Generation gt Delete Generated Code Lines you can delete the code lines that you have previously generated and inserted into the program window of HDevelop from within the Measure Assistant Note that this works only as long as you have not yet released the code lines Preview of the Generated Code Lines Via the menu item Code Generation gt Show Code Preview you can open the dialog for the Code Preview in the tab Code Generation 7 4 6 4 The Menu Help Via the menu Help you can access the online documentation 7 4 6 5 The Tab Input The Input tab consists of the following subdivisions e Image Source page 295 e Expected Gray Value Range page 301 e Calibration Source page 299
195. ased runtime Furthermore the higher the Max Deformation value is chosen the higher is the risk of finding wrong model instances Both problems mainly arise when searching for small objects or for objects with fine structures This is because such kinds of objects lose their characteristic shape which is important for a robust search if the deformations are to extreme Also note that for higher deformations the accuracy of partially occluded objects might decrease if clutter is present close to the object Consequently the value for Max Deformation should be chosen as small as possible and only as high as necessary For more information please refer to the reference documentation of the HALCON operator find_shape_model The Search Parameter Last Pyramid Level Shape based Matching Correlation based Match ing Deformable Matching With the parameter Last Pyramid Level you can select the lowest pyramid level to which the found matches are tracked For example when selecting the value 2 the matching starts at the highest pyramid level and tracks the matches to the second lowest pyramid level the lowest pyramid level is denoted by a value of 1 This mechanism can be used to speed up the matching It should be noted however that in general the accuracy of the extracted position orientation and scale is lower in this mode than in the normal mode in which the matches are tracked to the lowest pyramid level Hence if a high accuracy is desi
196. assified yet the value stays true 6 14 2 Steps for working with the OCR Training File Browser This section quickly guides you through a possible application workflow with the OCR Training File Browser More detailed information on the functionality of the OCR Training File Browser can be read in the sections corresponding to each of the windows within the OCR Training File Browser Open the Training File Browser either via the corresponding toolbar button or from the OCR Classifier tab within the OCR Assistant page 312 Load an existing training file or create a new training file via the corresponding toolbar buttons or the corresponding entries in the drop down menu File If several training files should be used or inspected all of them can be loaded into the OCR Training File Browser If required it is possible to add samples to the training file with the training file functionality of the OCR Assistant page 312 if required Choose a classifier via the drop down menu Classifier gt Load Classifier to classify your samples If you have an own or previously trained classifier you can load it Otherwise one of the trained OCR classifiers provided by HALCON can be selected Inspect and or edit the contents of training files This may include adding new samples deleting samples or combining existing samples for a new training file as well as checking for classification problems Use the Training File Window pag
197. ater_elem t1 lt t2 less or equal tuple_less_equal_elem t1 gt t2 greaterofequal tuple_greater_equal_elem ti t2 equal tuple_equal_elem ti t2 ti t2 not equal tuple_not_equal_elem ti t2 Table 8 15 Elementwise comparison operations longer tuple with the single element of the other tuple As a precondition for comparing the tuples elementwise two corresponding elements must either both be integer or floating point numbers or both be strings Ist Operand Operation 2nd Operand Result 1 2 3 lt 3 2 1 1 0 0 Pa b b 0 1 0 a b c lt b 1 0 0 Table 8 16 Examples for the elementwise comparison of tuples 8 5 11 Boolean Operations 359 Operation Meaning HALCON operator 11 and 12 logical and tuple_and 11 xor 12 logical xor tuple_xor 11 or 12 logical or tuple_or not 1 negation tuple_not Table 8 17 Boolean operations 8 5 11 Boolean Operations o te iv te c l The boolean operations and xor or and not are defined only for tuples of length 1 11 and 12 is set to true 1 if both operands are true 1 whereas 11 xor 12 returns true 1 if exactly one of both operands is true 11 or 12 returns true 1 if at least one of the operands is true 1 not 1 returns true 1 if the input is false 0 and false 0 if the input is true 1 8 5 12 Trigonometric Functions All these functions work on tuples
198. ation where known parameters are not calibrated again Calibration Plate This page 233 is an object whose shape is known precisely Calibration plates are available in different sizes Transparent calibration plates are available for applications requiring backlight illumination Which calibration plate is suited best depends on your machine vision task As a rule of thumb if you grab an image of the plane of measurement it should fill a fourth of the image For example if an image of the plane of measurement corresponds to an area of 80mm x 60mm you should choose the 30mm calibration plate The bigger calibration plates 100mm and 200mm made from aluminum come together with a file containing their exact measurements caltab_100mm descr and caltab_200mm descr Please copy this file to the subdirectory calib of the HALCON base directory you chose during installation This is not necessary for smaller ceramics calibration plates as they can be manufactured very precisely and can therefore use standard description files If you use your own calibration plate you have to create the description file yourself and copy it into the subdirectory calib 232 HDevelop Assistants Calibration Plate Extraction Parameters These parameters page 243 influence the extraction of the calibration plate You may change them in order to improve the extraction of the plate if necessary We recommend however that you try to improve your image quality fi
199. ations See table 8 10 for an overview of the available basic arithmetic operations All operations are left associative except the right associative unary minus operator The evaluation usually is done from left to right However parentheses can change the order of evaluation and some operators have a higher precedence than others see section 8 5 16 8 5 7 Bit Operations 351 Operation Meaning HALCON operator t is_int_elem t elementwise test for integer values tuple_is_int_elem t is_real_elem t elementwise test for real values tuple_is_real_elem t is_string_elem t elementwise test for string values tuple_is_string_elem t type_elem t get type value elementwise tuple_type_elem Table 8 9 Elementwise type operations Operation Meaning HALCON operator o te iv te c l al a2 division tuple_div al a2 multiplication tuple_mult al a2 modulus tuple_mod al a2 addition tuple_add al a2 subtraction tuple_sub a negation tuple_neg Table 8 10 Basic arithmetic operations The arithmetic operations in HDevelop match the usual definitions Expressions can have any number of parentheses The division operator a1 a2 can be applied to integer as well as to real The result is of type real if at least one of the operands is of type real If both operands are of type integer the division is an integer division The remaining arithmetic operators multiplication addition subtract
200. ations that HDevelop performs Most of the variables iconic as well as control are declared locally inside the corresponding subroutines Iconic variables belong to the class HObject and control variables belong to HTuple Depending on the program additional subroutines and variables are declared 9 2 2 1 Stop The HDevelop operator stop is translated into a subroutine in C that creates a message box This message box causes the program to halt until the button is pressed 9 2 2 2 Used Classes There are only four classes types that are used HTuple for control parameters and HObject for iconic data In addition there is the class HWindowControl It is used inside the project for the output window and a variable of class HTuple directs the output to this window Finally the class HOperatorSet is used as a container for all HALCON operators There is no need for other classes as long as the program has the same functionality as in HDevelop When editing a generated program you are free to use any of the classes of HALCON NET to extend the functionality 9 2 3 Limitations and Troubleshooting Besides the restrictions mentioned in this section and in section 9 6 on page 392 please also check the description of the HDevelop operators in section 6 2 6 2 on page 123 9 2 3 1 Variable Names The export adds the prefix ho_ to all local iconic and hv_ to all local control variables respectively in order to avoid collisions with reserved wor
201. ator Windaw lt lt lt ori ra do a ada a eS 167 GS Operator Name Meld ooo a di be be eRe eS 167 GA2 Parameter Display aus ok ee ee OE A Seo S a Rae es 168 65 5 Contal Boons as apa 64 ee Re Ede EM eed ew BOP ae Eee 170 O6 Vartable WIBDON pce s 64 kde fe we ee we ad 171 66 1 ICO Variables c socor 45 SEA DR RES LGA Ae ee ewe ee eG 173 0602 Couiral Vanables oo Aa a be Wh aw ek he Bl we ee eS 176 67 Graphics Window se wa PA EY Oe ewe ee 182 6 7 1 Interactive Creation and Handling of ROIs and XLDs 187 68 Help WindOW ooo cb we be ee ER eA wa ee ee E 192 G9 Zoom Window oa be GS Se Ra we Ba Se Be 197 6 10 Gray Histogram Window lt ccce oe oea a Ae eee RO eS 199 6 10 1 Interactive Visual Operations o exo orar A a SS 202 6 11 Feature Histogram Window lt lt s a EA ee ee 206 6 12 Feature Inspection Window ose ee ee ee ee eet 208 6 13 Eme Profile Window a ke ee a a es Bo eG a 210 6 13 1 ROI Menu of the Line Profile Window o 211 6 132 Lane Prone Display 25 24 0466 246 044004 a e A 211 6 33 PIE soc RA EA BAe ee OR ee eS 212 G34 Line Prone OPLOS 4 2446 oe MS See e eh be eet eee ees 212 GAS CUE 2 i ek ep tn Gos eo be bb eek ea wR EE ee ee 212 E SIES bho bbe RASS ob Se ee ee SeE Se eb bes 213 6 13 7 Focusing Your Camera How to Test Images for Sharpness 214 6 14 OCR Training Pile Br owse f ee A ee ee era 215 6 14 1 Windows of the Training File Browser o 21
202. autocompletion is displayed These options can also be set in the program window see section Program Window Actions on page 139 6 2 2 Menu Edit User Interface gt Fonts In this tab card the font settings of HDevelop may be modified General The font used throughout the user interface menu entries labels etc Help Window The body font used in the help window menu Help page 134 gt Help Program Listing The font used in the program window This is the same font setting as on the tab card Program Listing see above Advanced Autocompletion The font used in the advanced autocompletion overlays Values and Parameters The font used for displaying values in the variable window and associated inspection windows as well as parameters in the operator window Printing The font used when printing program listings User Interface gt Language In this tab card you can change the language of the user interface Please note that HDevelop needs to be restarted if a different language is selected By default HDevelop uses the language that is specified in the operating system locale For this the environment variables LANG LC_ALL LC_CTYPE and LC_COLLATE are tested in that order Once the language is changed in this dialog the operating system locale is disregarded User Interface gt Layout Show full path in main window title This check box determines whether the fu
203. automati cally via the menu item Inspect gt Optimize Recognition Speed page 289 e Has the object a low contrast Solution for shape based matching and deformable matching If the object is to be recognized in this state nevertheless try reducing the parame ter Contrast Low page 279 or Contrast page 279 respectively in the dialog Standard Model Parameters page 269 in the tab Parameters That way the model can later be detected more easily If the values are however chosen to low too many edges are detected e Do multiple objects overlap Solution for shape based matching deformable match ing and correlation based matching If the objects are to be recognized in this state nevertheless try decreasing the Max Overlap page 286 in the dialog Advanced Use Parameters in the tab Usage e If the object is found but not at the expected position or orientation check the following Solution for shape based matching deformable matching and correlation based matching e If multiple matches are found on one and the same object decrease the Maximum Overlap page 286 in the dialog Advanced Use Parameters e If an almost symmetric object is found at the wrong orientation try reducing the param eters specifying the allowed range of rotation page 273 in the dialog Standard Model Parameters page 269 in the tab Parameters Specifying Standard Model Use Parameters Via the menu item Usage gt Standard Model Use Parame
204. ay 4 El region area 3133 2000 4 E basic Dl area phi 0 483282 2 row roundness 0 731486 1 1 column outer_radius 40 1106 0 1000 width height inner_radius 9 5 0 1000 row1 circularity 0 636011 0 1 column1 ont compactness 1 57094 0 10 column2 bulkiness 1 7639 1 5 ra _ rb v phi V roundness num_sides connect_num holes_num area_holes max_diameter orientation E shape I I moments a Figure 6 80 Inspection of selected features e XLD features This group contains features that describe the selected XLD e g its dimensions or shape properties You can select the features to be inspected by ticking the corresponding check boxes in the tree The selected features are displayed on the right side of the window For each feature the calculated value of the selected region or XLD is displayed or the value for the entire image The current value is also visualized as a gauge in a value range that can be set to the desired values Simply select Show Minimum Maximum which is available in the context menu of the right side of the window See figure 6 80 for an illustration of a feature inspection The range for the area feature has been set to 2000 7000 Individual rings can be inspected by selecting them in the graphics window Moving the mouse pointer over a feature value displays a tool tip It shows the name and short description of the HALCON operator used for the calculation of that value Usi
205. based on a basic description of the image content that does not take all factors that may influence a segmentation into consideration For this reason the Quick Setup alone may not be sufficient to segment and read characters in an image Therefore it is recommended and usually necessary to improve an OCR application by adapting parameters page 316 To get started it is very easy to set up an OCR task with the OCR Assistant s Quick Setup in five steps 1 Load a sample image by clicking the icon right beside the text or alternatively acquire a live image by selecting the Image Acquisition Assistant page 225 under Image Source on the same tab 2 Mark the position of the text to be read with an axis aligned rectangle for text in horizontal or vertical direction and a rotated rectangle for rotated text Alternatively set the rectangle via the Region of Interest dialog on the same tab Note that if you are using the Quick Setup the rectangle must enclose the characters that should be read as precisely as possible and it has to include at least three characters 3 Now that the region of the text is located enter the text that you expect to be read in the text field Remember to enter the text exactly as it is in the sample including all separators line breaks and correct capitalization 4 Describe some basic properties of the text These properties are essential for a successful seg mentation with a minimum number of parameter adaptions
206. bly needed for your images Parameters gt Advanced Model Parameters page 275 The following Advanced Model Parameters may speed up deformable matching e Min Contrast page 279 Increase the value and check whether the matching still succeeds in all images e Optimization page 278 Point Reduction Select a higher reduction rate and check whether the matching still succeeds in all images e Angle Step page 276 size and Scale Step page 277 size Increase the values and check whether the matching still succeeds in all images Please note that the accuracy may suffer if you increase the step size Usage gt Advanced Use Parameters page 285 The following Advanced Use Parameters may speed up deformable matching e Subpixel page 286 If your application does not require subpixel accuracy you can speed up the matching by selecting the value none e Last Pyramid Level page 287 Increase the value and check whether the matching still succeeds in all images Note that as a result of this modification wrong instances of the model may be found Furthermore the accuracy of the calculated position orientation and scale may decrease Speed up descriptor based matching Note that for descriptor based matching the number of points is important for speed and robustness Therefore it is recommended to check the point number Many points lead to a robust matching result whereas few points speed up the matching pro
207. bol is equal to assigning a new symbol name explicitely 6 14 3 3 Samples The Sample Inspection Window page 216 provides the following options for viewing and editing samples Get an overview of the samples Use the sorting mechanisms to get an overview over the samples displayed in this window e You can also sort the results within the Sample Inspection Window in ascending or descending order To do this simply click on the feature that should be used for sorting e g Width or Symbol Name or choose a sorting order in the menu View to sort the list Note that this feature is only available for up to 1000 displayed elements e Enable the checkbox Display only incorrectly classified samples to filter the informa tion displayed for samples that were not classified correctly e Choose between two general viewing options Detailed View or Thumbnail Select those view ing options either via the corresponding toolbar buttons or via the menu items of the menu View Detailed View lists out all the symbol characteristics explained above whereas Thumbnail pro vides a quick overview over the samples just showing a thumbnail image of each symbol and the symbol that was read e Ifyou click on a sample its zoomed image is displayed in the lower left corner of the OCR Training File Browser e Directly view new samples that were saved to the training file via the OCR assistant page 312 Edit the samples e Copy a sample Select one or mor
208. cal variables 341 Locate page 196 look up table 108 loop body 405 Loop Counter 229 LUT 38 Lut 108 main procedure 382 385 387 389 391 main window 51 window title 51 Make A11 External 120 Manage Passwords 88 Manage Procedures 121 Matching Assistant 223 Max Deformation 287 Max Column Scale 273 Max Row Scale 273 Maximum Number of Matches 285 Maximum Overlap 286 MDI 133 MDI 54 Measure Assistant 223 measure task setup 295 Measuring 309 menu 54 Assistants 128 Calibration Image Acquisition Assis tant 230 Edit 66 Execute 97 File 54 Help 134 Operators 121 Procedures 118 Suggestions 127 Visualization 105 Window 128 messages status bar 53 method selection 254 Metric 277 Min AngleandMax Angle 275 Min Column Scale 273 Min Contrast 279 Min Row Scale 273 Min ScaleandMax Scale 275 Min Score 275 Minimum Component Size 272 Minimum Score 284 Mode 183 model creation 255 264 model image load 262 model parameters advanced 275 model parameters standard 269 418 Index model use parameters advanced 285 model use parameters standard 284 modified external procedure 58 program 51 Modify Model Image 265 Modify Regions 191 mouse click 13 Move Down 154 Move tab to the left 140 Move tab to the right 140 Move Up 154 multiple document interface 54 Name 150 native encoding 61 92 New Program 54 136 New Tab 139 New Train
209. calculations is reduced so that the speed of the matching can be enhanced e Guided Matching page 289 Switching this parameter off can in some cases increase the runtime of the matching by up to 10 Thus if robustness is less important than speed Guided Matching can be switched off 7 3 2 6 Inspect matching results for adapting parameters After changing parameters the Inspect page 290 tab is a very useful resource for statistical data Statistics that enables you to view how a matching application would perform based on these parameter settings and gives hints as to what can still be improved If for example Angle appears with a high value which is not necessary for the application decreasing this value manually via Starting Angle and Angle Extent on the Parameters tab increases speed 7 3 2 7 Generate code To finish the preparation for your matching application generate Code with the tab Code Generation page 291 This code includes all of the previous adaptions and can be used in the final application 7 3 3 Matching Assistant Reference 261 7 3 3 Matching Assistant Reference The Matching Assistant consists of the following elements Pull down menus e File e ROI page 264 e Parameters page 268 e Usage page 280 e Inspect page 290 e Code Generation page 291 e Help page 293 Tool bar with a selection of important buttons e Load Assistant Settings page 263 e Save Current Assistant Settings page
210. can now step through the table which consists of the columns e Insert Operator which shows the operator that will be inserted once you press the Insert button e Procedure which shows the corresponding procedure e Line referring to the line number within the code and e Replace Operator which shows previously generated code that will be replaced 7 5 7 OCR Assistant Reference The OCR Assistant consists of the following elements Pull down menus e File e OCR page 332 e Code Generation page 335 e Help page 333 Tool bar with a selection of important buttons e Load Assistant Settings page 331 e Save Current Assistant Settings page 331 e Insert Code page 333 e Load Image page 331 e Snap page 331 e Live page 331 330 HDevelop Assistants Draw Axis aligned Rectangle page 332 Draw Rotated Rectangle page 332 Load OCR Classifier page 331 New Training File Load Training File Save Training File Browse Training Files page 215 Train Now page 332 Help page 333 Tabs with the dialogs for most of the tasks that can be performed with the Measure Assistant Furthermore it provides a status bar at the bottom in which messages are displayed Please note that the status bar does not provide a scrolling mechanism if the displayed message is to long move the mouse over it so that a tool tip displaying the full message pops up Alternatively if the message is only slighly larger than the status b
211. ce 6 2 2 16 Preferences Synopsis Set global preferences of HDevelop E Shortcut ctrl Snift 0 s or Ctrl Shift O Ctrl Shift S HDevelop maintains a set of preferences that are persistent between sessions You can customize the appearance of HDevelop s user interface syntax highlighting fonts and language as well as its behav ior configure the settings of procedures and change the default visualization settings of the graphics windows The following settings are provided User Interface e Program Listing page 79 e Fonts page 81 e Language page 81 Layout page 81 Procedures e Directories page 82 e External Procedures page 84 e Manage Procedure Libraries page 86 e Manage Passwords page 88 e Procedure Use page 90 e Unresolved Procedure Calls page 90 General Options e General Options page 91 e Experienced User page 93 Visualization Settings e Pen page 94 e LUT page 94 e Paint page 94 Runtime Settings e Runtime Settings page 95 e Override Operator Behavior page 96 6 2 2 Menu Edit 77 Changes to the settings in this dialog are saved automatically without any user intervention The location of the generated file depends on the operating system Windows APPDATAZ MVTec HDevelop ini Linux HOME hdevelop MVTec HDevelop ini Mac OS X HOME Library Preferences com mvtec HDevelop plist The dialog provides its own menu with the following entries
212. cedure which has a special status inside the program because it is always the top most procedure in the calling hierarchy and cannot be deleted from the program HDevelop offers all necessary mechanisms for creating loading deleting copying modifying saving and exporting procedures Once a procedure is created it can basically be used like an operator Calls to the procedure can be added to any program body and be executed with the appropriate calling parameters Generally the concept of using procedures inside HDevelop is an extension to the concept of calling HALCON operators since procedure and operator interfaces have the same parameter categories and the same rules apply for passing calling parameters 5 1 Procedure Types HDevelop supports different types of procedures The type is specified when a procedure is created and determines the location of the procedure in the file system e Local procedures Local procedures are stored inside the HDevelop program Each program contains at least the main procedure Local procedures cannot be called from other programs or external procedures N o gt E o Q e a 46 HDevelop Procedures e External procedures External procedures are stored as separate files Each file contains exactly one external procedure External procedures can be shared between different HDevelop programs The modification of an external procedure immediately affects all HDevelop p
213. cedure in example hdev project visualization hdpl setup init project visualization hdpl init a common config init project init 5 main process 5 project visualization hdpl init process project visualization hdpl process 8 compute_results local e project setup local project local 5 6 Protected Procedures Procedures can be protected by a password The interface documentation and bodies of protected procedures can only be accessed if the correct password is supplied Protected procedures can be used i e called by all users but viewed and modified only by those who know the password Instead of protecting single procedures individually all procedures of an HDevelop program or a library respectively can also be protected as a whole Protected procedures alter between two states 50 HDevelop Procedures e locked A protected procedure is locked if the password has not been entered in the current session Locked procedures cannot be modified and the program code is not visible in the program window e unlocked A protected procedure is unlocked after the correct password has been entered Unlocked proce dures may be modified and the program code is visible in the program window To protect individual procedures see section 6 4 9 on page 162 To manage the protection state of multiple procedures see section 6 2 2 16 on page 88 5 7 Procedure Documentation HDevelop procedures can be documented like operators
214. cedure select_shape hd Parameters amp Regions Adi fe pap et y region E SelectedRegions SelectedRegions v region amp Features area y string Operation and v string Min 150 v real Max 99999 v real ok enter vty J _ ca Heo Figure 6 58 Specifying parameters for the operator select_shape the operator knowledge base By clicking the appropriate item you set the text field and the list disappears For the operators open_framegrabber set_framegrabber_param and get_framegrabber_param the value list of certain parameters is dynamic It depends on the selected image acquisition interface An even more reasonable parameter suggestion is given if the corresponding handle is opened If this dynamic behavior is undesired it can be disabled in the preferences see General Options gt Experienced User settings on page 93 This column may also contain action buttons for special semantic types e g a button to browse the file system for the parameters that expect a file name e The fourth column indicates the parameter s default semantic type and optionally its data type in parentheses Hover the mouse cursor over the second to fourth column to get a short description for the corresponding parameter as a tool tip Please refer to the following rules on how parameters obtain their values and how you may specify them Iconic input parameters Possible inputs for these parameters are iconic variables of the corres
215. cedures Operators Suggestions Assistants Window Help naaa ADS SEBBVCP BEG PDs PRES E Eh mEt K Graphics Window 3600 Tola x X Operator Window o asz RAYAS Eljrt o Kr Ja Fe Enter Operator or Procedure 7 1 graphics window 2 operator window AG Variable View main o amp z xX Program Editor E E Iconic Variables 4 D c El main BAFA e gt Control Variables 4 variable window 3 program window Wall Auto JW User JY Global J status bar Figure 6 1 HDevelop main window Window Area The main part of the window is reserved for the windows and dialogs of HDevelop The most important windows are the following e Program window see page 138 e Operator window see page 167 e Variable window see page 171 e Graphics window see page 182 e Online help window see page 192 6 1 Main Window 53 Status Bar The status bar at the bottom of the main window displays status information e g context sensitive in formation about a specific user action or the runtime of operator or procedure calls unless time measure ment has been deactivated in the preferences see section Runtime Settings gt Runtime Settings on page 95 The status bar also displays a progress bar for some very time consuming operators like trainf_ocr_class_mlp or train_class_svm The status bar is divided into the following five areas from left to right see figure
216. centrate on points specific to the feature histogram An important point regards the source of the regions or XLDs The feature histogram is calculated for the regions or XLDs that were displayed most recently in the graphics window Thus if you display an image and there are no regions or XLDs the histogram remains empty As soon as you display regions or XLDs on top of an image the histogram is calculated If you display regions or XLDs without an image you can still calculate feature histograms but only for shape features Please keep in mind that only the most recently displayed regions or XLDs are the source of the histogram not all objects currently displayed in the graphics window The histogram itself is displayed with the horizontal axis corresponding to the feature values and the vertical axis corresponding to the frequency of the values i e to the number of regions or XLDs with a certain feature value When comparing feature histograms to gray value histograms you will note a typical difference Because in most cases the overall number of regions or XLDs is much smaller than the overall number of pixels feature histograms often consist of individual lines most of them having the height 1 Of course this effect depends on the selected feature For features with floating point values e g the orientation the probability that two regions or XLDs have the same feature value is very small in contrast to features with int
217. cess 260 HDevelop Assistants The following modifications can speed up descriptor based matching Parameters gt Standard Model Parameters page 269 e Detector Type page 274 Use lepetit for the fastest extraction of significant points e Fern Depth page 275 and Fern Number page 275 Few ferns with a large depth are recommendend for a fast online matching but also require more memory If memory is an issue but runtime is not then many ferns with a small depth are recom mended e Set the parameters Min Angle page 275 Max Angle page 275 Min Scale page 275 and Max Scale page 275 according to the ranges probably needed for your images Restricting these parameters to small ranges speeds up the matching process Parameters gt Advanced Model Parameters page 275 e Patch Size page 280 Choose a smaller value and therefore a smaller side length of the quadratic neighborhood that describes the individual interest point for this parameter e Tilt page 280 Switching this parameter and therefore the ability to cope with perspective transformations off enhances the speed Usage gt Advanced Use Parameters page 285 e Descriptor Min Score page 289 Setting this parameter to a value larger than 0 0 but preferably below 0 1 increases the minimal classification score that determines if the individual points are considered as potential matches Thus the number of points for further
218. ch is the topmost layer changes accordingly The region Region is still dis played in filled red A more convenient way to set many display properties at once is available through the menu entry Set Parameters It opens the settings window displayed in figure 4 6 After trying some settings click the button Reset to restore the default visualization settings You cannot change the display properties of regions or XLDs other than the topmost What you can do is rebuild the image stack in the graphics window manually by double clicking iconic variables in the variable window and changing the properties each time another layer is added The stack is cleared whenever an image is added that uses the full domain To clear the stack and thus the graphics window manually click the clear icon see figure 3 2 on page 25 4 7 Inspecting Variables When you move the mouse cursor over the variable ConnectedRegions you see that it contains 98 regions Right click on the icon ConnectedRegions and select Clear Display to display only the con nected regions in the graphics window Right click again and select Display Content gt Select This menu entry opens a variable inspection window which lists the contents of the variable 4 8 Improving the Threshold Using the Gray Histogram 39 a K Visualization Parameters mS Pen LUT Paint Zoom Draw fill margin Shape elipse z Line Width 1 Colors a Custom colors
219. ch time you create a model ROI page 253 or change the parameter Contrast page 270 the Matching Assistant automatically selects a suitable value to obtain the highest possible accuracy You can select a higher value manually This may be useful to speed up the search process in special cases please note however that a large value may decrease the accuracy of the estimated orientation and even prevent the Matching Assistant from finding the object You can restore the automatically selected value by clicking the button Auto Select If you already loaded test images page 281 you can quickly test the effect of the selected parameter value via the menu item Inspect gt Determine Recognition Rate page 290 O Letting the Matching Assistant Select a Suitable Value for Row Scale Step and Column Scale Step Shape based Matching Deformabel Matching When you click the button Auto Select that is placed right beside the sliders for the parameters Row Column Step Size the Matching Assistant selects suitable values for both scale step sizes based on the model image The Model Parameter Metric Shape based Matching Correlation based Matching Deformable Matching The parameter Metric lets you choose whether the polarity of the contrast is to be observed when comparing a test image with the model By default the polarity is used use_polarity i e the points in the test image must show the same direction of the contrast as the correspondin
220. cking on its individual constituent parts to select them In figure 6 72 the upper rectangle is selected and can be modified by dragging its handles You can also edit the selected element in the mode it was created in by clicking right click to confirm the changes The corresponding values in the tool box will be updated accordingly You can also edit the values in the tool box parametrically The parameters Perimeter and Area are calculated depending on the other parameters of the rectangle They can not be modified directly and are therefore grayed out If you click on the upper rectangle twice the entire figure will be selected and can be dragged with the mouse In general if the figure consists of overlapping elements the first click will select the topmost element Each following click will select the element below the selected one When the bottommost element is reached the next click will select the entire figure In case of a very complex figure with many stacked elements it might be easier to select a distinct element by clicking onto the corresponding data block in the tool box 6 7 1 Interactive Creation and Handling of ROls and XLDs 189 S ror mrm Fie ROIType Operations Draw Edit Tools ANT 2440 48 Operation C Region Primitive Value Unit 4 ROI O 4 ME 2 Axis aligned rectangle Row1 197 724 Pixel Column1 233 807 Pixel Row2 250 029 Pixel Column2 363 17 45m 4 axis aligned rectangle Row1 260 0
221. classifier or training an own classifier the text can be located and read Finally code can be generated and inserted into your application The assistant is described in section OCR Assistant on page 312 Common Features of all HDevelop Assistants Some features are common to all HDevelop assistants First of all you can open multiple assistants Assistants of the same type are numbered consecutively e g if you open two image acquisition assis tants they are labeled Image Acquisition 01 and Image Acquisition 02 respectively When you open a new assistant a menu entry is added to the top of the menu Assistants from which the corresponding assistant can be restored if it has been closed The current setup is lost and the menu entry disappears if the associated assistant is exited explicitly see below If you want to keep the setup for later sessions you can always save it to a file Different assistants have different menus usually corresponding to the available tab cards These menus provide functionality specific to the assistant s task There are also some menu entries that are available in every assistant They are described in the following FilebLoad Assistant Settings Using this entry a previous configuration can be loaded from a file which has been generated using the menu entry Save Current Assistant Settings File gt Save Current Assistant Settings You can save the configuration of an assistant to a
222. collected from memory although the underlying iconic object e g an image might in fact occupy a large portion of memory In order to avoid memory leaks caused by this effect in the exported code every iconic object is deleted explicitly before it is assigned a new value 9 4 Code Generation for Visual Basic 6 HALCON COM This section describes how to create a HALCON application in Visual Basic 6 starting from a program developed in HDevelop HALCON can be used together with Visual Basic 6 based on the COM interface of HALCON A detailed description of this interface can be found in the Programmer s Guide part V on page 159 9 4 1 Basic Steps 389 9 4 1 Basic Steps 9 4 1 1 Export The first step is to export the program using the menu File gt Export Here select the language Visual Basic 6 0 HALCON COM and save it to file The result is a new file with the given name and the extension bas 9 4 1 2 The Visual Basic 6 Template If the file has been exported using the option Use Export Template it is intended to be used together with the predefined Visual Basic 6 project that can be found in the directory HALCONEXAMPLES AvbXHDevelopTemplate This project contains a form with a display window HWindowXCtr1 and a button labeled Run The file generated by HDevelop has to be added to this project This is done by using the menu Project gt Add Module gt Existing and selecting the file Now the project is ready
223. cording to the given requirements it has to be translated into its final environment For this the program is transferred into another programming language that can be compiled HDevelop allows to export a developed HDevelop program to the programming languages C Visual Basic Visual Basic NET C and C by writing the corresponding code to a file The following sections describe the general steps of program development using this feature for the languages e C section 9 1 e C HALCON NET section 9 2 on page 384 e Visual Basic NET HALCON NET section 9 3 on page 386 e Visual Basic 6 HALCON COM section 9 4 on page 388 e C section 9 5 on page 391 including some language specific details of the code generation and optimization aspects Because HDevelop does more than just execute a HALCON program the behavior of an exported pro gram will differ in some points from its HDevelop counterpart A prominent example is that in HDe velop all results are automatically displayed while in the exported programs you have to insert the corresponding display operators explicitly Section 9 6 on page 392 describes these differences in more detail 9 1 Code Generation for C This section describes how to create a HALCON application in C starting from a program developed in HDevelop 382 Code Export 9 1 1 Basic Steps 9 1 1 1 Program Export The first step is to export the program using the menu File gt Export
224. cquiring Images From Files or Directories o oo 3 3 2 Acquiring Images Through Image Acquisition Interfaces 33 3 Modifying the Generated Code o c p cesoie o ew E a 4 Programming HDevelop 3 1 Stata New Protan ces e ewes dedi ee a ee ee E e 4 2 Boteran pert a a e e A a aa SEG ey 43 Specily Paraineteis s c iea soraia eA A OA ees aa od 44 Gemas HeD eos ke a a a e la a eS 43 Add Additonal Program LINES e oss s cisco e EE ee eS 4 6 Understanding the Image Display s s sas ans aee e ea a e E e E a 4 7 Inspecting Variables gt s lt scp s ap pe eR paa e e e e RB ES eS 4 8 Improving the Threshold Using the Gray Histogram AR PO LDES e iio FA eee a Roe a eee BAe ate Se Ee eee 4 10 Re Bxecute the Progam oes Se ee aah a HEE ERED GS oD SSeS LLL Saves PRA gk oe eG a Re Se ee Re A 4 12 Selecting Regions Based on Features o o e 4 13 Looping Over the Results we RR EE ee ee 4 14 IMAN eo Sn te a eae a Ble ee ae ba es 5 HDevelop Procedures a Procedure TYPES eeni o a Many he eee es BES Bee eS eee eS Sa IMETIDES corrr eR A ee EY OR A Sle Se RR eee 2 RE ek 11 12 12 12 15 15 18 23 23 24 25 26 28 32 3221 HDevelop Prostams conos a a a a e BL 46 3 2 2 Exiemal Procedires RR e RA 46 ES A AGO Bb OKA PRR Ra BAS HOES Ee ARR AES 47 329 Procee Scope ss o ee eee ee a le we ee eG eS 47 34 Procedure Locations s lt a oia ts beet eet be ee awe dee eee es ewd 47 J3 P
225. cr 0 06 2010 13 00 File fo a Libraries I Regions 010 13 00 File fo Documents p Segmentation 010 13 00 File fo al Music I System 2010 13 00 File fo me J Tools 01300 Filefol_ EE Videos Tuple 010 13 00 File fo di XLD 0 06 2010 13 00 File fo NE Diggler Y explore_halcon dev 24 03 2010 17 53 DEV Fi amp System C vii 5 File name explore_halcon dev v HDevelop program hdev de v Figure 6 85 Example of a file selection dialog under Windows Usually the dialog is laid out similar to the shown example The elements at the top allow to navigate the directory hierarchy The area to the left provides shortcuts to special directories or system drives The area to the right provides a file listing of the currently selected directory At the bottom the selected file name is displayed or can be entered directly The file type selection at the bottom is useful to restrict the file listing to certain files that are of interest in the current context In this example only subdirectories and HDevelop programs are displayed o D 2 Q a 0 222 Graphical User Interface 6 15 2 Unsaved Changes File operations that will delete the current program such as loading a new program trigger a security check This security check prevents you from deleting the current program accidentally if the program has not been saved A dialog box appears and asks whether you want to save the HDevelop program
226. cribes a certain typeset that differs from other fonts by certain features of the characters A classifier can be trained for these special features of the font so that characters belonging to this font can be read successfully OCR Classifier An OCR classifier is trained to classify a certain set of characters defined by certain characteristics e g Pharma omc HALCON provides you with a set of pretrained OCR classi fiers which are based on a large amount of training data from various application areas These 314 HDevelop Assistants OCR classifiers for fonts allow you to read text in documents on pharmaceutical or industrial products dot prints and even handwritten numbers Furthermore HALCON includes pretrained OCR classifiers for fonts like OCR A and OCR B You can also use your own classifiers and train an OCR classifier with HDevelop Symbol A symbol is a class one or more samples are assigned to with the help of an OCR classifier Character A character can be a single letter number or special sign like a hyphen It belongs to a certain Font 7 5 2 Setup The OCR Assistant allows you to quickly and easily set up your OCR task in just a few steps e start easily with the Quick Setup e choose an image source e specify the position of a text with a region of interest 7 5 2 1 Quick Setup The Quick Setup is an easy way of setting up an OCR application However this preconfiguration of segmentation parameters is
227. cted global variable Click on an entry to jump to the corresponding location in the program window g la c i E 2 5 0 176 Graphical User Interface Sort by Name Sort all variables in alphabetical order Sort by Occurence Sort the variables in the same order as they are defined in the program Update Variables Toggle whether variables will be updated during program execution This is the same setting as in the runtime preferences see page 95 Cleanup Delete all unused variables see page 63 Add Variable tab User only This submenu contains a list of all variables that are currently not displayed in the tab User Click a variable name to add the corresponding variable to the tab Remove from User Tab tab User only The selected variables are removed from the tab User You can display the corresponding iconic variable in the active graphics window with or without clearing the window first and you can clear the iconic variable If an iconic variable contains multiple items you can also select a specific item from a submenu Up to 15 items are listed in this menu If an iconic variable contains more than 15 items the remaining items can be accessed by clicking Select If you click Select in this submenu you can quickly browse the items of the iconic variable from a dialog This also works for multi channel images See figure 6 61 for an example Visualization of Iconic Variables Normal
228. cted procedure call the current procedure call and thus the procedure belonging to the selected procedure call the current procedure When you click on a procedure call that belongs to a locked procedure see Protected Procedures on page 49 you can only see the procedure body if you enter the correct password into the program window 6 2 3 Menu Execute 101 K callStack o JO El p_set_font WindowHandle 3600 El p_show_status_window TitleCurrent1 3D Matching TitleCurrent2 for Bin Picking TitleCurrent main Figure 6 23 Call Stack 6 2 3 10 Set Clear Breakpoint Synopsis Set or clear breakpoint s at the selected program lines fr Shortcut This menu item sets or clears breakpoints on the lines that are currently selected in the program In most cases however it is more convenient to set individual breakpoints by holding the key and clicking in the left column of the program window as described in Program Counter Insert Cursor and Breakpoints on page 146 6 2 3 11 Activate Deactivate Breakpoint Synopsis Deactivate or activate breakpoints at the selected program lines Shortcut This menu item toggles the state of the breakpoints in the selected program lines It does not remove the breakpoints but rather disables them temporarily and re enables them later This might be useful to switch the run mode of the current program between continuous mode and debug mode If you want to deact
229. cter of the line For example you can enter 6 4 2 Editing Programs 143 disp_arrow WindowID Rowli Column i Row i Length sin Phi i Column i Length cos Phi i 4 instead of disp_arrow WindowID Row i Column i Row il Length sin Phi i Column i If you switch over to the dialog based editor continued lines will be joined up again As soon as you switch back to the full text editor mode the formatting is restored unless the corresponding line has been edited in the dialog based editor in the meantime Comments Comments start with an asterisk as the first non whitespace character this comment is ignored during program execution You may also add comments at the end of regular program lines by introducing them with read_image Image clip instantiate iconic variable threshold Image Region 0 63 select dark pixels Auto Indenting The indent of new lines is adjusted automatically Usually the indent of the previous line is maintained If a line is continued inside the parentheses of an operator call the new line is indented up to the opening parenthesis If the previous line opens a control structure e g if or while the indent is increased by the indent size The indent size is specified in the preferences see Program Listing page 79 It defaults to four spaces If a control structure is closed e g by entering endif or endwhile the indent of the current line
230. ctions Generating an ROI Interactively e Click the tool bar icon FA to create a new figure This will open the dialog shown in figure 6 70 b which will act as a tool box for your new figure By default the figure type is set to ROI cf E in the tool bar which is just what we want for this example e Click al to create a rectangle Click and hold inside the graphics window to draw an initial rectangle You can modify the rectangle by dragging its sides or corners Make the rectangle match the big label on the chip see figure 6 71 a Click the right mouse button to confirm the rectangle and it will be created in the toolbox o D 2 Q a 0 188 Graphical User Interface Figure 6 71 Drawing an ROI of rectangles e Repeat the last step to create another rectangle and make it match the lower part of the label see figure 6 71 b e Click 8 to generate program code in the current program gen_rectanglel ROI_0 197 724 233 807 235 947 360 162 gen_rectanglel TMP_Region 260 088 326 066 284 229 398 269 union2 ROI_0 TMP_Region ROI_0 In this example the iconic variable ROI_0 corresponds to the region defined by the two rectangles Editing the Figure Please note that figure changes are not recorded in the undo buffer and cannot be reverted However you can save all figures in the tool box and load them later using the menu File You can make changes to a figure by cli
231. ctories External Procedures Manage Procedure Libraries Manage Passwords Procedure Use ur te Show the names of procedures that are used or not used by the loaded program or a selected procedure El main y used unused Y internal Y external Name 1 init 2 setup_a 3 setup_b 4 setup_c 5 init 6 Y local_a z init 8 Y local b 9 init 10 El local_c Figure 6 21 Procedures gt Procedure Use Procedures gt Unresolved Procedure Calls This tab card helps you to find unresolved procedures in your current program If the current program or the loaded procedures contain unresolved procedure calls they are listed here along with the calling procedure name 6 2 2 Menu Edit General Options gt General Options Select the behavior of pressing the Return key This option can also be set in the program window see section Program Window Actions on page 139 e OK Enter and execute Enter the operator in the program window and execute it the default behavior e Enter Enter the operator without executing it Display string values with special characters quoted Special characters like n for a newline character in string values are usually interpreted in the variable window and the variable inspect window If this option is ticked special characters are displayed verbatim i e as they are entered See table 8 1 on page 339 for a list
232. cular Arc which you find in the tool bar of the Measure Assistant Place the ROI perpendicular to the edges you want to measure e Now that you have located the ROIs you can extract edges within the chosen region s and there fore use the functionality of the Edges tab The Input tab offers two more options that you can use if necessary If you already have calibration data available you can load the data as described in the paragraph Calibration Source page 299 otherwise just return to the Input tab later A more advanced feature is changing the mode of the expected gray value range which is only relevant if your image data uses more than 8 bits Read more about this topic under Expected Gray Value Range page 301 In case your edge extraction is not as successful as expected further improvements can be made using the fuzzy measuring function of the assistant page 301 Image Source The Input tab lets you choose images from the following sources e If your image has already been opened in the Graphics Window you can activate Graphics Window to continue working with the currently displayed image e You can load and image file by activating Image File or choosing Load Image from the menu File and the tool bar respectively and either typing in the image path or using the Browse button on the right to choose an image from a file e Another option is to activate the radio button for the Image Acquisition Assistant Bei
233. d If the PC is placed in first the first element of the callstack is popped If the PC is placed in main only main remains on the callstack Please note the outlined green arrows in main and first They indicate the return positions 6 4 4 Context Menu By clicking into the program window with the right mouse button you can open a context menu which contains shortcuts to some of the actions of the menus Menu Edit e g copy and paste lines and Menu Execute e g activate and deactivate lines or set and clear breakpoints Please note that these actions behave slightly differently than their counterparts in the main menus When called via the main menus the actions are performed only on the selected part of the program if nothing is selected no action is performed In contrast when an action is called via the context menu and no line is selected in the program the action is performed for the line onto which you clicked with the right mouse button Note that any actions that modify the position of the PC will cause the call stack to pop all procedure calls until the current procedure call remains on top This is relevant in case the current procedure call is not the top most procedure call and is necessary to secure the consistency of the call stack Modification of the PC can happen as well directly as described above or indirectly by e g inserting a program line above the PC in the current procedure body o D 2 Q a
234. d DM for deformable matching Parameter Name SBM CBM DBM DM Contrast High Low page 270 x o x x Min Component Size page 272 x o o o Pyramid Levels page 272 X xX o X Starting Angle page 273 x x o x Angle Extent page 273 x x o x Min Max Angle page 275 o o x o Min Max Row Scale page 273 x o o x Min Max Column Scale page 273 x o o x Min Max Scale page 275 o o x o Model Type page 272 o o o xX Detector Type page 274 o o x o Radius page 274 o o x o Min Score page 275 o o xX o Fern Depth page 275 o o x o Fern Number page 275 o o X o Gradient Sigma page 274 o o x o Gradient Mask Size page 274 o o x o Threshold page 274 o o xX o 7 3 3 Matching Assistant Reference 269 Read more about setting advanced parameters page 275 The following table gives you an overview over the available advanced model parameters for each match ing method The abbreviations used are SBM for shape based matching CBM for correlation based matching DBM for descriptor based matching and DM for deformable matching Parameter Name SBM CBM DBM DM Angle Step page 276 xX x o x Row Column Scale Step page 277 x o o x Metric page 277 X xX o xX Optimization page 278 X o o X Pregenerate Shape Model page 278 x o o o Min Contrast page 279 x o o x Check Neighbor page 279 o o xX o Neighbor Diff Threshold page 279 o o x o Subpixel page 279 o o xX o Patch Size page 280 o o xX o Tilt page 2
235. d from three selected images It is a self contained HDevelop program that runs without alteration Code generated by Image Acquisition 01 ImageFiles ImageFiles 0 C Program Files MVTec HALCON images fin1 png ImageFiles 1 C Program Files MVTec HALCON images fin2 png ImageFiles 2 C Program Files MVTec HALCON images fin3 png for Index 0 to ImageFiles 1 by 1 read_image Image ImageFiles Index Do something endfor 28 Acquiring Images with HDevelop 3 3 2 Acquiring Images Through Image Acquisition Interfaces Select Image Acquisition Interface in the Source tab The drop down list below the radio button becomes active Initially 1t lists all image acquisition interfaces supported by HALCON You can tidy this list by clicking the button Detect HDevelop will then probe all the image acquisition interfaces and remove those that do not respond Probing the interfaces might cause the system to hang due to erroneously installed drivers or hardware failures If there are unsaved changes in the current program HDevelop will display a warning dialog You are advised to save the changes before you proceed You can also ignore the warning and proceed or abort the operation After the interfaces have been probed you can select the desired image acquisition interface from the list Selecting the entry Help from the menu of the image acquisition assistant will open the online help for the selected image acqui
236. d the corresponding sections of the reference manual To get there quickly select an operator from the menu and click the button Help in the operator window 6 2 6 1 Control Synopsis Select control flow operators Here you may select control structures for the program This involves the execution of a program seg ment henceforth named body depending on a test if ifelse and elseif or comparison switch case and endswitch and the repetition of a program segment for while and repeat with con trolled loop execution break continue Exception handling is implemented with try catch and endtry along with throw for user defined exceptions Furthermore you may stop the program s ex ecution at any position stop or terminate HDevelop exit The operators assign and insert do not influence the execution but serve to specify values for control data assignment The operator comment is used to add a comment that means any sequence of characters to the program Using the operator export_def you can enter special comments that will get uncommented when you export the HDevelop program to another programming language This way arbitrary code may be embedded into HDevelop programs See page 392 for more information The operator return terminates the current o D 2 Q a 0 122 Graphical User Interface procedure call and returns to the calling procedure see section Creating Procedures on pa
237. d their operations A more detailed description of each operator mentioned here is given in the following sections Please note that in all following tables variables and constants have been substituted by letters which indicate allowed data types These letters provide information about possible limitations of the areas of definition The letters and their meaning are listed in table 8 4 Operations on these symbols can only be applied to parameters of the indicated type or to expressions that return a result of the indicated type The symbol names i a 1 and s can denote atomic tuples tuples of length 1 as well as tuples with arbitrary length Operations are normally described assuming atomic tuples If the tuple contains more than one element most operators work as follows o te iv te c l 344 HDevelop Language Symbol Types i integer arithmetic that is integer or real boolean s string v all types atomic ct all types tuple Table 8 4 Symbols for the operation description Input Result 5 5 25 5 5 25 1 2 3 2 2 4 6 1 2 3 2 1 10 12 1 14 2 16 3 1 2 3 1 2 3 1 4 9 1 2 3 1 2 runtime error Text1 Text2 TextiText2 17 3 2173 Text 3 1 2 Text 6 2 3 1 2 Text 3 1 2 Text runtime error 25 1 Text 3 1 2 Text 3 12 Text Table 8 5 Examples for arithmetic operations
238. ded for continuous acquisition Variable Names This section defines the variable names that are used in the generated code Connection Handle Variable storing the acquisition handle The image acquisition interface is ac cessed by this name Set to AcqHandle in the example below Image Object Variable used for the acquired images Set to Image in the example below The following variables have to be specified if Source is set to Image File s and multiple files are specified Loop Counter Variable storing the loop index Image Files Variable for storing the image names as a tuple 230 HDevelop Assistants Generate the Code Insert Code The actual code is inserted at the IC Example Code Code generated by Image Acquisition 01 open_framegrabber GigEVision 1 1 0 0 0 0 progressive 8 gray 1 false default 003053095003_Basler_scA160014gc 0 1 AcqHandle grab_image_start AcqHandle 1 while true grab_image_async Image AcqHandle 1 Do something endwhile close_framegrabber AcqHandle 7 1 6 Menu Bar Menus File Code Generation Help For the description of the corresponding menu entries see section 7 on page 224 Menu Calibration Connect Connect disconnect the selected image acquisition device See section 7 1 2 on page 226 Snap Acquire a single image See section 7 1 2 on page 226 Live Acquire images in live mode See section 7 1 2 on page 226 7 2 Ca
239. defined Select Individual Parameters for Calibration After having decided on your calibration task proceed with the details about your Calibration Plate Calibration Plate Parameters First choose the description file for your calibration plate and the calibration plate Thickness in mm The description file consists of the size of the plate and you have to choose a filename ending with _old if you are using an old plate without a black triangle in one of the edges you can update your plate by drawing the triangle in one of the edges With the parameter Thickness you can modify the position of the world coordinate system and the measurement plane which is located beneath the calibration plate surface by the value of Thickness in the Reference Image page 237 Then proceed to set the Camera Parameters Set Camera Parameters For setting up the camera parameters 234 HDevelop Assistants e first choose the Camera Model e then set the parameters for a full calibration or e set the parameters for a user defined calibration It is also possible to import parameters from a file If you should decide to do this just click the Import Parameters button Once you have finished this last part of the Setup tab proceed to the Calibration tab Choose your Camera Model First choose the Camera Model you are using e either Area Scan Division e Area Scan Polynomial e orLine Scan Even
240. der to be included in the model e the Model Type page 272 which allows you to choose the type for the deformable matching model e the number of Pyramid Levels page 272 on which the model is created e the Starting Angle page 273 of the allowed range of rotation e the allowed range of rotation Angle Extent page 273 and e the scale range page 273 For descriptor based matching the following parameters can be specified e the Detector Type page 274 e theMin Score page 275 e the Fern Depth page 275 e the Fern Number page 275 e theMin AngleandMax Angle page 275 and e theMin ScaleandMax Scale page 275 If you want to reset all of the model and search parameters you can do this via the Reset Model button in the toolbar Note that due to performance reasons viewing the effect of your adaptions of the shape based matching parameters Contrast Low Contrast High and Min Component Size will only immediately be possible if the model image is small and if it is not too noisy The reason for this is that changes in those parameters lead to a new calculation of the model For other images the system will wait until the changes are loaded instead of blocking the graphical user interface This enables you to finish your adaptions of the model parameters without having to wait In most applications specifying the standard parameters will already suffice Therefore you can directly test the model page 255 n
241. dialog Display Font that opens when clicking on the font button to choose the font as well as further font settings for the text that is read Several display functions can be turned on and off If activated e Symbol Regions displays symbol regions e Text displays the text that is read e Bounding Boxes displays a bounding box for each character and e Shadows adds shadows to the displayed read text to enhance its visibility 7 5 5 4 Results The Results section consists of two windows The first one shows the active ROI and also lets you choose between the different ROIs so you can view their results The results of each ROI are displayed in the text field below Colums will be displayed according to the features chosen in Feature Selection 328 HDevelop Assistants 7 5 6 Code Generation Code Generation produces the code that is necessary to perform the chosen OCR tasks within an HDevelop program On the Code Generation tab you can choose between several options and change parameter names which has a direct effect on the code that is generated Under General Options you can decide on the Generation Mode on the Alignment Method and whether code from the Image Acquisition Assistant should be integrated into the generated code You can furthermore change variable names and see a preview of the code that will be generated in Code Preview Once you are finished changing parameters click the Insert Code button under on the right sid
242. displays the HDevelop program code of a single procedure You can open multiple program windows to view different procedures or different parts of the same procedure at the same time see Menu Window gt Open Program Listing page 128 To switch between selected procedures rapidly program windows support multiple tabs The program window see figure 6 38 is divided into three areas e The main part of the program window contains the program code of the current HDevelop proce dure See section 6 4 2 e The column at the left side displays line numbers It also contains the PC the IC and optionally one or more breakpoints Furthermore bookmarked lines and warning indicators are displayed See section 6 4 3 on page 146 e At the top the displayed procedure can be selected from the drop down list If you hold down while selecting a procedure it will be displayed in a new tab card The arrow buttons provide convenient access to previously displayed procedures For example if the current procedure is the main procedure and you select another procedure from the drop down list the left arrow button takes you back to the main procedure When you get there the right arrow button moves forward and displays the previously selected procedure again Using the tool bar button to the right of the procedure list the interface of the current procedure and its documentation can be edited 1 e the number of parameters as well as their names and
243. dition gt endfor The for loop is controlled by a start and an end value and an increment value step that determines the number of loop steps These values may also be expressions which are evaluated immediately before the loop is entered The expressions may be of type integer or of type real If all input values are of type integer the loop variable will also be of type integer In all other cases the loop variable will be of type real Please note that the for loop is displayed differently in the program window than entered in the operator window What you enter in the operator window as for start end step index is displayed in the program window as for lt index gt lt start gt to lt end gt by lt step gt endfor To enter both for and endfor at once select the operator for in the operator window and make sure the check box next to the operator is ticked The start value is assigned to the index variable The loop is executed as long as the following conditions are true 1 The step value is positive and the loop index is smaller than or equal to the end value 2 The step value is negative and the loop index is greater than or equal to the end value After a loop cycle the loop index is incremented by the step value and the conditions are evaluated again Thus after executing the following lines for i 1 to 5 by i J 251 endfor i is set to 6 and j is set to 5 while in for i 5 to 1 by 1 jJ i endfor
244. dow If this option is activated the context menu is available when clicking in a graphics window with the right mouse button This behavior may be undesirable if a program provides user interaction with the mouse See also dev_set_preferences g la c i E 2 0 96 Graphical User Interface e Enable the mouse wheel in the Graphics window By default the mouse wheel is used to zoom in and out in the graphics window If this interferes with a custom mouse handling the mouse wheel may be disabled This is desirable e g if 3D objects are displayed in the graphics window and the zooming functionality is implemented with the help of 3D display operators See also dev_set_preferences e Enable tooltip showing coordinates and gray value at the mouse cursor position If enabled a tooltip will be displayed if the mouse cursor is in the graphics window and the key is held down The tooltip shows the pixel coordinates row and column and the gray value s at the mouse cursor position e Record Interactions If enabled changes to the visualization settings will be recorded by adding the corresponding operator calls to the current program See section Record Interactions on page 115 Runtime Settings gt Override Operator Behavior This tab card allows to modify the default behavior of selected operators Click the check box next to the corresponding operator and specify the modificatio
245. dow This editing mode is described in the section Dialog based Editor on page 140 e Full Text Editor Selects the full text editor In this mode text can be freely edited in the program window Double clicking in the program window still sends the corresponding program line to the operator window unless the operator window has been closed This way the full text editor can be used in conjunction with the classical dialog based editing mode This editing mode 1s described in the section Full Text Editor on page 142 Tool tip mode When the mouse cursor rests on a program line a tool tip is displayed by default When placed over an operator name the interface of the corresponding operator and its short description is displayed When placed over an instantiated iconic variable an icon is displayed When placed over the program line column warning messages may be displayed e g if the used operator is deprecated This behavior may be turned off if it disturbs your editing activities e Always Always display a tool tip when the mouse cursor rests on a program line e Only on Control key Display the tool tip only when the key is pressed If the full text editor is selected the following option tweaks its operation e Autocompletion Enables advanced autocompletion in the full text editor This feature is described in the section Full Text Editor on page 142 The value for show after ms defines the delay before the
246. draw colors draw mode line width region shape LUT and paint mode Window geometry Insert operator calls to restore the window size and the visible part 116 Graphical User Interface 6 2 4 19 Update Window Synopsis Specify the update behavior of the active graphics window If the menu entry In Run Mode is checked every object image region or XLD is displayed in the active graphics window during program execution Otherwise the active graphics window is not updated The submenu In Single Step Mode specifies the update behavior when stepping through the pro gram Setting Behavior Always display iconic results Never do not display iconic results Clear and clear graphics window before displaying iconic results Display Last Image and keep displaying the latest image and additional iconic results Display As in Run Mode same behavior as run mode setting 6 2 4 20 Position Precision Synopsis Select the precision of subpixel mouse positions By default mouse positions are displayed as integers precision 0 where the upper left image pixel is displayed as 0 O Increasing the precision results in mouse positions being reported as subpixel precise positions Please note that when subpixel mouse positions are enabled the position 0 0 0 0 refers to the center of the upper left pixel i e the upper left edge of the image is displayed as 0 5 0 5 6 2 4 21 Tools This menu contains several visualization tool
247. ds 386 Code Export 9 2 3 2 Exception Handling In HDevelop every exception normally causes the program to stop and report an error message in a dialog window This might not be useful in CA The standard way to handle this in C is by using the try catch mechanism This allows to access the reason for the exception and to continue accordingly Thus for HDevelop programs containing error handling dev_ set_check give_error the corresponding code is automatically included Every operator call for which it is assumed that the HALCON error mechanism is turned off is enclosed in a try block followed by a catch block The latter handles the exception and assigns the corresponding HALCON error number to the error variable activated by dev_error_var or to a local error variable otherwise Please note that a call of dev_ set_check give_error has no influence on the operator call The exception will always be raised This is also true for messages like H_MSG_FAIL which are not handled as exceptions in C for example 9 2 3 3 Memory Management The NET Framework s runtime environment CLR Common Language Runtime has a mechanism called garbage collector which is used by the CLR to remove no longer needed NET objects from memory As mentioned earlier in the exported C code every iconic object is represented by a NET HObject object From the garbage collector s point of view a NET HObject object is rather small Thus it
248. dure in the program window e Click to edit the interface of the selected procedure e Click the button Password to assign a password to the procedure Then a separate window appears and the new password must be entered twice see figure 6 52 If both times the same password is used clicking OK assigns the password Otherwise an error message is displayed and you have to repeat the password assignment When a protected procedure is finally saved it is stored in a binary format If you set up a password for the main procedure you may optionally lock the entire program i e protect all local procedures with the same password The same mechanism works for library procedures You may either protect the library procedures individually or protect the entire library at once see page 87 If individual local procedures have been password protected before this option will only work if the same password is selected Otherwise you will have to remove all other passwords from local procedures before locking the entire program When you start HDevelop the next time the protected procedure is locked i e when trying to edit the procedure e g by selecting it from the combo box in the program window a corresponding message is displayed in the program window see figure 6 53 Additionally a password button is displayed in the program window Upon entering the correct password the procedure remains unlocked for this session 1 e until you close
249. e Y byte Y int1 Y int2 Y uint2 Select All Pixel Types Flits inte F real Y cydic None Y direction V complex Y vector field Multi Channel Optional Images with an arbitrary number of channels are accepte y Mult Value False Only a single object no object tuple is accepted x Image to the size of which the new window is adapted Description Y adaptprogram ok Cancel Apply Help Figure 6 50 Editing the iconic parameter documentation of a procedure Control Parameter Documentation Field Meaning Semantics Specifies the data class of the parameter For some semantic types addi tional subtypes may be selected Type List Specifies the accepted data types Default Type Mixed Types Default Value Values Value Min Value Max Multi Value Description Specifies the default data type False All values of a tuple have the same type True Values of different types can be mixed in one tuple The entered value is suggested as the default value by HDevelop Comma separated list of suggested values Check Exclusively to re strict the selection to the specified values Minimum value for numeric control data Check Enabled to enforce this setting Maximum value for numeric control data Check Enabled to enforce this setting False The parameter accepts only a single value True The parameter always expects a tuple of values Optional Single values as well as tuple va
250. e 9 1 1 2 Compiling and Linking in Windows Environments The next step is to compile and link this new program In the Windows environment Visual C is used for the compiling and linking Example projects can be found in the directory HALCONEXAMPLES cpp If you want to use HALCON XL you have to include the libraries halconx1 1ib d11 and halconcppx1 lib d11 instead of halcon 1ib d11 and halconcpp 1ib d11 in your project see the Programmer s Guide chapter 13 on page 111 for more details 9 1 1 3 Compiling and Linking in UNIX Environments To compile and link the new program called e g test cpp under UNIX you can use the exam ple makefile which can be found in the directory HALCONEXAMPLES cpp console makefiles by calling make PROG test Alternatively you can set the variable PROG in makefile to test and then just type make You can link the program to the HALCON XL libraries by calling make PROG test XL 1 or just type make XL 1 if you set the variable PROG as described above For more details see the Programmer s Guide chapter 13 on page 111 9 1 2 Optimization 383 9 1 2 Optimization Optimization might be necessary for variables of class HTuple This kind of optimization can either be done in HDevelop or in the generated C code In most cases optimization is not necessary if you program according to the following rules 1 Using the tuple concatenation it is more efficient to extend a tuple at th
251. e reset_preferences reset all persistent settings from previous sessions preferences lt file gt start HDevelop with the preferences from a file override_stop lt time gt override stop operator with wait_seconds time override_wait lt time gt replace time of wait_seconds operator with lt time gt GUI options style lt style gt sets the application GUI style Possible values are o 3 ES lt G E E fe oO 410 Command Line Usage Windows Motif CDE Plastique Cleanlooks X11 options display lt display gt sets the X display default is DISPLAY geometry lt geometry gt sets the client geometry of the first window that is shown graphicssystem fnativelrasterlopengl sets the graphics backend used default native fn font lt font gt defines the application font The font should be specified using an X logical font description bg background lt color gt sets the default background color and an application palette light and dark shades are calculated fglforeground lt color gt sets the default foreground color btn button lt color gt sets the default button color name lt name gt sets the application name title lt app_title gt sets the application title visual TrueColor forces the application to use a TrueColor visual on an 8 bit display ncols lt count gt limits the number of colors allocated in the color cube on an 8 bit display if the application is using
252. e right side like T T New because this can be transformed to T T TupleConcat New in C and requires no creation of a new tuple whereas T New T which is translated into T HTuple New TupleConcat T would need the creation of a new tuple 2 Another good way to modify a tuple is the operator assign_at see section 8 5 2 on page 345 In this case HDevelop code like T i New can directly be translated into the efficient and similar looking code T i New 9 1 3 Used Classes There are only two classes that are used HTuple for control parameters and HObject for iconic data There is no need for other classes as long as the program has the same functionality as in HDevelop When editing a generated program you are free to use any of the classes of HALCON C to extend the functionality 9 1 4 Limitations and Troubleshooting Besides the restrictions mentioned in this section and in section 9 6 on page 392 please also check the description of the HDevelop operators in section 6 2 6 2 on page 123 384 Code Export 9 1 4 1 Exception Handling In HDevelop every exception normally causes the program to stop and report an error message in a dialog window This might not be useful in C The standard way to handle this in C is by using the try catch mechanism This allows to access the reason for the exception and to continue accordingly HDevelop supports exception handling us
253. e gt Close Dialog or the X in the topright corner of the window the current settings are stored for the duration of the current HDevelop session That is as long as you do not exit HDevelop you can again open the Measure Assistant with the same settings In contrast to this when you exit the Measure Assistant the settings are lost also for the current HDevelop session Exit Assistant When you exit the Measure Assistant with the menu item File gt Exit Assistant the assistant s dialog is closed and the current settings are lost unless you have stored them via the menu item File gt Save Current Assistant Settings If you want to close the dialog but keep its settings for the current HDevelop session you should use the menu item Close Dialog instead 7 4 6 2 The Menu Measuring Via the menu Measuring you can e draw a linear ROI e draw a circular ROI e view the line profile page 210 e delete a selected ROI items e delete all ROIs e load a ROI from file and e save a ROI to file Draw Line To create a linear ROL select the menu item Measuring gt Draw Line also accessible as tool bar button For more information about how to draw a linear ROI please refer to the section Create ROI page 295 You can also check the ROI data via the tool bar button View ROI Data read more about ROI data in the section Create ROI page 295 Draw Circular Arc To create a circular ROI select the me
254. e the coordinate system by adapting the parameter Thickness The star on the left side of the Calibration window indicates the reference image It is by default set on the first image You can however by clicking the Set Reference button pick another image as reference Calibrating 238 HDevelop Assistants Figure 7 2 Calibration plate image with coordinate system Click the button Calibrate to finally perform the calibration task You should however check first whether you have 10 to 20 images that are of sufficient quality You can check the quality under Quality Issues page 239 If necessary you can also change Calibration Plate Extraction Parameters page 243 before actually calibrating In case your calibration fails and displays the er ror Camera calibration did not converge check possible error sources in the Checklist for Calibration Errors page 239 7 2 2 How to Calibrate with the Calibration Assistant Possible Error Source Solution Did any camera settings like aperture focus or pose of the camera change during the cali bration process Take new calibration images and do not change any settings during calibration and later during the application If you decide to change any thing you have to start a new calibration Did you acquire the calibration images the way they are required Check if you have acquired 10 to 20 images 1f the calibration plate has been positioned ev erywh
255. e 162 The same password is applied to all selected procedures If you move procedures from the second to the third column the corresponding procedures will be locked i e the procedure interfaces can no longer be edited and the procedure bodies will no longer be displayed They can only be accessed if the correct password is supplied This can either be done from this dialog by simply moving the corresponding procedures back to the middle column and entering the password Or you can unlock procedures individually from the program window as described in section 6 4 9 on page 163 If you select multiple procedures in the third column and move them to the left a password dialog appears to unlock the procedures Only those procedures are moved and thus unlocked that match the supplied password This way you can conveniently edit a group of procedures that share the same password 6 2 2 Menu Edit 89 Directories External Procedures Manage Procedure Libraries Manage Passwords ProcedureUse Ur gt Unprotected Procedures Unlocked Protected Procedures Locked Protected Procedures A dev_display_shape_matchinc dev_open_window_fit_image dev_open_window_fit_size dev_resize_window_fit_imag dev_resize_window_fit_size gt gt dev_update_off dev_update_on disp_3d_coord_system disp_continue_message disp_message gen_arrow_contour_xld init init init init init list_image_files El local_a d
256. e 215 to edit the training file and the Sample Inspection Window page 216 to inspect and edit samples Save changes e g via File gt Save Training File Use the training file within an OCR application or continue to prepare an application with the OCR assistant page 312 Note that all actions can be undone redone by selecting Undo or Redo in the menu Edit to reverse or repeat changes respectively 6 14 3 Actions within the Training File Browser The following sections describe how to manipulate different levels of training data namely training files symbols and samples page 219 g la c i E 2 5 0 218 Graphical User Interface 6 14 3 1 Training Files The Training File Window page 215 provides the following options for editing training files e Open Close training files When opening the OCR Training File Browser via the OCR Assistant page 312 the current training file is automatically loaded Otherwise training files can be loaded or closed via the corresponding entries in the menu item File or via the corresponding toolbar buttons e Create training files Training files can be created via the entry New Training File in the menu File or via the corresponding toolbar button 6 14 3 2 Symbols The Training File Window page 215 provides the following options for editing symbols e Add a symbol To add a new symbol to a training file e press the toolbar button Add s
257. e General Options gt General Options 6 2 1 5 Open Procedure for Editing Synopsis Load an existing external procedure or library From the file selection dialog page 221 an arbitrary external procedure or library can be selected for editing If a library is selected all included procedures are loaded for editing Procedures opened through this dialog need not be part of the configured procedure locations section Procedure Locations on page 47 6 2 1 Menu File 57 6 2 1 6 Close Procedure Synopsis Close an HDevelop procedure 6 2 1 7 Close all Procedures Synopsis Close all HDevelop procedures 6 2 1 8 Insert Program Synopsis Insert parts of another HDevelop program into the current program Selecting an entry in this submenu opens a file selection dialog page 221 for the selection of an HDe velop program Insert All Synopsis Insert a complete HDevelop program into the current program The main procedure of the selected program is inserted at the IC All local procedures of the selected program are added to the current program If the names of inserted local procedures clash with those of existing local procedures the former are renamed by appending the suffix _COPY_1 or _COPY_2 _COPY_3 for subsequent insertions Note that inserted local procedures will conceal loaded external procedures with the same name i e calls to the now hidden external procedures will have to be adapted
258. e HALCON modules used by the current program Modules marked with a lit bulb are used This window allows you to get an estimate of how many modules your appli cation will need in a runtime license Please refer to the Installation Guide for more information about modules and runtime licenses See figure 6 7 for the corresponding dialog of an OCR example Check only used procedures If checked only used procedures are considered for the evaluation of the used modules Otherwise all procedures are considered Copy to Clipboard Copy the names of the used modules to the system clipboard This way the list can be easily pasted into other applications 6 2 1 Menu File 65 6 2 1 17 Print Synopsis Print the current program or selected procedures Shortcut The print dialog is displayed in figure 6 8 F Print Name teeters Print Range O Program Current Procedure Selection External Procedures Procedure Options y Print Procedures O Used Local Procedures All Local Procedures V Used External Procedures Only Procedure Interface Figure 6 8 Print Print Range Program Complete program including all procedures Current Procedure Current procedure and its used procedures Selection Highlighted program lines and their used procedures External Procedures All external procedures Procedure Options Print Procedures Define whether procedures are printed or not e Used Local Procedures print onl
259. e a eS 385 923 Limitations and Troubleshooting 0 0 45 5 058 ee eee eS 385 9 3 Code Generation for Visual Basic NET HALCON NET 386 231 Basie Sps IEA 93 2 Protan SUBO o A a ee 9 3 3 Limitations and Troubleshooting o ooo e 9 4 Code Generation for Visual Basic 6 HALCON COM 0 4 Sal Basie See ecos hae ba ek be eds a be Bes 4342 Program SOCIE oe 6 65 RE Eee RE OR E es 9 4 3 Limitations and Troubleshooting e 85 Cale GeneratientorLl ocak opie arder ew REE See OE Gol Mase Seis ee 26k PERE ew SEP EER Shee SESS 2d eA 96 General Aspects of Code Generation c oe oe eR eR e e 9 6 1 Arbitrary Programi Code 4024s he eee ee Ee ee J02 SSIOMMIENE eo as a Re ad ae we 9 6 3 Variable Names 002 506 44 4 064 68 bd ee PA bee ee ea eee Di Tor LOOPS a recre pepa o BE ee ee ae ee EE SoS Protected Procedures eosa 405 4 8 ee AA RE E R Soe System Parameters 56 2264 E E e Oh ES Read oe ag ees OOS Graphics WIndows pe Loss be be ok ee RH ee aE GO 10 Miscellaneous 10 1 Keyboard Shorteuts ea sa 266 hoa ee ea eda eee a hee aes IGA Mevelep serenor a sea SS BADER SEES Owe EE EEG ER se 10 1 2 Program Listing 644 6 tee ee A eg aes 101 2 Help Window 0 2404 ba 50s eS REEDS EE Se eS ILLA Grophics Window cae Ae ee ee ee eee EE eed DELS Varia Wie pect xs os oS Pad DAA ES de 4 10 1 6 OCR Training File Browser 6 6 4 5 668 bee Re Re eS Pee lie Help a is hk RR bE hay ee e
260. e as HALCON operator interfaces that is they may contain parameters of the four categories iconic input iconic output control input and control output in this order The procedure interface dialog contains four separate areas where the different parameters types may be edited Each area contains a button for appending new parameters to the parameter list When creating a new procedure from selected program lines HDevelop automatically determines suit able interface parameters for the procedure from the usage of the variables in the selected code The combo box Selection Scheme determines the suggestion of the procedure parameters The meaning of this selection is as follows First In Ifthe first use of a variable inside the selected lines is as an input variable it will be suggested as an input parameter of the procedure Last Out Ifthe last use of a variable inside the selected lines is as an output variable it will be sug gested as an output parameter of the procedure 6 4 5 Creating Procedures 153 i X Create Procedure Parameter Elm Documentation English en_US General Documentation General Settings Selection Scheme First In All Out E Iconic Parameters lalo E Image aye E E Control Parameters Move Down les ImageFile E E Pointer Type Width Height WindowHandle E V Replace selected program lines Cox Cancel l Apply Help Figure 6
261. e based matching e correlation based matching e descriptor based matching and e deformable matching For basic information on these matching methods and how to choose a suitable method for your appli cation please refer to the section Select a Matching Method page 254 or for more detailed information refer to the Solution Guide on Matching These matching methods that are available within the Matching Assistant let you locate objects with subpixel accuracy at a high speed even when they appear rotated partly occluded or under changing illumination Using the Matching Assistant you can e configure page 268 and test the matching process page 255 with a few mouse clicks and e optimize the parameters interactively to get the maximum matching speed page 289 and recog nition rate All you need is a single model image and a set of test images The Matching Assistant further assists you by automatically calculating suitable parameter values based on your selections How to use the Matching Assistant is described here page 254 A reference to the elements of the Matching Assistant can be found here page 261 In this online help the following special terms are used Matching Matching is the process of locating an object described by a model in an image The results of the matching process are the position and orientation of the object and the matching score e Shape Based Matching The shape based matching describes the model b
262. e current setup of the assistant If the program already contains generated code which is linked to the current assistant the changed code lines can be compared side by side in the preview 7 1 Image Acquisition Assistant 225 7 1 Image Acquisition Assistant The image acquisition assistant is an easy to use front end to the various image acquisition methods supported by HALCON Firstly 1t lets you read images from the file system selected files or whole directories More importantly it supports acquiring images from image acquisition devices that are sup ported by HALCON s image acquisition interfaces When an image acquisition interface is selected the corresponding device parameters e g the image format can be set After establishing a connection to the selected image acquisition interface images can be grabbed and displayed in the active graphics window Using live images the parameters supported by the selected interface can be explored interactively When a suitable setup is achieved the settings of the assistant can be saved for later reuse The assistant can also be instructed to generate HDevelop code that will connect to the selected image acquisition interface set the specified parameters and grab images 7 1 1 Tab Source Synopsis Select from where to acquire images Image File s Activate this radio button to load images from files You can enter the names of image files in the text field Multiple file names
263. e eee 4 bes VAS Em rsencr Backiip 2 5 65 eee 4 A ER EE A RRS ae Re es A Glossary B Command Line Usage Index 411 Introducing HDevelop 11 c O El 3 le La E Chapter 1 Introducing HDevelop HDevelop is a tool box for building machine vision applications It facilitates rapid prototyping by offering a highly interactive programming environment for developing and testing machine vision ap plications Based on the HALCON library it is a versatile machine vision package suitable for product development research and education There are four basic ways to develop image analysis applications using HDevelop e Rapid prototyping in the interactive environment HDevelop You can use HDevelop to find the optimal operators or parameters to solve your image analysis task and then build the application using various programming languages e g C C C Visual Basic NET or Delphi e Development of an application that runs within HDevelop Using HDevelop you can also develop a complete image analysis application and run it within the HDevelop environment The example programs supplied with HDevelop can be used as building blocks for your own applications e Execution of HDevelop programs or procedures using HDevEngine You can directly execute HDevelop programs or procedures from an application written in C or any language that can integrate NET or COM objects using HDevEngine This is described in detail in
264. e file it is recommended to click No and save your program under a different name using Save Program As 6 2 1 10 Save Program As Synopsis Save the current HDevelop program to a new file Shortcut Ctri Shift S A file selection dialog page 221 is opened You can specify a new file name and optionally a file format see section File Types on page 46 and save the current program under that name The new file name becomes the default name of the current program so that subsequent Save operations will use that name instead of the old The file name of the program you save is added to the menu Recent Programs 6 2 1 Menu File 59 6 2 1 11 Save Procedure As Synopsis Save the current procedure as an external procedure or as a stand alone HDevelop program Shortcut ctrl Shift P s or Ctrl Shift P Cul Shift S Using this menu entry you can save the currently selected procedure as an external procedure or an HDevelop program A file selection dialog page 221 is opened where you can select the file type see also section File Types on page 46 e HDevelop procedures hdvp or dvp The procedure is saved as an external procedure If the target directory is not already configured in the external procedure directories see Menu Edit gt Preferences Directories page 82 HDevelop will suggest adding the directory to the list An example dialog is displayed in figure 6 4 If you click No H
265. e gray histogram window the adaptation of these values depends on the selected adaptation mode which can be set independently for horizontal and vertical ranges adaptive In this mode the upper and lower boundary of the displayed gray values will always be adapted when a new image is displayed The maximum and minimum value for the threshold bars green and red are also fixed to the maximum gray value of the type of image currently displayed Note that if you are using 8 bit and 16 bit images in a mixed mode the histogram will constantly be reset Thus it is not possible to display a 16 bit image set thresholds then display an 8 bit image and keep the threshold values of the 16 bit image increasing In this mode only the upper boundary of the displayed gray values will be adapted and it will only increase but never decrease This for instance is useful when first inspecting 8 bit images but then switching to 16 bit images In this situation the histogram will simply display the 16 bit gray value range after displaying the first 16 bit image In this mode the minimum and maximum value of the threshold bars are not limited to the currently displayed image type The reason is simple This mode allows to inspect images of a different data type with the same threshold values If the values were always limited the histogram would forget the values like in the adaptive mode fixed In this mode the boundaries are not adapted automat
266. e histogram of the image within that region will be com W Gray Histogram Image LeoJLo Jess Y Input Window Active y Output Window Input linear display iz Es 3 logarithmic display Z 50000 Zoom 19 40000 fit display to vertical lines t 30000 E o Detras reset view d 20000 reset height E 10000 reset width a an a a oe el force minimum histogram width 4 te 5 100 255 operation stack EX Threshold 1 0 o Insert Code none y Connection Histogram Options A Output Color Draw Line Width visualization in graphics window 7 Q colored 3 y I iil vii 2 Statistics Figure 6 78 Gray Histogram o D 2 Q a 0 200 Graphical User Interface puted and shown If you click into a part of the image that is not contained in any of the overlaid regions the histogram of the entire image will be displayed e The same mechanism is used for regions that have gray value information e g image objects created by reduce_domain or add_channels Here the histogram of the image object you click into will be displayed Freeze Gray Histogram Sometimes it is desirable to suppress the updating of the histogram when new image data is available e g if you want to select thresholds for a gradient image but want to visualize the original image along with the segmentation see below In that case you
267. e loaded image is reported e The output variable Clip is created and displayed in the variable window e The operator window is cleared and ready for the insertion of the next operator 4 4 Getting Help You may be wondering where the clip image was loaded from since we did not specify any path or even a file extension This is a detail that is related to the way the HALCON operator read_image works HDevelop does not know anything about it It just executes the operator with the parameters you supply Accessing the operator documentation from within HDevelop is very easy Double click the first program line in the program window The operator is displayed in the operator win dow for editing Now click Help to open the HDevelop online help window It will automatically jump to the documentation of the displayed operator see figure 4 4 The reference manual is completely cross linked The navigation at the left part of the window provides quick access to the documentation The to f E E o o fo a 36 Programming HDevelop a RK HDevelop Help read_image HALCON Operator Reference Version 11 0 Es O ee Contents operators 1P E gt AA O E ste Hoeve Y Fin 4 Parti General I Chapter 1 B Chapter 2 P Chapter 3 T Part 2 Program Part 3 Program Part 4 Program Operators Part 5 Program Part 6 Using HD H Solution Guides read_image Operator 4 Reference Manuals 4 HA
268. e of the General Options dialog to generate the code Finally integrate the code into your HDevelop program 7 5 6 1 General Options In this dialog you can select the Generation Mode and the Alignment Method if required Generation Mode lets you select the task for which the code is generated 1 e e Text Reading or e OCR Classifier Training You can also enable alignment if it is needed for your application i e if you want to use it to align the ROIs To learn more about this setting please refer to the description in the section Alignment Activate Initialize Acquisition if you have previously used the Image Acquisition Assistant page 225 to acquire images and want to integrate the generated code from this assistant in your code Such an automatic integration of code results e g in the automatic opening of the framegrabber if Image Acquisition Assistant is activated If code for image acquisition already exist the checkboxes should be deactivated If Image Acquisition Assistant is not in use Initialize Acquisition is grayed out Alignment If the characters in your image can appear shifted or rotated an alignment which can be chosen on the Code Generation tab under Alignment Method is necessary An alignment allows you to automat ically relocate your ROI in an image where the object occurs in a different position Note however that the OCR Assistant does not perform the alignment by itself but only generates c
269. e samples in the Sample Inspection Window page 216 They can then be copied to e another symbol in the same training file or e another symbol in a different training file in the Training File Window page 215 This can be achieved by using g la c i E 2 5 0 e drag and drop while keeping the Shift button pressed e using the Copy and Paste buttons in the toolbar or e selecting the corresponding buttons in the menu Edit 220 Graphical User Interface e Move a sample Select one or more samples in the Sample Inspection Window page 216 They can then be moved to e another symbol in the same training file or e another symbol in a different training file in the Training File Window page 215 via drag and drop e Delete a sample Select one or more samples in the Sample Inspection Window page 216 They can then be deleted if necessary e by pressing the Del button on your keyboard or e via the menu entry Edit gt Delete Check samples for correct classification e The following actions describe how to improve the quality of a training file e Sort the samples by Correctness to see whether the correct symbol class was assigned If Correctness is true the value of Read Symbol is identical to the value of Symbol and thus the correct class was assigned Otherwise the column is marked in red so that samples that do not belong to the symbol can easily be detected e Use the checkbox Dis
270. e the Matching Assistant of HDevelop 255 The following table provides some information which matching method is recommended under which circumstances For more information on matching methods and recommendations please refer to the Solution Guide on Matching The abbreviations used are SBM for shape based matching CBM for correlation based matching DBM for descriptor based matching and DM for deformable matching Restrictions SBM CBM DBM DM 2D object xX xX o xX 3D object o o x o Camera is perpendicular to object x x o x Camera is not perpendicular to object o o x o Scaling is needed xX o o o Object is colored partially occluded image contains clutter x o o o Object is characterized by specific texture o x o o Images are highly defocused o x o o Local deformation of the object is expected rectification or informa 0 o o x tion about deformations needed 7 3 2 2 Creating the Model A model page 253 is created in three steps e Load the so called model image page 253 via the menu item File gt Load Model Image page 262 or the corresponding button and text field under Model and Model Source inside the tab Creation e Create an ROI page 253 around the object either via the menu item ROI page 264 or via the corresponding buttons inside the tab Creation e Specify standard and advanced model parameter values that are available for your matching method in the tab Parameters page 268 Alternatively you can load a
271. e the consistency of the program code The search scope can be specified as follows e All Search the main procedure all local and all external procedures e Program Search the main procedure and all used procedures e Current Procedure Search the current procedure only Please note that locked procedures are not searched see section Protected Procedures on page 49 o D 2 Q a 0 70 Graphical User Interface The following parameters specify how the search is performed e Case Sensitive By default the case of the search text is ignored thus searching for image will find Image or IMAGE as well Check this box to make the search case sensitive e Whole Words By default program lines are matched even if the search text is only part of a word thus an operator search for grab_image also matches operator calls to grab_image_async or grab_image_start Check this box to find only exact matches e Backward Check this box to reverse the search direction Finding Single Occurrences of the Search Text Enter the search text and click Find If there is no match the text field will blink shortly Otherwise the first matching program line in the current procedure is highlighted Each subsequent click of Find highlights the next matching program line If the last matching line of the current scope has been reached the text field blinks shortly The next click on Find starts over a
272. e to specify standard model param eters page 269 Choosing a calibration source Available for Descriptor based matching and Deformable Match ing Using the dialog Calibration Source within the tab Creation you can choose the source of your calibration data if you want to use it for your matching application or start a new calibration to gain calibration data with the Calibration Assistant page 230 In this dialog you can choose between e None no calibration data is used e Loading Calibration Files files that end with cal or dat and e using the Calibration Assistant page 230 which allows you to conveniently perform a calibration by guiding you step by step through the calibration process HDevelop Assistants Once you are finished with setting parameters in this section continue to specify standard model param eters page 269 7 3 3 4 The Tab Parameters and the Corresponding Entries in the Menu Parameters The Matching Assistant allows you to adapt e standard parameters as well as e advanced parameters for your matching application Depending on the matching method different parameters are available for adaption Read more about setting standard parameters The following table gives you an overview over the available standard model parameters for each match ing method The abbreviations used are SBM for shape based matching CBM for correlation based matching DBM for descriptor based matching an
273. e type of the parameter where it was used for the first time Variables that correspond to an iconic object parameter create an iconic variable variables for a control parameter create a control variable Every time an operator or procedure call is executed the results are stored in variables connected to its output parameters This is achieved by first deleting the contents of the variable and then assigning the new value to it The variable window is similar to a watch window used in window oriented debuggers Inside this window you are able to keep track of variable values Corresponding to the two variable types there are two areas in the variable window One for iconic data above or left and the other for control data below or right All computed variables are displayed showing their iconic or control values unless the automatic update has been switched off see section Runtime Settings gt Runtime Settings on page 95 In case of a tuple result which is too long the tuple presentation is shortened indicated by three dots In this 6 6 1 Iconic Variables 173 case the full content of a variable can be displayed in an inspection window by double clicking the value list See also the following sections Switching Between Horizontal and Vertical Layout You can toggle the orientation of the two parts of the variable window To do this double click the dividing line between both parts You can also drag that line to resize t
274. e_atan arc tangent2 atan2 al a2 tuple_atan2 o te iv te c l HDevelop Language hyperbolic sine sinh a tuple_sinh hyperbolic cosine cosh a tuple_cosh hyperbolic tangent tanh a tuple_tanh exponential function exp a tuple_exp natural logarithm log a tuple_log decadic logarithm log10 a tuple_log10 power function pow a1 a2 tuple_pow Idexp function ldexp al a2 tuple_ldexp minimum elementwise minimum maximum elementwise maximum sum function mean value standard deviation cumulative sum median element rank min t min2 t1 t2 max t max2 t1 t2 sum t mean a deviation a cumul a median a select_rank a i tuple_min tuple_min2 tuple_max tuple_max2 tuple_sum tuple_mean tuple_deviation tuple_cumul tuple_median tuple_select_rank square root sqrt a tuple_sqrt radians to degrees deg a tuple_deg degrees to radians rad a tuple_rad integer to real real a tuple_real real to integer int a tuple_int real to integer round a tuple_round absolute value abs a tuple_abs floating absolute value fabs a tuple_fabs ceiling function ceil a tuple_ceil floor function floor a tuple_floor fractional part fmod al a2 tuple_fmod elementwise sign sgn a tuple_sgn sort elements sort t tuple_sort 8 9 Summary of HDevelop operations 375 sort elements returns index reverse element order test for numeric value string to number environment vari
275. ecked these suggestions are extended so that they also include suggestions of variables with a different semantic type Show memory usage If this option is activated the internal temporary memory usage of the last operator or procedure call is displayed in the status bar Suppress checksum in HDevelop programs By default HDevelop stores a checksum inside the saved program files If you manage your HDevelop programs using revision control software this ever changing number will most certainly interfere with the tracking of changes Therefore the checksum may be suppressed altogether Please note that programs without a checksum cannot be loaded in the demo version of HDevelop o D 2 Q a O 94 Graphical User Interface Visualization Settings gt Pen LUT Paint The tab cards in this category define the default visualization settings for graphics windows when HDe velop is started See the description of Set Parameters on page 108 The dialog is displayed in figure 6 22 Pen tut Paint Draw o fill margin Shape original Y Line Width 1 Colors A Custom colors alv A colored 6 ANA gt colored 12 H black l white gt HB red E green BB blue dim gray gray light gray w cyan B magenta q Mm yellow Lite medium slate blue 8 coral E diate blue Figure 6 22 Visualization Settings gt Visualization Parameters
276. ect always appears in the same position or the intent is to find the object location by measuring You can now continue to change variable names page 300 if necessary or preview the generated code page 300 before inserting it into your HDevelop program 7 4 6 Measure Assistant Reference The Measure Assistant consists of the following elements Pull down menus e File e Measuring page 309 e Code Generation page 335 e Help page 311 Tool bar with a selection of important buttons e Load Assistant Settings page 308 e Save Current Assistant Settings page 309 e Insert Code page 310 e Load Image e Snap e Live 7 4 6 Measure Assistant Reference 307 e Draw Line page 309 e Draw Circular Arc page 309 e Line Profile page 210 e View ROI Data page 309 e Delete Selected ROI Item page 310 e Delete All ROIs page 310 e Help page 311 Tabs with the dialogs for most of the tasks that can be performed with the Measure Assistant e Input page 311 e Edges page 311 e Fuzzy page 334 e Results page 312 e Code Generation page 312 Furthermore it provides a status bar at the bottom in which messages are displayed Please note that the status bar does not provide a scrolling mechanism if the displayed message is to long move the mouse over it so that a tool tip displaying the full message pops up Alternatively 1f the message is only slighly larger than the status bar you can also drag the left or right
277. ed 9 4 2 1 Arrays If a single value is inserted into a Variant array a special subroutine is called to ensure that the index is valid If the array is too small it is resized 390 Code Export 9 4 2 2 Expressions All parameter expressions inside HDevelop are translated into expressions based on the HALCON tuple operators Therefore an expression might look somewhat complex In many cases these expressions can be changed to simple Visual Basic expressions For example TupleSub becomes a simple subtraction To ensure that the exported program has the same effect in Visual Basic this exchange is not applied automatically because the semantics are not always identical 9 4 2 3 Stop The HDevelop operator stop is translated into a subroutine in Visual Basic that creates a message box This message box causes the program to halt until the button is pressed 9 4 2 4 Exit The HDevelop operator exit is translated into the Visual Basic routine End Because this routine has no parameter the parameters of exit are suppressed 9 4 2 5 Used Classes There are only six classes types that are used Variant for control parameters and HUntypedObjectX for iconic data In addition there is the container class HTupleX which comprises all operators of HAL CON processing tuples in this case the data type Variant Then there are the classes HWindowXCtr1 and its low level content HWindowX HWindowXCtrl is used inside the project for the outp
278. ed gray value edges due to e g reflections on the surface gt Fuzzy Measure page 301 Fuzzy Score The so called fuzzy score is part of fuzzy measuring and describes an evaluation of the quality of an edge It is more than just an edge amplitude because it is the reasult of specifying different criteria and areas for edges as well as a tolerance The score is calculated as a median value A good edge is completely within a previously specified area for fuzzy measuring and has a fuzzy score of 1 If an edge is on the border of a fuzzy measure area the Fuzzy Score describes how far the edge is still on the good side The value can range from 0 to 1 Tolerances can be defined by the user gt Fuzzy Score page 302 7 4 2 How to Use the Measure Assistant of HDevelop The Measure Assistant allows you to easily choose the dimensions of an object you need in just a few steps e set up the measure task e extract edges page 296 e if desired calibrate your system to obtain measuring results in world coordinates page 299 7 4 2 How to Use the Measure Assistant of HDevelop 295 7 4 2 1 Set up the measure task It is very easy to set up the measure task with the Measure Assistant e Choose your Image Source on the Input tab by either using the content of the Graphics Window loading an Image File or acquiring the image of an object using the Image Acquisition Assistant e Create an ROI using the buttons Draw Line or Draw Cir
279. ed until the optimum parameters are found You can lower the threshold of acceptance for the recognition rate manually using the corresponding slider or text box at the bottom of the dialog The Matching Assistant then displays the optimal Minimum Score and Greediness and the reached recognition time It automatically enters the parameter values in the dialogs Usage gt Standard Model Use Parameters page 284 and Usage gt Advanced Model Use Parameters page 285 respec tively If a test image can contain more than one object the term recognition rate is ambiguous Therefore you can choose between three recognition modes 290 HDevelop Assistants e In each test image at least one object is expected The recognition rate is calculated as the per centage of test images which fulfill this condition i e it is 100 if in all test images at least one object is found e In each test image as many objects are expected as specified in the parameter Maximum Number of Matches page 285 in the dialog accessed via Usage gt Standard Model Use Parameters page 284 The recognition rate is calculated as the relation of found objects to the sum of ex pected objects over all images i e it is 100 if in all test images at least Maximum Number of Matches objects are found e In each test image as many objects are expected as specified manually page 283 in the dialog Test Images page 281 of the tab Usage The recognition rate
280. edure Shortcut All variables of the current procedure are reset The PC is set back to the line in the calling procedure from which the current procedure was called The calling procedure becomes the current procedure 6 2 3 17 Activate Profiler Synopsis Activate or deactivate the profiler Shortcut Ctrl Shift FF OF Ctrl Shift F Curl Shift F The profiler is described in section Profiler on page 164 o o o d o 2 o a 5 9 6 2 3 18 Profiler Display The entries in this submenu select what is being displayed in the profiler section of the program window The profiler is described in section Profiler on page 164 104 Graphical User Interface 6 2 3 19 Reset Profiler Synopsis Reset profiler data Shortcut ctrl Shift ER Or Ctrl Shift F Ctrl Shift R The profiler is described in section Profiler on page 164 6 2 3 20 Show Runtime Statistics Synopsis Evaluate runtime statistics Shortcut Ctrl Shift F S or Ctrl Shift F Ctrl Shift s The profiler is described in section Profiler on page 164 6 2 4 Menu Visualization 105 6 2 4 Menu Visualization Via this menu you can open or close graphics windows and clear their displays Furthermore you may specify their output behavior during runtime Most functions are also available from the context menu of the graphics windows 6 2 4 1 Open Graphics Window Synopsis Op
281. edure will not be removed from the file system The undo item does not work for the password assignment for procedures see section Protected Proce dures on page 49 To undo the password assignment you either have to remove the password as long as you can edit the procedure or you quit HDevelop without saving the corresponding procedure 6 2 2 2 Redo Ctrl Y Synopsis Revoke undo activities Shortcut This is a quick way to restore the state before the last undo operation The menu action explicitly states the last Undo Ctr1 Z action that will be revoked 6 2 2 Menu Edit 67 6 2 2 3 Cut Synopsis Cut the highlighted program lines in the program window to an internal buffer Shortcut or ShineDel The highlighted program lines are removed from the selected procedure and placed in an internal buffer for later use Additionally for every procedure call the corresponding procedure and all procedures that can be reached from it are copied to the buffer This is necessary in order to obtain a consistent program when pasting procedure call lines to a program in which the corresponding procedures might not exist The highlighted program lines are also copied to the system clipboard 6 2 2 4 Copy Synopsis Copy the highlighted program lines from the program window to an internal buffer Shortcut or The highlighted program lines are copied to an internal buffer without affecting the program Addition ally for every procedu
282. edures body If checked both the declaration and the body of local procedures is exported Otherwise only the declaration is exported Export external procedures body If checked both the declaration and the body of external procedures is exported Otherwise only the declaration is exported Export all referenced external procedures Determines if all referenced i e used external procedures are also exported with the current program External Procedures Destination By default external procedures are exported to a single file Select Separate Files to export external procedures to separate files The file name corresponds to the procedure name while the file extension is derived from the export format Select Separate or Library Files to export external procedures to separate files but keep the files of libraries together in a single file Export only if procedure is newer than export file Export only those proce dures to separate files whose time stamp is newer than the time stamp of the destination file Window Export Specifies the export behavior of HALCON windows Encoding Use HALCON Windows Export as a stand alone project Use Export Template HALCON NET and HALCON COM only Export as a project using the supplied project template Specifies the encoding of exported programs The following options are available g la c i E 2 5 0 62 Graphical User Interface W Read Ima
283. eformable matching This dialog allows you to load camera parameters from file The internal camera parameters include Cell Width Sx and Cell Height Sy in micrometer Focal Length in mm Center Column Cx and Center Row Cy Image Width and Image Height in pixels They also include Kappa in 1 m or instead of Kappa the distortion parameters Radial 2nd Order K1 in 1 m Radial 4th Order K2 in1 m Radial 6th Orderin m Tangential 2nd Order P1 and Tangential 2nd Order P2 in 1 m for the polynomial area scan camera model If you have a line scan camera additionally to the values of the area scan camera division model values for the motion parameters Motion x Vx Motion y Vy and Motion z Vz in micrometer pixel will be returned Loading the Camera Pose for descriptor based matching or deformable matching This dialog allows you to load the camera pose from file The 3D pose of the world coordinate system relative to the camera is described by the external camera parameters X Y and Z in mm and Rotation X Rotation Y and Rotation Z in degrees Loading Assistant Settings If you have saved the settings of a former Matching Assistant session you can load them again by the menu item File gt Load Assistant Settings or via the corresponding button of the tool bar If the settings file refers to a model image file that is no longer available because it has been moved or deleted since you can choose to
284. eger values e g the number of holes 6 11 Feature Histogram Window 207 fe 3 00 4 00 gt E di 2 00 e Ww e Jl Hi k aoa T a E KE Feature Histogram Image Connec O Ea 7 Input Window Output Window W Feature Histogram Image Connec aa 7 Input Window Output Window PA EEN les an 0 79087 Ik 0 80 731 0 50 0 40 a t 0 20 ar 0 00 _ we 0 714 0 760 00 787 0 826 Feature Channel Min Max EY area 2300 3600 EY roundness 0 73165 0 79087 Insert Code AND y none y Histogram Op A Output Color Draw Line Width E magenta y iil gt 1 Statistics F Graphics Window 3600 Feature Histo o Js AI QAQ Brit 50 select objects of similar size F W Graphics Window 3600 Feature Histo amp BRNY aAsS Er a gt AND restrict the selection to round objects Figure 6 79 Combining different features selections g la c i E 2 5 0 208 Graphical User Interface You can influence the calculation of the histogram with the slider Quantization The selected value is used to discretize the horizontal axis Instead of determining the frequency of an exact feature value regions with feature values falling within discrete intervals are summed Graphical
285. el This button dismisses the dialog Any changes to the interface or the documentation of the edited procedure are lost with the exception of the editing status see section Protected Proce dures on page 49 Apply Applies the changes in the dialog just like pressing OK without closing it Help Displays the documentation of the selected procedure If the documentation is empty the button will be grayed out The newly defined procedure is now available for selection in the operator window The variables that were used to determine the procedure interface parameters are now being offered as input parameters for the procedure call Please note that a return call has been added at the end of the procedure body If you create a procedure from scratch the newly created procedure body will contain only the return operator initially 5 le KR Program Editor Program Editor oe 2 gt mant de 2 init image Image ImageFile Pointer Type Width Height WindowHandle la EAR AEA 1 ImageFile clip read image Image ImageFile z init_image Image get_image pointerl Image Pointer Type Width Height threshold Image Rd dev_close_ window connection Region dev_open window 0 0 Width Height black WindowHandle select shape Conned dev_display Image return Figure 6 45 Resulting new procedure 6 4 6 Editing Procedures The combo box on top of the program
286. elected variable preselected Declared in global variables only List the names and line numbers of the procedures that declare and thus use the selected global variable Click on an entry to jump to the corresponding location in the program window Sort by Name Sort all variables in alphabetical order Sort by Occurence Sort the variables in the same order as they are defined in the program Update Variables Toggle whether variables will be updated during program execution This is the same setting as in the runtime preferences see page 95 Cleanup Delete all unused variables see page 63 Add Variable tab User only This submenu contains a list of all variables that are currently not displayed in the tab User Click a variable name to add the corresponding variable to the tab Remove from User Tab tab User only The selected variables are removed from the tab User g la c i E 2 5 0 182 Graphical User Interface 6 7 Graphics Window This window displays iconic data It has the following properties e The user may open several graphics windows e The active graphics window is shown by the lit bulb in the window s tool bar e Pressing the clear button clears the graphics window content and the history of the window e You close a graphics window using the close button of the window frame Figure 6 66 a shows an example graphics window which is displaying a color image of a pizza overla
287. en a new graphics window Shortcut Ctl Shift G O OT Ctrl Shift G Ctrl Shift O See also dev_open_window When selecting this menu entry a dialog window pops up Here you may specify some graphics window attributes The dialog is displayed in figure 6 25 The position size and background color of the new graphics window can be specified For example it is more convenient to have a white background while building graphics for slides or reports see the HALCON operator dump_window If the window height and width are set to 1 the window size is set by HDevelop It is taken from the persistent preferences of HDevelop usually the size of the last graphics window in the previous HDevelop session A position value of 1 specifies that the window position is determined by the window manager in SDI mode K Open Graphics Window Sa Enter position size and background color of the new Graphics window Row 0 y Column 0 Width 1 Height 1 Background black z Figure 6 25 Specifying the parameters of the new graphics window The window handle of the new graphics window is displayed in its title bar This number may be used in operators that require a window handle e g dev_set_window or dump_window The handling of graphics windows is described in more detail in the section Graphics Window on page 182 o D 2 Q a 0 106 Graphical User Interface fal iii 6 2
288. en the Training File Browser page 215 which allows you to comfortably view and edit training files Load Training File If you have saved a training file of a former OCR Assistant session you can load the training file again by the menu item File gt Load Training File or via the corresponding button of the toolbar Save Training File You can save a training file using the menu item File gt Save Training File or the corresponding button of the tool bar Then you can load the training file again in a later session Load Assistant Settings If you have saved the settings of a former OCR Assistant session you can load them again by the menu item File gt Load Assistant Settings or via the corresponding button of the tool bar Save Current Assistant Settings You can save the current settings of an OCR Assistant using the menu item File gt Save Current Assistant Settings or the corresponding button of the tool bar Then you can load them again in a later session Close Dialog When closing the OCR Assistant dialog with the menu item File gt Close Dialog or the X in the topright corner of the window the current settings are stored for the duration of the current HDevelop 332 HDevelop Assistants session That is as long as you do not exit HDevelop you can again open the OCR Assistant with the same settings In contrast to this when you exit the OCR Assistant
289. ens distortion parameters for radial distortion Radial 2nd Order K1 Radial 4th Order K2 Radial 6th Order K3 and the two parameters for tangential distortion Tangential 2nd Order P1 and Tangential 2nd Order P2 If you want to change the parameters Cell Width and Cell Hight independently from each other click the chain button 7 2 2 How to Calibrate with the Calibration Assistant 235 7 2 2 2 Acquiring Calibration Images The main part of the calibration process consists of acquiring images of the calibration plate in different positions and orientations relative to the vision system Please note that the more you vary the position and orientation the better the calibration results will be Therefore place the plate so that it appears in different corners at different distances to the camera and in different planes i e tilt it for some images Note that it is necessary to not only place the calibration plate in the center of the field of view but also move it to the corners and margins Good calibration images will improve your calibration results significantly Detailed instructions on how to take calibration images can be found in the section Acquiring Images for a Successful Calibration Obligatory steps for calibration are e acquiring calibration plate images e choosing your image source e and calibrating page 237 Optional parameters which may be changed are e parameters concerning Quality Issues page 239 e Di
290. er interaction except Stop is disabled during program execution in case the latter was not started in the main procedure HDevelop may be slow to react to your actions while the program is running This is caused by the fact that HALCON reacts to user input only between calls to operators e A variable window update during runtime will only be performed if it has not been suppressed see section Runtime Settings gt Runtime Settings on page 95 In any case the values of all variables are shown in the variable window after the execution s termination While the program is running the menu items Run Step Over Step Into and Step Out and the corresponding tool bar buttons are grayed out i e you cannot execute them You have the following possibilities to stop your HDevelop program e The program runs until the last operator or procedure call in the current program i e the main procedure body has been called The PC is positioned behind this operator This is the usual way a program terminates e The menu Menu Execute gt Stop or the corresponding tool bar button is pressed e A breakpoint is reached see section Program Window on page 138 In this case the last oper ator or procedure call that will be executed is the one before the breakpoint e The entry Menu File gt Quit has been executed see Quit on page 66 g la c i E 2 5 0 98 Graphical User Interface I gt
291. er windows which will be covered later in this manual Unless the context menu has been disabled in the preferences to prevent any interference with interactive drawing functions See section 6 2 2 16 on page 76 18 Getting Started 2 2 Running Example Programs HALCON comes with a large number of HDevelop example programs from a variety of application areas These range from simple programs that demonstrate a single aspect of HALCON or HDevelop to complete machine vision solutions As an introduction to HDevelop we recommend to try some of these programs to quickly get accustomed to the way HDevelop works The example program Explore the Power of HALCON demonstrates many different capabil ities of HALCON in one program It can be started from the Start menu under Windows The Linux path to this program is HALCONEXAMPLES hdevelop explore_halcon hdev On Mac OS X the path is Users Shared Library Application Support HALCON 11 0 examples explore_halcon hdev Running this program is highly recommended to get a good overview of the many application areas of HALCON Click the Run button or press F5 to start the program W HDevelop H halcon current examples hdevelop explore_halcon hdev no Fie Edit Execute Visualization Procedures Operators Suggestions Assistants Window Help NAAA SYI XBEL VP BE gt lela m HEE O Bl i uw W Graphics Window 3601 Fe B 53 R Graphics window 3600 aejk AGAR En
292. ere in the field of view and if it has been tilted in every direction If you are un sure about how to take good calibration im ages read the instruction page 235 Are you using an extreme wide angle lens The distortions that appear close to the im age borders cause a higher Mean Error or can even be responsible for the failure of the cali bration You must use another lens in this case Is the size of your camera chip compatible with the lens Using a lens that is not compatible with your camera chip size this information should be included in the instructions of the lens will de crease the quality of your image Table 7 1 Checklist for Calibration Errors Handling Quality Issues Under Quality Issues you find an evaluation of each image which includes descriptions of the de fective image features and a quality percentage that tells you how severe the problem is A result of 0 indicates a very defective image feature whereas 100 equals ideal quality This can help you to improve your calibration result by deleting images which are not good enough and might lead to a higher error rate during the calibration process If you need a certain quality level you can set a Warn Level and the defects will be listed under Quality Issues The quality issues are detected by image tests and sequence tests If you want the program to run faster or 1f you do not need quality feedback you can change Image Tests and Sequence
293. erent parameter settings Encoding for saving HDevelop programs and procedures HDevelop can save programs and procedures in two different encodings Upon loading HDevelop detects the used encoding automatically It is recommended to use UTF 8 encoding Unicode if the program contains international characters that exceed the ASCII standard However in order to load programs in older versions of HDevelop you have to set the encoding to Native Default file format for saving HDevelop programs Sets the default file format for new programs see section File Types on page 46 Default file format for saving HDevelop procedures Sets the default file format for new external procedures see section File Types on page 46 Update Windows in Single Step Mode Specifies the window update policy when stepping through the program The different options are described in section 6 2 4 19 on page 116 6 2 2 Menu Edit 93 General Options gt Experienced User Show HALCON Low Level Error Message Boxes Low level errors are normally invisible for the user because they are transformed into more com prehensive error messages or simply ignored Activating this item generates a message box each time a low level error occurs Suppress error message dialogs within try catch blocks HDevelop normally displays a dialog when a run time error occurs unless this has been changed in the tab Runtime Settings gt Runtime Settings
294. erent tilt in every direction as shown in Figure 6 1 we recommend to tilt the plate in every quadrant of the image twice and vary the tilting direction 10 In total you should acquire at least 10 better 15 to 20 images Choosing an Image Source The images for the calibration can either be loaded from a file or acquired directly using the Image Acquisition Assistant 7 2 2 How to Calibrate with the Calibration Assistant 237 When loading images from a file just click the radio button Image Files To acquire new images click the radio button Image Acquisition Assistant page 225 The assis tant will then appear in a new window and support you with acquiring new calibration images Note that the calibration works on a single channel For color RGB images the red channel will be used A color transformation can be performed with the operator trans_from_rgb Calibration The three basic steps of each calibration are e acquiring calibration images e selecting a reference image and e calibrating Calibration Images All images from files will be displayed with their path on the Calibration tab whereas images acquired using the Acquisition Assistent will be displayed with their consecutive numbers Furthermore the image status gives information about the quality of each image Details concerning quality can be found under Quality Issues page 239 If you use the Image Acquisition Assistant and w
295. error variable has to be defined as a global variable see section 8 3 1 global tuple ErrorCode dev_error_var ErrorCode 1 8 8 2 Exception Handling HDevelop supports dynamic exception handling which is comparable to the exception handling in C and C A block of program lines is watched for run time errors If an error occurs an exception is raised and an associated exception handler is called An exception handler is just another block of program lines which is invisible to the program flow unless an error occurs The exception handler may directly act on the error or it may pass the associated information i e the exception on to a parent exception handler This is also known as rethrowing an exception In contrast to the tracking method described in the previous section the exception handling requires HDevelop to be set up to stop on errors This is the default behavior It can also be turned on explicitly 8 8 2 Exception Handling 371 dev_set_check give_error Furthermore HDevelop can be configured to let the user choose whether or not an exception is thrown or to throw exceptions automatically This behavior is set in the preferences tab General Options gt Experienced User An HDevelop exception is a tuple containing data related to a specific error It always contains the error code as the first item The operator dev_get_exception_data provides access to the elements of an exception tuple HDevelop excepti
296. es and check whether the matching still succeeds in all images Please note that the accuracy may suffer if you increase the step size Usage gt Advanced Use Parameters page 285 The following Advanced Use Parameters may speed up shape based matching Subpixel page 286 If your application does not require subpixel accuracy you can speed up the matching by selecting the value none Last Pyramid Level page 287 Increase the value and check whether the matching still succeeds in all images Note that as a result of this modification wrong instances of the model may be found Furthermore the accuracy of the calculated position orientation and scale may decrease Timeout page 287 This parameter enables you to specify a certain time in milliseconds after which the detection of model within an image is aborted Speed up correlation based matching Parameters gt Standard Model Parameters page 269 The following Standard Model Parameters may speed up correlation based matching Number of Pyramid Levels page 272 Increase the value and check whether the matching still succeeds in all images Allowed range of rotation page 273 Set the parameters Starting Angle page 273 and Angle Extent page 273 according to the range probably needed for your images Parameters gt Advanced Model Parameters page 275 Correlation based matching may also be sped up by selecting a higher reduction rate for Angle Ste
297. es by clicking on them in the Values list and then using the Remove button If you want to start over you simply click on the Remove A11 button to delete all values It is also important that you choose the tolerance which defines how far from your chosen good value an edge can be to be still classified as good In the graph beneath Tolerance you can see the values corresponding to all extracted edges These are displayed as little crosses and the curve that was defined by your good values and the allowed tolerance is displayed as well Once you have determined all relevant edges continue to the Results tab page 334 Fuzzy Contrast Enable Fuzzy Contrast to choose edges with specific amplitides Then specify your good values as described in the section Specify Good Values page 302 Once all relevant edges have been found continue to the Results tab page 334 Fuzzy Edge Position Enable Fuzzy Edge Position to choose edges of a certain position Under subtype you can determine the kind of edge position that is relevant for your application You have the choice between e position which lets you define the position of your edges with the starting point of the ROI set to 0 e position_center which lets you define the position of your edges with the center of the ROI set to 0 e position_end enables you to choose values with the end point of the ROI set to 0 e positon_first_edge which defines the fi
298. escription of the menu entry Lut on page 108 Using LUT you are able to load different look up tables for visualization With the help of a false color presentation you often get a better impression of the gray values of an image In the case of a true color display the image has to be redisplayed due to the missing support of a look up table in the graphics hardware For color images only the gray look up tables can be used which change each Pen LUT Paint Zoom inv_cube sqrt inv_sqrt cubic_root inv_cubic_root three six twelve twenty_four color 1 color2 color3 color4 rainbow temperature cydic_gray cydic_temperature hsi channe 1 mM 255 0 Y Update Reset Use settings for new windows Figure 6 30 Visualization Parameters LUT settings 6 2 4 Menu Visualization 113 Paint settings Here you can select between several graphical image presentations In the default mode the image is displayed unmodified In the other modes the gray values of the image are taken as height information The greater the gray value the higher the resulting image point See figure 6 31 for an illustration of the different modes Further information can be found at the description of the operators dev_set_paint and set_paint If you have chosen a presentation mode the window displays all possible parameters you may modif
299. est contains only characteristic parts of the object and no clutter If clutter is unavoidable it is recommended to remove it with inpainting using the Modify Model Image menu item on the Creation tab You can refine the ROI you have drawn by viewing the region shapes on the Creation tab with the button Show List of ROI Shapes A table then shows you your ROI data and lets you adapt the values Remember that for polygons and free form ROIs values cannot be adapted After creating an ROI you can specify model parameters page 268 7 3 3 3 The Tab Creation In addition to the two settings described before i e choosing your image source see menu File gt Load Model Image page 262 and creating an ROI see menu ROI in the tab Creation you can modify the model image Furthermore two more settings are only available some of the matching methods 7 3 3 Matching Assistant Reference 265 e display the image pyramid page 266 is only available for shape based matching and e choose a calibration source page 267 is only available for deformable matching and descriptor based matching If you choose to create a model you can display the model image via the button Display Model in the toolbar of the Matching Assistant If you loaded a model page 262 from file the model image is not available Parameters are specified in the tab Parameters page 268 Modifying the Model Image Available for ALL Matching Methods
300. etection speed significantly Note however that using Descriptor Min Score might have negative effect on the robustness of the detection process especially when only few points can be found The Search Parameter Guided Matching Enable Guided Matching to use an already approximately known homography to guide the matching process which enhances the accuracy of the object recognition Note that it increases the computational costs up to 10 in some cases Optimizing the Recognition Speed When you select the menu item Usage gt Optimize Recognition Speed or click either the corre sponding button in the tool bar or the button Run Optimization in the dialog Optimize Recognition Speed of the tab Usage the Matching Assistant automatically determines values for the parameters Minimum Score page 284 and Greediness page 286 to optimize the recognition speed The speed is calculated as the average recognition speed over all test images You can interrupt this process by clicking the button labelled Stop please note however that this event is processed only after the current search has finished The two parameters are optimized as follows At the beginning the Greediness is set to O and the Minimum Score to 1 Then the minimum score is decreased until the matching succeeds in all test im ages i e until the recognition rate is 100 Now the Greediness is increased as long as the matching succeeds This process is repeat
301. eters only Context Menu The context menu may be enabled disabled from the preferences page 95 The entries of the context menu are a subset of the menu Visualization page 105 6 7 1 Interactive Creation and Handling of ROls and XLDs 187 E Tee rer E l ES Eme x Es om Fie ROIType Operations Draw Edit Tools Mame eL ELL ARLA Operation C Region Primitive Value Unit Figure 6 70 Base image for the creation of an ROI 6 7 1 Interactive Creation and Handling of ROIs and XLDs The graphics window allows to create and manage multiple figures interactively These figures consist of an arbitrary collection of geometric elements or free form drawings Ultimately these figures are interpreted as ROIs or XLDs that can be used in your current program by generating the appropriate program lines You can also perform simple interactive measurements in that you specify a known dimension and thus translate pixels to real world units As an introductory example the image shown in figure 6 70 a shall be used as the base image for a completeness check application To determine the location and the alignment of the chip in subsequent images parts of its imprint will be used as a landmark Therefore an ROI has to be created It would be cumbersome to generate an ROI based on written down pixel coordinates Instead it is much easier to draw a figure right into the image and let HDevelop generate the corresponding instru
302. ever have trouble with your image quality and see no other option of improving it you can still adapt some parameters under Calibration Plate Extraction Parameters There are three groups of parameters which may be changed e Locating the Calibration Plate including Filter Size Mark Threshold and Minimum Mark Diameters e Extracting the Mark Regions including Initial Threshold Threshold Decrement and Minimum Threshold and 244 HDevelop Assistants e Extracting the Mark Contours including Smoothing Alpha Minimum Contour Length and Maximum Diameters For more information about the first group of parameters please refer to the reference manual en try of the HALCON operator find_caltab Groups two and three equate to HALCON operator find_marks_and_pose 7 2 3 Results of the Calibration Two types of parameters of your vision system are calculated as results internal parameters e g the precise focal length the size of the camera chip or the distortion caused by an imperfect lens and external parameters i e the position and orientation of the vision system Consequently the calibration returns the following results e Calibration Status e Camera Parameters and e the Camera Pose The results displayed in Camera Parameters and Camera Pose can also be saved to a file by clicking the Save buttons on the right Display Results enables you to choose which results should be displayed Once you are finished
303. except Gaussian filters enter filter gauss See figure 6 76 b for an illustration Index This tab card provides access to HALCON operators and relevant sections of the documentation through index entries just like an index in a book The list of index entries can be filtered by entering any word into the text field Filter If you enter multiple words only index entries matching all the words are displayed 6 8 Help Window 195 When you select index entries from the list the related operator names and links to the corresponding parts of the documentation are displayed below the index entries You can click on an operator name to read its documentation in the online help If you click on a documentation link the corresponding PDF 1s opened in the registered PDF viewer Please note that the link text also includes the page number so you can find the desired information very quickly See figure 6 76 c for an illustration Bookmarks This tab card lists all user defined bookmarks You can add the currently displayed document to the list by clicking the button Add To remove a bookmark from the list select it and click the button Delete See figure 6 76 on page 194 d for an illustration g la c i E 2 5 0 196 Graphical User Interface Help Window Actions Action Shortcut Description gt Bet itl Y eos Locate page Back Forward Home Increase Font Size Decrease Font
304. f Matches 285 parameter Maximum Overlap 286 parameter Metric 277 parameter Min Angle and Max Angle 275 parameter Min Column Scale 273 parameter Min Component Size 272 parameter Min Contrast 279 parameter Min Row Scale 273 parameter Min Score 275 Index 419 parameter Minimum Score 284 parameter Optimization 278 parameter optimization 256 parameter Patch Size 280 parameter Pyramid Levels 272 parameter Row Scale Step 277 parameter Score Type 288 parameter Start Angle 273 parameter Subpixel 286 parameter Tilt 280 parameter Timeout 287 Parameters Image Acquisition Assistant 227 parameters 268 parameters Min Scale and Max Scale pa Password 150 Paste 67 136 148 paste 142 Patch Size 280 PC 138 PC Down 140 PC Up 140 Pin the program listing 139 pixel type 198 pixel info 116 197 Plot Quality 183 Port 226 pose bounds determine 291 Position Precision 116 Predecessors 127 preferences export 77 HDevelop ini persistence 77 import 77 Preferences 76 Pregenerate Shape Model 278 preview code 300 329 Previous 196 Previous Bookmark 73 print HDevelop procedure 65 HDevelop program 65 procedure 65 program 65 Print 65 136 149 196 procedure 382 385 387 389 391 Procedures 126 menu 118 procedures 45 Procedures menu Create New Procedure 118 Delete All Unused Local 120 Delete Current 119 Duplicate 119 Edit Interface 119 Ed
305. f Output Window specifies the graphics window that is used to visualize the gray values between the green line and the red line You can select the originating window Input the active graphics window Active or an arbitrary window ID from the list The type of visualization is specified in the table below the histogram Click the button to add a new operation to the table Click the button to remove an operation from the table The column Operation specifies the operation that is applied to a selected range of gray values threshold or scale see below To visualize a specific operation click the corresponding icon next to the operation When a multi channel image e g a RGB color image is sent to the tool by default the histogram of the first channel is displayed The column Channel lets you select the channel from which to compute the histogram For RGB images Channel may also be set to the special mode RGB which shows a g la c i E 2 5 0 204 Graphical User Interface combined histogram of all three channels The columns Min and Max correspond to the position of the green and the red line respectively Each operation may specify its own range of gray values add operation Operation Channel Min Max le remove operation EY Threshold 1 0 60 visualize operation E xX Scale 1 0 60 6 10 1 1 Threshold Operation The image from which the histogram was computed is segme
306. f finteger freal boolean or string Variable window In HDevelop the variable window manages the control and ficonic data XLD is the short term for eXtended Line Description Itis used as a superclass for contours polygons and lines Command Line Usage 407 Appendix B Command Line Usage HDevelop understands many command line switches when started from a console or terminal window Run the following command to get a list of all supported command line switches hdevelop h In general HDevelop is started using hdevelop OPTIONS FILE FILE can be an HDevelop program an external procedure a library file or an image file The default action is to load the given file for editing If an image file is given it is preselected in the dialog Read Image page 62 same behavior as dragging an image file onto a running instance of HDevelop This appendix presents some useful command line examples Load the HDevelop program example hdev and run it immediately hdevelop run example hdev Run the HDevelop program example hdev and skip stop calls hdevelop override_stop 0 run example hdev Use the procedures and libraries from C projects in the next session hdevelop external_proc_path C projects The given path name s are put first in the list of directories that are searched for external procedures and libraries Multiple directories are separated by the system dependent separator on Windows and
307. f type integer or real However the resulting type will be of type real The functions are applied to all tuple values and the resulting tuple has the same length as the input tuple For pow and 1dexp the two input tuples have to be of equal length See table 8 19 for the provided exponential functions 8 5 14 Numerical Functions The numerical functions shown in table 8 20 work on different data types The functions min and max select the minimum and the maximum values of the tuple values All of these values either have to be of type string or integer real Itis not allowed to mix strings with numerical values The resulting value will be of type real if at least one of the elements is of type real If all elements are of type integer the resulting value will also be of type integer The same applies to the function sum that determines the sum of all values If the input arguments are strings string concatenation will be used instead of addition The functions mean deviation sqrt deg rad fabs ceil floor and fmod work with integer and real the result is always of type real The function mean calculates the mean value and deviation the standard deviation of numbers sqrt calculates the square root of a number cumul returns the different cumulative sums of the corresponding elements of the input tuple and median calculates the median of a tuple For both functions the resulting value will be of type real if at least one of the eleme
308. file for later use The default extension for these configuration files is das File gt Close Dialog The assistant is closed but the current configuration is preserved This menu entry performs the same function as the assistant s close button You can restore a closed assistant by clicking the numbered entry in the menu Assistants which is generated when a new assistant is opened File gt Exit Assistant The assistant is quit The resources used by the assistant are released The link to the generated code is lost i e it is not possible to restore the assistant unless the setup has been saved to a file The menu entry in the menu Assistants is also removed Code Generation Insert Code Insert HDevelop code based on the current settings of the assistant The code is inserted at the IC As long as the associated assistant is not quit you can change the settings and update the code accordingly Code Generation gt Release Generated Code Lines The link to the generated code is cut off The code remains in the program but can no longer be updated or removed from the formerly associated assistant Nevertheless you can generate new code with the current settings of the assistant Code Generation p Delete Generated Code Lines The generated code is deleted from the pro gram Please note that any manual changes to the generated lines are deleted as well Code Generation gt Show Code Preview Generate a preview of the code based on th
309. for descriptor based or deformable matching e display image pyramid levels for shape based matching page 266 e load formerly used and saved settings of the Matching Assistant e save the current settings of the Matching Assistant for later use e close the Matching Assistant dialog while retaining the current settings as long as the HDevelop session is active and e exit page 264 the Matching Assistant dialog discarding the settings Loading the Model Image The so called model image page 253 is used to create the model of the object you want to find later This image should be a characteristic image of the object 1 e the object should appear in its default position and orientation and not be occluded furthermore the image should not contain clutter When you select the menu item File gt Load Model Image or activate the corresponding radio buttons in the dialog Model in the tab Creation a standard file selection box appears The Matching Assistant can read the image file types TIFF BMP GIF JPEG JPEG XR PPM PGM PNG and PBM The selected image is displayed automatically Typically the next step is to create a region of interest page 264 around the object As an alternative to loading a model image and creating the model page 255 interactively the menu item File gt Load Model can be used to load a model that you have saved with the Matching Assistant or HALCON or that is available as DXF model N
310. for execution Run the project and then press the button Run on the form which will call the exported code 9 4 2 Program Structure If the program has been exported using the option Use Export Template the file created by HDevelop contains a subroutine with the corresponding name for every HDevelop procedure except the main pro cedure which is contained in the subroutine action Otherwise the file is exported as a standalone application Iconic input and output parameters of a procedure are passed as ByVal HUntypedObjectX and ByRef HUntypedObjectX respectively while control input and output parameters are passed as ByVal Variant and ByRef Variant respectively The subroutine RunHalcon contains a call to the subroutine action and has a parameter Window which is of type HWindowX This is the link to the window on the form to which all output operations are passed In addition another subroutine is created with the name InitHalcon This subroutine applies the same initializations that HDevelop performs Most of the variables iconic as well as control are declared locally inside the corresponding subroutines Iconic variables belong to the class HUntypedObjectX and control variables belong to Variant The subroutine RunHalcon has a parameter Window which is of type HWindowX This is the link to the window in the panel to which all output operations are passed Depending on the program additional subroutines and variables are declar
311. for loop for instance all operator calls that are located between for and endfor form the body Button A button is part of a graphical user interface With the mouse the user can press a button to cause an action to be performed Control data Control data can be either numbers finteger and freal character strings string and truth values boolean This data can be used as atomic values i e single values or as Ttuples i e arrays of values Empty region An empty fregion contains no points at all i e its area is zero Graphics window A graphics window is used in THDevelop for displaying e g images Tregions and XLD HDevelop is an interactive program for the creation of HALCON applications Iconic data are image data i e image arrays and data which are described by coordinates and are derived from image arrays e g Tregions images and TXLD Image An image consists of one or more multi channel image image arrays and a region as the definition domain All image arrays have the same dimension but they can be of different pixel types The size of the region is smaller or equal than the size of the image arrays The fregion determines all image points that should be processed Iconic object Generic implementation of ficonic data in HALCON integer is the type name for integer numbers Operator data base The operator data base contains information about the HALCON operators It is loaded at runtime from the b
312. for symbol fragmentation e specify text orientation range e set parameters for text layout page 318 e view content of the ROI in the inspection page 318 field and apply corrections if necessary e and reset page 320 all parameters 7 5 3 1 Symbol Appearance This section allows you to choose up to three options that specify the way the characters are printed Select e Light On Dark whenever the gray values of the printed characters are brighter than the back ground gray values e Dot Print if the character print is composed of single dots e g from matrix printers and e Imprinted Embossed for print that is visible more by its relief rather than its pigment 7 5 3 Segmentation 317 7 5 3 2 Symbol Size Three characteristics of a symbols size i e the e maximum width of a single character e maximum height of a single character e and the so called Stroke Width defining the maximum thickness of the lines of a character can be adjusted either by directly entering a number into the text field or by using the slider on the right Each value can be reset to the default value by clicking on the button on the right side of the slider 7 5 3 3 Symbol Shape This dialog allows you to choose up to three options that specify the shape of a symbol Select e Interpunctuation for a text containing punctuation like e g comma or period e Seperators for a text containing seperators such as hyphens or slashes and e
313. from the context menu or by pressing Del Clear all breakpoints and remove all entries from the list leaving you with an empty window ra Activate all breakpoints at once This action can also be triggered from the context menu EA Deactivate all breakpoints at once This action can also be triggered from the context menu Individual breakpoints may be activated deactivated by clicking the check boxes in front of the corre sponding program line entries 6 2 3 Menu Execute 103 6 2 3 14 Reset Program Execution Synopsis Reset program to its initial state Shortcut The main procedure becomes the current procedure and the call stack is cleared of all procedure calls except the main procedure call The latter is reset i e all variables have undefined values and the PC 1s set to the first executable line of the main procedure The breakpoints however are not cleared All graphics windows except one are closed and the remaining graphics window is cleared This menu item is useful for testing and debugging programs 6 2 3 15 Reset Procedure Execution Synopsis Reset procedure execution Shortcut The variables of the current procedure are reset i e all variables have undefined values and the PC is set to the first executable line of the current procedure This menu item is useful for debugging procedures without affecting the calling procedures 6 2 3 16 Abort Procedure Execution Synopsis Abort execution of current proc
314. g The parameter Pregenerate Shape Model specifies whether the internal representation of the shape model is pregenerated completely whenever the model is created If you select a complete pregeneration by checking the check box Pregenerate Shape Model the model generation may require a substantial amount of time and memory In contrast if you switch off the complete pregeneration the model creation will be very fast and the model will consume less memory The advantage of selecting a complete pregeneration is that the model can possibly be found slightly faster than if the complete pregeneration is switched off Typically you may find it useful to switch off the complete pregeneration if your model uses a large angle and scale range 7 3 3 Matching Assistant Reference 279 The Model Parameter Min Contrast Shape based Matching Deformable Matching In order to select significant object points for the model page 253 you have specified which Contrast page 270 the points must show in the model image page 253 With the parameter Min Contrast you can specify a separate minimum contrast for the matching page 252 process itself i e when searching for the object in the test images page 253 The main use of this parameter is to exclude noise from the matching process Note that a low value for Min Contrast slows down the matching process because more points in the test image must be compared with the model Therefore we reco
315. g points in the model This means that for example if a model appears bright on dark background only bright objects on dark background can be detected You can choose to ignore the polarity globally ignore_global_polarity at the cost of a slightly lower recognition speed In this mode an object is recognized also if the direction of its contrast reverses e g if your object can appear both as a dark shape on a light background and vice versa 278 HDevelop Assistants A third mode lets you ignore the polarity locally ignore_local_polarity i e objects are also recog nized if the direction of the contrast changes only in some parts This mode can be useful e g if the object consists of a part with a medium gray value within which either darker or brighter sub objects lie Please note however that the recognition speed as well as the robustness decreases dramatically in this mode especially if you allowed a large range of rotation page 273 Finally you can choose to ignore the color polarity ignore_color_polarity to apply shape based match ing to multi channel images If you already loaded test images page 281 you can quickly test the effect of the selected parameter value via the menu item Inspect gt Determine Recognition Rate page 290 The Model Parameter Optimization Shape based Matching Deformable Matching After you created a model ROI page 253 by default all points showing the required
316. g the browse button The latter will start browsing in the current working directory or in the last used directory Depending on the operating system you may be able to switch to a thumbnail view in the file selection dialog Variable Name HDevelop suggests a variable name derived from the selected file name You may adopt or edit this name If you want to use a name of an already created iconic variable this combo box offers you all known iconic variable names Simply click the arrow on the right side of the combo box to select a variable name Note that the reuse of a variable deletes the old content and replaces it with the new image After selecting a file name click OK to load the image into HDevelop The operator read_image is inserted at the specified insert position 1C or PC The specified iconic variable is updated in the variable window and the image is displayed in the active graphics window Clicking Cancel aborts the operation By default an absolute path to the selected image is inserted You can instruct HDevelop to use relative path names see General Options gt General Options in the preferences 6 2 1 15 Cleanup Synopsis Clean up allocated resources that are no longer being used See also iconic variables page 173 control variables page 176 This menu item deletes all unused variables iconic and control data from the current procedure These are variables in the variable window that are no longer used in any
317. ge display 282 test image remove 281 test image select 282 test image set reference 282 Test Images 281 test images load 281 test model 255 280 text layout 318 text orientation 317 throw 369 Tilt 280 Timeout 287 Tools 116 Train Now 332 training 321 Trigger 226 trigonometric functions 359 true 405 try 369 tuple 406 concatenation 346 347 422 Index Type 150 Colored 107 type 406 Display 106 boolean 405 Draw 107 integer 405 real 405 406 string 405 406 Undo Ctr1 Z 66 136 Unicode 62 Unit 191 UNIX 382 392 unnamed 51 unsaved changes 51 until 366 Update Graphics Window 95 Update Image 227 Update Program Counter 95 149 Update Variables 95 176 181 Update Window 116 Use Model 280 User 173 UTF 8 encoding 62 92 variable _ 341 variable names 300 329 variable window 17 variable window 171 406 layout 173 resize 173 tabs A11 Auto User 173 variables 341 view image pyramid 266 view test image 282 Visibility 228 visible objects 283 Visual Basic 11 Visual Basic NET 11 Visual Basic NET export 386 Visual Basic export 388 Visualization menu 105 Record Interactions 115 Visualization menu Apply Changes Immediately 108 Clear Graphics Window 106 Close Graphics Window 106 Color 107 Feature Histogram 117 206 Feature Inspection 117 208 Gray Histogram 117 199 Image Size 106 Insert Code 11
318. ge 150 for more information about HDevelop procedures Selecting a menu item displays the corresponding control construct in the operator window where you can set the necessary parameters After specifying all parameters you may transfer the construct into your program A direct execution for loops and conditions is not possible in contrast to other HDevelop and HALCON operators because you have to specify the loop s and condition s body first to obtain useful semantics If necessary you may execute the program after the input with Step Over or Run The IC is positioned after the construct head to ensure the input of the construct s body occurs in the correct place This body is indented to make the nesting level of the control constructs visible and thus to help you in understanding the program structure The semantics for loops and conditions are shown in section Control Flow Operators on page 363 Assignment The operator assign serves as an assignment operator for control variables numbers and strings Anal ogously to normal operators the input is made in the operator window by specifying both parameters Input and Result 1 e right and left side of the assignment An instruction in C e g x y Z is declared inside the operator window as assign y z x and displayed in the program window by X y z The operator insert implements the assignment of a single value tuple of length 1 at a specified
319. ge 152 The remaining buttons provide access to the documentation of the current procedure This is described in section 6 4 8 on page 158 You can step through the individual tab cards of the dialog using the arrow buttons at the bottom of the dialog 6 4 7 Side Effects of Procedure Changes Name determine_area_of interest El Password Type E HDevelop 10 0 Procedure File hdvp y Pubic y Directory Jocuments MVTec HALCON 11 0 procedures projects project_a v V Activated Keep Explicitly Opened Modify the original procedure or duplicate it before Applying the changes will convert the current procedure into an external procedure This instantly creates a new external procedure file The changes can be applied directly on the original procedure or the procedure is duplicated before it is modified Duplicate internal procedure Figure 6 47 Procedure type changed from local to external 6 4 7 Side Effects of Procedure Changes Certain changes to procedure properties may have side affects that have be taken care of For example if you change the type of an external procedure to local what happens with the original procedure file Is it kept or will it be deleted The procedure dialog lets you choose the appropriate action yourself Changing the type or name of a local or library procedure If the procedure type is changed to external a new external procedure file will created in the spec ified
320. ge 192 6 2 10 7 HALCON News WWW Synopsis Visit the HALCON home page Shortcut Ctrl Shift H W Or Ctrl Shift H Ctrl Shift W This menu item lets you check for the latest news about HALCON on MVTec s WWW server e g whether new extension packages image acquisition interfaces or HALCON versions are available 6 2 10 8 About Synopsis Display HDevelop version and licensing host IDs Shortcut Ctri Shift H A Or Ctri Shift H Ctrl Shift A This window provides the following information e HDevelop version and build date e HALCON version and build date e platform version HALCONARCH e number of processors e host and dongle IDs The host and dongle IDs are detected by the license manager see the Installation Guide for more infor mation g la c i E 2 5 0 136 Graphical User Interface 6 3 Tool Bar You use most icons in this tool bar to accelerate accessing important HDevelop features These are features which you are performing many times while working with HDevelop Hence there are buttons to handle your HDevelop programs and to edit them The most important buttons are used to start and to stop a program or parts of a program Action Shortcut Info H New Program _CtrleN 54 pel Open Program Cui 0 53 jE Browse HDevelop Program Examples ChE 55 E Save Cts 58 FET Ed Save All C
321. ge 328 Using the OCR Assistant is simple either choose the Quick Setup page 314 to load an image and perform an OCR by setting basic parameters or use the sections Image Source page 315 and Region of Interest page 315 where you can also load a sample and mark the text that should be read with a rectangle Then improve the segmentation page 316 by adapting relevant parameters choose a pretrained font or performing your own training page 320 and finally add the resulting code to your application page 328 When looking for an overview of all OCR Assistant elements please refer to the reference page 329 The general process of an OCR application is visualized in figure 7 5 This figure shows how a sample 7 5 1 Introducing the OCR Assistant of HDevelop 313 is found in an image via segmentation and can be directly classified if an OCR classifier is available The sample is then assigned to a certain class a symbol page 314 If no suitable classifier is available samples can be added to a training file from which a classifier can be trained that can subsequently be used to classify a sample The symbol class is typically equivalent to a simple character page 314 Therefore a sample that is assigned to a symbol class results in a certain character that is read 092404 092404 092408 Segmentation Classification A A Sample Symbol Character Image Teaching Train Training File
322. ge Ea File Name C Program Files MVTec HALCON images dip png bd ES vr Variable Name Clip Image Info Width 830 a E BS Channel number 1 Insert Position D Y WSs ss Cox Jl ams Figure 6 6 Read Image e Native Export in the encoding defined by the operating system e UTF 8 Force export in UTF 8 encoding Unicode Keep dialog open Checking this box keeps the dialog open for subsequent exports 6 2 1 14 Read Image Synopsis Add an image file to the current program e3 Shortcut See also read_image This menu entry provides a quick way to open an image file and access it in the current program The associated dialog Read Image is displayed in figure 6 6 File Name You can enter the name of an image file into this field A relative file name is looked up in several directories in that order 1 The current working directory a single dot i e the directory HDevelop was started from 2 The subdirectory images of the directory specified by the environment variable HALCONROOT 3 The directories specified by the environment variable HALCONIMAGES 4 The directories used in previous invocations of Read Image 6 2 1 Menu File 63 The first matching image file is displayed as a thumbnail preview along with its width height color type and number of channels Alternatively open a file selection dialog page 221 by selecting a predefined directory from the File Name combo box or clickin
323. ge you want to use for OCR and you can even choose to work with a Live image The same operations can be performed by clicking on the Snap or Live symbols in the toolbar Note that the OCR works on a single channel image For color RGB images the red channel will be used A color transformation can be performed with the operator trans_from_rgb later in the generated code Once you have loaded your image you can continue to create an ROI 7 5 2 3 Region of Interest Create an ROI by using the buttons Draw Axis aligned Rectangle or Draw Rotated Rectangle in the tool bar or in the drop down menu OCR respectively or by choosing a shape within the Region of Interest section of the Setup tab The shape of the ROI should be chosen according to the shape of the object to be inspected After having chosen the ROI shape you draw the ROI in the Graphics Window by keeping the left mouse button pressed Then modify the ROI until it has the correct shape Once you are finished click the right mouse button to confirm your choice To select a rotated rectangle with a correct reading direction check that the arrow that is displayed within the rectangle corresponds to the reading direction of the characters All characters that can be read with default parameters within the ROI are displayed immediately Note that the ROI should be chosen such that it also contains a small border around the characters to be recognized If you have previously prepared
324. ger value helps to reduce noise however if the edges themselves are not perpendicular to the line or arc of measure you must choose a smaller value otherwise the edge will loose its strength The general rule here is to choose the ROI always perpendicular and as wide as possible This will lead to both a high precision and accuracy If changing the ROI width leads to an edge length that is inconvenient for the display e g because it 1s very short or very long you can choose another length for the display instead of the ROI width under Display Parameters e With the Interpolation Method you influence the accuracy of the edge extraction but also the processing time Processing time and accuracy both increase from nearest_neighbor over bilinear up to bicubic Activating Highest Accuracy influences the way the interpolation is calculated it takes a bit more processing time and also slightly improves accuracy If one or more edges cannot be found without further processing or if false edges are detected the Line Profile page 210 which can be opened with the View Line Profile button on the upper right edge of the Edges tab can provide the missing details to solve the problem In its display the line profile shows a green line with a gray top for each successfully detected edge that is above a certain level to qualify as an edge Potential edges that do not qualify as edges are displayed as vertical red lines It may also be helpful to view the li
325. ges e g the deletion of code lines can then only be applied directly in the Program window and not from within the Matching Assis tant anymore Delete the Generated Code Lines Via the menu item Code Generation gt Delete Generated Code Lines you can delete the code lines that you have previously generated and inserted into the Program window of HDevelop from within the Matching Assistant Note that this works only as long as you have not yet released the code lines Preview of the Generated Code Lines Via the menu item Code Generation gt Show Code Preview you can open the dialog for the Code Preview in the tab Code Generation Here you have the possibility to e g edit or replace individual operators of the code lines proposed by the Matching Assistant 7 3 3 8 The Menu Help Via the menu Help you can access the online documentation 7 4 Measure Assistant 7 4 1 Introducing the Measure Assistant of HDevelop The Measure Assistant of HDevelop is a front end to HALCON s 1D measuring Using the Measure Assistant you can for example e easily set parameters and perform a visual inspection e quickly measure distances between edges along a straight line or circular arc page 295 e choose the results you need page 334 294 HDevelop Assistants e perform a calibration to transfer your results to world coordinates page 299 and e if necessary use advanced features to e g optimize your
326. ghlight the next match Highlight the previous match Highlight the next link on current page Highlight the previous link on current page Jump to the highlighted link 6 9 Zoom Window 197 6 9 Zoom Window Synopsis Zoom window for image details and pixel inspection See also Menu Visualization gt Zoom Window The zoom window enables the interactive inspection of image details You can open up any number of zoom windows with different zoom levels see Menu Visualization gt New Zoom Window The window also displays the gray values of each image channel at the mouse cursor position Apart from this the pixel type the number of channels and the current position of the mouse cursor are displayed The percental scale can be selected from the combo box It is related to the original size of the image There are multiple methods to navigate the zoom window Check Follow Mouse and move the mouse pointer over the image to select the zoomed area Click once to keep the currently displayed area in the zoom window when the mouse cursor moves out of the image window Or uncheck Follow Mouse and click or drag inside the image to select the zoomed area The red square in the center of the zoom window indicates the position of the mouse cursor The corresponding coordinates are also displayed at the bottom of the window You can select a particular pixel by single clicking on it with the left mouse button The zooming tool stores th
327. ght side 318 HDevelop Assistants 7 5 3 6 Text Layout This dialog offers several options to make adjustments specifing a certain layout for text to be read Those adjustments apply to characteristics of the text lines as they appear within the image For the text line layout it is possible to set the Baseline Tolerance i e the allowed amount of deviation from a perfect line via text field or slider setthe Max Number of Lines and therefore limit the number of text lines that will be searched for via text field or slider use a text field next to Line Structure to set the maximum number of words and characters when searching for lines e g 3 4 5 indicates a line consisting of three letters then a space then 4 5 letters and activate the checkbox of Eliminate Background Lines if background lines exist e g in certain forms or scanned documents and shall be ignored The values of Baseline Tolerance and Max Number of Lines can easily be reset to the default values via the buttons on the right side of the sliders 7 5 3 7 Inspection The Inspection section helps you to find a solution to a segmentation problem Therefore the embed ded window shows only the content of the region of interest By choosing an option from the combo box intermediate results for different parameters as well as filtered images or symbol candidates can be viewed By adapting parameters on this tab changes in the segmentation process may
328. he graphics window while 1 grab_image Image FGHandle dev_error_var Error 1 dev_set_check give_error get_mposition WindowHandle R C Button dev_error_var Error 0 dev_set_check give_error if Error H_MSG_TRUE and Button 0 break endif endwhile switch case endswitch The switch block allows to control the program flow via a multiway branch The branch targets are specfied with case statements followed by an integer constant Depending on an integer control value the program execution jumps to the matching case state ments and continues to the next break statement or the closing endswitch statement An optional default statement can be defined as the last jump label within a switch block The program exe cution jumps to the default label if no preceding case statement matches the control expression switch Grade case 1 Result excellent break case 2 Result good break 8 8 Error Handling 369 case 3 Result lacceptable break case 4 case 5 Result unacceptable break default Result undefined endswitch stop The operator stop stops the program after the operator is executed The program can be continued by pressing the Step Over or Run button exit The exit operator terminates the HDevelop session return The operator return returns from the current procedure call to the calling procedure If return is called in the main procedure the PC jumps t
329. he mouse pointer After this size modification the window content is redisplayed Now you see the same part of the window with changed zoom 3D Plot Mode Clicking je activates an interactive 3D plot mode It displays meaningful information for height field images i e images that encode height information as gray values The greater the gray value the higher the corresponding image point Figure 6 67 shows a height field image of a blob of solder a and the corresponding 3D plot b The 3D plot mode uses OpenGL and benefits from hardware acceleration Using the mouse you can alter the view of the 3D image select mode must be active for this to work click A in the tool bar e Drag the image to rotate the view e Hold and drag the image up and down to zoom out and in respectively Alternatively use the mouse wheel e Hold and drag the image to translate the view There are four different rendering methods texture shaded hidden_lines and contour_lines which can be selected from the drop down menu in the tool bar See set_paint for detailed information about the different methods The display quality may be fine tuned in the tool bar of the graphics window or in the visualization parameters of the graphics window right click into the graphics window select Set Parameters and open the tab card Paint Mode sets the rendering mode just like the drop down menu in the graphics window o D 2 Q a 0
330. he parts Managing Variables In large programs the variable window can become quite cluttered which makes watching selected variables difficult Therefore you can customize the selection of displayed variables At the bottom of the variable window the following tabs are available All Auto Jl User JW Global A11 All variables used by the current procedure are displayed at once Global variables see section 8 3 1 are marked with a globe icon Auto The variables of the current and the previous operator call are displayed This is useful when single stepping through the program because only the variables relevant to the current context are displayed User A user defined selection of variables is displayed Variables may be added and removed using the context menu of the variable window see below If the tab User is active variables may be added from a list in the context menu In the other tabs variables are added by selecting them first and clicking Add to User Tab in the context menu It is also possible to select a variable name in the program window and drag it to the variable window The corresponding variable will then be added to the watched variables and the tab User will be activated Global All global variables see section 8 3 1 of the current program are displayed This includes global variables in external procedures even if they are not used in the current program The context menu of the global variables inc
331. he system modifies the graphics window coordinate system in a way that the image is visible completely in the graphics window If a partial zooming has been activated before see section Graphics Window on page 182 it is going to be suppressed 6 6 1 Iconic Variables 175 Displaying Information about Iconic Variables You can get information about an instantiated variable by placing the mouse pointer over the correspond ing icon in the variable window See also figure 6 60 for an illustration The information depends on the contents of the corresponding variable e Images The image type and size and the number of channels is displayed If the iconic variable contains multiple images the properties of the first image are reported e Regions The area and the center of the region is displayed If the iconic variable contains multiple regions the properties of the first region are reported e XLDs The number of contour points and the length is displayed If the iconic variable contains multiple XLDs the properties of the first XLD are reported Context Menu Clicking on an icon with the right mouse button opens a context menu with several options Display Display the selected iconic variable in the active graphics window Regions and XLDs are displayed on top of the previous contents of the active graphics window Display Channel Display a single channel of the selected iconic variable in the active graphics win dow Thi
332. he tab Usage a standard file selection box appears in which you can select one or more images to load The Matching Assistant can read the image file types TIFF BMP GIF JPEG JPEG XR PPM PGM PNG and PBM Please note that the test images must have the same size as the model image A dialog appears in the tab Usage which enables you to test the matching on the loaded images Removing a Test Image When you select the menu item Usage gt Test Images gt Remove Test Image or click the button Remove inside the dialog Test Images of the tab Usage the currently selected test image is removed from the list of test images You can select a test image by clicking onto its index number or path in the text field left to the buttons You can also delete all test images at once Removing All Test Images When you select the menu item Usage gt Test Images Remove All Test Images or click the button Remove A11 in the dialog Test Images of the tab Usage all test images are removed from the list of test images You can also delete a selected test image 282 HDevelop Assistants Select Test Image as Reference Image When you select an image in the tab Usage gt Test Images and then click the button Set Reference the match in the chosen image is set as reference position for alignment Note that this is only possible if a match is detected in the image If no reference image is chosen the model im
333. hem appear blurry This leads to a lower ro bustness The image test failed even though the plate could be found in the image Close the lens aperture or the shutter a bit more or turn down the brightness of your illumina tion until an adequate quality is reached Inhomogeneity in an image is often the result of using lat eral illumination If that is the case Can you change the set ting and instead use illumina tion from above Another pos sibility would be to use diffuse illumination Reasons can be either overex posure or underexposure To improve your results change your aperture or the brightness of your illumination The object should cover ap proximately one fourth of the image s total area Mount the camera closer to the object use a longer focal length or use a larger calibration plate The depth of field has to in clude the whole object To fix this error change either your focal length or the distance of the object to the camera Al ternatively you can also make the aperture smaller and use brighter illumination Check if any part of the image is occluded and if the occlusion interrupts the black margin of the calibration plate HDevelop Assistants Quality Issue Explanation Possible Solution Mark extraction failed for some images Quality issues detected for some images Number of images is too low Field of view is not cov ered by plate images Tilt ang
334. histogram window is kept open These windows are described in the next sections 6 10 1 2 Scale Operation The scale operation maps the gray values between the green line and the red line to the full range usually 0 255 See also scale_image The gray values of the image are scaled such that the gray value O of the scaled image corresponds to the selected minimum gray value and the gray value 255 to the selected maximum gray value Again the combo box Output Window determines the graphics window in which the result is displayed This mode is useful to interactively set a window of gray values that should be displayed with a large dynamic range You can define as many scale operations as you like but only one of them may be visualized in the graphics window at the same time Click the button Insert Code to generate HDevelop code that performs the currently visualized scale Operation in your program The code is inserted at the IC o o o d o 2 o a 5 9 206 Graphical User Interface 6 11 Feature Histogram Window Synopsis Interactive inspection of feature histograms See also Menu Visualization gt Feature Histogram This window provides a sophisticated tool for the inspection of feature histograms In contrast to the gray value histogram described in the previous section this tool does not inspect individual pixels but regions or XLDs for these iconic objects 1t displays the distribution of values
335. i e different number and or types of parameters the call will be invalid External and library procedures are searched in the order specified in section 5 4 on page 47 A procedure call in a local procedure including main looks for a matching procedure in the following order e local procedure e first matching public external library procedure in the external procedure path list A procedure call in an external procedure looks for a matching procedure in the following order e external procedure in the same directory e first matching public external library procedure in the external procedure path list A procedure call in a library procedure looks for a matching procedure in the following order e procedure of the same library e first matching public external library procedure in the external procedure path list 5 6 Protected Procedures 49 As an example we look at a program with three local procedures Two procedure directories are defined disregarding the standard procedure path C Users Public example hdev main compute_results init procedures project l init hdvp public local hdvp private setup hdvp public visualization hdpl library init private process private setup public l procedures common config hdvp public In procedure a call to resolves to main init init local pro
336. ically but can be changed manually This mode is also suitable for scenarios with images of mixed data types Like in the mode increasing the minimum and maximum value of the threshold bars are not limited to the currently displayed image type o o o ES o 2 o a 9 202 Graphical User Interface Gray Histogram Tool Bar Z Display linear histogram the default a Display logarithmic histogram Initially the histogram is displayed at full vertical range i e up to the peak value The displayed part can be manipulated with the following buttons Le Zoom histogram display to a selected area Click this button and drag an area inside the histogram to view that area led Spread the histogram horizontally so that only the area between the lines is displayed tt Display the full histogram b Reset the display of the histogram vertically dar Reset the display of the histogram horizontally L Force minimum histogram width Does not adjust the width of the histogram when resizing the window 6 10 1 Interactive Visual Operations The selected range of gray values can be used for two major purposes Thresholding segmentation and scaling the gray values This is illustrated using the images rings mixed_03 png and meningg5 png 6 10 1 Interactive Visual Operations 203 SA Graphics 4 3600 1 a fa BRASS Brit 550 fy no scale scale The setting o
337. ick on next to Industry Click on the subtopic Semiconductors The examples belonging to the semiconductor industry are listed on the right Enter the word measure into the Find text field Note how the list is updated as you type Now you have a short list of example programs to select from You may need to resize the example browser to fully read the short descriptions of the listed programs e Select measure_ic_leads hdev by clicking on it e Click Open The selected example program is then loaded Alternatively you can load an example program by double clicking on it The example browser is closed unless Keep dialog open is checked 20 Getting Started iconic variables images regions XLDs control variables PC program counter current procedure rn r y WN variable View main Le Jl Ls Program Listing Lo J 5233 prone varabies de gt 185 gt main 9 Je BE T gt Lead Measurement Example for the application of thea 2 2 including a lot of visualization operators F e a E First the length of the leads is measured then tr Image Rectangle Control Variables w First read in the image and initialize the program ER a z se 7 read image Image ic pin ole get_image pointerl Image Pointer Type Width Heigt Type 4 dev_close_window Width me dev_open window _fit_image Image 0 0 509 509 Winc a E set_display font WindowHandle 14 Cou
338. ics window If you want to redisplay the selected test image in a later step e g after you displayed the model image page 264 again you can also display 1t via the menu item Usage gt Test Images gt Display Selected Test Image without newly selecting it Specifying the Number of Objects Visible in a Test Image In the dialog Test Images page 281 in the tab Usage you can specify how many objects are visible in the current test image using the corresponding text box that appears when clicking onto the currently displayed number of visible objects in the text field of the currently selected test image The default value is 1 If you select the corresponding recognition mode in the dialog accessed via Usage gt Go To Optimize Recognition Speed page 289 the specified numbers of visible objects are used when determining the recognition rate i e the recognition rate is 100 when the sum of all objects found in the test images is equal to the sum of the specified numbers Assuring the Matching Success After loading page 281 the test images you can quickly test whether all objects are found successfully via the dialog Inspect gt Determine Recognition Rate page 290 If the matching succeeds in all test images 1 e if a recognition rate of 100 is reached you can start to optimize the speed page 256 of the matching process If the matching fails in one or more test images proceed as follows e Open
339. id with region data the segmented salami slices One of the displayed regions is selected illustrated by the dashed border The variable name and index of the selected region is displayed in the title bar Figure 6 66 Graphics window displaying a tasty pizza Every HDevelop graphics window has its own visualization parameters Thus modifying the parameters see section Menu Visualization on page 105 applies to the currently active graphics window only i e the parameter settings of all other open graphics windows remain unchanged Additionally the new parameter settings are used as the default settings in all graphics windows yet to be opened The origin of the graphics window is the upper left corner with the coordinates 0 0 The x values column increase from left to right the y values row increase from top to bottom When the mouse cursor is placed inside a graphics window the coordinates row column and the gray value or in this case the RGB values at that position are displayed in the status bar see page 53 Sometimes it is desirable to display this information close to the mouse cursor This can be achieved by holding down the key note this does not work when the zoom in and out tool is selected since pressing inverts the corresponding zoom action Figure 6 66 b shows the coordinate color value display after zooming in with the mouse wheel 6 7 Graphics Window 183
340. ier page 320 Teaching page 321 Basic Features page 322 Advanced Training Parameters and Features page 324 7 5 7 8 The Tab Results The Results tab consists of the following subdivisions Word Processing page 326 Feature Selection page 327 Display Parameters page 327 Results page 327 7 5 7 OCR Assistant Reference 335 7 5 7 9 The Tab Code Generation The Code Generation tab includes the following subdivisions e General Options page 328 e Variable Names page 329 e Code Preview page 329 336 HDevelop Assistants HDevelop Language 337 Chapter 8 HDevelop Language This chapter introduces the syntax and the semantics of the HDevelop language In other words it illustrates what you can enter into a parameter slot of an operator or procedure call In the simplest case this is the name of a variable but it might also be an arbitrary expression like sqrt A Besides control structures like loops and the semantics of parameter passing are described Note that the HALCON operators themselves are not described in this chapter For this purpose refer to the HALCON reference manual All program examples used in this chapter can also be found in the directory HALCONEXAMPLES hdevelop Manuals HDevelop 8 1 Basic Types of Parameters HALCON distinguishes two kinds of data control data numbers or strings and iconic data images regions etc By further distinguishing input from output
341. ification fields depend on the parameter type iconic or control parameter and on the selected semantics In the following the most common fields of both iconic and control parameters are listed Please refer to the Extension Package Programmer s Manual Chapter 2 3 for additional information about the documentation fields especially the semantic types Iconic Parameter Documentation Field Meaning Semantics Specifies the data class of the parameter Pixel Types Only available for Semantics image Lists the accepted pixel types The buttons Select A11 and None toggle the selection of all parameters Multi Channel Only available if Semantics image False Only the first channel of the image is processed True Only a multi channel image is accepted Optional Images with an arbitrary number of channels are accepted Multi Value False Only a single object no object tuple is accepted True Only object tuples are accepted Optional A single object as well as an object tuple is accepted Description Short description of the iconic parameter 6 4 8 Providing Procedure Documentation A Edit Procedure Interfaces dev_open_window_fit image teta Select Procedure E dev_open_window_fit image General Parameter El Language Documentation Engish fenus 7 General setos Parameters Image Row Column Widthuimit HeightLimit WindowHandle E E Image iconic input Semantics imag
342. ift P M or Ctrl Shift P Ctrl Shift M Ctrl Shift P E or Ctrl Shift P Ctrl S hift E J Ctrl Shift P A or Completion Mode Ctrl Shift P Ctrl ShifttA Pin the program listing List Open Tabs Set Program Ctrl Counter Set Insert Ctrl Cursor Set Clear F10 Breakpoint Help F1 Back in history Forward in history Select the next tab card to the left Select the next tab card to the right Open a new tab in the current program win dow Edit interface and documentation of cur rent procedure Toggle editing mode off dialog based ed itor on full text editor page 142 Toggle behavior of key on current program line is entered and executed off current line is entered Toggle advanced autocompletion on off full text editor only If enabled automatic scrolling is turned off during program execution Lists all open tabs if multiple tabs are dis played Click on a list item to activate the corresponding tab Set program counter to current program line Set insert cursor to current program line dialog based editor Set or clear breakpoint in current line Open the reference documentation of the operator or procedure call of the current line o o o d o 2 o a 5 9 140 Graphical User Interface Action Shortcut Description Select a Alt Up Display a selected procedure from the list Procedure Move tab to the Ctrl Alt Shift Left
343. in between Preprocessing can either normalize a value range of a feature or transform the feature space to de crease the number of dimensions Principal Components and Canonical Variates can be used to reduce the amount of data without losing a large amount of information while additionally optimizing the separability of the classes after the data reduction Dimension of the reduced feature space when us ing appropriate preprocessing For preprocessing with principal components or canonical variates the length of the data is determined in Compo nents It is ignored if Processing was set to None or Normalization Number of neurons hidden in the middle layer of the MLP This value should be selected cor responding to the size of the input data In many cases very small values of Hidden Units already lead to very good classification results If Hidden Units is chosen too large the MLP learns the training data very well but does not re turn very good results for unknown data 7 5 4 OCR Classifier 325 Iterations MLP Weight Toler MLP ance Error Toler MLP ance Mode SVM Specialization SVM Gamma Regularization SVM Nu Number Trees of KNN The maximum number of interations for training a MLP classifier default 200 MLP training continues while weights still change more than this value be tween iterations default 1 MLP training continues while error still changes more than this value be
344. in the first bracket pair followed by zero or more digits optionally followed by a dot which may be followed by digits followed by a conversion character from the last bracket pair Some conversion examples might show it best Input Output 23 10 2f f 23 00 23 10 2f 123 00 4 7f 4 0000000 1234 56789 10 3f 1234 568 255 x ff 255 X FF Oxff 5d 100255 ltotal 10s total total 108 total total 10 3 tot flags Zero or more flags in any order which modify the meaning of the conversion specification Flags may consist of the following characters The result of the conversion is left justified within the field The result of a signed conversion always begins with a sign or lt space gt Ifthe first character of a signed conversion is not a sign a space character is prefixed to the result This means that if the space flag and flag both appear the space flag is ignored The value is to be converted to an alternate form For d and s see below conversions this flag has no effect For o conversion see below it increases the precision to force the first digit of the result to be a zero For x or X conversion see below a non zero result has Ox o te iv te c l 354 HDevelop Language or OX prefixed to it For e E f g and G conversions the result always contains a radix character even if no digits foll
345. inary files in HALCONROOT help gt p n N 2 9 406 Glossary Program window In HDevelop the program window contains the program It is used to edit copy delete and paste lines and to run or debug the program Operator window In the operator window of HDevelop the parameters of the selected operators can be entered or modified Real is the type name for floating point numbers They are implemented using the C type double 8 bytes Region A region is a set of image points without gray values A region can be imagined as a binary image mask Regions are implemented using runlength encoding The region size is not limited to the image size see also set_system clip_region true false in the HALCON reference manual String is the type name for character strings A string starts and ends with a single quote in between any character can be used except single quote The empty string consists of two consecutive single quotes The maximum length of a character string is limited to 1024 characters Tuple A tuple is an ordered multivalue set In case of control data a tuple can consist of a large number of items with different data types The term tuple is also used in conjunction with ficonic objects if it is to be emphasized that several ficonic objects will be used Type ficonic variables can be assigned with data items of type fimage Tregion and XLD The types of fcontrol data items can be one o
346. individual scores Reference Pair Width helps you to adapt your values to changes in the setup More information on how to use Reference Pair Width and the Normalize function can be found in the section Ad vanced Fuzzy Features page 304 How to specify the values that are to be evaluated as good by fuzzy measuring is described in more detail below Specify Good Values Fuzzy measuring works with good values To determine whether a value is good all edges receive a score which is a number between O and 1 depending on your chosen tolerance There are different possibilities how you can specify those values that lead to the score which can be viewed on the Results tab page 334 e Click into the Values list and type in the values that you want as good values 7 4 5 Advanced Measuring Tasks 303 e Another solution is to use the Add Current button and add values corresponding to the currently extracted edges You can then inspect and if necessary edit each single value simply by clicking on it and modifying the number E g if you want to measure the distance between wires but due to reflection you get one wrong edge pair you can use Fuzzy Pair Width to specify the pair width Enter the wire s width into the Values list to detect the right edge Alternatively you can load the current values into the list and delete the wrong one Whatever solution you choose to obtain your values you can always delete valu
347. ine in the operator window double click it in the program window If you make changes to the parameters and click Ok or Enter the original line in the program is updated You can also edit the program directly in the program window see section 6 4 2 2 on page 142 Double click the second line of the program to adjust the threshold operation Replace the value 30 with 56 and click Enter The program line is updated in the program window 4 10 Re Execute the Program The last editing step was just a tiny modification of the program Often after editing many lines in your program with perhaps many changes to the variables you want to reset your program to its initial state and run it again to see the changes Click Execute gt Reset Program Execution to reset the program Now you can select Execute gt Run to run the complete program or click Execute gt Step Over repeatedly to execute the program line by line 4 11 Save the Program Perhaps now is a good time to save your program Select File gt Save and specify a target directory and a file name for your program 4 12 Selecting Regions Based on Features Inspecting the variable ConnectedRegions after the changed threshold operation yields a much better result Still a contiguous area at the left edge of the image is returned To obtain only the regions that coincide with the clips we need to further reduce the found regions based on a common criterion Analogous to the gray histogr
348. ine the range for the angle of rotation around the normal vector of the model The restriction to small ranges for the the angle can be used to speed up the training significantly But note that during the later applied matching the model can be found only if its angle and scale is within the trained scope The Model Parameters Min ScaleandMax Scale Descriptor based Matching Min Scale and Max Scale define the scale range of the model The restriction to small ranges for the the scale can be used to speed up the training significantly But note that during the later applied matching the model can be found only if its angle and scale is within the trained scope Specifying Advanced Model Parameters In most applications specifying the Standard Model Parameters page 269 will already suffice The menu item Parameters gt Advanced Model Parameters provides additional parameters that let you handle special cases like changing the contrast polarity or enable you to further optimize the model For shape based matching the following parameters can be specified 276 HDevelop Assistants e the Angle Step at which the model is created e the scale steps Row Scale Step and Column Scale Step page 277 at which the model is created e whether to use the polarity of the contrast Metric in the model e whether to optimize the model page 278 by using a reduced number of points e whether to pregenerate the model comple
349. ing the missing procedures 6 2 1 9 Save Synopsis Save changes of the current HDevelop program or the currently selected external procedure Shortcut The actual functionality of this menu entry depends on the selected procedure in the program window e Main or local procedure selected in program window Save changes of the current HDevelop program If no file name has been specified yet a file selec tion dialog page 221 will be opened where you can specify the program name and optionally the file format see section File Types on page 46 Local procedures are saved within the HDevelop program The file name of the program you save is added to the menu Recent Programs Please note that modified external procedures are not saved automatically To save them as well select the menu entry Menu File gt Save A11 or select the corresponding external procedure in the program window and click Menu File gt Save again see below e External procedure selected in program window Save changes to the currently selected external procedure back to the originating file The operation is done quietly A modified external procedure is marked with an asterisk in the program window If you try to save a file that has been modified outside of your running instance of HDevelop possibly by another user a warning message is displayed asking whether you want to overwrite the file If you are uncertain about the external changes to th
350. ing File 331 New Zoom Window 117 Next 196 Next Bookmark 73 Next Link 196 Normal 228 number of visible objects 283 OCR 332 OCR Assistant 223 ocr classifier 320 ocr classifier save 320 ocr classifier select 320 OCR Training File Browser 118 137 OCR training files 118 Open 56 Open Graphics Window 128 Open Graphics Window 105 Open in new HDevelop 56 Open Operator Window 129 148 Open Output Console 53 129 Open Procedure for Editing 56 Open Program Line View 131 Open Program Listing 128 Open Program 55 136 open test images 281 Open Variable Window 128 operation precedence 363 Operations 190 operator data base 405 window 167 operator window 17 operator window 406 Operators Control 121 Develop 123 menu 121 submenus 126 Optimization 383 Optimization 278 optimize parameters 256 Optimize Recognition Speed 289 Organize Windows 132 Output Window 203 Paint 108 parameter expressions 343 parameter Angle Extent 273 parameter Angle Step 276 parameter Column Scale Step 277 parameter Contrast 270 parameter Descriptor Min Score 289 parameter Detector Type 274 Parameter Documentation 160 parameter Fern Depth 275 parameter Fern Number 275 parameter Greediness 286 parameter Guided Matching 289 parameter Last Pyramid Level 287 parameter Max Deformation 287 parameter Max Column Scale 273 parameter Max Row Scale 273 parameter Maximum Number o
351. ing try catch blocks which is exported transparently to C Therefore it is the recommended method of handling errors in HDevelop programs that are going to be exported to C For HDevelop programs containing error handling using dev_ set_check give_error the cor responding code is automatically included Every operator call for which it is assumed that the HAL CON error mechanism is turned off is enclosed in a try block followed by a catch block The latter handles the exception and assigns the corresponding HALCON error number to the error variable acti vated by dev_error_var or to a local error variable otherwise Please note that a call of dev_ set_check give_error has no influence on the operator call The exception will always be raised 9 2 Code Generation for C HALCON NET This section describes how to create a HALCON application in C starting from a program developed in HDevelop HALCON can be used together with C based on the NET interface of HALCON A detailed description of this interface can be found in the Programmer s Guide part IV on page 121 9 2 1 Basic Steps 9 2 1 1 Export The first step is to export the program using the menu File gt Export Here select the language C HALCON NET and save it to file The result is a new file with the given name and the extension g3 GB 9 2 1 2 The C Template If the file has been exported using the option Use Export Template it is
352. inside main or the currently displayed procedure respectively el Reset profiler values cH Open runtime statistics see section 6 4 10 2 6 4 10 2 Runtime Statistics This window displays the accumulated profiling data in a table which can be sorted by clicking the corresponding headers lal Save the runtime statistics as a plain text file txt or csv Each line contains a table row and the columns are separated by tabs ES Copy the selected entries to the clipboard If no entries are selected the entire table is copied Operators Show execution times per operator procedure Program Lines Show execution times per program line f Show execution time bp Show operator time ms Display times in milliseconds s Display times in seconds h Display times in hours Display values as percentages If percentages are selected the values refer to the accumulated times of the entire program i e the run time of main corresponds to 100 El Include runtime statistics of procedures in display o Include runtime statistics of operators in display M0 Include program lines with zero calls 6 5 Operator Window 167 7 K Runtime Statistics ice fnC a fel e Oers Programuines E ra mM Eu Calls Total Average Minimum Maximum 1 0 300ms 0 300ms 0 300ms 0 300 ms 2 comment 0 0 000ms 0 000ms 0 000ms 0 000 ms 3 connection 1 0 406ms 0 406ms 0 406ms 0 406ms 4 decompose3 1 2 636ms 2 636ms 2
353. inspect edges along an ROI If necessary i e if your edge extraction is not as successful as expected you can refine the determination of the edges you need for measuring by using the Fuzzy Measure page 301 option you find on the Fuzzy tab Fuzzy measuring allows you to specify certain ranges within which edges are labeled good Edge Extraction You can optimize edge extraction by adapting the following parameters on the Edges tab e WithMin Edge Amplitude you can specify how strong an edge must be to be selected Adapt this parameter such that only your desired edges are selected Note that very small values should only be used with high quality images otherwise false edges might be caused by noise e Smoothing is helpful to reduce noise and therefore the detection of false edges Please note how ever that smoothing distorts the edge profiles i e edges are detected at a slightly wrong positions 7 4 2 How to Use the Measure Assistant of HDevelop 297 and the accuracy decreases When using the line profile tool page 210 smoothing can either be applied with the Measure Assistant or it can be performed with the smoothing slider within the line profile window The smoothing values are immediately transfered to the Measure Assistant and the line profile window respectively e With ROI Width you can specify how many pixels alongside i e perpendicular to the line or arc of measuring are used to detect edges A lar
354. intended to be used together with the predefined C project that can be found in the directory HALCONEXAMPLES c HDevelopTemplate This project contains a form with a display window HWindowControl and a button labeled Run Add the file generated by HDevelop to the project in the Solution Explorer Add Existing Item Now the project is ready for execution Run the project and then press the button Run on the form which will call the exported code Additional information about using the template can be found in the Programmer s Guide section 17 4 1 on page 153 9 2 2 Program Structure 385 9 2 2 Program Structure If the program has been exported using the option Use Export Template the file created by HDe velop contains a subroutine with the corresponding name for every HDevelop procedure except the main procedure which is contained in the subroutine action Otherwise the file is exported as a standalone application Iconic input and output parameters of a procedure are passed as HObject and out HObject respectively while control input and output parameters are passed as HTuple and out HTuple respectively The subroutine RunHalcon contains a call to the subroutine action and has a parameter Window which is of type HTuple This is the link to the window on the form to which all output operations are passed In addition another subroutine is created with the name InitHalcon This subroutine applies the same initializ
355. interface selected in the tab Source This tab card is only available if the image source is set to an image acquisition interface The connection parameters are described below See the description of the operator open_framegrabber for additional information about the fields Configuration Device Select the ID of a board camera or logical device if multiple devices are available for the selected image acquisition interface Upon building the list of devices the assistant queries the status of each device Depending on the image acquisition interface devices may be reported as misconfigured If you select such a device the assistant may suggest a Generic parameter that potentially resolves the misconfiguration If you confirm this suggestion the parameter will be entered into the Generic slot see below If a device is labeled with a question mark icon it is either read only busy or unknown Port Specify the ID of the input port Camera Type Select a camera configuration or signal type Select Select a camera configuration file in XML format from a file browser Trigger Tick the check box if the image acquisition is controlled by an external trigger Resolution X Y Specify the factor for image width height Color Space Specify the configuration for color acquisition Field Specify the frame selection for interlaced cameras Bit Depth Specify the number of bits used for one image channel Generic Some image acquisition inte
356. ion and negation can be applied to either integer or real numbers If at least one operand is of type real the result will be a real number as well Examples Expression Result 4 3 1 4 3 0 1 3333333 4 3 2 0 2 0 Simple examples can be found in the program arithmetic hdev 8 5 7 Bit Operations This section describes the operators for bit processing of numbers The operands have to be integers The result of lsh i1 i2 is a bitwise left shift of i1 that is applied i2 times If there is no overflow this is equivalent to a multiplication by 2 The result of rsh i1 i2 is a bitwise right shift of 11 that 352 HDevelop Language Operation Meaning HALCON operator 1sh i1 i2 left shift tuple_lsh rsh il i2 right shift tuple_rsh il band i2 bitwise and tuple_band il bxor i2 bitwise xor tuple_bxor il bor i2 bitwise or tuple_bor bnot i bitwise complement tuple_bnot Table 8 11 Bit operations is applied i2 times For non negative i1 this is equivalent to a division by 2 For negative 11 the result depends on the used hardware For 1sh and rsh the result is undefined if the second operand has a negative value or the value is larger than 32 More examples can be found in the program bit hdev 8 5 8 String Operations There are several string operations available to modify select and combine strings Furthermore some operations allow to convert numbers real and integer to strings v s vi v2 strchr
357. ion in HDevelop The assignment in C syntax u sin x cos y is defined in HDevelop using the assignment operator as assign sin x cos y u which is displayed in the program window as u sin x cos y If the result of the expression does not need to be stored into a variable the expression can directly be used as input value for any operator Therefore an assignment is necessary only if the value has to be used several times or if the variable has to be initialized e g for a loop The assignment operator assign_at Index Value Result is used to modify tuple elements The call assign_at Radius 1 Area Areas is not presented in the program text as an operator call but in the more intuitive form as Areas Radius 1 Area As an example Areas 1 2 3 Areas 1 9 sets Areas to 1 9 3 To construct a tuple with assign_at normally an empty tuple is used as initial value and the elements are inserted in a loop o te iv te c l 346 HDevelop Language Tuple for i 0 to 5 by 1 Tuple i sqrt real i endfor As you can see from the examples the indices of a tuple start at 0 An insertion into a tuple can generally be performed in one of the following ways 1 Incase of appending the value at the back or at the front the tuple concatenation operation comma can be used Here the operator assign is used with the following parameters assign T
358. ion is determined only with pixel accuracy and 7 3 3 Matching Assistant Reference 287 the accuracy of the orientation and scale is equal to the angle step size page 276 and scale step size page 277 respectively If you select the value interpolation the Matching Assistant examines the matching scores at the neigh boring positions angles and scales around the best match and determines the maximum by interpolation Using this method the position is therefore estimated with sub pixel accuracy The accuracy of the es timated orientation and scale depends on the size of the object The larger the size the more accurately the orientation and scale can be determined For example if the maximum distance between the center and the boundary is 100 pixels the orientation is determined with an accuracy of about 0 1 Because the interpolation is very fast you can select interpolation in most applications When you choose the values least_squares least_squares_high or least_squares_very_high a least squares approximation is used instead of an interpolation resulting in an even higher accuracy However this method requires additional computation time The Search Parameter Max Deformation Shape based Matching The parameter Max Deformation enables you to allow a certain deviation in pixels of the found edges from the model edges Note that higher values for Max Deformation often result in an incre
359. irectories You can specify a selection of image files or a directory to load images from Make sure the radio button Image File s is selected in the tab card Source You can directly enter image names or the name of a directory into the text field Multiple image names are separated by a semicolon Usually it is more convenient to use one of the following buttons Select File s HDevelop opens a file selection dialog in the current working directory displaying the image files sup ported by HALCON Multiple image files can be selected by holding down the key while clicking additional image files Click Open to confirm the selection The first selected image is displayed in the active graphics window Select Directory HDevelop opens a directory browser It is not possible to select multiple directories Confirm your selection by clicking Open or OK The first image from the selected directory is displayed in the active graphics window If the check box Recursive is ticked all subdirectories of the specified directory are scanned for images as well View Images You can single step through the selected images by clicking the Snap button see figure 3 4 Each time you click the button the next image is displayed in the active graphics window You can also loop through the images by clicking the button Live This is especially useful for animations Both functions are also available from the menu Acquisition Snap ee images Sax
360. irl Alt s 39 fae Read Image _Ctrl R 62 lal Export Ctrl Shift 0 X OF Ctrl Shift O Ctrl Shift x 60 E Print Ctrl P 65 de Cut _CtrleX J Or Shift Del 67 ES Copy Cut C or Ctrt Ins 67 E Delete Del 68 E Paste Ciri v or Shift ins 67 gt Undo Ctrl Z Ctrl Z 66 Cad Redo Ctrl1 Y Ctrl Y 66 Ep Activate F3 68 Ek Deactivate F4 68 Find Replace Ctrl F 69 d Run ES 97 gt Step Over 63 98 ha Step Into F7 99 da Step Out Fs 99 O Stop Fo 100 bp Reset Program Execution F2 103 Ep Reset Procedure Execution Shift F2 103 6 3 Tool Bar 137 Action Shortcut Info El Abort Procedure Execution Shift F8 103 G Activate Profiler Ctrl Shift EF Or Ctrl Shift F Ctrl Shift F 103 er Set Parameters Ctrl Shift G P Or Ctrl Shift G Ctrl Shift P 108 Zoom Window Ctrl Shift 0 Z OF Ctrl Shift O Ctrl shift Z 116 ba Gray Histogram Ctrl Shift 0 H OF Ctrl Shift O Ctrl Shift H 117 lie Feature Histogram Ctrl Shift O F Or Ctrl Shift O Ctrl Shift F 117 LS Feature Inspection Ctrl Shift O 1 Or Ctrl Shift O Ctrl Shiftel 117 ba Line Profile Ctrl Shift O L Or Ctrl Shift 0 Ctrl ShiftL 117 P Help Fl 134 AfA OCR Training File Browser Ctrl Shift 0 T Or Ctrl Shift O Ctrl shift T 118 o o o d o 2 o a 5 9 138 Graphical User Interface 6 4 Program Window A program window
361. is calculated as the relation of found objects to the sum of expected objects over all images i e it is 100 if in each image exactly as many objects are found as specified Note that if you select Maximum Number of Matches 0 and by mistake specify a lower num ber of visible objects than are actually present in a test image a recognition rate 100 results in a completely confused optimization algorithm You may handle this case by selecting the condition gt 100 for the recognition rate 7 3 3 6 The Menu and Tab Inspect Via the menu Inspect you can determine the recognition rate and the pose bounds of the object for the used set of test images When selecting Determine Recognition Rate via the menu Inspect the tab Inspect is opened and the recognition rate is automatically determined Alternatively you can directly open the tab and select the button Run Inside the tab you can also specify the maximum number page 285 of object instances the Matching Assistant should search for Determining the Recognition Rate With the menu item Inspect gt Determine Recognition Rate or when you click either the corre sponding button in the tool bar or the button Run in the tab Inspect the Matching Assistant determines the recognition rate by searching for the object in all loaded test images You can interrupt this process by clicking the button labelled Stop please note however that this event is processed only after the current
362. is decreased by the indent size Advanced Autocompletion The full text editor provides advanced autocompletion to support you in entering programs quickly and correctly without restricting your typing in any way Autocompletion is enabled by default It can be toggled on or off from the tool bar of the program window see section 6 4 1 on page 139 When you start typing a new line HDevelop will suggest a list of matching operator names read read_aop_knowledge read_calib data read_cam_par read camera setup model read char o D Q xX 0 144 Graphical User Interface Note that the line is highlighted as invalid red in the default color scheme because it is still incomplete The list is updated immediately as you continue typing read i Press to complete to the longest common string In this example only one operator name remains in the list Thus it is fully completed including the opening parenthesis of the operator call read_image image Image filename read FileName fabrik Image Image Once the cursor moves inside the parentheses the suggestion list changes from operator mode to param eter mode Furthermore the signature of the selected operator is displayed and the parameter corre sponding to the cursor position is highlighted in bold The first entry in this list is a suggestion that completes the full operator call up to the closing parentheses
363. is position internally and will redisplay the thus selected part of the image object when you leave the graphics window This enables you to have a meaningful display in the zooming tool whenever you want to do actions outside of the graphics window For finer control of the zoomed area click inside the zoom window to give it the focus and use the cursor keys to move pixel wise Press and hold the key and use the cursor keys to move ten pixels at a time F W zoom Image ACEI Size Y Follow Mouse 133 114 93 byte 3 channels F Column 416 Figure 6 77 Zoom g la c i E 2 5 0 198 Graphical User Interface Click inside the zoom window to move relative to the center position For example clicking ten pixels above the center will move the view up ten pixels The lower part of the window contains a gauge to display the gray value of the center pixel graphically The range goes from 0 left to 255 right Normally the gray value of the first channel is displayed with a black bar For images with multiple channels the gauge is split accordingly to show individual bars for each channel Thus for color images in RGB space three channels with red green and blue values three colored bars are used If the gray value is below 1 the gauge is light gray background If the value is above 255 the gauge is dark gray or colored for RGB images Above the gauge the gray values are disp
364. ist Checks for Unsaved changes page 222 Shortcut Selecting this menu item opens a dialog that allows you to load HDevelop example programs grouped by categories The dialog is displayed in figure 6 3 Browsing the Categories The tree on the left contains a structured list of categories Clicking the icon in front of a category toggles the display of its children Alternatively double clicking any category label shows and hides the subcategories while also selecting the node of the tree There can be multiple levels of categories If you select a category all its matching example programs are listed in the area on the right You can select multiple categories by holding down the key while clicking additional categories An HDevelop example program may appear multiple times under different topics and categories Filtering the Matched Example Programs Both the file name and the short description of the matched example programs are displayed You can reduce the number of listed programs by entering a search string into the Filter text box As you type o D 2 Q a 0 56 Graphical User Interface A Browse HDevelop Program Examples Category 2 Find measure Pharmaceutical ds A Photogrammetry and remote sensing Bamsi Short ase Precision engineering and opti Measure pins of an Printi OS aa fuzzy_measure_ using fuzzy measuring Inspect the position of ball
365. it Procedure 121 Insert All As Local 120 Insert Used As Local 120 Make A11 External 120 Manage Procedures 121 process features 299 Profiler Display 103 Program Protection 89 program counter 17 program window 17 138 406 edit line 140 Properties 64 pull down menu 54 Pyramid Levels 272 pyramid levels lock model and model image 267 pyramid levels model 266 pyramid levels model image 267 pyramid display 266 quality issues 239 quick setup 314 Quit 66 Read Image 62 136 Recent Programs 55 56 recognition rate determine 290 recognition speed optimize 289 Record Interactions 115 Recursive 225 Redo Ctrl Y 66 136 reference to assistant elements 248 261 306 329 References 160 Refresh 74 227 regexp_match 356 regexp_replace 356 420 Index regexp_select 356 regexp_test 357 region 406 colors 107 empty 405 line width 107 shape 108 regions visualization 107 regular expressions 356 relative file paths 91 Release Generated Code Lines 224 250 293 310 333 Remove 154 Remove All Test Images 281 Remove from User Tab 176 181 Remove Test Image 281 repeat 366 replace Find Replace 69 Replace selected program lines 154 reserved words 363 Reset 77 154 reset 320 graphics window 114 Reset A11 227 Reset Parameters 114 Reset Procedure Execution 103 136 Reset Profiler 104 Reset Program Execution 103 136 Resolution
366. its enclosing circle etc The setting of Line Width applies to XLDs and regions in draw mode margin The color of the regions XLDs can be set to one of the named colors If you select one of the color sets each region or XLD will be displayed in an alternating color from a set of 3 6 or 12 colors This visualizes the connectivity of different regions in the graphics window Click the add button to define additional colors Colors are specified by hue saturation value or by giving the red green and blue values see figure 6 29 User defined colors are added to the list of named colors They can be removed by selecting them and clicking the remove button You can also define your own custom color sets Add selected colors to the list of custom colors by clicking the right button or remove them by clicking the left button The check box next to Custom colors specifies if the custom color set is used User defined colors and custom color sets are discarded when you quit HDevelop If you want them to be permanent you will have to define them in the preferences dialog see section Visualization Settings gt Pen LUT Paint on page 94 7 Select Graphics Window 3600 Pen LUT Paint Zoom Draw o fill margin Shape original v Line Width 1 remove user defined color add user defined color Colors Custom colors A 6 colored 3 a color sets colored gt L
367. ivate activate the breakpoints in many procedures at once consider using the tab Breakpoints of the program line view window which is discussed in section 6 2 3 13 6 2 3 12 Clear All Breakpoints Synopsis Clear all breakpoints in the current program o D 2 Q a 0 102 Graphical User Interface Po Program Line View nce ofa Cravaidnes naar Breakpoints Boolmaris 400 Breakpoint Procedure Line Context 7 0 main 43 smallest_rectangle Y 0 main 68 count_obj Final W 0 dev_open_window_fit_size 37 ResizeFactor m Figure 6 24 Managing breakpoints in the program line view window 6 2 3 13 Breakpoints Synopsis Manage breakpoints Shortcut ctrl Snift 0 F10 or Ctri Shift 0 Ctrl Shift F10 The program line view window see section Open Program Line View on page 131 contains a tab card to manage breakpoints and navigate to the corresponding program lines The tab card lists all program lines that contain a breakpoint Clicking an entry focuses the corresponding program line in the active program window If the selected procedure is already displayed in a program window tab the corresponding tab is activated Otherwise the current view switches to the selected procedure a Clear the breakpoints of the selected program lines and immediately remove the corresponding entries from the list This action can also be triggered
368. k Synopsis Jump to next bookmarked program line Shortcut The cursor jumps to the next bookmark i e the next bookmarked program line in the current procedure or the first bookmarked program line in the first following procedure that contains bookmarks The procedures are traversed in alphabetical order with the exception of the main procedure which always comes first in the list 6 2 2 13 Previous Bookmark Synopsis Jump to previous bookmarked program line Shortcut The cursor jumps to the previous bookmark i e the previous bookmarked program line in the current procedure or the last bookmarked program line in the first preceding procedure that contains bookmarks The procedures are traversed backwards in alphabetical order with the exception of the main procedure which always comes first in the list 6 2 2 14 Bookmarks Synopsis Manage program line bookmarks Shortcut ctr Shift O F11 Or Ctrl Shift O Ctrl Shift F11 The program line view window see section Open Program Line View on page 131 contains a tab card to manage your bookmarks and navigate to the bookmarked program lines o D 2 Q a 0 The tab card lists all program lines that are currently bookmarked Clicking an entry focuses the corre sponding program line in the active program window If your program contains many bookmarks this will be more transparent and convenient then repeatedly jumping through your
369. l Basic NET that creates a message box This message box causes the program to halt until the button is pressed 9 3 2 2 Exit The HDevelop operator exit is translated into the Visual Basic NET routine End Because this routine has no parameter the parameters of exit are suppressed 9 3 2 3 Used Classes There are only four classes types that are used HTuple for control parameters and HObject for iconic data In addition there is the class HWindowControl It is used inside the project for the output window and a variable of class HTuple directs the output to this window Finally the class HOperatorSet is used as a container for all HALCON operators There is no need for other classes as long as the program has the same functionality as in HDevelop When editing a generated program you are free to use any of the classes of HALCON NET to extend the functionality 388 Code Export 9 3 3 Limitations and Troubleshooting Besides the restrictions mentioned in this section and in section 9 6 on page 392 please also check the description of the HDevelop operators in section 6 2 6 2 on page 123 9 3 3 1 Variable Names In contrast to C C or HDevelop Visual Basic NET has many reserved words Thus the export adds the prefix ho_ to all iconic and hv_ to all control variables respectively in order to avoid collisions with these reserved words See also section 9 6 3 on page 394 about case sensitivity 9 3 3 2 Exception Handling
370. l contains enough points on the selected number of pyramid levels only when actually creating the model In case the model does not contain enough model points a corresponding error dialog appears Letting the Matching Assistant Select a Suitable Value for Pyramid Levels Shape based Match ing Correlation based Matching Deformable Matching 7 3 3 Matching Assistant Reference 273 When you click the button Auto Select that is placed right beside the slider for the parameter Pyramid Levels the Matching Assistant selects a suitable number of pyramid levels automatically thus relieving you of the task of examining the model image pyramid Please note that in rare cases the automatic selection will yield a too low value and thereby slow down the search process or a too high value resulting in failures to recognize the object In such a case we recommend to inspect the model image pyramid page 266 and select a suitable value manually The Model Parameter Starting Angle Shape based Matching Correlation based Matching Deformable Matching With the parameter Starting Angle you can specify the starting angle of the allowed range of rotation unit With another parameter you can specify the extent of the allowed range Note that the range of rotation is defined relative to the model image i e a starting angle of 0 corresponds to the orientation the object has in the model image Therefore to allow rotations up to 5 e g
371. l tip when placing the mouse pointer over the message area of the status bar The history can be copied to the clipboard by selecting the entry Copy History to Clipboard in the context menu of the status bar Open Output Console The output console displays the message history in a separate window See section Open Output Console on page 129 o D 2 Q a 0 54 Graphical User Interface Window Modes There are two different window modes in HDevelop which can be toggled in the menu Window MDI multiple document interface In this mode the main window contains all other windows and dialogs with the exception of the online help window and modal dialogs which block other win dows temporarily You are free to move the windows according to your needs and preferences inside the main window You may iconify and or deiconify them HDevelop provides basic win dow management functions in this mode SDI single document interface In this mode all windows are stand alone There is no main window The menu the tool bar and the status bar are relocated to the first program window You may find this mode beneficial if you want to take advantage of special window manager capabilities under UNIX 6 2 Menu The menu of the main window provides access to the complete functionality of HDevelop Here you may choose HALCON or HDevelop operators or procedures or manipulate the graphical output Every menu item
372. layed as numbers Up to five channels are displayed If more than five channels are present the remaining channel values are truncated Next to the gauge the coordinates of the mouse position are displayed Below these the image size pixel type and the number of channels are shown m The button next to the scale combo box enlarges the zoom window so that partially visible pixels at the border become fully visible 6 10 Gray Histogram Window 199 6 10 Gray Histogram Window Synopsis Display gray value histograms See also Menu Visualization gt Gray Histogram The gray histogram window is a sophisticated tool for the inspection of gray value histograms which can also be used to select thresholds interactively and to set the range of displayed gray values dynamically Input Window When opening the tool the histogram of the image shown in the active graphics window is displayed When the tool is already open the following means of sending new image data to the tool are available e Make another graphics window active or display another image in the active graphics window Whenever you do so the histogram of this image is computed and drawn and the tool records the graphics window from which the image was sent the originating window e Select a graphics window number in Input Window e Whenever image data is displayed overlaid with region data in a graphics window you can click into any of the segmented regions and th
373. layout is displayed in figure 6 37 6 2 9 Menu Window 133 x HDevelop unnamed k gt a File Edit Execute Visualization Procedures Operators Suggestions Assistants Window Help PAALA SYI ABBR IE BE bbe gt P gt W Program Editor elas de N variable View main o a 3 Ico Operator Window oes Ent Graphics Window 3600 Lo LO fees FAS Er gt Eur K je E UY i 191 384 Figure 6 37 Cascaded window layout of HDevelop 6 2 9 9 SDI MDI Synopsis Switch between multiple document interface the default and single document interface Shortcut ctrl shift w s Or Ctrl Shift W Ctrl Shift S The different modes are explained in section Main Window on page 51 6 2 9 10 Full Screen Synopsis Toggle fullscreen mode Shortcut Ctl Shift W F or Ctrl Shift W Ctrl Shift F In full screen mode the main window is maximized and the window decorations are removed to make full use of the screen estate The full screen mode is not available in SDI mode g la c i E 2 5 0 134 Graphical User Interface 6 2 10 Menu Help Here you may query information about HALCON itself and all HALCON and HDevelop operators 6 2 10 1 Help Synopsis Open the online help window Shortcut The help window provides access to the documentation of HDevelop and HALCON In particular the complete H
374. ld Image The image will be stored in this variable Next enter clip into the text field FileName You can press to go to the next input field Pressing takes you back to the previous field This way you can enter all parameters without using the mouse Click OK or press to submit the operator to the current program This will do the following 4 4 Getting Help 35 5 A Operator Window Insert read_image O Enter Operator or Procedure read_image z read_image HALCON operator Read an image with different file formats Parameters iconic output Image Clip v image semantic type E data type control input amp FileName clip E flename read string file selection dialog Figure 4 3 Specifying parameters e An operator call is added as the first line of the current program e The IC is advanced so that additional lines will be added after the inserted line e The program line is executed and the PC is advanced To be more precise All the lines from the PC to the IC are executed which makes a difference when adding program lines in larger programs e The character is added to the window title to indicate unsaved changes in the current program The current procedure main is also marked with in the program window e The image is displayed in the graphics window e The status bar is updated i e the execution time of the operator read_image is displayed and the format of th
375. lected path into a path relative to the preferred search directory If this fails HDevelop tries to turn the selected path into a path relative to the current working directory As a minimum requirement the selected path and the current working directory must have the same device and toplevel directory This will be useful in cases where e g an image directory and a directory for HDevelop scripts are placed side by side within a common project directory o D 2 Q a 0 92 Graphical User Interface If no relative path can be established HDevelop will use the absolute path Number of recent program files The maximum number of recent program files that are displayed in the menu File gt Recent Programs can be adjusted by altering this value Show recent program files If you select the option Only available the list of recent programs contains only programs that are currently available This option is useful if the list is likely to contain files from network drives that might be disconnected at times Save program and external procedures automatically before execution If this option is enabled and you click any of the execution buttons like Run or Step Over and there are unsaved changes in the current program the program will be saved before being executed Use this option with care You usually do not want to select this option if you are experimenting with a program e g when trying out diff
376. les are not cov ered by sequence Not all image sizes are identical It was impossible to extract the calibration plate marks in some images which makes it also im possible to calibrate in this state The quality of some images is be low the warn level The number of images is lower than recommended Some part of the field of view is not covered by any image of the calibration plate i e there are ar eas with no marks The calibration plate has not been tilted enough The image list contains images of different sizes Delete the images for which mark extraction has failed and use new images instead or adapt the ex teraction parameters Make sure that you follow the steps for good calibration images page 235 and check for possible error sources page 239 Check the quality issues of the sin gle images by clicking on their names in the list Handle qual ity issues as described in the table above Check if you have taken enough images Less than 10 images will lead to a low percentage in the quality ranking whereas 20 images equal 100 percent Press the Show button which appears in a column named Details to see all areas in red that are not covered by calibration plate images compare figure 6 3 Before continuing add the missing image s to your sequence You can avoid this problem by following the steps for good calibration images page 235 Add more images of your calibra tion plate ti
377. libration Assistant 7 2 1 Introducing the Calibration Assistant of HDevelop Most applications that need a previous calibration of the camera system belong to the area of 3D machine vision These applications require a 3D model of the camera system Calibration is necessary in order to gain information about distortions perspective and lens distortions in an image and about parameters of the camera system Calibrating your camera system with the HALCON Calibration Assistant enables you to measure in the world coordinate system with a high accuracy This task can be performed by taking images of a known object a calibration plate The Calibration Assistant of HDevelop is a front end to HALCON s operator camera_calibration Using the Calibration Assistant you can e either perform a complete calibration or 7 2 1 Introducing the Calibration Assistant of HDevelop 231 e take advantage of the user defined mode and only calibrate chosen parameters if the rest is already known e g if you are using a special setting All you need is a set of ideally 10 to 20 calibration images The Calibration Assistant then returns the calibration results and enables you to generate code and insert it into a given program The Calibration Assistant can calibrate vision systems based on standard lenses as well as on telecentric lenses With the HALCON Calibration Assistant you can e perform a calibration page 233 e view the calibration results
378. line If an error occurs during grabbing it is displayed in the status bar of the dialog The dialog is displayed in figure 6 65 g la c i E 2 5 0 180 Graphical User Interface W Pose inspect o Pose TransX O TransY 0 TransZ 0 RotX 0 RotY 0 RotZ 30 Type O0 0 0 D0 0 0 Figure 6 64 Inspection of a pose control variable Context Menu Inspect Inspect the values of the selected control variables in an auxiliary window See above page 177 for more information Copy Copy the values of the selected variables to the system clipboard If the variable window has the keyboard focus can be used as a shortcut Tuples with zero or more than one values are returned in tuple notation If multiple variables are selected the tuples of the different variables are separated by a new line Clear Variable Clear the selected control variables The contents of the variables become undefined Add to User Tab The selected variables are added to the tab User W Acquisition inspect Name 4 gtl 1 0 4 1 Width 1392 Height 1040 ColorSpace gray BitsPerChannel 1 Port 0 Device asler scA139017gm Trigger false CameraType default Online Status Figure 6 65 Inspecting an image acquisition device handle 6 6 2 Control Variables 181 Find Variable Open the Find Replace page 69 dialog with the name of the s
379. ll path of the current program or only the file name is displayed in the title bar of the HDevelop window Default for Organize Windows These combo boxes define the tiled layout of the four main windows of HDevelop when using the menu entry Menu Window gt Organize Windows page 132 g la c i E 2 5 0 82 Graphical User Interface Procedures gt Directories Use this tab card to manage the list of directories that contain external procedures The directories are recursively scanned for external procedures in their listing order see section 5 4 on page 47 Directories External Procedures Manage Procedure Libraries Manage Passwords Procedure Use ur 43 gt List of search directories for external procedures A Add Add Library v Delete Directory Libraries Procedures Loaded The following procedure paths were set via command line and cannot be altered Y C Users Public Documents MVTec HALCON 11 0 procedures custom 3 3 User defined procedure paths Y C JUsers Public Documents MVTec HALCON 11 0 procedures projects project a 1 2 5 5 V C Users Public Documents MVTec HALCON 11 0 procedures projects project_b 3 3 V C JUsers Public Documents MVTec HALCON 11 0 procedures projects project_c 3 3 V C Users Public Documents MVTec HALCON 11 0 procedures common 4 4 The following standard procedure path cannot be removed Y W stable 11 0
380. llowing modifications can speed up e shape based matching e correlation based matching e deformable matching page 259 and e descriptor based page 259 To find out if a speed up is necessary or sucessful it is useful to check the Statistics on the tab Inspect page 290 Speed up shape based matching Parameters gt Standard Model Parameters page 269 The following Standard Model Parameters may speed up shape based matching e Number of Pyramid Levels page 272 Increase the value and check whether the matching still succeeds in all images e Allowed range of rotation page 273 Set the parameters Starting Angle page 273 and Angle Extent page 273 according to the range probably needed for your images e Set the allowed range of scale via Starting Angle page 273 Min Row Scale page 273 Max Row Scale page 273 Min Column Scale page 273 and Max Column Scale page 273 according to the ranges probably needed for your images Parameters gt Advanced Model Parameters page 275 The following Advanced Model Parameters may speed up shape based matching e Min Contrast page 279 Increase the value and check whether the matching still succeeds in all images e Optimization page 278 Point Reduction Select a higher reduction rate and check whether the matching still succeeds in all images 258 HDevelop Assistants Angle Step page 276 size and Scale Step page 277 size Increase the valu
381. lso possible to write Sequence 1 1000 If we want to construct a tuple with the same length as a given tuple there are two ways to get an easy solution The first one is based on gen_tuple_const tuple_new gen_tuple_const tuple_oldl 4711 o te iv te c l 350 HDevelop Language Operation Meaning HALCON operator b is_int t test for integer values tuple_is_int b is_mixed t test for mixed values tuple_is_mixed b is_number t test for numerical values tuple_is_number b is_real t test for real values tuple_is_real b is_string t test for string values tuple_is_string i type t get type value tuple_type Table 8 8 Type operations The second one is a bit tricky and uses arithmetic functions tuple_new tuple_old 0 4711 Here we get first a tuple of the same length with every element set to zero Then we add the constant to each element In the case of tuples with different values we have to use the loop version to assign the values to each position tuple for i 1 to 100 by 1 tuple tuple ix i endfor In this example we construct a tuple with the square values from 1 to 100 8 5 5 Type Operations The type operations allow to test or query the value type of control data See table 8 3 on page 341 for the corresponding type constants There are also corresponding operations that test each element of the input tuple 8 5 6 Basic Arithmetic Oper
382. lted in different direc tions We recommend to tilt the plate in every quadrant of the im age twice and vary the tilting di rection You have changed your setup while taking calibration images Therefore you should delete those images taken before the change in order to get useful results back 7 2 2 How to Calibrate with the Calibration Assistant 243 BE a Quality Issues Scope Description Quality Details 1 Sequence Number of images is too low 0 2 Sequence Field of view is not covered by plate images 4 3 Sequence Tilt angles are not covered by sequence 0 c not covered covered Figure 7 3 Not enough calibration images have been taken a and b calibration sequence consisting of two calibration plate images c A Show button appears due to the fact that the coverage is not sufficient d An image shows which parts of the field of view are not covered by calibration plate images 7 2 2 3 Display Parameters The drop down menus under Display Parameters enable you to choose the the colors and drawing parameters for the calibration images display that you prefer You can either leave the default values or choose your own values for Plate Region Mark Centers or the Coordinate System The Draw option lets you choose whether you want to see margins or filled regions 7 2 2 4 Calibration Plate Extraction Parameters You should always aim for high quality images If for some reason you should how
383. ludes an additional entry Declared in It lists the names and line numbers of the procedures that declare and thus use the corresponding global variable Click on an entry to jump to the corresponding location in the program window 6 6 1 Iconic Variables The iconic variables are represented by icons which contain an image a region or an XLD depending on the current value The icons are created depending on the type of data according to the following rules e For images the icon contains a zoomed version of them filling the icon completely Due to the zooming onto the square shape of the icon the aspect ratio of the small image might be wrong If there is more than one image in the variable only the first image is used for the icon Similarly for multi channel images only the first channel is displayed An exception is made for images with 3 channels These are displayed as color icons RGB g la c i E 2 5 0 174 Graphical User Interface x Variable View main Iconic Variables Od Podi ImageReduced image type byte B PizzaRaw ConnectedRe Pizza PizzaFilled channels 1 size 1280 1024 Control Variables with ROI of area 745097 Est aiaa i center 516 195 610 953 Type byte semantics ng Width 1280 Height 1024 WindowHandle 3600 All Auto User Global Figure 6 60 Displaying information about an iconic variable with a reduced domai
384. lues are accepted Short description of the control parameter g la c i E 2 5 0 162 Graphical User Interface A Edit Procedure Interfaces dev_open_window_ft image eJLo sa Select Procedure E dev_open_window_f image General parameters Seneral Parameter _ Language Settings Documentation Engish enUS y image Row Column Widthuimit Heighttimit windowtande Ey E Row control input Semantics integer y Typelist Y integer E real string Default Type integer Mixed Types False Al values of a tuple have the sa Default Value 0 Values 0 10 50 100 150 200 500 Exdusively Value Min 0 00 E Enabled Value Max 0 E Enabled Multi Value False The parameter accepts only a single value x Row coordinate of the upper left corner of the new window Description Y Adapt program OK Cancel Apply Help Figure 6 51 Editing the control parameter documentation of a procedure 6 4 9 Protecting a Procedure The concept of protected procedures is explained in section 5 6 on page 49 The status of a procedure can be changed via the procedure interface dialog page 150 To manage the status of multiple procedures at once click Menu Procedures gt Manage Procedures and select the tab card Manage Passwords page 88 If you want to protect a procedure with a password do the following e Select the corresponding proce
385. lways be raised This is also true for messages like H_MSG_FAIL which are not handled as exceptions in C for example When handling exceptions you also have to be aware that the COM interface always resets the output parameters at the beginning of the operator execution Thus when the exception occurs output variables are set to Nothing Therefore you cannot use the values of variables used as output parameters of the operator causing the exception 9 5 Code Generation for C This section describes how to create a HALCON application in C starting from a program developed in HDevelop 9 5 1 Basic Steps 9 5 1 1 Program Export The first step is to export the program using the menu File gt Export Here select the language C HALCON C and save it to file A file will be created that contains the HDevelop program as C source code For every HDevelop procedure except the main procedure the exported file contains a C procedure with the corresponding name Iconic input and output parameters of a procedure are de clared as Hobject and Hobject respectively while control input and output parameters are declared as Htuple and Htuple respectively All procedures are declared at the beginning of the file The program body of the HDevelop main procedure is contained in a procedure action which is called in function main action and main can be excluded from compilation by inserting the instruc tion define NO_EXPORT_MAIN at the app
386. ly regions images and XLDs are represented in variable icons Besides this there are three exceptions which are shown by special icons e Undefined variables are displayed as a question mark icon You may write to but not read them because they do not have any value e Brackets are used if a variable is instantiated but does not contain an iconic object empty tuple This may be the case using operators like select_shape with wrong specified thresholds or using the operator gen_empty_obj Such a value might be reasonable if you want to collect iconic objects in a variable gradually in a loop using concat_obj Here an empty tuple is used as starting value for the loop e A last exception is an empty region This is one region that does not contain any pixels points 1 e the area number of points is 0 You must not confuse this case with the empty tuple because there the area is not defined The empty region is symbolized by an empty set icon 6 6 2 Control Variables To the right of the variable name you find its values in the default representation If you specify more than one value for one variable tuple they are separated by commas and enclosed by brackets If the number of values exceeds an upper limit the output is clipped This is indicated by three dots at the end of the tuple For undefined variables their name and a are shown in the variable field An empty tuple is represented by Both exceptions
387. ly outside the test images i e in which the shape model extends beyond the image border Here points lying outside the image are regarded as being occluded i e they lower the score This should be taken into account while selecting the Minimum Score page 284 Please note that the runtime of the search will increase in this mode The Search Parameter Score Type Score Type defines the type of score to be evaluated You have two options to choose from e inlier_ratio and 7 3 3 Matching Assistant Reference 289 e num_points inlier_ratio defines the ratio of the number of point correspondences to the number of model points Although this value can have values of from 0 0 to 1 0 it is rather unlikely that this ratio can reach 1 0 Yet objects having inlier ratio less than 0 1 should be disregarded num_points defines the number of point correspondences per instance An object instance should be considered good if it has 10 or more point correspondences with the model Fewer points are insufficient because any random 4 point correspondences define a mathematically correct homography between two images The Search Parameter Descriptor Min Score Decriptor Min Scoreis the minimal classifier score for an interest point to be regarded as a potential match The score function is between 0 0 and 1 0 but typically only values between 0 0 and 0 1 make sense default 0 0 Increasing the value for Min Score can increase the d
388. ly speaking the horizontal axis is subdivided into bins with a width equal to the value selected with the slider Quantization add feature Feat 2306 72 3997 72 remove feature EX area visualize feature As with the gray histogram operations each selected feature has to be enabled to visualize the selection in the graphics window 6 12 Feature Inspection Window Synopsis Inspection of shape and gray value features of individual regions See also Menu Visualization gt Feature Inspection This window provides a tool for the convenient inspection of shape and gray value features of individual regions and XLDs It can for instance be used to determine thresholds for operators that select regions based on these features e g select_shape or select_gray The strategy to determine the data from which to compute the features is very similar to that of the gray histogram inspection window see section Gray Histogram Window on page 199 You can display an image or region by double clicking on it in the variable window or you can select a region or an image which is already displayed by single clicking it If you display or click into an image the gray value features of the entire image will be calculated If you click into a region that is not underlaid with an image only the shape features of this region will be displayed If you click into a region that is underlaid with an image or into a regio
389. m during runtime The deactivated lines are still part of the program i e they are stored like all other lines and their variables are still needed like all other variables To reverse this action select Activate Note that you can insert a real comment into your program by using the operator comment 6 2 2 Menu Edit 6 2 2 9 Find Replace Synopsis Find and replace text in the current program Shortcut This dialog provides comprehensive facilities for searching the program code You can perform a full text search or search for variable names as well as operator or procedure calls In addition you can replace variable names and substitute operator or procedure calls The dialog is displayed in figure 6 9 Y Find Replace babaka Find Replace Variables 0 Operators Texts Search for grab_image v Find All Replace x Replace Replace Al Find Parameter Scope All Program Current Procedure Options Case Sensitive Whole Words E Backward Figure 6 9 Looking for operator calls containing grab_image The search context can be set to one of the following entities e Variables Find program lines with variable names that match the search text e Operators Find program lines with operator or procedure calls that match the search text e Texts Full text search Find program lines that match the search text anywhere If the full text editor is disabled no replacing is allowed in this mode to ensur
390. mage Image invalid Wrong parameter number main 24 threshol Image R invalid Unresolved procedure call dev_update_on 3 flag invalid Syntax error Figure 6 36 Managing program lines in the program line view window 6 2 9 7 Organize Windows Synopsis Clean up window area of main window a uu Shortcut Ctrl Shift W 0 OF Ctrl Shift W Ctrl Shift 0 When selecting this item the main window is split into four areas by default all graphics windows are cascaded to fit the upper left quarter the operator window fits the upper right quarter the variable window fits the lower left quarter and the program window fits the lower right quarter The positioning can be adjusted in the preferences see page 81 All other windows that are currently open are cascaded at the center of the main window In this arrangement the four most important windows are placed in a non overlapping fashion to provide maximum accessibility It is therefore the default layout of HDevelop If the full text editor is enabled and the operator window is closed the program window will be stretched to occupy the configured position of the operator window as well The tiled layout is displayed in figure 6 1 on page 52 6 2 9 8 Cascade Windows Synopsis Arrange windows in a cascade Shortcut ctrl Snift w c or Ctrl Shift w Cul shift C By selecting this item HDevelop arranges the currently open windows in a cascade The cascaded window
391. meter 228 HDevelop Assistants Parameter Grouping The available parameters are grouped by user parameters read only parameters action parameters and write only parameters The latter cannot be changed in the assistant and are listed only for reference The parameters of some of the interfaces are additionally grouped by category and visibility If grouping information is available the amount of displayed parameters can be reduced by choosing a subject matter from the down down list Category You can further filter the parameters by selecting a skill level from the down down list Visibility beginner expert or guru By default the parameters are sorted thematically You can also sort the parameters by name check box Sort by Name Setting Parameters The parameters are displayed in a tabular format Hover the mouse pointer over a table row to get the short description of the corresponding parameter as a tool tip The tool tip also includes the value range for numeric parameters min max The first column shows the parameter name The second column depends on the parameter type e If the parameter is editable its value can be entered into a text field This field may contain value suggestions as a drop down list Numeric values can be incremented decremented using the arrows next to the text field e If the parameter is read only its value is displayed but cannot be modified e For action parameters the corresponding
392. meters rapidly since the operator dialog remains open and hence you can change parameters quickly Note that this functionality is not available for procedure calls and thus the button is grayed out in this case Unlike the button OK only the single line you edit or enter is executed no matter where the PC is located Thus you have to ensure that all the input variables contain meaningful values By clicking Apply the corresponding output variables are changed or created if necessary to allow you to inspect their values If you decide not to enter the line into the program body some unused variables may thus be created You can easily remove them by selecting Menu File gt Cleanup Cancel Clicking Cancel clears the contents of the operator window Thus there are neither changes in the program nor in any variables Help Clicking Help invokes the online help for the selected operator or procedure For this the system activates the online help window see Help Window 6 6 Variable Window There are two kinds of variables in HALCON corresponding to the two parameter types of HALCON iconic objects images regions and XLDs and control data numbers strings The corresponding vari ables are called iconic and control variables These variables may possess a value or may be undefined An undefined variable is created for example when loading a program or after inserting an operator with a new variable that is not executed immediately int
393. mmend to choose a value which is higher than the noise level in the test images You can also let the Matching Assistant select a suitable value automatically based on the model image Note that although this parameter is only used during the search it is already included when creating the model in order to speed up the matching process If you already loaded test images page 281 you can quickly test the effect of the selected parameter value via the menu item Inspect gt Determine Recognition Rate page 290 Letting the Matching Assistant Select a Suitable Value for Min Contrast Shape based Match ing Deformable Matching When you click the button Auto Select that is placed right beside the slider for the parameter Min Contrast the Matching Assistant selects a suitable value for the minimum contrast by estimating the noise in the model image Note that an automatic determination only makes sense if the image noise during the recognition is similar to the noise in the model image For this reason it is typically not useful when using a synthetic model image without noise Parameters relating to the Detector Type The interest points that build the model are extracted from the image by the so called detector The type of detector is selected via the parameter Detector Type Available types are e lepetit e harris or e harris_binominal For more information on these types see the description of the parameter Detector Ty
394. model page 262 that you have saved page 263 either with the Matching Assistant or with HALCON or that is available as DXF model You can also acquire a new image with the Image Acquisition Assistant page 225 as source for the model creation Now you can test the model on fest images page 253 7 3 2 3 Testing the Model After you created the model page 253 you test it in the following steps 256 HDevelop Assistants e Load one or more fest images page 253 via the menu item Usage gt Test Images gt Load Test Images page 281 or via the button Load inside the dialog Test Images in the tab Usage Al ternatively you can also choose the Image Acquisition Assistant page 225 as source of your test images by activating the corresponding checkbox under Test Image Source e Specify standard search parameter values via the menu item Usage gt Standard Model Use Parameters page 284 which opens the corresponding dialog in the tab Usage Especially the number of object instances page 285 to search for in an image should be specified If the number of object instances varies from test image to test image you can specify the number of visible ob jects page 283 for each test image separately in this case the search parameter mentioned above should be set to 0 or to the maximum number of visible objects Use the button Detect A11 page 282 to detect all matches and automatically set the maximum number of matches if it has not bee
395. n The domain of the image is not reflected in the displayed icon Information about the domain can be obtained from the tool tip which appears when the mouse cursor points to the icon See figure 6 60 for an illustration e Regions are displayed by first calculating the smallest surrounding rectangle and then zooming it so that it fills the icon using a border of one pixel In contrast to images the aspect ratio is always correct This can lead to black bars at the borders The color used to draw the region is always white without further modifications except zooming e XLD data is displayed using the coordinate system of the largest image used so far The color used for XLD objects is white on black background Because of the different ways of displaying objects you have to be aware that the coordinates cannot be compared The variable name is positioned below each icon They are displayed in the variable window in the order of occurrence or name from left to right If there is not enough space a scrollbar is created which you can use to scroll the icons Displaying Iconic Variables Double clicking an icon with the left mouse button displays the data in the active graphics window If you use images of different sizes in a program the system uses the following output strategy for an automatic adaption of the zooming Every window keeps track of the size of the most recently displayed image If you display an image with a different size t
396. n Redefined operators are marked by an icon in the first column of the program window Currently the following operators may be redefined stop By default the stop operator halts the program execution It is mainly used to highlight or evalu ate processing steps in a larger program If you want to run such a program uninterrupted without altering the actual program code you can make the stop operator behave like wait_seconds i e perform a defined delay The delay is specified in seconds wait_seconds The operator wait_seconds is often used in situations where an intermediate program result is presented that would otherwise pass by too fast Sometimes you want to run such a program without any delays e g for performance measuring purposes At other times you would like to stretch the delays e g for evaluation or presentation purposes Therefore you can redefine the actual delay of wait_seconds The delay is specified in seconds Selecting exactly causes the specified delay for each wait_seconds instruction Selecting with minimum causes delays up to the specified duration Calls to wait_seconds with a shorter duration will not be affected Selecting with maximum causes delays of at least the specified duration Calls to wait_seconds with a longer duration will not be affected The following table shows the actual delay caused by different override settings Actual program call with minimum 10s with maximum 10s wait_seconds
397. n set previously i e was set to 0 e Select a reference image page 282 with Set Reference if you want to perform an alignment The position of the match in this image is then used as reference If no reference image is chosen the model image page 253 will be used as basis for alignment page 253 and rectification page 239 e Assure that all objects are found page 283 in all test images by comparing the number of existing models with the number of found models or simply determine the recognition rate page 290 Now you can optimize the speed of the matching process by tuning the parameters 7 3 2 4 Optimizing the Parameters After you configured the matching page 252 process such that the search is successful in all test images you can start to optimize the parameters on the tabs Parameters and Usage to speed up the matching as far as possible For the four matching methods different parameters are especially useful to improve speed e To support this process for shape based matching and deformable matching the Matching As sistant allows to optimize the search parameters Minimum Score page 284 and Greediness page 286 on the tab Usage e For correlation based matching the parameter Minimum Score page 284 on the tab Usage should be set to a value larger than 0 0 but preferably below 0 1 to reduce the number of points considered for further calculations e Fordescriptor based matching the model parameters Fern Number
398. n the following windows are available by default 1 Graphics window This window displays iconic data images regions and XLDs It provides its own tool bar to quickly zoom and pan the displayed image and a context menu to adapt the visualization settings The context menu is available by right clicking inside the window It contains the most frequently used entries from the menu Visualization You can open multiple graphics windows The one marked with a lit bulb in the upper right corner is the active graphics window i e it is the target for subsequent display operations The graphics window works like an image stack Images can be overlayed with regions or XLDs or with images that have a reduced domain 2 Operator window You can select HALCON operators and HDevelop procedures in this window The parameters of the selected operator can be specified and the operator can be executed entered in the current program or both You can also get online help for the selected operator from this window 3 Program window This window displays the current program It provides syntax highlighting with user definable colors The left column displays the program line numbers The small black triangle is the insert cursor which is where new program lines will be added In the following it is referred to as IC The green arrow is the program counter which marks the next line to be executed In the following the program counter is referred to as P
399. n a pad a Reconstruct the height of measure_bga_dff a solder ball on a BGA Surveillance and security using depth from focus Transport logistics trade E Measure the width of pcb Wood and timber measure _circuit_ tracks Method measure_ic_lead Measure leads of an IC Cd F Measure the dimensions of _ New in version _ measure _pads_S _ nodennadie EN 7 Keep dialog open Open in new HDevelop Figure 2 3 HDevelop program examples Browse and Load Example Programs e Click File gt Browse HDevelop Program Examples This will open the example program browser see figure 2 3 Similar to a file browser it shows a tree of categories on the left and a list of example programs from the selected categories on the right Categories that contain hidden subtopics are marked with a Double click on a category label to open the subtopics or click Double click again to close the subtopics or click 4 Browse the categories Click on a category to select it and display its example programs You can select multiple categories at once by holding the key while clicking on the categories Filter the example programs To reduce the amount of listed example programs enter a word or substring into the Find text field Subsequently only example programs matching this substring in the file name or short description will be displayed We pretend that you are looking for a measuring example from the semiconductor industry e Cl
400. n section Feature Inspection Window on page 208 Line Profile Synopsis Display line profile of active graphics window g la c i E 2 5 0 Shortcut ctrl shitt 0 L or Ctri Shift 0 Ctrl Shift L Selecting this entry opens a useful tool for the detailed inspection of the gray value profile of a line or circular arc Using the line profile is helpful in particular for optimizing edge detection in the Measure Assistant page 293 or when checking the focus of your camera The line profile is described in section Line Profile Window on page 210 118 Graphical User Interface D I afa OCR Training File Browser Synopsis Browse OCR training files Shortcut Ctrl Shift O T OF Ctrl Shift O Ctrl Shift T Selecting this entry opens a useful tool for inspecting and modifying training files Using the OCR Train ing File Browser is especially useful to eliminate errors made during the teaching process by checking if the samples are assigned the correct classes This tool can be used within any OCR application and also in combination with the OCR Assistant page 312 The OCR Training File Browser is described in section OCR Training File Browser on page 215 6 2 4 22 Save Window Synopsis Save the contents of the active graphics window to an image file Shortcut ctrl shift G s or Ctrl Shift G Ctrl Shift s See also dump_
401. n that has gray value information e g from reduce_domain or add_channels both the shape and gray value features of that region will be displayed Finally if you have overlaid an image with a region but click into a part of the image that is outside the region only the gray value features of the entire image will be calculated Use the select tool of the graphics window to select a region or XLD The selected region or XLD is highlighted in the graphics window The corresponding variable name and index are displayed in the title of the feature inspection window The gray value features of a multi channel image are calculated from all channels independently The tree on the left side of the feature inspection window groups the features into several categories At the top most level the following groups of features are distinguished e Region features This group contains features that describe the selected region e g area center and orientation e Gray value features The feature values of this group are calculated from the gray values of the image under the selected region e g minimum and maximum gray value mean gray value anisotropy and entropy 6 12 Feature Inspection Window 209 select ee region r bajka Z NAS Grit 50 gt ig feature value of selected region range visualization X Feature Inspection Mixed03 Connection 7 Feature Value Minimum Displ
402. n the current program The difference to Step Over is apparent in loops Only the first run of the loop is single stepped When the closing statement of the loop is reached the remaining runs of the loop are executed without interruption and the line following the loop is executed stepwise again Clicking Step Forward continues the program immediately if the current operator is wait_seconds 6 2 3 5 Step Into Synopsis Step into HDevelop procedure Shortcut This entry allows you to step into procedure calls Executing Step Into with the PC on a procedure call line causes the corresponding procedure and procedure call to become the current procedure and proce dure call respectively The PC is set on the first executable program line in the new current procedure Step Into has the same effect as Step Over if the program line to be executed is not a procedure call 6 2 3 6 Step Out Synopsis Step out of HDevelop procedure Shortcut This entry steps out of the current procedure call Program execution is continued until the first exe cutable program line after the previous procedure call in the calling procedure is reached The previous calling procedure becomes the current procedure If the current procedure is the main procedure the behavior is the same as Run g la c i E 2 5 0 Clicking Step Out continues the program immediately if the current operator is wait_seconds 100 Graphical User Interface
403. n the line profile window as well and likewise affects the Measure Assistant s smoothing see figure 6 82 Derivate Display the derivation of the line profile Horizontal Vertical The visible part of the profile can be specified parametrically by entering the minimum and maximum values into the spinner boxes These values are adapted when the visible area is set with the buttons next to the profile This can also be adjusted with the mouse wheel in the plot widget if only a part is displayed i e if Zoom Profile Display has been activated and the profile has been zoomed in Whenever new image data is displayed in the line profile window the adaptation of these values depends on the selected adaptation mode which can be set independently for horizontal and vertical ranges e adaptive The corresponding range is adapted to the new values e increasing The corresponding range is only adapted if it has increased i e the new minimum value is smaller or the new maximum value is greater or both e fixed The corresponding range is not changed at all 6 13 5 Output The Output section lets you choose the visualization of the marker lines the line profile displays within in your active ROI You can select the color and length of your lines as well as their width Changing those output features can be necessary to achieve optimum visibility within an image 6 13 6 Statistics 213 Input Window Active z Measure
404. nable reference to a Gaussian filter 6 2 7 3 Predecessors Many operators require a reasonable or necessary predecessor operator For example before comput ing junction points in a skeleton junctions_skeleton you have to compute this skeleton itself skeleton To obtain a threshold image you usually use a lowpass filter before executing a dynamic threshold dyn_threshold Using the watershed algorithms watersheds it is reasonable to apply a smoothing filter on an image first because this reduces runtime considerably 6 2 7 4 Successors In many cases the task results in a natural sequence of operators Thus as a rule you use a thresholding after executing an edge filter or you execute a region processing e g morphological operators after a segmentation To facilitate a reasonable processing all the possible operators are offered in this menu item o D 2 Q a 0 6 2 7 5 Keywords This menu item gives access to HALCON operators through keywords which are associated with each operator The tab card Index of the online help window is opened It is described in section Index on page 194 128 Graphical User Interface 6 2 8 Menu Assistants This menu assembles assistants for specific machine vision tasks The general concept of the assistants 1s described in the chapter HDevelop Assistants on page 223 The following assistants are available e Image Acquisition Assista
405. nction Shortcut Alternative Gray Histogram Feature Histogram Feature Inspection Line Profile Call Stack Zoom Window OCR Training File Browser Export Open Output Console Open Program Line View Breakpoints Bookmarks Invalid Lines Organize Windows Cascade Windows SDI MDI Full Screen Next Window Previous Window Help Context Help About Keywords HALCON News WWW Search Documentation HDevelop Language HALCON Reference HDevelop User s Guide Ctrl Shift O H Ctrl Shift O F Ctrl Shift O I Ctrl Shift O L E A A Ctrl Shift 0 C Ctrl Shift 0 Z Ctrl Shift O T Ctrl Shift 0 X Ctrl Shift O E A Ctrl Shift O R Ctrl Shift O F10 Ctrl Shift O F11 Ctrl Shift 0 F12 Ctrl Shift W 0 Ctrl ShiftW C Ctrl Shift W S Ctrl Shift W M ll Ctrl Shift W F Ctrl Tab Ctrl Shift Tab 1 Shift F1 Ctrl Shift H A Ctrl Shift H K Ctrl Shift H W Ctrl Shift H F Ctrl Shift H L Ctrl Shift H R Ctrl Shift H U UU 8 Ctrl Shift O Ctrl Shift H Ctrl Shift O Ctrl Shift F Ctrl Shift O Ctrl Shift Ctrl Shift O Ctrl Shift L Ctrl Shift O Ctrl Shift C Ctrl Shift O Ctrl Shift Z Ctrl Shift O Ctrl Shift T Ctrl Shift O Ctrl Shift xX Ctrl Shift O Ctrl Shift E Ctrl Shift O Ctrl Shift R Ctrl Shift O Ctrl Shift F10 Ctrl Shift 0 Ctrl Shift F11 Ctrl Shift O Ct
406. ndow size Figure 3 2 Tools in the graphics window 3 3 Image Acquisition Assistant The image acquisition assistant is a powerful tool to acquire images from files including AVI files directories or image acquisition devices supported by HALCON through image acquisition interfaces To use this assistant select Assistants gt Open New Image Acquisition The window is displayed in figure 3 3 It features several tab cards that can be stepped through one after another Ultimately the assistant generates HDevelop code that can be inserted into the current program Select the entry Help in the menu of the image acquisition assistant to open its online help W Image Acquisition Image Acquisition 01 a RoR Ex File Acquisition Code Generation Help cH ZF fae g 2 a 5 y lt o a Source Connection Parameters Inspect Code Generation Image File s Recursive Select File s Select Directory Image Acquisition Interface File oO m m 0 0 0 ms Figure 3 3 Image acquisition assistant The tab card Source determines the acquisition method and the image source In the default setting images are acquired from files This is described in the following section Alternatively images are 26 Acquiring Images with HDevelop acquired from an image acquisition device e g a camera This is described in section 3 3 2 on page 28 3 3 1 Acquiring Images From Files or D
407. ne profile along an ROI while changing parameters for edge detection to see exactly how your actions influence the line profile and therefore possibly change which edges are detected This profile can consequently be a basis for the decision which steps should be taken next i e what would be necessary to enhance weak edges or suppress false edges In order to select which edges or edge pairs from your current results are relevant proceed to Edge Selection If you are already satisfied with the detected edges continue to the Results tab page 334 Edge Selection Edge Selection allows you to specify what kind of edges you are looking for First you decide whether you want to find single edges or edge pairs Depending on your choice you have different options for the drop down menus Transition and Position These options will be explained for edge pairs in the following paragraph and subsequently for single edges You can activate Group Edges to Pairs to find an even number of edges with alternating transitions The parameter Transition lets you select which edges are chosen to resolve ambiguity The default setting of all will always accept the first matching edge The values positive and negative restrict the transition of the very first edge The _strongest variants will pick the strongest edge instead of the first edge in a sequence of edges with the same transition Position lets you decide whether you are looking for a11 edge p
408. ng and Deformable Matching When you click the button Auto Select that is placed right beside the sliders for the parameters Contrast Low High and Contrast page 270 the Matching Assistant selects suitable values for the contrast by trying to obtain many long and straight contour segments Note that you may need to set the value manually if certain model components should be included or suppressed because of application specific reasons or if the object contains several different contrasts 272 HDevelop Assistants The Model Parameter Model Type Deformable Matching Via the combo box Model Type you can select two model types e locally deformable and e ridgid depending on the expectations concerning the deformation of the object The Model Parameter Min Component Size Shape based Matching The parameter Min Component Size specifies the minimum size i e number of pixels which con tour parts must have to be included in the model page 253 This parameter is useful to exclude clutter You can also let the Matching Assistant select a suitable value automatically based on the model image Note that the selected value is divided by two for each successive pyramid level Letting the Matching Assistant Select a Suitable Value for Min Component Size Shape based Matching When you click the button Auto Select that is placed right beside the slider for the parameter Min Component Size the Matching Assistant
409. ng connected to this assistant you can acquire the image you want to measure in and you can even choose to work with a Live image The same operations can be performed by clicking on the Snap or Live symbols in the tool bar Note that the measuring works on a single channel For color RGB images the red channel will be used A color transformation can be performed with the operator trans_from_rgb Once you have loaded your image you can continue to create an ROI If your image data exceeds 8 bit you can change the expected gray value range page 301 If you want to load calibration data or calibrate now proceed to the section Calibration Source page 299 Create an ROI Create an ROI by using the buttons Draw Line or Draw Circular Arc in the tool bar The shape of the ROI should be chosen according to the shape of the object to be inspected 296 HDevelop Assistants After having chosen the ROI shape you draw the ROI in the Graphics Window by keeping the left mouse button pressed Then modify the ROI until it has the correct shape For linear ROIs you can modify the length by dragging the line s end points or move it by dragging its center For circular ROIs you can additionally modify the radius by dragging one of the four circle points that are located at 0 90 180 and 270 degrees Once you are finished click the right mouse button to confirm your choice The ROI will already display edges if those can be de
410. ng on each additional line e Use to select a sequence of lines using one mouse click All lines between the most recent selection and the clicked position will become selected The selected lines can then be cut copied or deleted either using the Edit menu or the tool bar see section 6 3 on page 136 or via the context menu of the program window see page 147 6 4 2 2 Full Text Editor The full text editor enables free text editing You can click in the program window to place the cursor and type ahead You can select portions of the text with the mouse and have the selection replaced with what you type afterwards This makes small changes to parameter values much faster than using the dialog based editor Special input formats The following assignments are equivalent Both variants can be used in the full text editor but the first variant is more readable and thus recommended FileName clip assign clip FileName Individual tuple elements can be set in the following way Both variants are equivalent but the first variant is more readable and thus recommended Line 12 text assign_at 12 text Line Note that for loops always have to be entered in the following format for Index 1 to 10 by 1 endfor Line continuation Unlike the dialog based editor operator calls may span several lines for readability This is indicated by entering the continuation character i e a backslash character as the last chara
411. ng the context menu you can insert the corresponding operator into the operator window o D 2 Q a 0 210 Graphical User Interface 6 13 Line Profile Window Synopsis Display line profile of active graphics window See also Menu Visualization Line Profile Selecting this entry opens a tool for the detailed inspection of a gray value profile of a linear or circular ROI see figure 6 81 Using the line profile is helpful in particular for optimizing edge detection in the Measure Assistant page 296 or when checking the focus of your camera see the section Focusing Your Camera page 214 The displayed line profile of the ROI is described in the section Line Profile Display Note that the line profile window is a visualization tool that cannot be used to create any output like performing changes within the image or producing code _ K Line Profile Measure 01 Co E e 22 mE Input Window Active y 9 Measure Assistant Measure 01 ENI 19 ss diy 200 i des 2 95 NE LA RE ee oe ee Nae ee ee ee 0 100 200 311 A Line Profile Options Y smoothing 1 0 51 E Derivate Vertical 95 255 adaptive v Horizontal 0 311 adaptive 5 Output Color Edge Length Line Width 0 colored 3 y 15 1 A Statistics x Value Gray Values Peak 95 255 Range 0 311 94 727 255 Value at Min 0 100 636 Value at Max o 1
412. nify the variable window dev_unmap_var and retransform the iconified window to the normal visualization size respectively dev_map_var This means that the variable window always remains visible on the display in one of the two ways of visualization These operators can be executed with the help of the window manager These operators are not supported for exported code 6 2 6 Menu Operators 125 dev_map_prog dev_unmap_prog Analogously to dev_map_var and dev_unmap_var these opera tors iconify or deiconify the program window These operators are not supported for exported code dev_update_window dev_update_var dev_update_time dev_update_pc Using these opera tors you may configure the output at runtime It corresponds to the settings in menu Menu Edit gt Preferences gt Runtime Settings gt Runtime Settings page 95 These operators are not supported for exported code dev_set_check This operator is equivalent to set_check of the HALCON library It is used to handle runtime errors caused by HALCON operators that are executed inside HDevelop The parameter value give_error which is the default leads to a stop of the program together with an error dialog if a value not equal to H_MSG_TRUE is returned Using the value give_error errors or other messages are ignored and the program can continue This mode is useful in connection with operators like get_mposition file_exists read_image or test_region_point which
413. not perform the alignment by itself but only generates code to align the measurements if a transformation matrix is available from other methods such as Template Matching For general information please read the following paragraph about align ment with the Measure Assistant For more detailed information please refer to the documentation on matching in the Solution Guide on Matching Chapter 2 4 Use the Results of Matching To perform an alignment with the Measure Assistant please follow the steps that are described in this paragraph When generating code with an activated Affine Transformation option the assistant produces code that requires a transformation matrix To find the object within the image you can perform a matching as explained in the Solution Guide on Matching or use the Matching Assistant to guide you through the matching task By teaching a template the object can be found in any position and orientation After this successful matching the affine transformation can be constructed with the operator vector_angle_to_rigid using the difference between the original and new model positions This operator produces the homogeneous transformation matrix that describes the transformation from the old to the new position If the object in your image is only shifted but not rotated the suitable Alignment Method would be Translation Only which also needs less processing time than Affine Transformation No Alignment is needed if the obj
414. nstances of HDevelop The contents of the internal buffer are kept allowing this command to be repeated o D 2 Q a 0 68 Graphical User Interface 6 2 2 6 Delete Synopsis Delete the highlighted program lines from the program window Shortcut This menu item deletes all highlighted program lines without storing them in an internal buffer The only way to get the deleted lines back into your program body is to use the menu item Undo Ctr1 Z 6 2 2 7 Activate Synopsis Uncomment the highlighted program lines Shortcut All of the highlighted program lines that were previously commented using the Deactivate command are converted back to executable code Comment lines created with the operator comment are unaffected by this command 6 2 2 8 Deactivate Synopsis Comment out the highlighted program lines Shortcut The highlighted program lines are converted into comments This is a quick way to suppress the execu tion of portions of the program for testing purposes Comment lines created with the operator comment are unaffected by this command During testing it is often useful to prevent some lines of the program from being executed This can be achieved by selecting the appropriate lines in the program window and then selecting Deactivate An asterisk is placed at the beginning of the selected lines i e the lines appear as comments in the program window and have no influence on the progra
415. nt page 225 e Calibration Assistant page 230 e Matching Assistant page 252 e Measure Assistant page 293 e OCR Assistant page 312 6 2 9 Menu Window This menu offers support to manage the sub windows of the main window i e the program operator variable graphics window s and possibly other dialogs At the bottom of the menu all open windows are listed Clicking an entry here brings the corresponding window to the front 6 2 9 1 Open Graphics Window Synopsis Open an additional graphics window Shortcut Ctri Shift 0 G Or Ctrl Shift O Ctrl Shift G See also dev_open_window and section Open Graphics Window on page 105 If no graphics window is open double clicking an iconic variable will also open a new graphics window 6 2 9 2 Open Program Listing Synopsis Open a program window Shortcut Ctri Shift O P or Ctrl Shift 0 Ctrl Shift P See also dev_map_prog This menu item opens a new program window See section Program Window on page 138 6 2 9 3 Open Variable Window Synopsis Open the variable window Shortcut Ctri Shift O V or Ctrl Shift 0 Ctrl Shift V See also dev_map_var This menu item is grayed out if the variable window is already open 6 2 9 Menu Window 129 6 2 9 4 Open Operator Window Synopsis Open the operator window Shortcut Cti shift 0 0 Or Ctrl Shift O Ctrl Shift 0 This menu item is grayed out if the o
416. nt point continue The operator continue forces the next loop cycle of a for while or repeat loop The loop condition is tested and the loop is executed depending on the result of the test In the following example a selection of RGB color images is processed Images with channel numbers other than three are skipped through the use of the operator continue An alternative is to invert the condition and put the processing instructions between if and endif But the form with continue tends to be much more readable when very complex processing with lots of lines of code is involved i Images while i Image Images i count_channels Image Channels if Channels 3 continue endif extensive processing of color image follows endwhile 368 HDevelop Language break The opeator break enables you to exit for while and repeat loops The program is then continued at the next line after the end of the loop A typical use of the operator break is to terminate a for loop as soon as a certain condition becomes true e g as in the following example Number Regions AllRegionsValid 1 check whether all regions have an area lt 30 for i 1 to Number by 1 ObjectSelected Regions li area_center ObjectSelected Area Row Column if Area gt 30 AllRegionsValid 0 break endif endfor In the following example the operator break is used to terminate an infinite while loop as soon as one clicks into t
417. nted with a threshold operation with the selected minimum and maximum gray value With the three combo boxes Color Draw and Line Width in the Output section of the window you can specify how the segmentation results are displayed see also Colored page 107 Draw page 107 and Line Width page 107 If you want to select threshold parameters for a single image display the image in the active graphics window and open the histogram tool For optimum visualization of the segmentation results it is best to set the visualization color to a color different from black or white Now set Operation to Threshold and interactively drag the two vertical bars until you achieve the desired segmentation result The pa rameters of the threshold operation can now be read off the two vertical lines If you want to select threshold parameters for an image that is derived from another image but want to display the segmentation on the original image e g if you want to select thresholds for a gradient image two different possibilities exist First you can display the derived image open the histogram tool deselect Input Window display the original image and then select the appropriate thresholds This way only one window is needed for the visualization Alternatively you can display the derived image in one graphics window and the original image in another Activate the first graphics window image and make sure Input Window is checked so that the corre
418. nter Operator or Procedure e 1 graphics window 2 operator window WN Variable View main o xz K Program Editor Iconic Variables a gt ey F2 main la IS R gt Control Variables 4 variable window 3 program window all Auto JW User JY Global J status bar Figure 2 1 User interface Command Line Switches HDevelop supports several command line switches to modify its startup behavior You can also add the path and file name of an HDevelop program on the command line to load it directly This is identical to an invocation of HDevelop without any parameters and a subsequent loading of the program The program name may contain environment variables in Windows syntax as in hdevelop HALCONEXAMPLES hdevelop explore_halcon hdev Or you can convert HDevelop programs to other programming languages without opening the graphical user interface at all A full list of the supported command line switches is available with the following command hdevelop help See appendix B on page 407 for a listing of the available switches and some example uses of the command line 2 1 Running HDevelop 17 User Interface When HDevelop is started for the first time it looks similar to figure 2 1 The main window offers a menu and a tool bar for quick access to frequently used functions The status bar at the bottom of the window displays messages and image properties In additio
419. nts is of type real If all elements are of type integer the resulting value will also be of type integer select_rank returns the element at rank i and works for tuples containing int or real values The index i is of type int deg and rad convert numbers from radians to degrees and from degrees to radians respectively real converts an integer to a real For real as input it returns the input int converts a real to an integer and truncates it round converts a real to an integer and rounds the value For integer it returns the input The function abs always returns the absolute value that is of the same type as the input value The following example file name euclid_distance hdev shows the use of some numerical func tions 8 5 14 Numerical Functions 361 Operation Meaning HALCON operator min t minimum value of the tuple tuple_min min2 t1 t2 elementwise minimum of two tuples tuple_min2 max t maximum value of the tuple tuple_max max2 t1 t2 elementwise maximum of two tuples tuple_max2 sum t sum of all tuple elements or string concatenation tuple_sum mean a mean value tuple_mean deviation a standard deviation tuple_deviation cumul a cumulative sums of a tuple tuple_cumul median a median of a tuple tuple_median select_rank a i sqrt a deg a rad a real a int a round a abs a fabs a ceil a floor a element at rank i of a tuple square root y a convert radians to degrees conve
420. nu item Measuring gt Draw Line also accessible as tool bar button For more information about how to draw a circular ROI please refer to the section Create ROI 310 HDevelop Assistants page 295 You can also check the ROI data via the tool bar button View ROI Data read more about ROI data in the section Create ROI page 295 Delete Selected ROI Item You can delete an ROI item via the menu item Measuring gt Delete Selected ROI Item or via the corresponding button of the tool bar Load ROI from File Via the menu item Measure gt Load ROI from File you can load a previously saved ROI from a file Save ROI to File If you want to reuse an ROI you can save it to a file via the menu item Measure gt Save ROI to File Delete All ROIs You can delete all ROIs via the menu item Measuring gt Delete All ROIs or via the corresponding button of the tool bar 7 4 6 3 The Menu Code Generation Via the menu Code Generation you can e insert code into the program window of HDevelop according to the current settings of the Measure Assistant e release generated code lines in the program window e delete generated code lines from the program window as long as you did not release them and e open the dialog for the code preview inside the tab Code Generation Insert the Generated Code Lines Via the menu item Code Generation gt Insert Code also accessible
421. o a program You may access these undefined o D 2 Q a 0 172 Graphical User Interface variable View main a orm Iconic Variables E Image Image_A Image_B PizzaRaw i Pi ImageReduce Control Variables Pointer 181928032 Type byte Width 1280 Height 1024 WindowHandle 3600 All Auto User Global Figure 6 59 Variable window with instantiated iconic and control variables variables only by writing to them If you try to read such a variable a runtime error occurs If a vari able obtains a value the variable type is specified more precisely A control variable that contains for example an integer is of type integer This type might change to real or a tuple of integer after specifying new values for this variable But it always remains a control variable Similarly this is the case for iconic variables which may contain regions images or XLDs You may assign new values to an iconic variable as often as you want to but you cannot change its type so that it becomes a control variable New variables are created in the operator dialog area during specification of operator or procedure call parameters Here every sequence of characters without single quotation marks is interpreted as a variable name If this name did not exist before the variable is created in the operator dialog area by pressing OK or Enter The variable type is specified through th
422. o be declared explicitly using the operator global The declaration global tuple File Constand Meaning Value H_TYPE_INT integer value 1 H_TYPE_REAL real value 2 H_TYPE_STRING string value 4 H_TYPE_MIXED mixed value 8 Table 8 3 Type values for control data o te iv 3 te c l 342 HDevelop Language declares a global control variable named File whereas global object Image declares a global iconic variable Image The keyword def allows to mark one declaration explicitly as the place where the variable is defined e g global def object Image This is only relevant when exporting the program to a programming language See the description of the operator global for more information Once the global variable is declared it can be used just like a local variable inside the procedure it has been declared in If you want to access a global variable in a different procedure you have to announce this by using the same global call otherwise a local variable will be created main procedure declare global variables global tuple File global object Image File particle read_image Image File process_image Image has been changed by process_image File remains unchanged process_image procedure use global variable global object Image bin_threshold Image Region File fuse read_image Image File return Because procedures have to explicitly announce their use of
423. o the end of the program i e the program is finished try catch endtry This control flow structure enables dynamic exception handling in HDevelop The program block between the operators try and catch is watched for exceptions i e runtime errors If an exception occurs diagnostic data about what caused the exception is stored in an exception tuple The exception tuple is passed to the catch operator and program execution continues from there The program block between the operators catch and endtry is intended to analyze the exception data and react to it accordingly If no exception occurs this program block is never executed See section Error Handling on page 369 and the reference manual e g the operator try for detailed information throw The operator throw allows to generate user defined exceptions 8 8 Error Handling This section describes how errors are handled in HDevelop programs When an error occurs the default behavior of HDevelop is to stop the program execution and display an error message box While this is certainly beneficial at the time the program is developed it is usually not desired when the program is actually deployed A finished program should react to errors itself This is of particular importance if the program interacts with the user There are basically two approaches to error handling in HDevelop e tracking the return value error code of operator calls e using exception handling A
424. o the left of the displayed program body contains the PC represented as a green arrow pointing to a program line the IC a black triangle between two program lines and optionally one or more breakpoints BP a red STOP sign The program counter resides in the line of the next operator or procedure call to execute The IC indicates the position to insert a new program line A break point shows the program line on which the program is stopped You may position or activate these three labels by clicking in the left column of the program window That column itself is divided into three areas Depending on the horizontal position of the mouse cursor all three label types are available The actual type is indicated through a change of the mouse cursor 6 4 4 Context Menu 147 At the leftmost position breakpoints can be placed In the middle position the PC can be placed And finally in the rightmost position the IC can be placed HDevelop assists you by displaying the icon that would be inserted If this seems confusing you can force a specific label by holding down the following keys regardless of the horizontal position e Hold to place the IC e Hold to place or delete a BP e Hold to place the PC The PC can only be placed on program lines of procedures on the callstack For example in figure 6 40 on page 146 the PC may be placed anywhere in the procedures main first or second It may not be placed within the procedure thir
425. ode Lines Via the menu item Code Generation gt Delete Generated Code Lines you can delete the code lines that you have previously generated and inserted into the program window of HDevelop from within the Calibration Assistant Note that this works only as long as you have not yet released the code lines Preview of the Generated Code Lines Via the menu item Code Generation gt Show Code Preview you can open the dialog for the Code Preview in the tab Code Generation 7 2 5 Calibration Assistant Reference 251 7 2 5 4 The Menu Help Via the menu Help you can access the online documentation 7 2 5 5 The Tab Setup The Setup tab consists of the following subdivisions e Calibration Task page 233 e Calibration Plate page 233 e Camera Parameters page 233 7 2 5 6 The Tab Calibration The Calibration tab includes e Image Source page 236 e Calibration page 237 e Quality Issues page 239 e Display Parameters page 243 e Calibration Plate Extraction Parameters page 243 7 2 5 7 The Tab Calibration Results The Calibration Results tab includes the following subdivisions e Calibration Status page 244 e Camera Parameters page 245 e Camera Pose page 245 e Display Results page 245 252 HDevelop Assistants 7 3 Matching Assistant 7 3 1 Introducing the Matching Assistant of HDevelop The Matching Assistant of HDevelop is a front end to HALCON s powerful matching methods e shap
426. ode to align the measurements if a transformation matrix is available from other methods such as Template Matching For general information please read the following paragraph about alignment with the OCR Assistant For more detailed information please refer to the documentation on matching in the Solution Guide on Matching Chapter 2 4 Use the Results of Matching To perform an alignment with the OCR Assistant please follow the description in this paragraph When generating code with an activated Affine Transformation option the assistant produces code that requires a transformation matrix To find the characters within the image you can perform a matching as explained in the Solution Guide on Matching or use the Matching Assistant page 252 to guide you 7 5 7 OCR Assistant Reference 329 through the matching task and generate the alignment code No Alignment is needed if the characters always appear in the same position You can now continue to change variable names if necessary or preview the generated code before inserting it into your HDevelop program 7 5 6 2 Change Variable Names If desired you can change the default variable names or replace them with your own variable names Once you are finished changing your variable names proceed to the Code Preview 7 5 6 3 Code Preview Before clicking the Insert button to include your code into the HDevelop Program Listing you can preview the code in the Code Preview table You
427. odify relevant parameters by explicitly calling the operator set_system in the exported program 9 6 7 Graphics Windows HALCON provides a functionality that emulates the behavior of HDevelop graphics windows for HAL CON windows This HALCON window stack is accessible via class methods and functions in the HALCON interfaces and code exported from HDevelop uses this functionality when opening closing setting or accessing the active window The HALCON window stack mechanism is threadsafe Thus in a multithreaded application every thread has its own window stack In order to avoid memory leaks or similar problems the application must take care to close all HALCON windows opened by a thread before terminating the thread because this is not done automatically by HALCON For the NET and COM code exports it is optional whether to export HDevelop programs as code using the HDevelop export example templates or as code using the previously described HALCON window stack functionality when doing graphics windows output Additionally in the latter case the exported code contains a main function and thus is usable as a standalone application The HDevelop Export dialog allows to select the corresponding option The graphics windows of HDevelop and the basic windows of the HALCON libraries e HALCON C class HWindow e HALCON NET class HWindowControl e HALCON COM class HWindowXCtr1 and e HALCON C addressed via handles have different functionality
428. of HALCON If you are uncertain about the current settings you can always start HDevelop with the default settings by invoking it from the command line in the following way see also chapter 2 on page 13 hdevelop reset_preferences This chapter deals with a simple example Given is the image displayed in figure 4 1 The objective is to count the clips and determine their orientation Figure 4 1 Paper clips 4 1 Start a New Program Start HDevelop or if itis still running click File gt New Program to start anew program HDevelop will notify you if there are unsaved changes in the current program If it does click Discard to throw away the changes and start anew In case you rearranged the windows click Window gt Organize Windows to restore the default layout displayed in figure 2 1 on page 16 to f E E o o fo a 34 Programming HDevelop The first thing to do is read the image and store it in an iconic variable From the last chapter we know that we can simply drag an image to the HDevelop window We also know that this inserts the operator read_image into the program Therefore we can just as well insert the operator directly 4 2 Enter an Operator Click into the text box of the operator window type read_image and press Return You can also type any partial operator name and press Return HDevelop will then open a list of operators matching that partial name This way you can easily select operato
429. of the characters occur in the string s1 may be a single string or a tuple of strings str r str See also tuple_strstr tuple_strrstr str r str s1 s2 returns the index of the first last occurrence of string s2 in string s1 or 1 if s2 does not occur in the string s1 may be a single string or a tuple of strings strlen See also tuple_strlen strlen s returns the number of characters in s See also tuple_str_bit_select s i selects a single character specified by index position from s The index ranges from zero to the length of the string minus 1 The result of the operator is a string of length one s i1 i2 returns all characters from the first specified index position i1 up to the second specified position i2 in s as a string The index ranges from zero to the length of the string minus 1 split See also tuple_split split s1 s2 divides the string s1 into single substrings The string is split at those positions where it contains a character from s2 As an example the result of split usr image usr proj image consists of the two strings usr image usr proj image 356 HDevelop Language Regular Expressions HDevelop provides string functions that use Perl compatible regular expressions Detailed infor mation about them can be found in the Reference Manual at the descriptions of the corresponding operators which have the same name but start with tuple_ In particular at the
430. okmarks sy Open Find Replace Dialog Procedure Line Context main 21 grab_image Image AcgHandle main 31 grab_image_start AcqHandle 1 main 33 grab_image_async Image AcqHandle 1 main 43 grab_image_async Image AcqHandle 1 main 59 grab_image_async Image AcqHandle 1 main 60 grab_image Image AcqHandle Figure 6 10 Finding all occurrences of the search text Replacing Variable Names Click Variables to specify the search context Enter the search text and the replace text You can replace parts of variable names by keeping Whole Words unchecked Click Find until the desired line is found Afterwards click Replace to replace all occurrences of the search text in the matched line The next matching line is highlighted automatically Click Replace A11 to replace all occurrences of the search text in the specified scope It is recom mended to do a Find A11 beforehand to estimate the extent of this operation Replacing Operator Calls You can replace one operator or procedure call with another Because different operators very likely have different parameters the source parameters have to be mapped to the target parameters beforehand See figure 6 11 for an example Click Operators to specify the search context Enter the source operator or procedure name and the target operator or procedure name When both names are specified the parameters of the target opera tor procedure are listed at the bott
431. om of the dialog For every target parameter you have to select or enter a corresponding source parameter Please note that the option Whole Words is always enabled in this mode because only exact matches are valid when replacing operator calls o D 2 Q a 0 72 Graphical User Interface Find Replace Variables Operators Texts Search for grab_mage ma yA Find Parameter Scope All Program Current Procedure Options Case Sensitive Whole Words Backward Parameter Replacement Scheme grab_image grab_image_async E El El Image y image E amp E Acgriandie y B AccHande z gt MaxDelay Figure 6 11 Replacing operator calls 6 2 2 10 Find Again Synopsis Find the next match of the last entered search string iss Shortcut This menu item repeats the search specified via the menu item Find Replace 6 2 2 Menu Edit 73 6 2 2 11 Set Clear Bookmark Synopsis Toggle bookmarking of selected program lines Shortcut Bookmarks help you remain focused when editing large programs or programs using many procedures You can set bookmarks to selected lines jump between bookmarks or manage bookmarks from the program line view window Bookmarked program lines are highlighted by a star icon in the left column of the program window Bookmarks are transient i e they are not saved with the program 6 2 2 12 Next Bookmar
432. ompletion does not suggest legacy or deprecated operators If you enter such an operator manually a warning icon is displayed in the left column Move the mouse cursor over this icon to get a tool tip with a corresponding warning message gt 4 open_window 0 0 256 256 0 visible WindowHandle Itis not recommended to use the operator open_window in HDevelop Please use the operator dev_open_window Special Keyboard Shortcuts in the Program Window General Tab cursor at the beginning of line adjust indentation of current line selected text indent corresponding code lines one level selected text outdent corresponding code lines one level reverse action of key see Program Window Actions execute current line same as clicking Apply in operator window see section Con trol Buttons on page 170 Ctrl F open find replace dialog with selected text section Find Replace on page 69 Shift Tab Shift Return Ctrl Return Cuts Advanced autocompletion Escape hide suggestion list Ctrl Space re display suggestion list based on cursor position or selection TE uo highlight previous entry in suggestion list y S 5 highlight next entry in suggestion list Tab operator suggestions complete to highlighted suggestion or to longest common string from suggestion list parameter suggestions complete to highlighted suggestion or first suggestion if no suggestion is highlighted
433. on handling is applied in the following way o te iv 3 te c l try start block of watched program lines catch Exception get error code ErrorCode Exception 0 react to error endtry program continues normally 372 HDevelop Language 8 9 Summary of HDevelop operations Functionality HDevelop Operation HALCON operator concatenation t1 t2 tuple_concat number of elements It tuple_length select tuple element t i tuple_select select tuple slice t i1 i2 tuple_select_range select elements subset t i tuple_select remove tuple elements lookup tuple values unify tuple elements tuple creation remove t i find t1 t2 uniq t gen_tuple_const i1 i2 tuple_remove tuple_find tuple_uniq tuple_gen_const tuple creation 11 12 13 tuple_gen_sequence tuple creation 11 12 tuple_gen_sequence division al a2 tuple_div multiplication al a2 tuple_mult modulo al a2 tuple_mod addition al a2 tuple_add subtraction al a2 tuple_sub negation a tuple_neg left shift l1sh i1 i2 tuple_1sh right shift rsh il i2 tuple_rsh bitwise and il band i2 tuple_band bitwise xor il bxor i2 tuple_bxor bitwise or il bor i2 tuple_bor bitwise complement bnot i tuple_bnot string conversion v s tuple_string string concatenation vi v2 tuple_concat search character strchr s1 s2 tuple_strchr search character reverse search string search string reverse strrchr s1 s2 st
434. on on the console version show version information in a message box version show version information on the console external_proc_path lt external procedure path s gt an external procedure path may point either to a directory 409 or a procedure library file multiple external procedure paths are separated by semicolons on windows systems or by colons on all other systems convert lt source gt lt destination gt lt options gt convert an HDevelop program or procedure into a file of the specified type source lt src_file gt hdev dev lt src_file gt hdvp dvp lt src_file gt hdpl destination dest_file lt type gt lt type gt write to lt src_file gt lt type gt lt type gt write to stdout type hdev dev HDevelop program hdvp dvp HDevelop procedure hdpl HDevelop procedure library c cpp bas C C VisualBasic 6 0 cs vb C VisualBasic NET txt text options COM use HALCON COM interface for export to NET languages C cs or VB NET vb CPP10 use HALCON C HALCON 10 interface for export to C external_procs_only_interfaces export only the interface s of the procedures the declarations without the bodies no_export_of_referred_procs export only the passed program or procecure but do not include any referred external procedures no_msg_box suppress error messages reset_free_text reset free text formating delete_local_procs delete_unused_local_procs no_use_hdevelop_templat
435. onic tuples 8 5 4 Tuple Creation The simplest way to create a tuple as mentioned in section 8 2 on page 338 is the use of constants together with the operator assign or in case of iconic data one of its equivalents shown in table 8 7 8 5 4 Tuple Creation 349 assign empty_tuple assign 4711 one_integer assign 4711 0 815 two_numbers This code is displayed as empty_tuple one_integer 4711 two_numbers 4711 0 815 This is useful for constant tuples with a fixed small length More general tuples can be created by suc cessive application of the concatenation or the operator assign_at together with variables expressions or constants If we want to generate a tuple of length 100 where each element has the value 4711 it might be done like this tuple for i 1 to 100 by 1 tuple tuple 4711 endfor Because this is not very convenient a special function called gen_tuple_const is available to construct a tuple of a given length where each element has the same value Using this function the program from above is reduced to tuple gen_tuple_const 100 4711 A fast way to create a sequence of values with a common increment is to use tuple_gen_sequence For example to create a tuple containing the values 1 1000 use tuple_gen_sequence 1 1000 1 Sequence An alternative syntax to the above is to write Sequence 1 1 1000 If the increment value is one as in the above example it is a
436. onsole 130 Graphical User Interface The following categories are available ap Messages about events related to the program execution ES Messages about file operations such as loading and saving programs iby Warning messages during program execution ny Warning messsages related to file operations EN HALCON low level error messages As Messages about invalid program lines Es Messages about program execution errors A Messages about HALCON errors 3 Messages about exceptions The tool bar includes the following action buttons le Clear the output console lal Save the log messages as a plain text file txt or csv Each line contains a log message and the columns are separated by tabs FEY Copy the selected log messages to the system clipboard Ma Open the preferences window of the output console You can specify the maximum number of log messages that are kept in the console The check boxes toggle the visibility of the corresponding categories just like the tool bar buttons in the output console window 6 2 9 Menu Window 131 W output Console Pre 1 fac Bo l Stored Events V iy Program Execution Info Events V G File Operation Info Events Y p Program Execution Warning Events Y File Operation Warning Events Y HALCON Low Level Error Events Y Ay Invalid Program Line Events Y Program Execution Error Events Y HALCON Error Events Y Exception Events
437. ontinue to inspect page 290 the results The Search Parameter Greediness Shape based Matching Deformable Matching The parameter Greediness influences the search algorithm used by the Matching Assistant It ranges between O and 1 If you select a low value the search is thorough but relatively slow The higher the value the faster the search algorithm becomes but at the cost of thoroughness i e an object might not be found even though it is visible in the image This parameter can be optimized easily Starting from the value 0 increase the value until the matching fails in a test image and then use the last value for which the object is found in fact this method is used by the Matching Assistant itself when you start the optimization via the menu item Usage gt Optimize Recognition Speed page 289 The Search Parameter Maximum Overlap Shape based Matching Correlation based Matching Deformable Matching The parameter Maximum Overlap specifies how much two matches may overlap in the image its value ranges between 0 and 1 Especially in the case of an almost symmetric object the allowed overlap should be reduced to prevent multiple matches on the same object The Search Parameter Subpixel Shape based Matching Correlation based Matching De formable Matching The parameter Subpixel allows to select the accuracy with which the position orientation and scale are calculated If you select the value none the posit
438. oose a calibration source Displaying the Image Pyramid Available for Shape based Matching Using the dialog Display Image Pyramid accessed via the menu item Create Model gt Display Image Pyramid or directly inside the tab Creation you can display the model image page 253 see the description in the section The Tab Creation page 264 and inspect the different model pyramid levels and the corresponding images by e selecting which model level is displayed e selecting which image level is displayed and e locking or unlocking model and image level Displaying the Model on the Different Pyramid Levels 7 3 3 Matching Assistant Reference 267 You can select the desired pyramid level of the model by using the slider or text box for Model inside the dialog Display Image Pyramid of the tab Creation The model is overlaid onto the pyramid image selected with the slider or text box Image within the same dialog By default the model and the image are displayed on the same pyramid level you can unlock and again lock the levels using the lock unlock button right to the sliders Note that the highest available pyramid level is determined automatically by the Matching Assistant based on the size of the model ROT page 253 depending on the selected Contrast page 270 and Min Component Size page 272 higher pyramid levels may not contain any model points Detailed information about the model image pyramid can be fo
439. operator and show its parameters In figure 4 5 you can see that the input parameter Image is set to Clip automatically For input variables with no default value reasonable suggestions are inferred automatically by collecting previous output variables of the same type Therefore the name of the most recent matching output parameter will be 4 5 Add Additional Program Lines 37 Operator Window Insert threshold a foe Enter Operator or Procedure threshold bd threshold HALCON operator Segment an image using global threshold Parameters Y Image y image El Region Region y region amp MinGray 128 v number real MaxGray 255 v number real Ga Ged a Figure 4 5 Parameter suggestions suggested most recent being the closest predecessor of the current program line In this example only Clipis available Set MinGray and MaxGray to 0 and 30 respectively This will select the dark pixels in the image Click Apply This button executes the operator without adding it to the program Additionally it keeps the current parameters open for editing This way you can easily try different settings and immediately see the result The selected pixels the so called region are stored in the output variable Region which is displayed in the variable window The region is an image mask White pixels are selected while black pixels are not The region is also displayed as an overlay in the graphics window The
440. operator or procedure call in the current procedure body This can happen after the deletion of program lines or after editing variable names because the corresponding variables are not deleted automatically You may use this menu item during a longer editing session to reorganize your variable window page 171 o D 2 Q a 0 64 Graphical User Interface 6 2 1 16 Properties Synopsis Display various properties of the current program The tab card General displays file properties of the current program such as file name path creation and modification date and write permission It also shows the file size the number of lines of code used and unused local procedures used external procedures and used protected procedures This is displayed in figure 6 7 Ki Properties mete R Properties gt l General Used Modules General Used Modules File Name engraved dev V Check only used procedures Path 10 examples hdevelop Applications OCR Foundation W Calibration Q Created 15 06 2010 13 50 13 Metrology Last Modified 28 11 2008 12 04 14 PR lol Writable yes y Q 3D Metrology Size 4529 Bytes 4 Lines of Code 52 ee ol Used Local Procedures 0 DataCode Q Unused Local Procedures 0 OCR OCV e Used External Procedures 3 Hog Q Used Protected Procedures 0 opy to Clipboard Figure 6 7 Properties General left Used Modules right The tab card Used Modules lists th
441. opy of an external procedure is placed in the same directory as the source procedure m K Duplicate Procedure Ea Source El p_do_world_plane 3 Target Figure 6 34 Duplicate Procedure Duplicating procedures that are protected with a password see Protected Procedures on page 49 is also possible The associated password is also used for the duplicated procedure 6 2 5 3 Edit Interface Synopsis Edit procedure interface Shortcut Ctri Shift P 1 Or Ctrl Shift P Ctrl Shift 1 This menu item opens the procedure interface window and displays the interface of the current procedure The menu item has the same effect as the button in the program window page 138 The interface of protected procedures can only be edited after the corresponding password has been entered see section Protected Procedures on page 49 6 2 5 4 Delete Current Synopsis Delete the current procedure Shortcut Ctri Shift P Del Or Ctrl Shift P Ctrl Shift Del If the current procedure is a local procedure it is deleted from the program and the main procedure becomes the current procedure All calls to the local procedure in the current program are marked as invalid code This item is disabled if the current procedure is the main procedure or if it is an external procedure g la c i E 2 5 0 120 Graphical User Interface 6 2 5 5 Delete All Unused Local
442. ories This will make the library procedures available without looking at other procedures in the same directory Delete Delete the selected entry from the list Programs using any external procedure from that direc tory will no longer run Rescan Rescan all listed entries to reflect any changes in the file system Using the check boxes you can disable the corresponding directories temporarily without removing them from the list The list entries can be reordered using the up down arrow buttons o o o d o 2 o a 5 9 Graphical User Interface Procedures gt External Procedures This tab card lists all external procedures in the order they are loaded from the configured directories page 82 For each procedure the following information is displayed External Procedures List of all external procedures and its loading state Procedure Name State Search Director dev_display_shape_matching_results Loaded C Program Files MVTec HALCON 11 0 procedur dev_open_window_fit_image C Program Files MVTec HALCON 11 0 procedure dev_open_window_fit_size C Program Files MVTec HALCON 11 0 procedure dev_resize_window_fit_image C Program Files MVTec HALCON 11 0 procedure dev_resize_window_fit_size C Program Files MVTec HALCON 11 0 procedure dev_update_off C Program Files MVTec HALCON 11 0 procedur dev_update_on C Program Files MVTec HALCON 11 0 procedure disp_3d_coord_system C Program Files MVTec HALCON
443. ot contain a variable Control parameter must be a constant value Wrong number of control values in condition variable Wrong type Condition variable must be an integer or boolean Variable names must not be empty Variable names must not start with a number Invalid variable name Invalid name for a control variable the name is already used for an iconic variable Invalid name for an iconic variable the name is already used for a control variable For loop variable must be a number Step parameter of for loop must be a number End parameter of for loop must be a number Variable names must not be a reserved expression Case label value has already appeared in switch block Default label has already appeared in switch block A global variable with the specified name but a different type is already defined Access to an unknown global variable Access to an invalid global variable Invalid name for a global variable the name is already used for a procedure param eter Access to an erroneous expression Wrong index in expression list Empty expression Empty expression argument Syntax error in expression Wrong number of function arguments in expression Expression expected Unary expression expected Expression list expected Function arguments in parentheses expected One function argument in parentheses expected o te y 3 te lt is l 378 HDevelop Language 21111 21112 21113 21114 21115 21116 21117 21118
444. ot match the regular expression are discarded For example assign regexp_select List jpg Selection sets Selection to all the strings from List that look like file names of JPEG images Please note that the backslash character has to be escaped to be preserved 8 5 9 Comparison Operations 357 Operation Meaning HALCON operator Alternative notation ti lt t2 less than tuple_less ti gt t2 greater than tuple_greater ti lt t2 lessor equal tuple_less_equal ti gt t2 greaterofequal tuple_greater_equal t2 ti t2 equal tuple_equal t1 ti t2 not equal tuple_not_equal ti t2 Table 8 13 Comparison operations o te iv te c l regexp_test See also tuple_regexp_test regexp_test s1 s2 returns the number of elements of the tuple s1 that match the regular expression s2 Additionally a short hand notation of the operator is available which is convenient in conditional expressions si s2 8 5 9 Comparison Operations In HDevelop the comparison operations are defined not only on atomic values but also on tuples with an arbitrary number of elements They always return values of type boolean Table 8 13 shows all comparison operations ti t2and ti t2 are defined on all types Two tuples are equal true if they have the same length and all the data items on each index position are equal If the operands have different types integer and real the integer values are first
445. ote that descriptor based matching and correlation based matching work on a single channel For color RGB images the red channel will be used A color transformation can be performed with the operator trans_from_rgb Loading a Model As an alternative to loading a model image and creating page 255 the model interactively the menu item File gt Load Model or the corresponding button Load in the tab Creation can be used to load a model that you have saved with the Matching Assistant or HALCON or that is available as DXF model Note that when you load the model from a file all the menu items buttons and dialogs that enable you to change the model parameters or display the model image will not be selectable because a loaded 7 3 3 Matching Assistant Reference 263 model cannot be changed and contains no information about the image from which it was created Thus e g the menu items File gt Display Image Pyramid page 266 which is used to inspect the model Parameters gt Standard Model Parameters page 269 and Parameters gt Advanced Model Parameters page 275 are disabled Saving a Model The menu item File gt Save Model enables you to save the created model page 255 in a file for later use For example the model page 253 can be loaded into the Matching Assistant again in a later session with File gt Load Model page 262 Loading Camera Parameters for descriptor based matching or d
446. ow Additionally advanced model parameters can be specified via the menu item Parameters gt Advanced Model Parameters page 275 The Model Parameters Contrast Low High Shape based Matching and Contrast Deformable Matching 7 3 3 Matching Assistant Reference 271 The two parameters Contrast Low and Contrast High for shape based matching and Contrast for deformable matching determine which pixels in the selected ROI page 253 are included in the model page 253 typically the points corresponding to the contours of the object should be selected When you select a value either by using the sliders or by entering a value in the text fields next to them the included pixels are marked in the displayed image In order to obtain a suitable model we recommend to choose the contrast in such a way that the significant pixels of the object are included i e those pixels that characterize it and allow to discriminate it clearly from other objects or from the background Please assure that no clutter is included i e pixels that do not belong to the object You can use the parameters Contrast Low and Contrast High in two ways 1 Simple threshold Set both parameters to the same value Then all pixels with a contrast higher than this value are included in the model You can modify both parameters at the same time as follows To increase the value use the slider of Contrast Low then the value Contrast High will foll
447. ow are implemented in terms of specific HDevelop operators These operators can be selected from the menu Operators gt Control Expressions are implemented in terms of a specific HDevelop language which can be used in input control parameters of operator calls To iterate over the elements in Phi we use a for loop which counts from zero the index of the first element of a tuple to the number of elements minus one The for loop is entered just like a common HALCON operator Enter for into the operator window and specify the parameters as in figure 4 11 The notation Phi 1 is part of the HDevelop language This operation calculates the number of elements in Phi minus one When inserted in the program window the operator for is displayed in a different format to make it more readable Note that the closing endfor is entered automatically if the corresponding check box is ticked Also note that the IC is placed between the added lines so that the body of the loop can be entered Add the following lines to the program They are automatically indented in the program window to highlight the nesting inside the for loop set_tposition 3600 Row Index Column Index write_string 3600 deg Phi Index degrees The instruction set_tposition places the text cursor in the active graphics window at the center of the region corresponding to the loop index variable Index The value 3600 is the so called window handle of the target graphics window
448. ow automatically Vice versa to decrease the value use the slider of Contrast High 2 Hysteresis threshold If there is no single contrast value that selects all significant object pixels without including clutter try using different values for Contrast Low and Contrast High Then pixels are selected in two steps First pixels that have a contrast higher than Contrast High are selected then pixels that have a contrast higher than Contrast Low and that are connected to a high contrast pixel either directly or via another pixel with contrast above the lower threshold are added We recommend to proceed as follows Increase both values using the slider of Contrast Low until no clutter pixels are selected anymore Then decrease Contrast Low to add more object pixels If significant object parts remain unselected decrease Contrast High Note that these parameters are used only to select model points in the model image In the test images the object may have a lower contrast You can also let the Matching Assistant select suitable values automatically based on the model image An additional method for removing clutter for shape based matching is to specify a minimum size for the model components If you cannot find suitable parameter values that exclude the clutter we recommend to create a new model ROI via the menu ROI page 264 Letting the Matching Assistant Select a Suitable Value for Contrast Shape based Matchi
449. ow the radix character For g and G conversions trailing zeros are not removed from the result contrary to usual behavior width An optional string of decimal digits to specify a minimum field width For an output field if the converted value has fewer characters than the field width it is padded on the left or right if the left adjustment flag has been given to the field width precision The precision specifies the minimum number of digits to appear for integer conversions the field is padded with leading zeros the number of digits to appear after the radix character for the e and f conversions the maximum number of significant digits for the g conversion or the maximum number of characters to be printed from a string conversion The precision takes the form of a period followed by a decimal digit string A null digit string is treated as a zero conversion A conversion character indicates the type of conversion to be applied d o x X The integer argument is printed in signed decimal d unsigned octal o or unsigned hexadecimal notation x and X The x conversion uses the numbers and lower case let ters 0123456789abcdef and the X conversion uses the numbers and upper case letters 0123456789ABCDEF The precision component of the argument specifies the minimum num ber of digits to appear If the value being converted can be represented in fewer digits than the specified minimum it is expanded with leading zeroes The default
450. p page 276 Usage gt Advanced Use Parameters page 285 The following Advanced Use Parameters may speed up correlation based matching Subpixel page 286 If your application does not require subpixel accuracy you can speed up the matching by selecting the value none Last Pyramid Level page 287 Increase the value and check whether the matching still succeeds in all images Note that as a result of this modification wrong instances of the model may be found Furthermore the accuracy of the calculated position orientation and scale may decrease 7 3 2 How to Use the Matching Assistant of HDevelop 259 e Timeout page 287 This parameter enables you to specify a certain time in milliseconds after which the detection of model within an image is aborted Speed up deformable matching Parameters gt Standard Model Parameters page 269 The following Standard Model Parameters may speed up deformable matching e Number of Pyramid Levels page 272 Increase the value and check whether the matching still succeeds in all images e Allowed range of rotation page 273 Set the parameters Starting Angle page 273 and Angle Extent page 273 according to the range probably needed for your images e Set the allowed range of scale via Starting Angle page 273 Min Row Scale page 273 Max Row Scale page 273 Min Column Scale page 273 and Max Column Scale page 273 according to the ranges proba
451. parameters we get four different kinds of parameters These four kinds always appear in the same order in the HDevelop parameter list In the reference manual operator signatures are visualized in the following way operator iconic input iconic output control input control output As you see iconic input objects are always passed first followed by the iconic output objects The iconic data is followed by the control data and again the input parameters succeed the output parameters Any of the four types of parameters may be empty For example the signature of read_image reads read_image Image FileName The operator read_image has one output parameter for iconic objects Image and one input control parameter FileName The parameter types are reflected when entering operators in the operator window The actual operator call displayed in the HDevelop program window is o te iv 3 te c is l 338 HDevelop Language read_image Image Name The parameters are separated by commas Input control parameters can either be variables constants or expressions An expression is evaluated before it is passed to a parameter that receives the result of the evaluation Iconic parameters must be variables Control output parameters must be variables too as they store the results of an operator evaluation 8 2 Control Types and Constants All non iconic data is represented by so called control data numbers or st
452. pe page 274 Depending on the detector type that is chosen different values can be specified For the Detector Type lepetit the following value can be specified e Check Neighbor e Neighbor Diff Threshold e Subpixel For the Detector Type harris the following values can be specified 280 HDevelop Assistants e Smoothing Sigma and e Alpha For the Detector Type harris_binominal the following values can be specified e Alpha and e Subpixel For more information and recommended values please refer to the reference documentation of the oper ator create_uncalib_descriptor_model The Model Parameter Patch Size Patch Size specifies the side length of the quadratic neighborhood that is used to describe the individ ual interest point A value that is too large may increase the runtime The Model Parameter Tilt Tilt is used to switch on or off the projective transformations during the simulation phase which leads either to an enhanced robustness of the model or to a speed up of the training 7 3 3 5 The Menu Usage and the Tab Usage Via the menu Use Model as well as the tab Usage you can e load test images e delete a selected test image e delete all test images at once e display the selected test image page 282 e access the test image settings in the tab Usage e open the dialog for the standard page 284 and advanced search parameters page 285 e open the dialog for the optimization of the
453. pecially used for parameters that contain data like file image acquisition or OCR handles Input control parameters may contain constants variables and expressions Common types are integer numbers integer floating point numbers real boolean values true and false and character strings string You can also specify multiple values of these types at once by using tuples This is an array of values separated by commas and enclosed in square brackets Furthermore you may build up expressions with these values You may use expressions in HDevelop similar to the use of expressions in C or in Pascal You will find a detailed description in section Expressions for Input Control Parameters on page 343 Control output parameters These parameters are handled in the same way as iconic output parame ters Their defaults are named as their parameter names Other possibilities to obtain a control output variable name are either using the combo box or specifying variable names manually You cannot use any expressions for these parameters After discussing what can be input for different parameters it is explained how this is done Nevertheless you have to keep in mind that you need to modify a parameter only if it contains no values or if you are not satisfied with the suggested default values Text input Give the input focus to a parameter field by clicking into it Now you may input num bers strings expressions or variables There
454. perator dev_display in the HDevelop program at each point where you want to display data This will not change the behavior of the HDevelop program but result in the appropriate call in the exported code When generating code using the option Use HALCON Windows close the default graphics window using dev_close_window and open a new one using dev_open_window before the first call of dev_display in order to assure a correct export Displaying images In HDevelop images are automatically scaled to fit the current window size This is not the case in exported programs For example if you load and display two images of different size the second one will appear clipped if it is larger than the first image or filled up with black areas if it is smaller For a correct display you must use the operator dev_set_part before displaying an image with dev_display as follows dev_set_part 0 0 ImageHeight 1 ImageWidth 1 dev_display Image In this example Image is the image variable ImageHeight and ImageWidth denote its size You can query the size of an image with the operator get_image_size Please consult the HALCON Reference Manuals for more details Note that the operator dev_set_part and its HALCON library equivalent set_part is more commonly used for displaying and thereby zooming parts of images By calling it with the full size of an image as shown above you assure that the image exactly fits the window Changing display parameter
455. perator window is already open If the full text editor is not enabled you can also open the operator window by double clicking a line in the program window 6 2 9 5 Open Output Console Synopsis Open the output console window Shortcut Ctl Shift 0 E or Ctrl Shift 0 Ctrl Shift E The output console window contains a log of the most recent messages This includes all messages displayed on the status bar as well as HALCON low level errors Therefore HALCON low level errors can now be logged without an interruption of the program execution The window can also be opened by double clicking onto the message area of the status bar See fig ure 6 35 for an example The logged messages are grouped by categories like informative messages warnings and error mes sages Whether or not messages of a certain category are displayed can be toggled by clicking on the corresponding tool bar icons W Output Console boba dB CHAAAR No Title Time Description G Open Program 16 40 39 Loaded D dip hdev HALCON operator error 1 e HALCON Error 16 40 46 while calling read_image in procedure main line 2 File not found HALCON error code 5200 2 ap Program Execution 16 40 48 Executed 3 program lines in 2 336 s last catch 0 1 ms 3 My Program Execution 16 40 49 Executed 4 program lines in 75 3 ms last connection 1 7 ms g la c i E 2 5 0 Figure 6 35 Open Output C
456. pes of contours but by a set of so called interest points These points are first extracted and then classified according to their location and their local gray value neighborhood Similar to the perspective deformable matching the descriptor based matching is able to find objects even if they are perspectively deformed Descriptor based matching can be applied for images from a calibrated camera as well as from an uncali brated camera This matching method provides a calibrated version with which also a 3D pose instead of 2D transformation parameters can be derived Alignment This method can be applied in order to transform the position of the matched object corre sponding to the reference image Alignment is useful if the following image processing step is not invariant against rotation or translation like OCR or the variation model Note that by alignment the matched object is only rotated and translated To remove perspective or lens distortions e g if the camera observes the scene under an inclined angle you must rectify the image first The matching assistant allows you to generate code for an affine transformation page 292 which can subsequently be used for alignment with the Measure Assistant Alignment is useful for all further processes that rely on fixed ROIs like measuring and OCR Model In order to locate an object you must provide the Matching Assistant with an example image of the object From this the Matching Assistant then c
457. play only incorrectly classified samples to view only samples that were classified incorrectly e Sort samples by Confidence as this may provide a hint to classification problems e Edit Symbol Name to assign a sample to the correct symbol class if necessary This action is equal to moving a sample via drag and drop to another symbol in the Training File Window page 215 6 15 Dialogs 221 6 15 Dialogs 6 15 1 File Selection Dialog The file selection dialogs opened by actions such as Open Program Save or Read Image are native windows of the operating system and thus their appearance and internal functionality is beyond HDevelop s control Their basic functionality is to browse the file system and to select one or multiple files or in some cases directories Usually they have two buttons The one labeled Open or OK confirms the selection and thus performs the initial action e g loading a file while the other labeled Cancel aborts the initial action As an example the dialog Menu File gt Open Program is shown A detailed description of the complete functionality is beyond the scope of this manual X Choose a HDevelop program to open N ze COv lu examples hdevelop gt v gt Search hdevelop p Organize v New folder Fil 60 HZ Desktop E Name i Date modified Type p Downloads s a Morphology 0 06 2010 13 00 File fo Recent Places M Object 010 13 00 File fo D o
458. ponding type If there is no need to execute the operator or procedure call immediately you may specify new variable names i e names that do not already exist in the variable window but will be instantiated later by adding further operators or procedure calls to the program body In any case you have to specify iconic parameters exclusively with variable names It is not possible to use expressions o D 2 Q a 0 Iconic output parameters These parameters contain default variables which have the same names as the parameters themselves If a variable with the same name as the output parameter is already 170 Graphical User Interface instantiated a number is added to the name to make it unique Because the parameter names characterize the computed result very well you may adopt these default names in many cases Besides this you are free to choose arbitrary names either by yourself or by opening the list see above If you use a variable that already has a value this value is overwritten with the new results It is possible to specify a variable both in an input and output position Control input parameters These parameters normally possess a default value As an alternative you may use the text field s button to open a combo box and to select a suggested value In addition this combo box contains a list of variables that contain values of the required type A restriction of proposed variables is es
459. ponding closing operator by default to keep the program code balanced In addition the IC is placed between the control flow operators This is fine for entering new code blocks If you want to add control flow operators to existing code you can also add the operators individually Keep in mind however that a single control flow operator is treated as invalid code until its counterpart is entered as well In the following lt condition gt is an expression that evaluates to an integer or boolean value A condition is false if the expression evaluates to O zero Otherwise it is true HDevelop provides the following operators to control the program flow o te iv te c l HDevelop Language abs assign band bxor chr cos deg endfor endwhile export_def floor global H_MSG_VOID H_TYPE_REAL insert is_int_elem is_real_elem log max2 min2 ords real regexp_test return select_rank sort stop strrstr switch true uniq acos assign_at bnot case chrt cosh deviation endif environment fabs fmod H_MSG_FAIL H_TYPE_ANY H_TYPE_STRING int is_mixed is_string logi0 mean not pow regexp_match remove round sgn sort_index strchr strstr tan try until and atan bor catch comment cumul else endswitch exit false for H_MSG_FALSE H_TYPE_INT if inverse is_number is_string_elem ish median or rad regexp_replace repeat rsh sin split strlen
460. precision is 1 The result of converting a zero value with a precision of 0 is no characters f The floating point number argument is printed in decimal notation in the style ddd dad where the number of digits after the radix character is equal to the precision specifica tion If the precision is omitted from the argument six digits are output if the precision is explicitly 0 no radix appears e E The floating point number argument is printed in the style d ddde dd where there is one digit before the radix character and the number of digits after it is equal to the precision When the precision is missing six digits are produced if the precision is 0 no radix character appears The E conversion character produces a number with E introducing the exponent instead of e The exponent always contains at least two digits However if the value to be printed requires an exponent greater than two digits additional exponent digits are printed as necessary g G The floating point number argument is printed in style f or e or in style E in the case of a G conversion character with the precision specifying the number of significant digits The style used depends on the value converted style e is used only if the exponent resulting from the conversion is less than 4 or greater than or equal to the precision Trailing zeros are removed from the result A radix character appears only if it is followed by a digit s The argument is taken
461. procedure call or the line before the next operator or procedure call to execute Using the PC in this way is time consuming Therefore you may suppress this option after your test phase or while running a program with a lot of small operators inside a loop See also dev_update_pc Update Variables This check box concerns the execution of a program Every variable iconic and control is updated by default in the variable window This is very useful in the test phase primarily to examine the values of control data since iconic data is also displayed in the graphics window If you want to save time while executing a program with many operator calls you may suppress this output Independent of the selected mode the display of all variables will be updated after the program has stopped See also dev_update_var Update Graphics Window This item concerns the output of iconic data in the graphics window after the execution of a HAL CON operator With the default settings all iconic data computed in the run mode is displayed in the current graphics window You may want to suppress this automatic output e g because it slows down the performance or because the program handles the visualization itself If the output is suppressed you have the same behavior as exported C C Visual Basic Visual Basic NET or C code where automatic output of data is not supported See also dev_update_window Enable the context menu in the Graphics win
462. r This section deals with the classifier that is used for the OCR application and with its settings The tab consists of the following sections e OCR Classifier e Teaching e Training e Basic Features page 322 e Advanced Training Parameters and Features page 324 7 5 4 1 Select or Save an OCR Classifier When using a previously trained classifier you can choose between either e aPretrained Classifier from one of the classifiers that are available for HALCON see So lution Guide I chapter OCR for a more detailed description of the available pretrained OCR classifiers or e apreviously trained classifier from file that can be selected via the Browse button next to the combo box for HALCON classifiers When deciding which pretrained classifier should be used it may help to view details of the OCR clas sifier by clicking on the button with the magnifying lens located right of the selection for pretrained classifiers If a new classifier should be trained a Training File has to be used as a basis for training a new classifier Therefore select the radio button Training File and continue by loading a training file with the Browse button next to the text field To start the creation of a new training file click on the button New After a new training file has been created samples can be added to the training file and then it has to be saved via the button Save before it can be used for training To look at a currently or pre
463. r camera it might help to take a quick look at the gray value transitions along a line within the image to see whether the edges are sharp or still a bit blurry While sharp images are defined by abrupt changes between dark and bright gray values no abrupt changes but rather gray value transitions can be found in blurry images see figure 6 83 255 Ras 200 100 Machine MVTec Software GmbH J a A 1 I o 2 60 80 100 120 140 179 a 200 Machine WO is See 7 a gt Poe S 1 2 4 60 80 100 120 140 179 Figure 6 83 a profile in a sharp image b profile in an unsharp image 6 14 OCR Training File Browser 215 6 14 OCR Training File Browser Synopsis Browse and manage OCR training files Selecting this entry opens a tool for inspecting and modifying training files With this tool you can for example eliminate errors made in the teaching process e g if a sample has been assigned to a wrong symbol please follow the links for a definition of the terms symbol page 314 and sample page 313 This tool is a useful addition to the OCR Assistant page 312 but can also be used independently for any OCR application It can be opened either via the corresponding toolbar button from within the OCR assistant page 312 or via the drop down menu Visualization gt Tools gt OCR Training File Browser Note that if the OCR Training File Browser is used in combination with the OCR Assistant page 312
464. r camera and therefore gain information about parameters of the camera system and distortions in the image Calibrating your system constitutes a preparation for your subsequent application as it provides the basis for you to measure with high precision in the world coordinate system The assistant is described in section Calibration Assistant on page 230 Matching Using this assistant you can generate code to perform shape based correlation based descriptor based and deformable matching in your HDevelop program You can load a reference image to train a model Using a selection of test images containing the model you can tweak a set of parameters to find the model in all variations permitted by the application Furthermore the parameters can be optimized to increase the processing speed The assistant is described in section Matching Assistant on page 252 Measure Using this assistant you can perform a 1D measuring By specifying one or more Regions of Interest and adapting variables relevant edges or edge pairs between which you want to measure can be determined Finally code can be generated and inserted into your application The assistant is described in section Measure Assistant on page 293 OCR Using this assistant you can perform optical character recognition OCR By specifying the region of the text adapting values teaching samples and either classifying with an existing 224 HDevelop Assistants
465. r saving the image click on the Save Image button on the right For saving the modification ROIs click on the corresponding button on the right of the modification ROI buttons A star next to the Enable checkbox reminds you that modifications have been made that have not been saved You can load your saved modification ROIs again with the corresponding button on the right of the modification ROI buttons Inpaint Regions Inpaint Region Smooth If an model image is disturbed by clutter or unwanted structures these can be removed by choosing Inpaint Regions from the drop down menu If you just want to smooth an area within an ROI without completely removing structures choose Inpaint Region Smooth 266 HDevelop Assistants For using either Inpaint Regions or Inpaint Regions Smooth choose a shape for your modifica tion ROI from the buttons on the right The shape should not only cover the area that is to be removed but also some of the good area around it You have the choice between circle ellipse axis aligned rectangle and if none of these regions is suitable it is also possible to draw an arbitrary region Remove Contours Remove Contours enables you to choose contours you want to delete from your model Activate the function by clicking on the ROI button and start to remove edges by selection Also choose the Strength of the removal i e the smoothing width either by manipulating the values in the box or using the slider
466. r tab in the section Training Delete one or all ROIs You can delete an ROI item via the menu item OCR gt Delete Selected ROI Item via the correspond ing button in the Region Of Interest section on the Setup tab read more about ROI data in the section Create ROI page 315 If you want to delete all ROI items select Delete All ROIs 7 5 7 OCR Assistant Reference 333 Load ROI from File Via the menu item OCR gt Load ROI from File you can load a previously saved ROI from a file Save ROI to File If you want to reuse an ROI you can save it to a file via the menu item OCR gt Save ROI to File 7 5 7 3 The Menu Code Generation Via the menu Code Generation you can e insert code into the program window of HDevelop according to the current settings of the OCR Assistant e release generated code lines in the program window e delete generated code lines from the program window as long as you did not release them and e open the dialog for the code preview inside the tab Code Generation Insert the Generated Code Lines Via the menu item Code Generation gt Insert Code also accessible as tool bar button or as button inside the tab Code Generation you can insert the code that is generated according to the current settings of the OCR Assistant into the program window Release the Generated Code Lines Via the menu item Code Generation Release Generated Code
467. rain ing vector becomes a support vector and train ing classification times grow A too small value leads to few support vectors The Nu parameter of the radial basis kernel func tion One typical strategy is to select a small Spe cialization Gamma and Regularization Nu pair and consecutively increase the values as long as the recognition rate increases The number of trees used by the kNN classifier If more trees are used the classification becomes more robust but the runtime also increases Other features that can be chosen are pixel pixel_invar pixel_binary gradient_8dir projection_horizontal projection_vertical_invar foreground_grid_9 foreground projection_horizontal_invar anisometry ration foreground_grid_16 projection_vertical width height zoom_factor compactness convexity 326 HDevelop Assistants moments_region_2nd_invar moments_region_2nd_rel_invar moments_region_3rd_invar moments_central moments_gray_plane phi num_connect num_holes cooc num_runs and chord_histo For more information about the effect of these parameters please refer to the reference documentation of the HALCON operators create_ocr_class_mlp create_ocr_class_svm create_ocr_class_knn and create_ocr_class_box 7 5 5 Results The Results tab lets you select features concerning the classification results The tab consists of four parts e Word Processing e Feature Selection e Display
468. ration tab Sorting out images with too many defects improves the calibration results 7 2 2 How to Calibrate with the Calibration Assistant 233 7 2 2 How to Calibrate with the Calibration Assistant By using the Calibration Assistant you can set up and optimize your calibration application in three steps e Choose the right calibration mode e load the calibration images page 235 e and respond to image quality feedback page 239 7 2 2 1 Choosing the correct Calibration Mode and Basic Parameters For the calibration setup in the Setup tab the basic information has to be filled in Which information 1s necessary for your application will depend on the answer to the question whether you want to perform a full calibration whether you have a special setup or you have calibrated before and therefore want to take advantage of the user defined calibration Furthermore information about the calibration plate and the camera is required In short the setup information includes e the Calibration Task e theCalibration Plate e and the known Camera Parameters Choosing the task for your application If you want to calibrate all parameters e g if you are calibrating for the first time with your setup click the radio button Full Calibration Pose and all Camera Parameters If you are using a special setting or you have already calibrated your system before and want to re use your resulting parameters choose User
469. rators of HDevelop Thus you will not find them in the reference manuals for HALCON C HALCON C or HALCON COM The menu has a cascade structure according to the chapter structure of the HALCON reference manual As this menu is built up dynamically when HDevelop starts it might take some time until it is available During the build up time the menu is grayed out Selecting a chapter of the menu opens a pulldown menu with the corresponding sections or operators respectively This operator hierarchy is especially useful for novices because it offers all operators sorted by thematic aspects This might be interesting for an experienced user too if he wants to compare e g different smoothing filters because they reside in the same subchapter To get additional information a short description of an operator while activating its name in the menu is displayed in the status bar Note that some operators are visible in the menus but should not be used e g open_window in Menu Operators gt Graphics gt Window or reset _obj_db in Menu Operators gt System gt Database If you select one of these operators a warning text is displayed in the operator window This warning will usually refer to a legal substitute In the case of most of these operators you should use the corresponding Develop operator e g dev_open_window instead of open_window within HDevelop 6 2 6 4 Procedures Synopsis Select procedures This menu lists
470. re call the corresponding procedure and all procedures that can be reached from it are copied to the buffer This is necessary in order to obtain a consistent program when pasting procedure call lines to a program in which the corresponding procedures might not exist The highlighted program lines are also copied to the system clipboard 6 2 2 5 Paste Synopsis Insert text into the currently selected procedure at the IC Shorteut Gv or Sit You can insert code lines from previous Cut or Copy operations or text placed in the system clipboard into the current procedure The insert position depends on the editing mode In the dialog based editor valid code lines from the paste buffer are inserted at the IC In the full text editor the text from the paste buffer is inserted at the text cursor position The following functionality is only available in the dialog based editor If the paste buffer contains local procedures that do not exist they are added to the current program If the paste buffer contains calls to external procedures the paths to those procedures are copied too However before an external procedure path is added during a paste action you are asked whether or not you want to add that particular path to the external procedure paths The mechanism of copying and pasting procedure calls together with the corresponding procedures is an easy way to transfer procedures between different HDevelop programs It also works between multiple i
471. reates the so called model an internal representation of the object containing only the information characterizing the object This repre sentation is then used when searching for the object in the test images You can also provide the Matching Assistant with a model in DXF format or in the HALCON formats SHM NCM DSM or DFM Model Image This is the image containing your example of the object to be searched for This image should be a characteristic image of the object i e the object should appear in its default position and orientation and not be occluded furthermore the image should not contain clutter You can load this image via the menu item File gt Load Model Image page 262 Reference Image If a reference image is selected the position of the match in this image is used as reference This is necessary to perform alignment If no reference image is chosen the model image will be used as basis for alignment Model Region of Interest ROI This is the region in the model image which contains the object to be trained You can select this region via the menu item ROI page 264 Rectification This method can be applied to the search image in order to transform it such that the found model and the model in the reference image appear as similar as possible Rectfying an image is useful for all further processes that rely on fixed ROIs like measuring and OCR Test Image You can test the performance of the matching process by providing
472. recognition speed page 289 and e directly start to optimize the recognition speed page 289 In the tab Usage you can additionally e open the Image Acquisition Assistant page 225 to acquire images e select a test image page 282 e specify the number of visible objects page 283 in the image and e start the matching for a selected test image page 282 or e for the whole sequence of test images page 282 7 3 3 Matching Assistant Reference 281 Test Images With the menu item Usage gt Test Images you can e load test images e delete a selected test image or delete all test images e display an already selected test image and e open the dialog Test Images inside the tab Usage The dialog Test Images inside the tab Usage you need to additionally e select a test image for display or deletion e select a test image as reference e specify the number of visible objects page 283 for each image and e search for the model in the complete sequence of test images in the currently selected test image or automatically after each selection Loading Test Images The so called test images page 253 should be representative images from your matching application 1 e the object should appear in all allowed variations of its position orientation occlusion and illumi nation When you select the menu item Usage gt Test Images gt Load Test Images or click the correspond ing button Load in t
473. red the parameter Subpixel page 286 should be set to at least least_squares Note that 1f the lowest pyramid level to use is chosen too large it may happen that the desired accuracy cannot be achieved or that wrong instances of the model are found because the model is not specific enough on the higher pyramid levels to facilitate a reliable selection of the correct instance of the model In this case the lowest pyramid level to use must be set to a smaller value The Parameter Timeout Shape based Matching Correlation based Matching 288 HDevelop Assistants Setting a timeout can improve the overall speed of your application as the program will then stop search ing for a model within an image after a certain time To use the Timeout function activate Enable on the right side of the tab Then choose the time in milliseconds after which the search for a model shall be aborted Activating the Timeout is especially useful in cases where a maximum cycle time has to be ensured Be aware that the runtime of the search increases by up to 10 percent with activated Timeout For more information please refer to the reference documentation of the HALCON operator set_shape_model_param The Search Parameter Increased tolerance mode Shape based Matching The Increased tolerance mode allows you to increase the searching tolerance and therefore also increase speed The matching is then less robust and accurate but faster and migh
474. remove the content of iconic output parameters Hobject and control output pa rameters Htuple before each operator call Memory issues regarding iconic objects in HALCON NET are described in section 9 3 3 3 Visual Basic NET and section 9 2 3 3 C Prefix Destination export_def The place of insertion gt in_place HO Beginning of the program at_file_begin End of the program at_file_end Before the current procedure before_procedure After the current procedure gt after_procedure Table 9 1 Embedding arbitrary code in HDevelop 394 Code Export However problems arise if a tuple variant contains a handle for example for a file a window or for OCR In this case the memory of the handle is automatically removed but not the data to which it points In the exported programs this data therefore has to be removed explicitly by calling the corresponding operators close_ like close_ocr or close_ocv Please insert the close_ operators for all handles in use e before a new value is assigned to a handle and e atthe end of the program 9 6 3 Variable Names Variable names in HDevelop are case sensitive i e x and X are distinct variable names in HDevelop programs If you export such a program to a case insensitive target language e g Visual Basic NET the development environment will complain about multiple declarations Either plan ahead and avoid these variable names or
475. respectively constants There are constants for the return value result state of an operator The constants can be used together with the operator dev_error_var and dev_set_check These constants represent the normal return value of an operator so called messages For errors no constants are available there are more than 400 error numbers internally see the Extension Package Programmer s Manual In table 8 2 all return messages can be found Additionally there are constants for the types of control data These can be compared to the result of a type operation to react to different types of control data tuple The control types are only used within the generic HDevelop type tuple A tuple of length 1 is interpreted as an atomic value A tuple may consist of several numerical data items with different o te iv te c l 340 HDevelop Language Tuple constant Value A AA Value QU LO G Figure 8 1 The syntax of tuple constants string 7 gt gt integer gt real gt gt boolean types The standard representation of a tuple is a listing of its elements included into brackets This is illustrated in figure 8 1 specifies the empty tuple A tuple with just one element is to be considered as a special case because it can either be specified in the tuple notation or as an atomic value 55 defines
476. responding variable names can be specified Control Flow Initialization Only Generate only code to initialize the image acquisition interface with the param eters specified in the other tab cards and to close it down properly Additional code for image acquisition and processing can be added later Acquire Single Image Also generate code to acquire an image Acquire Images in Loop Also add a loop around the image acquisition code Further image pro cessing can be added inside this loop The image acquisition interface is addressed by a so called handle The variable name of this handle can be specified in the text field Connection Handle The variable name of the acquired image s can be set in Image Object Click Code Preview to inspect the code Click Insert Code to generate the code in the program window at the IC Source Connection Parameters _ Inspect Code Generation Acquisition Control Flow Acquire Images inLoop Insert Code Acquisition Mode Asynchronous Acquisition Y Auto Disconnect Variable Names Connection Handle AcqHandle Loop Counter Index Image Object Image Image Files ImageFiles Code Preview Figure 3 9 Code generation g 2 a 5 y lt o a 32 Acquiring Images with HDevelop Here is a code example Code generated by Image Acquisition 01 open_framegrabber GigEVision 0 0 0 0 0 O progressive 1 default
477. rfaces support device specific parameters to preset selected values before the camera is initialized The parameters the interface claims to support are suggested as a drop down list To set a generic parameter select it from the list and edit the assigned value 1 e the value after the Multiple generic parameters may be set by separating the entries with a comma If the selected image acquisition interface does not support generic parameters this field is grayed out See the documentation of the individual image acquisition interfaces for more information about the supported generic parameters 7 1 3 Tab Parameters 227 Action Buttons Once the connection parameters are set up the action buttons are used to connect to and acquire images from the specified device Messages about connection errors are displayed in the status line of the image acquisition assistant window Connect Connect to the specified image acquisition device If the connection fails carefully check the configuration in the above fields Not all combinations of settings are allowed for all devices It is recommended to enable low level error messages see General Options gt Experienced User to find out what is going wrong Please note that an established connection is closed auto matically if the connection parameters are modified When the connection is established this button can be used to disconnect the device Snap Acquire a single image from the
478. rier New tz Height 2 dev I dev WindowHandle PE eiT gt a Define and display the rectangular ROIs within whict v Auto J User Ji Global J itt rs Figure 2 4 The variable and program window after loading the example program The program lines of the loaded example program are now displayed in the program window The PC is set to the first executable line of the program leading comments are ignored The variable window is also updated It lists the variables that are used in the main procedure which is initially the current procedure The variables are currently uninstantiated i e their current value is undefined This is indicated by the question mark Both windows are displayed in figure 2 4 Run Example Program e Click Execute gt Run or click the corresponding button from the tool bar see figure 2 5 The program line next to the PC is executed the PC is moved to the following line and so forth until the execution stops There are four reasons for the program execution to stop 1 the last program line has been executed 2 a breakpoint has been reached 3 the HDevelop instruction stop has been encountered as in this example or 4 an error has occurred During execution the graphics window is used for visualization Changes to the variables are reflected in the variable window When the program execution stops the status bar displays the number of executed lines and the processing time To continue
479. rings in HDevelop The name 1s derived from their respective functions within HALCON operators where they control the behaviour the effect of image processing e g thresholds for a segmentation operator Control parameters in HDevelop may contain arithmetic or logical operations A control data item can be of one of the follow ing types integer real string and boolean integer The type integer is used under the same syntactical rules as in C Integer numbers can be input in the standard decimal notation in hexadecimal by prefixing the number with Ox and in octal by prefixing the number with O zero For example 4711 123 Oxbeef 48879 in decimal notation 073421 30481 in decimal notation Data items of type integer are converted to their machine internal representations that is the C type long 4 or 8 bytes real The type real is used under the same syntactical rules as in C For example 73 815 0 32214 56 17 32e 122 32E19 Data items of type integer are converted to their machine internal representations that is the C type double 8 bytes string A string is a sequence of characters that is enclosed in single quotes The maximum string length is limited to 1024 characters Special characters like the line feed are represented in the C like notation as you can see in table 8 1 see the reference of the C language for comparison You can enter arbitrary characters using the format xnn where nn is a t
480. rl Shift F12 Ctrl Shift W Ctrl Shift O Ctrl Shift W Ctrl Shift C Ctrl Shift W Ctrl Shift S Ctrl Shift W Ctrl Shift M Ctrl Shift W Ctrl Shift F Ctrl Shift H Ctrl Shift A Ctrl Shift H Ctrl Shift K Ctrl Shift H Ctrl Shift wW Ctri Shift H Ctrl Shift F Ctrl Shift H Ctrl Shift L Ctrl Shift H Ctrl ShifteR Ctrl Shift H Ctrl Shift U 10 1 2 Program Listing 401 10 1 2 Program Listing Function Shortcut Alternative Run Until Here Shift F5 Set Insert Cursor Ctrl Set Program Counter Ctrl Show Procedure Alt Return Show Procedure in New Tab Alt Ctrl Return Alt Ctrl Enter Show Procedure in New Window Alt Shift Return Alt Shift Enter Shift Cuts Si Att Return AlteCurleReturn J AlteShifteRetum Auto Indent Curl Shift t PC Up Ctrl Up PC Down Cul Down Open Operator Window Ctrl Shift Space Apply Current Line Ctrt Return Go to Line AG Go to Program Counter am Show main Att Home Show Next Tab Card Alt Right Show Previous Tab Card Alt Left Select a Procedure Alt Up Move tab to the left Cul Alt Shifi Left Move tab to the right Cirl Alt Shift Right Set Editor Mode Cirl Shift PM Curl Shift P Ctrl ShifteM Set Enter Execute Mode Ctrl Shift P E Cirl Shift P Ctrl Shift E Set Auto Completion Mode Ctrl Shift P A Cirl Shift P Ct
481. rl Shitt A Set Breakpoint F10 Activate Deactivate Breakpoint Shift F10 Set Bookmark Ctrl F11 Back in History Alt Shift Left Forward in History Alt Shift Right New Tab Alt Ins List Open Tabs Alt Down jepe 402 Miscellaneous 10 1 3 Help Window Function Shortcut Alternative Locate page CoL Back Alt Left Forward Alt Right Home _Alt Home Increase Font Size Cut Decrease Font Size Curls Bookmark Curl D Print Cul P Insert New Cell Alt Return Find Ctrl4F Next Down Previous Up 10 1 4 Graphics Window Function Shortcut Alternative Delete 10 1 5 Variable Inspect Function Alternative Cut Ctrl X Copy Ctrl C Paste Ctrl V aga Delete Del Insert New Cell Ctrl Shift V 10 1 6 OCR Training File Browser 10 2 Online Help Function Alternative New Training File Load Training File Save Training File Close Training File Save all Training Files Close all Training Files Save Training File As Ctrl N Ctrl O Ctrl T Ctrl S Ctrl L Ctrl Alt S Ctrl Alt L Ctrl Shift S Ipocnenaa pagan Add Symbol Name Load Classifier Undo Ctrl Z Redo Ctrl Y Cut Ctrl X Shift Del Copy Ctrl C Curl ins Paste Ctrl V Shift Ins Delete Del Generate Variations Ctrl 0 V Ctrl 0 Ctrl V Detailed View Ctrl Shift V D Ctrl Shift V Ctrl Shift D Thumbnails Ctrl Shift V T Ctrl Shift V Ctrl Shift T 10 2 Online Help Online documentation
482. rocedwe Resolution As as oe Ae pE EE ES ee ee ae eS 48 5 0 Protected Precedures cc neo HRS ER SOR EHR ERE DS Se RRS ESS 49 Procede Deenmenianon p cocoge ape a i e a ae k eee ee ee eS 50 Graphical User Interface 51 6 1 Mam Window sec coea pa a AA ere fee we ee eS 51 ARM oras oo te ck Re a E AA ee a a ASA GS 54 Gl Wenn Pile ori ds a a o Bees 54 Goo Menu ELE oo ata e ida id is ee HS eRe e e SS 66 O25 IMENESECUES o a Re G 97 624 Memm Visualization os e a ed eR ae we eS 105 023 Meni Procedures 6 cb oe he AA a eae NS 118 6206 MennQpersters 2 06054 20 586 othe Bh Se be ERS oe GS 121 027 Memi Suggestions o ooe ek ob a eee we a 127 628 Menn Assistants 265 564 ces e 128 G25 Men Winder bo ck aS CRS a e be Dee A ES AS ORES 128 6 210 Mem Help oe acosa ea bea hee bre ES 134 D3 Tool Bee coccion Ae ley we a A 136 64 Program Window es aea anne e A A Be eee Ve ees 138 GA Program Window ACHONS osos ogee BR ee ee A Sey Ge et 139 GAZ Eicitine Prosrams 4 ob ee ee Re ROP rn ee NS 140 6 4 3 Program Counter Insert Cursor and Breakpoints 146 O44 Context Memi lt hacks ee wR eae Ee A AR e Re ee eS 147 Gao Create Procedures con tt eRe Se eb oe eh eee a eS 150 646 Editing Procedures ci soe dc ES ee ee Rk 155 6 4 7 Side Effects of Procedure Changes 157 6 4 8 Providing Procedure Documentation o sooo e 158 GAS Protecting aProced re oe a sodo 22 884 e toia eee es 162 A 164 OS oper
483. rograms using it The file name determines the name of the procedure Thus if the file name of an external procedure is changed programs and other procedures using it will have to be adapted e Libraries Libraries contain a collection of typically related procedures in a single file They share the same properties as a collection of external procedures in a single directory By convention the term external procedure includes library procedures as well unless stated otherwise The idea of creating a library is to keep related procedures as a unit If the type of an existing procedure is changed the procedure resolution might be affected see section 5 5 on page 48 5 2 File Types HDevelop programs procedures and libraries are stored in files with different formats and extensions 5 2 1 HDevelop Programs hdev HALCON 10 or higher This is the default file format for HDevelop programs i e the main procedure and all local procedures It stores programs in XML format and is suitable for revision control software If you intend to manage your HDevelop programs using revision control software make sure to suppress the program checksum which is generated by default see preferences Experienced User page 93 However note that programs saved without the checksum cannot be loaded in the demo version of HDevelop Please note that programs in this format are not supported in HDevelop versions up to and includ ing HALCON
484. ropriate position in the application Using the instruction define NO_EXPORT_APP_MAIN only the main procedure is excluded from compilation This can be useful if you want to integrate exported HDevelop code into your application through specific proce dure interfaces In that case there is typically no need to export the main procedure which was probably used only for testing the functionality implemented in the corresponding real procedures Besides the program code the file contains all necessary include instructions All local variables iconic as well as control are declared in the corresponding procedures Iconic variables belong to the class Hobject and all other variables belong to Htuple Please note that in the current version the generated C code is not optimized for readability It is output such that it always produces identical results as the HDevelop code 392 Code Export 9 5 1 2 Compiling and Linking in Windows Environments The next step is to compile and link this new program In the Windows environment Visual C is used for the compiling and linking Example projects can be found in the directory HALCONEXAMPLES c If you want to use HALCON XL you have to include the libraries halconx1 1ib d11 and halconcxl 1lib d11 instead of halcon 1ib d11 and halconc 1ib d11 in your project see the Programmer s Guide chapter 24 on page 197 for more details 9 5 1 3 Compiling and Linking in UNIX Environments
485. rs without having to type or even know the exact name Selection is done with the mouse or using the arrow keys to highlight the desired operator and pressing Return If you selected the wrong operator by accident you can reopen the list by clicking on the drop down arrow next to the operator name When entering a partial name operators commencing with that name appear at the top of the list 1 Operator Window Insert read_aop_knowledge colo Enter Operator or Procedure read_aop_knowledge read_contour_xld_dxf read_aop_ je read_data_code_2d_ model k read_deformable_mode e HALCON operator Loads read descriptor_model read_fft_optimization_data Parameters jread_funct_id read_gray se E lread_kalman amp FileName D read_matrix x ParamName none X string ParamValue none X string e Attributes Attributes X string OperatorNames OperatorNames v string gt oe enter pet caes Jer Figure 4 2 Matching operators after typing read_ and pressing Return 4 3 Specify Parameters After selecting an operator its parameters are displayed in the operator window They are grouped by iconic and control parameters The icons next to the parameter names denote the parameter type Input vs output see figure 4 3 The semantic type is displayed to the right of the parameters Parameters are specified in the text fields The first parameter gets the input focus Enter Clip into the text fie
486. rst Camera Parameters Internal Camera Parameters describe the camera itself e g its Focal Length Cell Width and Cell Height These parameters are part of the calibration results initial values for some of them are also needed for the setup of the calibration Camera Pose The position and orientation of the world coordinate system relative to the camera are called the external Camera Parameters They are part of the calibration results Display Parameters On the Calibration page 235 tab you can choose the display parameters like colors as you prefer them See also Display Parameters page 243 Full Calibration In a Full Calibration the complete camera system is calibrated The only infor mation needed are approximate values for Camera Type Cell Width Cell Height and Focal Length as well as the question whether you are using a Telecentric camera in which case the Focal Length is not required Image Rectification Based on the calibration results you can remove image distortions This is called image rectification Example code is available from the Code Generation tab page 245 Pose Estimation Once the interior parameters are calibrated it is possible to estimate the camera pose from a single image Example code is available from the Code Generation tab page 245 Reference Image This image locates the world coordinate system which then has its origin in the middle of the calibration plate in the reference image By default
487. rst edge as value 0 or e position_last_edge which defines the last edge as value 0 Please note the description about how to specify good values page 302 You can learn how to use the Normalized option in the paragraph Advanced Fuzzy Features Once all relevant edges have been found continue to the Results tab page 334 Fuzzy Pair Center Position 304 HDevelop Assistants Enable Fuzzy Pair Center Position to choose edge pairs with a center of a certain position Under subtype you can determine the kind of pair center position that is relevant for your application You have the choice between position_pair which lets you define the position of your edge pairs with the starting point of the ROI set to 0 position_pair_center which lets you define the position of your edge pairs with the center of the ROT is set to 0 position_pair_end which enables you to choose values with the end point of the ROI set to 0 position_first_pair which defines the first edge pair as value 0 and position_last_pair which defines the last edge pair as value 0 Please note the description about how to specify good values page 302 You can learn how to use the Normalized option in the paragraph Advanced Fuzzy Features Once all relevant edges have been found continue to the Results tab page 334 Fuzzy Pair Width Fuzzy Pair Width lets you select pairs of a certain width You can choose between the subtype
488. rstr s1 s2 strrstr s1 s2 tuple_strrchr tuple_strstr tuple_strrstr 8 9 Summary of HDevelop operations 373 length of string select character select substring split string regular expression match regular expression replace regular expression select regular expression test strlen s sti s il i2 split s1 52 regexp_match s1 s2 regexp_replace s1 s2 s3 regexp_select s1 s82 regexp_test s1 s2 tuple_strlen tuple_str_bit_select tuple_str_bit_select tuple_split tuple_regexp_match tuple_regexp_replace tuple_regexp_select tuple_regexp_test less than t1 lt t2 tuple_less greater than t1 gt t2 tuple_greater less or equal ti lt t2 tuple_less_equal greater or equal ti gt t2 tuple_greater_equal equal tl t2 tuple_equal not equal tl t2 tuple_not_equal less than elementwise t1 lt t2 tuple_less_elem greater than elementwise t1 gt t2 tuple_greater_elem less or equal elementwise t1 lt t2 tuple_less_equal_elem greater or equal elementwise t1 gt t2 tuple_greater_equal_elem equal elementwise t1 t2 tuple_equal_elem not equal elementwise t1 t2 tuple_not_equal_elem logical and 11 and 12 tuple_and logical xor 11 xor 12 tuple_xor logical or 11 or 12 tuple_or negation not 1 tuple_not sine sin a tuple_sin cosine cos a tuple_cos tangent tan a tuple_tan arc sine asin a tuple_asin arc cosine acos a tuple_acos arc tangent atan a tupl
489. rt degrees to radians convert integer to real truncate real to integer convert real to integer absolute value of a integer or real absolute value of a always real smallest integer value not smaller than a largest integer value not greater than a tuple_select_rank tuple_sqrt tuple_deg tuple_rad tuple_real tuple_int tuple_round tuple_abs tuple_fabs tuple_ceil tuple_floor fmod a1 a2 fractional part of a1 a2 with the same sign as al tuple_fmod sgn a elementwise sign of a tuple tuple_sgn Table 8 20 Numerical functions Vi 18 8 132 4 33 19 3 V2 233 23 32 786 234 4224 63 33 Diff V1 V2 Distance sqrt sum Diff Diff Dotvalue sum V1 V2 d gt Vli V2 First the Euclidian distance of the two vectors V1 and V2 is computed by using the formula The difference and the multiplication square are successively applied to each element of both vectors o te iv te c l 362 HDevelop Language Operation Meaning HALCON operator sort t sort_index t inverse t is_number v number v environment s ord a chr a ords s chrt i rand a sorting in increasing order return index instead of values reverse the order of the values test if value is a number convert string to a number value of an environment variable ASCII number of a character convert an ASCII number to a character ASCII number of a tuple of strings convert a t
490. s Zoom Window Synopsis Open zoom window for image details and pixel inspection Shortcut Ctri Shift 0 Z Or Ctrl Shift O Ctrl Shift Z The zoom window is described in section Zoom Window on page 197 ro 6 2 4 Menu Visualization 117 New Zoom Window Synopsis Open additional zoom window See section Zoom Window on page 197 Gray Histogram Synopsis Display gray value histogram of active graphics window Shortcut Ctrl Shift 0 H Or Ctrl Shift O Ctrl Shift H Selecting this entry opens a sophisticated tool for the inspection of gray value histograms which can also be used to select thresholds interactively and to set the range of displayed gray values dynamically It is described in section Gray Histogram Window on page 199 Feature Histogram Synopsis Interactive inspection of feature histograms Shortcut ctrl Shift 0 F Or Ctrl Shift 0 Ctrl Shift F This menu item opens a sophisticated tool for the inspection of feature histograms It is described in section Feature Histogram Window on page 206 Feature Inspection Synopsis Inspection of shape and gray value features of individual regions Shortcut ctrl Snift 0 1 or Ctrl Shift O Cul Shift This window provides a tool for the convenient inspection of shape and gray value features of individual regions It is described i
491. s size which evaluates the width of the edge pairs i e the distance between the two edges of a pair size_diff which evaluates the signed difference between the reference pair width and the actual width of the edge pairs and size_abs_diff which evaluates the absolute difference between the desired reference pair width and the actual width of the edge pairs The images of a dip switch show how to use fuzzy measuring to improve edge detection Due to surface reflections one of the edge pairs is not detected properly It is however known that the pair width is 9 Setting Fuzzy Pair Width to 9 results in the exclusion of the wrong edge and therefore also in the detection of all the right edge pairs Please note the description about how to specify good values page 302 You can learn how to use the Normalized option in the paragraph Advanced Fuzzy Features Once all relevant edges have been found continue to the Results tab page 334 Fuzzy Pair Gray Mean Fuzzy Pair Gray Mean lets you select pairs of a certain mean gray value Please note the description about how to specify good values page 302 Once all relevant edges have been found continue to the Results tab page 334 Advanced Fuzzy Features 7 4 5 Advanced Measuring Tasks 305 _A Fuzzy Pair Width Subtype size y J Normalized Good Values Add Current E 1 Add Value Removal J7 Below Minimum is Good J Above Maximum
492. s If you change the way how results are displayed color line width etc in HDevelop interac tively via the menu Visualization these changes will not be incorporated in the exported pro gram We recommend to insert the corresponding Develop operators e g dev_set_color or dev_set_line_width in the HDevelop program explicitly This will result in the appropriate call set_color set_line_width etc in the exported code Miscellaneous 397 Chapter 10 Miscellaneous 10 1 Keyboard Shortcuts The following sections list the keyboard shortcuts supported in HDevelop On Mac OS X the command key is used instead of Cu 10 1 1 HDevelop Function Shortcut Alternative New Program CiN Open Program C 0 Save Curl S Save Program As Cut Shift S Save All Cirl AltS Print Cul4P Quit Ctrl Q Undo Cul4Z Redo Ctrl Y Cut Curl X Copy Cuac Delete Der Activate F3 398 Miscellaneous Function Shortcut Alternative Deactivate F4 Find Ctrl F Find Again Ctrl G Reset Program Execution F2 Reset Procedure Execution Shift F2 Run F5 Run to Insert Cursor ShifF5 Step Over F6 Step Forward Shift F6 Step Into F7 Step Out FS Abort Procedure Execution Shift F8 Stop F9 Stop after Procedure Shift F9 Set Breakpoint F10 Activate Deactivate Breakpoint shift F10
493. s R 1D Measuring Name gt 2D Metr 3D a read_image Read an image with different file formats gt 3D Object Model gt 3D Reconstruction Signature Calibration ar read_image Image FileName gt Develop ee 4 File Description 4 Images deseriali The operator read_image reads the indicated image files from the background X read im Y m Figure 6 75 Help window with the contents tab card la c i E 2 5 0 194 Graphical User Interface tents Operators Contents Operators Sea gt Filter gray gray_bothat a gray_dosing gray_dosing_rect gray_closing_shape gray_dilation gray_dilation_rect gray_dilation_shape gray_erosion gray_erosion_rect gray_erosion_shape gray_histo gray_histo_abs gray_histo_range gray_inside gray_opening gray_opening_rect gray_opening_shape gray_projections gray_range_rect gray_skeleton gray_tophat min_max_gray moments_gray_plane overpaint_gray paint_gray query_gray read_gray_se rgb1_to_gray rgb3_to_gray select_gray select_grayvalues_from_channels m camera calibration Search V Reference V Manuals V PDFs Search KIO perators Search n 09 Rank File 100 HDevelop User s Guide _ 94 HDevelop User s Guide 93 Calibration HALCON Ref 92 HDevelop User s Guide 92 HDevelop
494. s menu lists up to 15 channels If the iconic variable contains more than 15 channels you can access the remaining channels by clicking Select which opens an auxiliary window listing all channels This entry is only available if the selected iconic variable contains a mult channel image Display Content Display a single object of the selected iconic variable in the active graphics win dow This menu lists up to 15 objects Ifthe iconic variable contains more than 15 objects you can access the remaining objects by clicking Select which opens an auxiliary window listing all objects This entry is only available if the selected iconic variable contains multiple objects e g multiple images regions or XLDs Clear Display Clear the active graphics window before displaying the selected iconic variable Clear Variable Clear the selected iconic variable The contents of the variable become undefined Add to User Tab The selected variable is added to the tab User Find Variable Open the Find Replace page 69 dialog with the name of the selected variable preselected Insert dev_display into program Insert the operator dev_display into the program window at the IC The parameter of the inserted instruction is the name of the selected iconic variable Shortcut Ctrl double click on variable icon Declared in global variables only List the names and line numbers of the procedures that declare and thus use the sele
495. search has finished The Matching Assistant then displays at Recognition Rate the recognition rate calculated for different criteria and at Statistics the minimum and maximum score page 253 as well as the minimum and maximum matching time It also calculates the extent between minimum and maximum score and time respectively Depending on what you have chosen on the Usage tab as recognition mode under Optimize Recognition Speed page 289 and as Standard Use Parameters page 284 three results can be viewed e In each test image at least one object is expected The recognition rate is calculated as the per centage of test images which fulfill this condition e In each test image as many objects are expected as specified in the parameter Maximum Number of Matches page 285 in the dialog accessed via Usage gt Standard Model Use Parameters 7 3 3 Matching Assistant Reference 291 page 284 The recognition rate is calculated as the relation of found objects to the sum of expected objects over all images in percent Please keep in mind that if an image contains more objects than specified in the parameter Maximum Number of Matches only the best Maximum Number of Matches instances are found There fore if there are e g two test images containing 1 and 3 objects respectively and you select Maximum Number of Matches 2 the recognition rate will be 75 i e 3 out of 4 expected objects e In each test image as many objec
496. select an alternate model image If some of the test images cannot be loaded a message box with the missing image file names is displayed Save Current Assistant Settings You can save the current settings of a Matching Assistant session using the menu item File gt Save Current Assistant Settings or the corresponding button in the tool bar Then you can load them again in a later session Close the Matching Assistant Dialog When closing the Matching Assistant dialog with the menu item File gt Close Dialog the current settings are stored for the duration of the current HDevelop session That is as long as you do not exit 264 HDevelop Assistants HDevelop you can again open the Matching Assistant with the same settings In contrast to this when you exit the Matching Assistant the settings are lost also for the current HDevelop session Exit the Matching Assistant When you exit the Matching Assistant with the menu item File gt Exit Assistant the assistant s dialog is closed and the current settings are lost unless you have not stored them via the menu item File gt Save Current Assistant Settings page 263 If you want to close the dialog but keep its settings for the current HDevelop session you should use the menu item Close Dialog page 263 instead 7 3 3 2 The Menu ROI and the Corresponding Buttons on the Creation Tab Via the menu ROT or the corresponding buttons on the Crea
497. selected values of an inspection window can be copied to the system clipboard using the context menu or pressing Cu C The columns are separated by tabs and the rows are separated by newlines or presented as an HTML table depending on the application the values are pasted into An example inspection window with three control variables is displayed in figure 6 62 g la c i E 2 5 0 178 Graphical User Interface Editing Variable Values To change a variable value click into the corresponding cell and type the new value followed by Return You enter text text 42 42 0 7 2e2 1t becomes text string text string 42 integer 42 string 0 7 real 200 0 real Depending on the variable type only certain value types may be allowed e g matrix variables see below contain only real values You can also add new elements to a tuple Instead of entering a single value simply enter a list of values enclosed in square brackets tuple notation For example Variable Inspect dl 2 3 gt 2 22 222 results in the following tuple a Y variable Inspect Area Row Column 5 fate ea Row Coum A 0 272 0 325 5 1 23 273 13 310 304 2 24 272 625 317 73 3 25 274 16 294 88 4 23 273 609 302 565 5 24 275 0 279 5 6 23 274 652 287 348 Zz 23 276 087 264 435 8 24 275 708 271 917 Min 20 272 0 96 0 Max 28 344 0 327 375 Sum 5088 65973 6
498. sequent program lines relying on the value of that parameter will have to be adjusted manually As another example if a new parameter has become necessary a variable of the same name will be added to all procedure calls If this is an input parameter the corresponding variable will most likely not be initialized at the time of the procedure call and has to be assigned to manually If it is an output parameter the program will continue to run without further modifications It is highly recommended to leave this feature enabled to keep the program consistent OK Activating the button OK at the bottom of the dialog either creates a new procedure or commits the changes made in the procedure interface depending on whether the interface dialog was invoked in order to create a new procedure or to modify an existing procedure In the latter case not only the interface itself might be changed but also the procedure s program body and variable lists as new variables might have been added or existing variables might have been removed or renamed 6 4 6 Editing Procedures 155 If you change the interface of an external procedure be aware of the fact that other programs containing it do not update the procedure calls When loading these programs the procedure calls are disabled If the changes were applied to a procedure that is called from inside a protected external procedure that procedure call is not even updated in the current program Canc
499. side of a circle a XLD Select this mode if you want to generate a vector based closed contour XLD or a line XLD The XLD consists of geometric elements The contours defined be these elements are connected by set operations see below Path Select this mode if you want to generate a vector based path XLD The path consists of geometric elements The individual elements of the path are connected with straight lines This connection is done automatically Of the two endpoints of each element the one that is closest to an endpoint of another element is connected to that endpoint Depending on the selected mode different geometric elements are available in the tool box Tool Type ROI XLD Path line X X X Cd circle X X Gi circular arc X X E ellipse X X amp elliptic arc X X a axis aligned rectangle X X ee rotated rectangle X X Eai arbitrary region X X pe NURBS curve X X ES Interpolated NURBS curve X X Set Operations The elements of a figure are connected by set operations In the case of ROIs applying the set operations determines the final face of the compound region For closed contour XLDs applying the set operations determines the final contour of the compound XLD Set operations are not meaningful and therefore not available in path mode The set operation of the next new element can be selected from the drop down button of the tool bar or the menu Operations The set operation of an existing element c
500. sition interface Source Connection Parameters Inspect Code Generation 0 m T Image File s O Image Acquisition Interface GigEVision rta Detect first detect the available interfaces then select an interface from the list Figure 3 6 Source selection example 3 3 2 Acquiring Images Through Image Acquisition Interfaces 29 Connect to the Device Once an image acquisition interface is selected its connection parameters are detected and updated in the tab card Connection see figure 3 7 Here you can specify the device that is connected to the selected image acquisition interface If for example the interface of a frame grabber board with multiple cameras has been selected as the source the actual device can be selected here The parameters of this tab card are described in general in the reference section of the operator open_framegrabber please refer to the HTML page of the selected interface for detailed information menu Help Sol urce Connection Parameters Inspect sect al Code le Gener sration Interface Library hAcqGigEVision dll Rev 5 0 gt 1 0 6 5 beta Device KickerCam v Port 0 Camera File default hd Trigge Select Resolution X Default v Y Defaut v Color Space default X Field progressive Bit Depth 1 X Generic bd Connect Snap Live Detect Reset All Figure 3 7 Connection parameters example If the acquisition interface File is selected
501. splay Parameters page 243 and e Calibration Plate Extraction Parameters page 243 ATTENTION Remember that it is essential to keep your camera setup aperture focus pose fixed once you have chosen it This applies to the calibration process itself as well as to the sub sequent application Any changes will result in the failure of the calibration or even worse in wrong output values Once the calibration images are available you can push the Calibrate button and move on to the Results page 244 tab Acquiring Images for a Successful Calibration Note that the calibration assistant currently only supports 8 bit C byte images Steps that will improve your calibration results 1 Use a calibration plate that is big enough to fill a large part of the image at least one fourth of the image s total area 2 The minimum diameter of the circular marks should be 10 pixels To check this move the mouse pointer over a calibration mark and examine whether the difference between the start and end position as displayed in the row column section of the Status Bar is more than 10 pixels 3 Use an illumination where the background is dark and the calibration plate is bright 4 The white background of the calibration plate should have a gray value of at least 100 You can check the gray value of an area by moving the mouse pointer on the particular area in the graphics window The gray value is then displayed in the H
502. sponding gray value histogram is calculated Afterwards Input Window can be turned off to prevent the histogram from being updated In the gray histogram window set Output Window to the window ID of the second graphics window and select your thresholds Multiple Threshold Operations You can combine as many threshold operations as you like If multiple operations are visualized at the same time the display depends on the combo box below the table of op erations If none is selected the results of the different threshold operations are displayed independently If union is selected the results are combined to a single region If intersection is selected only the common pixels from all results are visualized Connected Regions Clicking Connection displays the connected regions of the selected gray values in the style specified with Color Draw and Line Width This display mode is similar to a plain threshold operation Additionally it performs a connection operation The separate regions can only be distinguished if Color is set to colored 3 colored 6 or colored 12 6 10 1 Interactive Visual Operations 205 Click the button Insert Code to generate HDevelop code that performs the currently visualized thresh old operation s in your program The code is inserted at the IC The resulting regions of the threshold and connection operation can be used as input to the feature histogram window or the feature inspection window if the gray
503. sregarded You can check if your camera to see if 10 12 or 14 bits are used and choose your values accordingly Depending on the mode you have chosen the minimum and maximum values will differ The gray value range that is chosen here directly affects the Min Edge Amplitude as well the the graphs on the Fuzzy tab The Reset button allows you to set the values back to their default If you are not finished with your Input page 295 yet proceed to either add calibration images or per form a calibration respectively page 299 if you want to transform your results in to world coordinates or continue to create an ROI page 295 and then step to the next tab to extract edges page 296 7 4 5 2 Fuzzy Measuring So far an edge amplitude was used for choosing edges This is however sometimes not sufficient When e g reflections are part of the image it might be necessary to further specify the features of the 302 HDevelop Assistants edges that should be detected Such features like position contrast pair width or mean gray value can be selected and graded by using fuzzy measuring Fuzzy measuring is based on fuzzy logic and allows a more specific determination of edge selection by assigning a certain score to each edge that determines wheter this edge is a member of a particular fuzzy set For most applications however it is not necessary to use fuzzy measuring because the general edge detection functions are sufficient
504. ssary that all symbol Candidates symbol candidates are found candidates are found here as only the best can Line Geometry Symbol Results The extracted line does not match the text orientation No results or incorrect results are found didates are displayed Check if the parame ters in the dialogs Symbol Appearance Size and Shape correspond to the appearance of the characters i e if the characters appear white on black background the corresponding pa rameter has to be set Adapt the Baseline Tolerance in the dia log text layout and check if candidates are dis played Check if the parameters in the dialogs Symbol Appearance Size and Shape correspond to the appearance of the characters i e if the characters are composed of single dots dot print the corresponding parameter has to be set Please note that if there are problems with the OCR first of all the image quality should be checked Only if there is nothing to enhance about the quality and therefore the training images are representative for the images in the application parameters should be changed 320 HDevelop Assistants 7 5 3 8 Reset To simply set everything in this tab back to the default settings which is recommended if a new OCR application is started with the OCR Assistant just press the Reset A11 button To reset single values on this tab use the corresponding buttons on the right side of the selections 7 5 4 OCR Classifie
505. ssification These features are e Pattern Width e Pattern Height e Interpolation Furthermore the three pattern features can be activated e Gray Values e Symbol Region and e Gradient And the following three symbol features can be activated e Ratio e Anisometry and e Convexity Pattern Width and Pattern Height With the parameters Pattern Width and Pattern Height you set the fixed pattern size which is used for classification 1 e the size to which characters are scaled This pattern size influences the parameter Gray Values as this if activated uses the interpolated gray values Depending on how much the characters are scaled or if they are not scaled at all i e how much Pattern Width and Pattern Height differ from the size of the character in the image a different Interpolation method might be suitable for the application Setting a bigger size generally helps to distinguish more characters If the value is however chosen to big overspecification may be a problem In this case the amount of time necessary for the training and the time necessary for the recognition will also increase 7 5 4 OCR Classifier 323 Interpolation The parameter Interpolation lets you choose the interpolation mode i e the adaptation of characters in the image to the pattern size page 322 It also influences the parameter Gray Values as this if activated uses the interpolated pattern The most suitable in
506. ssion failed Internal operation in a constant expression failed Parameters are tuples with different size Division by zero String exceeds maximum length Parameter is an empty tuple Parameter has more than one single value Parameter is not a single value Parameter has the wrong number of elements Parameter contains undefined value s Parameter contains wrong value s Parameter contains value s with the wrong type First parameter is an empty tuple First parameter has more than one single value First parameter is not a single value o te y te lt i l 380 HDevelop Language 22203 22204 22205 22206 22300 22301 22302 22303 22304 22305 22306 23100 23101 30000 First parameter has the wrong number of elements First parameter contains undefined value s First parameter contains wrong value s First parameter contains value s with the wrong type Second parameter is an empty tuple Second parameter has more than one single value Second parameter is not a single value Second parameter has the wrong number of elements Second parameter contains undefined value s Second parameter contains wrong value s Second parameter contains value s with the wrong type The generic parameter value is unknown The generic parameter name is unknown User defined exception Code Export 381 Chapter 9 Code Export The idea of code export or code generation is as follows After developing a program ac
507. t Color page 107 dev_set_colored is equal to the menu item Menu Visualization gt Colored page 107 o D 2 Q a 0 124 Graphical User Interface dev_set_draw This operator has the same effects as the menu item Menu Visualization gt Draw page 107 dev_set_line_width For an explanation see the menu item Menu Visualization gt Line Width page 107 dev_set_lut For an explanation see the menu item Menu Visualization gt Lut page 108 dev_set_paint For an explanation see the menu item Menu Visualization gt Paint page 108 If you want to specify all possible parameters of a given paint mode you have to specify them as a tuple analogously to the HALCON operator set _paint dev_set_shape For an explanation see the menu item Menu Visualization gt Shape page 108 dev_set_part This operator adjusts the coordinate system for image region XLD and other graphic output This is done by specifying the upper left and the lower right corner coordinates This specified part is shown in the entire graphics window If the width or height of the specified rectangle has a negative value e g Row1 gt Row2 the result is equivalent to the menu Menu Visualization gt Reset Parameters the zoom mode is switched off i e the most recently displayed image fills the whole graphics window This feature of dev_set_part is not supported for exported C C Visual Basic Visual Basic NET and C code de
508. t find deformed and defocused objects in an image The first value of NumLevels determines the number of pyramid levels the second level determines at which pyramid level the search for the model will stop If the Increased tolerance mode is enabled the second value of NumLevels will be negative If this value is negative the search for the model will stop on the lowest pyramid level where a model is detected Therefore the increased tolerance mode is useful e if images are sometimes defocused but still the object has to be found e if itis acceptable that slightly deformed objects may also be found e if in your application matching is not used to distinguish between two quite similar looking object types e if the image quality is not very high but also cannot be further improved The Search Parameter Shape models may cross the image border Shape based Matching With the parameter Shape models may cross the image border you can specify whether shape models that cross the image border i e that lie partially outside the test images should be searched for If you switch off the check box Shape models may cross the image border the shape model will only be searched for within those parts of the test images in which the shape model completely lies within the image If you switch on the check box Shape models may cross the image border the shape model will be searched for in all positions in which the model additionally lies partial
509. t images page 253 in fact this method is used by the Matching Assistant itself when you start the optimization via the menu item Inspect gt Optimize Recognition Speed page 289 Choosing small values may cause the program to search for quite a while In such a case we recommend to enter a larger value Please note that by default the objects must lie completely within the test images in order to be found For shape based matching this behavior can be changed via the parameter Shape models may cross the image border page 288 in the dialog accessed via the menu item Usage gt Advanced Model Use Parameters The Search Parameter Maximum Number of Matches The parameter Maximum Number of Matches specifies how many instances of the object are searched for in the image Note that the parameter sets a maximum value i e if more object instances are present in the image only the best instances of the specified number are displayed If you specify the value 0 all found instances are displayed Specifying Advanced Model Use Parameters Via the menu item Usage gt Advanced Use Parameters the tab Usage is opened and you can specify advanced parameters For shape based matching the following parameters can be specified e the Greediness of the search algorithm e how much the objects may overlap Maximum Overlap e the accuracy Subpixel of the calculated position orientation and scale e how far the positions of the fo
510. t the beginning Finding All Occurrences of the Search Text Enter the search text and click Find A11 The search result will be presented in a separate window i e the corresponding tab card of the program line view window see section Open Program Line View on page 131 Clicking an entry focuses the corresponding program line in the active program window If the selected procedure is already displayed in a program window tab the corresponding tab is activated Otherwise the current view switches to the selected procedure You can even select multiple lines from the search result by holding the key The following actions may be performed for all selected lines either from the context menu of the search result or the corre sponding menu entries or tool bar icons Cut page 67 Copy page 67 Delete page 68 Activate page 68 and Deactivate page 68 W Add bookmarks to the selected program lines This action will also add the selected program lines to the tab Bookmarks This way you can remember a search result for later use just open the program line view window again Menu Window gt Open Program Line View and go to the tab card Bookmarks The find all operation is recommended before doing a global replace to preview which program lines will be affected An example is displayed in figure 6 10 6 2 2 Menu Edit p K Program Line View o 5 El invalid Lines Find All Breakpoints Bo
511. t the parameter values that are used as input values for the currently edited operator or procedure call have to be calculated If the PC is placed at or after the insertion position only the currently edited operator or procedure call is executed The operator or procedure call is entered into the program window before it is executed After the execution the PC is positioned on the next executable program line after the edited operator or procedure call The computed output parameter values are displayed in the variable window Iconic variables are shown in the current graphics window if you haven t suppressed this option compare section Runtime Settings gt Runtime Settings on page 95 Afterwards the operator window is cleared If you did not specify all parameters or if you used wrong values an error dialog is raised and execution is canceled In this case the operator window remains open to allow appropriate changes Enter Replace By clicking the button Enter the currently edited operator or procedure call is trans ferred into the program window without being executed When editing existing program lines through double clicking in the program window see page 140 the button label changes to Replace When clicked the original program line is replaced Apply If you click Apply the operator is executed with the specified parameters but not entered into or changed in the program This enables you to determine the optimum para
512. ta 405 Control Flow 229 control flow break 368 continue 367 elseif 365 exit 369 for endfor 366 if else ss if endif 364 endif 365 operators 363 repeat until 366 return 369 stop 369 throw 369 try catch while endwhile 365 coordinates status bar 53 Copy 67 136 148 180 copy 142 Copy History to Clipboard 53 Create Model 264 create model 255 Create New Procedure 118 149 Create ROI 295 315 Cut 67 136 148 endtry 369 Deactivate 68 136 149 Declared in 175 181 Decrease Font Size 196 Delete 68 136 148 delete 142 Delete All ROIs 310 332 Delete All Unused Local 120 Delete Current 119 Delete Generated Code Lines 224 250 293 311 333 Delete Selected ROI 332 Delphi 11 Descriptor Min Score 289 Detailed Description 159 Detect 225 227 Detect All 282 Detector Type 274 Detector Type advanced 279 determine pose bounds 291 Determine Recognition Rate 290 dev_ operators 123 dev_display 396 dev_open_window 396 dev_set_part 396 Develop 123 Device 226 Dialog based Editor 80 dialog based editor 140 Disabled 228 414 Index Disconnect 227 Display 106 175 Display Axes 183 Display Channel 175 Display Content 175 Display Grid 183 Display Image 228 Display Image Pyramid 266 display parameters 243 298 327 Display Selected Test Image 282 drag and drop 13 23 Draw 107 204 Draw Axis aligned
513. tain a meaningful histogram and as a consequence the histogram s peak value may actually represent a whole range of input values The dynamic parts of the histogram area are the two colored lines which can be manipulated The vertical green and red lines denote the minimum and maximum selected gray value of the histogram respectively The gray values on which the two vertical lines lie are displayed next to the lines in the same color The red arrows denote the current mouse cursor position Histogram Options These controls define the visible area of the histogram and the way it is displayed Quantization 1 E Y Smoothing 0 0 E Vertical 0 68569 adaptive y Horizontal 5 255 z adaptive v e Quantization Display the histogram quantized The bucket size can be specified with the slider or entered into the spinner box Click Auto Select to let HDevelop select a suitable bucket size automatically 6 10 Gray Histogram Window 201 Smoothing Display the histogram smoothed The smoothing factor can be specified with the slider or entered into the spinner box The check box specifies whether smoothing is applied or not Vertical Horizontal The visible part of the histogram can be specified parametrically by entering the minimum and maximum values into the spinner boxes These values are adapted when the visible area is set with the buttons next to the histogram Whenever new image data is evaluated in th
514. tandard programming features such as procedures loops or conditional statements Parameters can be changed even while the program is running HDevelop immediately displays the results of operations You can try different operators and or parameters and immediately see the effect on the screen Moreover you can preview the results of an operator without changing the program Several graphical tools allow to examine iconic and control data online For example you can extract shape and gray value features by simply clicking onto the objects in the graphics window or inspect the histogram of an image interactively and apply real time segmentation to select parameters Built in graphical assistants provide interactive interfaces to more complex machine vision tasks The assistants can also generate HDevelop code in the current program Variables with an automatic garbage collection are used to manage iconic objects or control values 1 2 HDevelop XL In addition to the standard HDevelop there is also a variant called HDevelop XL which is based on HALCON XL The user interface is identical but underneath HALCON XL is optimized for large im ages In the remainder of this document when we refer to HDevelop you can substitute HDevelop XL if that is the variant you will be using 1 3 Terminology amp Usage HDevelop adheres to well established conventions and usage patterns regarding its graphical
515. tart ex pected In for statement after for to keyword by expected In for statement after for keyword to expected 8 10 HDevelop Error Codes 379 21216 21217 21218 21219 21220 21221 21222 21223 21224 21225 21226 21227 21228 21229 22000 22001 22010 22011 22012 22100 22101 22102 22103 22104 22105 22106 22200 22201 22202 In for statement assign operation for initializing the index variable expected After for keyword assignment of Index parameter expected In for statement error after by keyword in expression of parameter Step In for statement error after to keyword in expression of parameter End or the following by keyword In for statement error after assignment operation in expression of parameter Start or the following to keyword In for statement invalid variable name in parameter Index or error in the following assignment operation for statement not complete In for statement space after for expected In for statement space after to expected In for statement space after by expected Wrong type The switch statement requires an integer value as parameter Wrong type The case statement requires a constant integer value as parameter At the end of the case and the default statement a colon is expected Unknown operator or procedure Internal operation in expre
516. tected with default parameters Remember that the ROI should run perpendicular to the edges you want to measure If you have previously prepared and saved an ROI you can reuse it by choosing Load ROI In order to delete one or more ROIs you can either mark them and just press the delete button on your keybord or click on the tool bar buttons for Delete Selected ROI Item or Delete All ROIs You can view and edit the ROI data which includes all the data about the exact position of the ROI s using the tool bar button View ROI Data Editing an ROI by changing the ROI data is useful if an ROI should be modified more precisely than is possible by drawing in the graphics window Once you are satisfied with the shape of your ROI proceed to the edge extraction on the Edges tab 7 4 2 2 Extract Edges After you have prepared the measure task page 295 you continue to choose parameters on the Edges tab such that you can detect the edges between which you want to measure e On the tab Edge under Edge Extraction you can specify the parameters that are used to extract edges e Edge Selection allows you to group edges to pairs or choose edges with certain features e In order to improve the visibility of your ROI and edges you can change the display parameters page 298 Now you can select edges you want to measure and afterwards proceed to the Results tab page 334 to view your measuring results Open the Line Profile window page 210 to
517. tely page 278 and e the Min Contrast page 279 points must have in a search image to be compared with the model For correlation based matching the following Advanced Model Parameters can be specified e the Angle Step at which the model is created and e whether to use the polarity of the contrast Metric in the model For deformable matching the following parameters can be specified e the Angle Step at which the model is created e the scale steps Row Scale Step and Column Scale Step at which the model is created e whether to use the polarity of the contrast Metric in the model e whether to optimize the model page 278 by using a reduced number of points and e the Min Contrast page 279 points must have in a search image to be compared with the model For descriptor based matching the following parameters can be specified e parameters relating to the Detector Type page 279 e the parameter Patch Size page 280 and e the parameter Tilt page 280 If you want to reset all of the model and search parameters you can do this via the Reset button in the toolbar Once you are finished setting the Advanced Model Parameters you can continue to work with test images in the menu Usage page 280 The Model Parameter Angle Step Shape based Matching Correlation based Matching De formable Matching The standard model parameters Starting Angle page 273 and Angle Extent page 273 specify the step size at which
518. terpolation method largely depends on the values that were chosen as Pattern Width and Pattern Height page 322 i e the scale factors Parameter Effect Usage Constant De Bilinear interpolation in an image fault with a mean filter Weighted Bilinear interpolation in an image with a Gaussian filter Bilinear Interpolation using the values of the 4 closest pixels in diagonal direc tion Nearest Neigh No interpolation is performed bor Recommended choice if characters are scaled down but not by a large amount This interpo lation method achieves a high precision with out requiring to much processing time Recommended choice if characters are scaled down by a large amount and a very high pre cision is required Note that this interpolation method requires more processing time Can be used if characters are not scaled very much Fast but not very precise interpolation Should only be used if the image is blurred For more detailed information on this parameter see also affine_trans_image Pattern Features Used for Classification In this part of the dialog three characteristics defining the classification of pattern features can be acti vated Activate e Gray Values to use the gray values of the interpolated pattern e Symbol Region to use the symbol regions of the interpolated pattern and e Gradient to use gradient features instead of pixel patterns 8 directions sampled from a fi
519. ters you can specify e the Minimum Score the object must have and e the number of instances of the object that are searched for in an image Maximum Number of Matches for ALL matching methods Additionally advanced search parameters can be specified via the menu item Usage gt Advanced Model Use Parameters If you are finished setting search parameters continue to inspect page 290 the results The Search Parameter Minimum Score When comparing a region in a test image with the model page 253 the Matching Assistant calculates a measure of similarity the so called score page 253 which ranges between O no similarity and 1 perfect similarity With the parameter Minimum Score you can specify a minimum score that a match must reach Graphically speaking the parameter specifies how much of the object i e how many of the model points must be visible A part of the object may be invisible not only because it is occluded but also if 7 3 3 Matching Assistant Reference 285 1ts contrast is lower than the selected minimum contrast value page 279 or has the wrong polarity page 277 A further cause for a too low score could be a too large angle step size page 276 The larger the value is chosen the faster the search will be because candidate matches can be discarded earlier Therefore this parameter can be optimized easily Starting from the maximum value reduce the value until the object is found in all tes
520. ters cbas Select Graphics Window 3600 Pen LUT Paint Zoom Draw o fill margin Shape original X Line Width 1 Custom colors ally Colors x 6 colored 3 a colored 6 gt gt colored 12 BB blac white 4 A red Mi arcen V Update Reset Use settings for new windows Figure 6 26 Visualization Parameters with multiple graphics windows Update This check box corresponds to the setting of Menu Visualization gt Apply Changes Immediately If it is checked every change of a parameter will immediately lead to a redis play of the image regions or XLD in the graphics window Otherwise the parameters become active for the next display of an object double click on an icon or execution of an operator Reset Reset to the visualization settings defined in the Preferences page 76 Use settings for new windows Make the current settings also the default settings for new graphics windows Pen settings The pen settings specify the drawing mode filled or outlined the shape the line width and the color s of regions and XLDs la c i E 2 5 0 110 Graphical User Interface For regions the draw mode can set to filled item 111 or outlined item margin The parameter Shape default is original specifies the presentation shape for regions You can display not only the region s original shape but also its enclosing rectangle or
521. th 304 gen_tuple_const 349 General Settings 156 General Documentation 158 generate code 260 Generic 226 get_system 395 Give Error 95 Global 173 global 341 global variables 341 Go to Line 140 Go to Program Counter 140 graphics window 182 graphics window 17 395 405 clear 106 close 106 colors 107 image size 106 416 Index line width 107 open 105 regions 107 108 select iconic variable 106 window size 106 Gray Histogram 117 137 gray value histogram 117 199 inspection 116 197 status bar 53 Greediness 286 Guided Matching 289 guru 228 HALCON example programs 55 modules 64 HALCON News WWW 135 HALCON Reference 134 HALCON XL 382 392 HALCONIMAGES 62 225 HALCONROOT 62 225 HDevelop dev_ operators 123 example programs 55 language 337 runtime error 97 warning 222 HDevelop Language 134 HDevelop User s Guide 134 HDevelop ini 77 Help 134 137 139 148 About 135 Context Help 134 HALCON News WWW 135 HALCON Reference 134 HDevelop Language 134 HDevelop User s Guide 134 Help 134 menu 134 Search Documentation 135 history of files 55 Home 196 IC 138 iconic data 405 iconic object 405 if 364 365 if 405 ifelse 365 Ignore first image of live acquisition 229 image 405 image acquisition assistant 25 Image Acquisition Assistant 223 225 Code Generation 229 Connection 226 frames per second 229 Inspect 228 Parameters
522. th similar numeric values will be added to your program at the position of the IC select_shape ConnectedRegions SelectedRegions area and 4100 5964 Run the program and inspect the output variable SelectedRegions The regions corresponding to the clips are now determined correctly To obtain the orientation and the center of gravity of the clips add the following operator calls to the program orientation_region SelectedRegions Phi area_center SelectedRegions Area Row Column The operator orientation_region returns a tuple of values For each region in SelectedRegions a corresponding orientation value in Phi is returned The operator area_center in the same way returns the area row and column of each input region as tuples Again run the program and inspect the calculated control variables You can inspect multiple control variables in one inspection window This is especially useful if the control variables all relate to each other as in this example In the variable window select all control variables hold down the key and right click Inspect see figure 4 10 W Feature Histogram Clip Connecte 5 5233 Y Input Window Active y Output Window Input _ y is 0 80 100 W Graphics Window 3600 Feature Histo oso e Eg g maaa Ert 5 100 K lo 3 5964 Bi fee pee ee pe y 26 4000 5000 5964 R EY area 4
523. the QApplication ManyColor color specification If count is 216 then a 6x6x6 color cube is used i e 6 levels of red 6 of green and 6 of blue for other values a cube approximately proportional to a 2x3x1cube is used cmap causes the application to install a private color map on an 8 bit display Index 411 Index asterisk external procedure 58 in window title 35 51 NET 384 386 avi 29 dev 46 dvp 46 hdev 46 hdpl 47 hdvp 46 seq 29 393 393 393 393 393 353 IC 17 dev_set_check 370 PC 17 _COPY_1 57 File 29 Source image 25 Live 29 Detect 29 Reset All 29 Snap 29 Abort Procedure Execution 103 137 About 135 Acquisition Mode 229 actionUpdateWin 116 Activate 68 136 148 Activate Profiler 103 137 Activate Deactivate Breakpoint 101 149 Adapt program 154 Add to User Tab 175 180 Add Variable 176 181 Add Watch 149 Advanced 160 advanced autocompletion 143 advanced fuzzy features 304 advanced measuring tasks 301 316 advanced model parameters 275 advanced parameters Detector Type 279 advanced search parameters 285 advanced training parameters 324 alignment 305 A11 173 Alternatives 127 Always Find 282 Angle Extent 273 Angle Step 276 Apply Changes Immediately 108 assign_at 383 assistant calibration 223 Close Dialog 224 Delete Generated Code Lines 224 Exit Assistant 224 image acquisition 25 223 Insert Code
524. the Programmer s Guide part VII on page 209 e Export of an application as C C Visual Basic Visual Basic NET or C source code Finally you can export an application developed in HDevelop as C C Visual Basic Visual Basic NET or C source code This program can then be compiled and linked with the HALCON library so that it runs as a stand alone console application Of course you can also extend the generated code or integrate it into existing software Let s start with some facts describing the main characteristics of HDevelop Introducing HDevelop 1 1 Facts about HDevelop HDevelop actively supports your application development in many ways With the graphical user interface of HDevelop operators and iconic objects can be directly se lected analyzed and changed within a single environment HDevelop suggests operators for specific tasks In addition a thematically structured operator list helps you to find an appropriate operator quickly An integrated online help contains information about each HALCON operator such as a detailed description of the functionality typical successor and predecessor operators complexity of the operator error handling and examples of application In addition the online help provides a search facility that allows to search the complete documentation of HALCON HDevelop comprises a program interpreter with edit and debug functions It supports s
525. the current search has finished If the test images cover the whole ranges of allowed orientations and scales of the object you can use the calculated ranges to optimize the parameters Angle Extent page 273 Start Angle page 273 and the parameters for the scale range page 273 in the dialog accessed via the menu item Parameters gt Standard Model Parameters page 269 we recommend to use slightly larger values to get accurate results at the boundaries of the ranges In a corresponding HALCON program you can use the calculated range of positions as a region of interest and thus further speed up the matching process 7 3 3 7 The Menu and Tab Code Generation Via the menu Code Generation you can e open the dialog Options inside the tab Code Generation where options for the code generation can be set e open the dialog Variable Names inside the tab Code Generation where the names for the used variables can be specified 292 HDevelop Assistants insert code page 293 to the program window of HDevelop according to the current settings of the Matching Assistant release the generated code lines in the program window delete the generated code lines from the program window as long as you did not released them and open the dialog for the code preview inside the tab Code Generation Specifying the Options for the Code Generation Via the menu item Code Generation gt Show Code Generation Options you can open
526. the help of the window manager All operators in this menu start with the prefix dev_ It has been introduced to have a distinction to the underlying basic HALCON operators e g dev_set_color and set_color The effects of each operator are described as follows dev_open_window dev_close_window dev_clear_window The operators dev_open_window and dev_close_window are used to open and to close a graphics window respectively During opening the parameterization allows you to specify the window s size and position The oper ator dev_clear_window clears the active window s content and its history This corresponds to the usage of the button Clear in the graphics window Please note that dev_open_window and dev_close_window are not exported to Visual Basic Visual Basic NET and C because here one HWindowXCtr1 is used dev_set_window_extents With this operator you can set the size and position of the active HDevelop graphics window dev_set_window This operator activates the graphics window containing the given ID This ID is an output parameter of dev_open_window After the execution the output is redirected to this win dow This operator is not needed for exported code in C or C because here every window operation uses the ID as a parameter The operator has no effect for exported code in Visual Basic Visual Basic NET and CF dev_set_color dev_set_colored dev_set_color has the same effects as the menu item Menu Visualization g
527. the samples are displayed inverted if Light On Dark has been chosen as Symbol Appearance within the assistant This has an effect on the zoomed sample visualization in the lower left window as well as the thumbnail view the right window The following sections will introduce you to the OCR Training File Browser by e providing an overview over the different windows within the Training File Browser e explaining typical steps page 217 of using the tool in an application e giving an overview over all possible actions page 217 within the training file browser 6 14 1 Windows of the Training File Browser The design of the OCR Training File Browser The OCR Training File Browser is composed of three windows see figure 6 84 The upper left window lists training files and symbols and is described in the section Training File Window Underneath this window the Zoomed Sample Window allows to view the magnified image of a selected sample The Sample Inspection Window on the right lists details for selected samples to inspect the training results 6 14 1 1 Training File Window This window of the OCR Training File Browser enables you to view and edit training files page 218 and symbols page 218 6 14 1 2 Zoomed Sample Window This window displays the symbol that is selected in the Sample Inspection Window If a symbol has been selected in the Training File Window the first sample is displayed by default o o o d o 2
528. tically Depending on the parameter type different selection methods are enabled As an example parameters with a defined range of values can be specified by dragging a slider or entering the value parametrically If a value is changed a reset button to the right is activated Some parameters provide a check box which attempts to set the parameter automatically if clicked If Update Image is checked parameter changes are immediately reflected in the graphics window by acquiring a new image The button Refresh updates the list of parameters which is useful 1f parameters have side effects You can reset all parameters to their default values at once by clicking Reset A11 Source Connection Parameters Inspect Code Generation A 4 acquire new image Interface Library GigEVision dll Rev 4 6 gt 1 0 5 1 Y hdate Image Refresh Reset A at parameter _ change Category all Parameters Z Visibility Beginner y Sort by Name adjust displayed parameters GainAuto off y bP GainSelector All y Pb reset parameter GainRaw 492 s L gt BlackLevelSelector All T b gt BlackLevelRaw 16 la gt GammaEnable 0 gt Figure 3 8 Device specific parameters example 3 3 2 Acquiring Images Through Image Acquisition Interfaces 31 Generate Code On the tab card Code Generation the settings made in the other tab cards are turned into executable code The basic structure of the code and the cor
529. time you can make it the default by modifying the preferences see General Options page 91 6 2 1 1 New Program Synopsis Initialize a new HDevelop program 6 2 1 Menu File 55 Checks for Unsaved changes page 222 Shortcut This menu item deletes the current program including all local procedures The contents of variables are deleted before removing them In addition all graphics windows except one are closed The last graphics window is cleared The display parameters for the remaining graphics window are reset to the default values stored in the preferences see section Visualization Settings gt Pen LUT Paint on page 94 The runtime settings of the preferences are reset to their default values see section Runtime Settings gt Runtime Settings on page 95 6 2 1 2 Open Program Synopsis Load an existing HDevelop program Checks for Unsaved changes page 222 Shortcut A file selection dialog page 221 pops up to select an HDevelop program Please note that only native HDevelop programs hdev or dev can be loaded Thus text C C Visual Basic Visual Basic NET and C versions of a file are rejected After you have loaded a program the corresponding file name is added to the top of the menu Recent Programs This allows you to quickly switch between recently loaded programs 6 2 1 3 Browse HDevelop Program Examples Synopsis Select an HDevelop example program from a categorized l
530. tion tab you can mark the region that serves as the model by drawing it on the displayed model image The Matching Assistant provides different ROI page 253 shapes axis parallel and arbitrarily oriented rectangles circles and ellipses as well as free form shapes including polygons You draw rectangular circular and elliptic ROIs as follows Select the corresponding drawing mode and click into the image Then move the mouse over the object while keeping the left mouse button pressed the selected shape appears After releasing the mouse button you can move the ROI by dragging its center marked with a cross with the left mouse button Furthermore you can edit the shape by dragging its boundaries You finish the creation by clicking once with the right mouse button or by clicking the Stop button in the tool bar of the main window By selecting the menu item ROI gt Draw Arbitrary Region or the corresponding button on the Creation tab you can create polygons and free form shapes To create a polygon click with the left mouse button to mark each corner point a click with the right mouse button closes the polygon and finishes the creation To create a free form ROI draw it directly while keeping the left mouse button pressed a click with the right mouse button closes the shape and finishes the creation Note that in both cases you cannot edit the ROI after its creation In order to create an optimal model please assure that the region of inter
531. to be a string and characters from the string are printed until the end of the string or the number of characters indicated by the precision specification of the argument is reached If the precision is omitted from the argument it is interpreted as infinite and all characters up to the end of the string are printed In no case does a nonexistent or insufficient field width cause truncation of a field if the result of a conversion is wider than the field width the field is simply expanded to contain the conversion result Examples for the string conversion can be found in the program string hdev 8 5 8 String Operations 355 string concatenation The string concatenation can be applied in combination with strings or all numerical types if neces sary the operands are first transformed into strings according to their standard representation At least one of the operands has to be already a string so that the operator can act as a string concatenator In the following example a file name e g Name5 tiff is generated For this purpose two string constants Name and tiff and an integer value the loop index i are concatenated for i 1 to 5 by 1 read_image Image Name i tiff endfor o te iv 3 te c l str r chr See also tuple_strchr tuple_strrchr str 1 chr s1 s2 returns the index of the first last occurrence of one of the character in s2 in string s1 or 1 if none
532. to its natural size Double and Half double and half the current image size respectively Aspect Ratio 1 1 scales down the image size so that its aspect ratio is maintained 6 2 4 Menu Visualization 107 6 2 4 7 Colored Synopsis Disambiguate the display of regions and XLDs by using multiple colors See also dev_set_colored This is an easy way to display multiple regions or XLDs Each region is displayed in a different color where the number of different colors is specified in the submenu You can choose between 3 6 and 12 colors If all regions are still displayed with one color you have to use the operator connection beforehand You can check this also with the operator count_obj The default setting is to use 12 colors 6 2 4 8 Color Synopsis Display regions XLDs and text in a specific color See also dev_set_color This item allows you to choose a color for displaying segmentation results regions and XLDs text created with write_string and general line drawings e g 3D plots contour lines and bar charts The number of colors that are available in the submenu depends on the graphics display i e the number of bits used for displaying After selecting a color the previously displayed region or XLD object will be redisplayed with this color if the menu entry Apply Changes Immediately is checked The default color is red 6 2 4 9 Draw Synopsis Draw type of regions See also dev_set_draw Here you
533. to perspective projection the button Insert Code to insert the code generated by the Matching Assistant into the Program window of HDevelop Note that for Generate affine transformation code as well as for Generate rectification code a reference image page 282 has to be set on the Usage tab otherwise the model image is used Specifying the Variables for the Code Generation Via the menu item Code Generation gt Show Variables for Code Generation you can open the dialog for determining the variables used for the code generation inside the tab Code Generation The dialog consists of several text fields for the individual variables needed for the code lines The Matching 7 4 Measure Assistant 293 Assistant automatically generates reasonable variable names but you can change the individual names via the text fields Insert the Generated Code Lines Via the menu item Code Generation gt Insert Code also accessible as tool bar button or as button inside the tab Code Generation you can insert the code that is generated according to the current settings of the Matching Assistant into the Program window Release the Generated Code Lines Via the menu item Code Generation gt Release Generated Code Lines you can release the gen erated and inserted code lines After releasing the code lines all connections between the Matching Assistant and the program window of HDevelop are lost That is chan
534. transformed into real numbers Values of type string cannot be mixed up with numbers i e string values are considered to be not equal to values of other types The four comparison operations compute the lexicographic order of tuples On equal index positions the types must be identical however values of type integer real and boolean are adapted auto matically The lexicographic order applies to strings and the boolean false is considered to be smaller than the boolean true false lt true In the program compare hdev you can find examples for the comparison operations 8 5 10 Elementwise Comparison Operations These comparison operations compare the input tuples t1 and t2 elementwise If both tuples have the same length the corresponding elements of both tuples are compared Otherwise either t1 or t2 must have length 1 In this case the comparison is performed for each element of the 358 HDevelop Language 1st Operand Operation 2nd Operand Result 1 1 0 true gt true 2 false 1 gt 2 1 2 false 4 231 1 2 false 4711 Hugo 4711 Hugo true Hugo hugo false 2 gt 1 true 2 gt 1 0 true 5 4 1 gt 5 4 true 2 1 gt 2 0 true true gt false true Hugo lt hugo true Table 8 14 Examples for the comparison of tuples Operation Meaning HALCON operator Alternative notation t1 lt t2 less than tuple_less_elem ti gt t2 greater than tuple_gre
535. ts are expected as specified manually page 283 in the dialog accessed via Usage gt Standard Model Use Parameters page 284 The recognition rate is calculated as the relation of found objects to the sum of expected objects over all images in per cent Before using this mode please check the value specified for the parameter Maximum Number of Matches page 285 If it is not set to 0 it should not be smaller than the maximum number of objects visible in a test image otherwise the recognition rate will be below 100 Note that if you select Maximum Number of Matches 0 and by mistake specify a lower num ber of visible objects than actually present in a test image a recognition rate 100 causes prob lems with the algorithm To further extend this line of thought If for some reason in another test image an object is not found the two errors cancel each other out i e the recognition rate is 100 Therefore we recommend to check whether the correct objects are found via the dialog Test Images page 281 in the tab Usage Determining the Pose Bounds When you click the button Run in the tab Inspect besides the recognition rate page 290 the Matching Assistant determines so called pose bounds i e the range of positions orientations and scales in which the object appears in the test images You can interrupt this process by clicking the button labelled Stop please note however that this event is processed only after
536. ts specified in i tuple_select from t t select_mask t1 t2 select all elements from ti tuple_select_mask where the corresponding mask value in t2 is greater than 0 t remove t i remove elements specified ini tuple_remove from t i find t1 t2 get indices of all occurrences tuple_find of t2 within t1 or 1 if no match t uniq t discard all but one of succes tuple_unig sive identical elements from t t 11 12 13 generate a sequence of values tuple_gen_sequence from i1 to i3 with an incre ment value of i2 t i1 i2 generate a sequence of values tuple_gen_sequence from i to i2 with an incre ment value of one Table 8 6 Basic operations on tuples control data and the corresponding HALCON operators 8 5 3 Basic Tuple Operations A basic tuple operation may be selecting one or more values combining tuples concatenation or getting the number of elements see table 8 6 for operations on tuples containing control data The concatenation accepts one or more variables or constants as input They are all listed between the brackets separated by commas The result again is a tuple Please note the following t t t t returns the number of elements of a tuple The indices of elements range from zero to the number of elements minus one i e t 1 Therefore the selection index has to be within this range Tuple V1 V2 V3 V4 Please note that the index of objects e g select_obj
537. u select one operator and the combo box disappears Now the operator s parameters are shown in the operator window The short description of the selected operator is displayed in the status bar The operator name is dis played in the window title of the operator window 6 5 2 Parameter Display The parameter display is the main part of the operator window If you have selected an operator or pro cedure call HDevelop displays its interface i e the name value and semantic type of each parameter e In the first column of the parameter display the parameter types are indicated by icons Note that icons are not repeated if a parameter is of the same type as its predecessor Hover the mouse cursor over the icons to get a tool tip with the short description of the parameter e In the second column of the operator window you find the parameter names e The third column consists of the text fields which contain variable names in case of iconic and control output parameters and expressions in case of control input parameters If you want to change the suggestions offered by the system variable names or default values you may do so either manually or by clicking the arrow button connected with the respective text field This opens a list containing a selection of already defined variables and other reasonable values from 6 5 2 Parameter Display 169 a K Operator Window Insert select_shape 8 foe x Enter Operator or Pro
538. uare object the allowed extent must be less than 90 for a rectangular object less than 180 and for a circular object 0 Note that if you use shape based matching and have chosen a very large angle and scale range you may find it useful to switch off the complete pregeneration page 278 of the model if it has been switched on before default switched off The Model Parameters for the Scale Range Shape based Matching Deformable Matching The allowed range of scale is defined separately in row and column direction Thus it is described by the parameters e Min Row Scale e Max Row Scale 274 HDevelop Assistants e Min Column Scale e Max Column Scale In the model image the scales all have the value 1 0 Note that if you use shape based matching and have chosen a very large angle extent page 273 and scale range you may find it useful to switch off the complete pregeneration page 278 of the model Depending on the specified parameters the most efficient matching method is used This method deter mines how the shape model is created in the generated code e Unscaled matching This method is used if all four scale factors are equal to 1 0 e Scale invariant matching This method is used if all four scale factors are equal but not 1 0 or if the scale parameters are locked e Anisotropic scale invariant matching This method is used if none of the above applies The Model Parameter Detector
539. uccess of the search as e g a value of 1 0 is rather unlikely to be reached by a matching Thus the number of points for further calculations is reduced so that the speed of the matching can be enhanced But note that this speed up is obtained at the cost of a reduced robustness especially if the number of extracted points is low The Model Parameter Fern Depth Fern Depth specifies the depth of the classification fern Interest points can be better discriminated when selecting a higher depth On the other hand a higher depth leads to an increasing runtime The Model Parameter Fern Number Descriptor based Matching Fern Number specifies the number of used fern structures Using many fern structures leads to a better robustness but also to an increasing runtime The selection of values for the depth and the number of ferns depends on your specific requirements If a fast online matching is required few ferns with a large depth are recommendend Note that with these parameter settings more memory is required If a very robust matching result is needed and neither memory consumption nor runtime are critical many ferns and a large depth are recommended Note that this might significantly increase the runtime of the matching If the memory consumption is critical but runtime is not many ferns with a small depth are recommended The Model Parameters Min Angle and Max Angle Descriptor based Matching Min Angle and Max Angle def
540. und edges may differ Max Deformation page 287 from the model edges positions e the lowest pyramid level Last Pyramid Level page 287 to which the found matches are tracked and e the time in milliseconds after which the detection of a model within an image is aborted Timeout page 287 and also e whether objects that lie partially outside the image Shape model may cross the image border page 288 should be searched for For correlation based matching the following parameters can be specified e how much the objects may overlap Maximum Overlap 286 HDevelop Assistants e the accuracy Subpixel of the calculated position orientation and scale e the lowest pyramid level Last Pyramid Level page 287 to which the found matches are tracked and e the time in milliseconds after which the detection of a model within an image is aborted Timeout For deformable matching the following parameters can be specified e the Greediness of the search algorithm e how much the objects may overlap Maximum Overlap e the accuracy Subpixel of the calculated position orientation and scale and also e the lowest pyramid level Last Pyramid Level to which the found matches are tracked For descriptor based matching the following parameters can be specified e the Score Type page 288 e the Descriptor Min Score page 289 e the Guided Matching page 289 Once you are finished setting search parameters c
541. und here page 272 Displaying the Model Image on the Different Pyramid Levels You can select the desired pyramid level of the model image using the slider or text box for Image inside the dialog Display Image Pyramid of the tab Creation Onto this image the model on the pyramid level selected with the slider or text box for Model page 266 within the same dialog is overlaid By default the model and the image are displayed on the same pyramid level you can unlock and again lock the levels using the lock unlock button right to the sliders Note that the highest pyramid level available for display is determined automatically by the Matching Assistant based on the size of the model ROI page 253 depending on the selected Contrast page 270 and Min Component Size page 272 higher pyramid levels may not contain any model points Detailed information about the model image pyramid can be found here page 272 Locking the Display of Model and Image Pyramid By default the pyramid levels of the displayed model page 266 and model image are locked When pressing the unlock button right to the sliders which are used for specifying the pyramid levels you can select different pyramid levels for the model image and the model When pressing the button again both levels are locked again Detailed information about the model image pyramid can be found here page 272 Once you are finished with setting parameters in this section continu
542. uple NewVal Tuple which is displayed as Tuple Tuple NewVal 2 If the index position is somewhere in between the operator tuple_insert has to be used To insert the tuple 11 12 13 into the tuple 1 2 3 at position 1 use tuple_insert 1 2 3 1 11 12 13 Result resulting in 1 11 12 13 2 3 In the following example regions are dilated with a circle mask and afterwards the areas are stored into the tuple Areas In this case the operator assign_at is used read_image Mreut mreut threshold Mreut Region 190 255 Areas for Radius 1 to 50 by 1 dilation_circle Region RegionDilation Radius area_center RegionDilation Area Row Column Areas Radius 1 Area endfor Please note that first the variable Areas has to be initialized in order to avoid a runtime error In the example Areas is initialized with the empty tuple Instead of assign_at the operator assign with tuple concatenation Areas Areas Area could be used because the element is appended at the back of the tuple More examples can be found in the program assign hdev 8 5 3 Basic Tuple Operations 347 Operation Meaning HALCON operator t t1 t2 concatenate tuples tuple_concat i tl get number of elements of tuple tuple_length t v tli select element i of tuple t O tuple_select lt i lt ltl t t i1 i2 select from element i1 to ele tuple_select_range ment i2 of tuple t t subset t i select elemen
543. uple of integers into a string create random numbers tuple_sort tuple_sort_index tuple_inverse tuple_is_number tuple_number tuple_environment tuple_ord tuple_chr tuple_ords tuple_chrt tuple_rand Table 8 21 Miscellaneous functions Afterwards sum computes the sum of the squares Then the square root of the sum is calculated After that the dot product of V1 and V2 is determined by the formula V1 V2 gt Vli V2 i 8 5 15 Miscellaneous Functions sort sorts the tuple values in ascending order that means that the first value of the resulting tuple is the smallest one But again strings must not be mixed up with numbers sort_index sorts the tuple values in ascending order but in contrast to sort it returns the index positions 0 of the sorted values The function inverse reverses the order of the tuple values Both sort and inverse are identical if the input is empty if the tuple is of length 1 or if the tuple contains only one value in all positions e g EA is_number returns true for variables of the type integer or real and for variables of the type string that represent a number The function number converts a string representing a number to an integer or a real depending on the type of the number Note that strings starting with Ox are interpreted as hexadecimal numbers and strings starting with O zero as octal numbers for example the string 20 is converted to the integer 20 020 to 16
544. uplication i Paste the marked procedures into the selected entry FS Add procedures from the file system to the selected entry a Delete the selected procedures Drag and drop support In practice itis much easier to drag procedures from one location to another than using the corresponding buttons A simple drag and drop moves the selected procedures from one place to another To copy the selected procedures start to drag then hold down Cu and drop at the destination this is visualized by a icon 6 2 2 Menu Edit 87 Directories External Procedures amp al amp Library Name Procedures visualization 2 visualize_object_model_3d Procedures 35 4 m Cc pera Manage Procedure Libraries Manage Passwords Procedure lt gt eBBDE analyze_graph_event Y determine_optimum_pose_distance disp_object_model_no_ Y disp_title_and_information E dump_image_output E get_object_models_center E get_trackball_center Y max_line_width project_point_on_trackball Y trackball tuple_vector_cross_ product visualize_object_model_3d Figure 6 18 Procedures gt Manage Procedure Libraries Create a new procedure library or edit existing libraries First you have to specify the name of the new library and select a target directory The configured directories can be selected from the drop down list or you can select an arbitrary directory using the
545. use the Find Replace dialog to substitute conflicting variable names before exporting your program 9 6 4 for Loops Old HDevelop programs prior to HALCON 11 have different semantics of for loops compared to other programming languages If an old HDevelop program is opened the for loops are labeled to be run in a compatibility mode to simulate the old behavior To avoid confusions about the exported code it is recommended to disable the compatibility mode by removing the special __use_internal_index__ tag See the reference manual of the for operator for more information The following applies only to old HDevelop programs using the compatibility mode that are going to be exported Because the problems are so rare and the generated code would become very difficult to understand otherwise the code generation ignores the different semantics These differences are 1 In the programming languages you can modify the loop variable e g by setting it to the end value of the condition to terminate the loop This can t be done in HDevelop because here the current value is stored inside the f or operator and is automatically updated when it is executed again 2 In the programming languages you can modify the step range if you use a variable for the increment This is also not possible with HDevelop because the increment is stored inside the for operator when the loop is entered 3 The last difference concerns the value of the loop
546. use the same symbols as the corresponding cases for the iconic variables 6 6 2 Control Variables 177 ES Find Variable Image_B a Insert dev_display into program Control Val Sort by N Ponte Sort by Occurrence Ki Imag De i byte channels D Update Variables Image 1 type byte els 3 size 1280 1024 Width channel 1 type byte icht 6 Cleanup channel 2 type byte channel 3 type byte WindowHandle 3600 All User_ _ Global Auto channel 1 red channel 2 green channel 3 blue Figure 6 61 Interactive channel selection from an RGB image Inspecting Variables See also dev_inspect_ctrl Double clicking a control variable opens a window that displays all its values in a tabular format This is helpful if you have tuple variables with a large number of values that you want to inspect Below the list some statistical data may be displayed minimum value maximum value sum of values mean value deviation types number of values and the semantics if appropriate You can select which statistical data is displayed by right clicking on the statistics table and selecting the corresponding entries You can also select multiple control variables at once in the variable window by holding down the key To inspect these variables in a single inspection window right click on the selected variables and select Inspect The
547. user inter face Most of the terminology explained here will have become second nature to most users and may most likely be skimmed over 1 3 Terminology amp Usage 13 Mouse Usage click A single click with the left mouse button e g to mark and select items or to activate buttons To select multiple items hold down the key and click the desired items To select many items from a list click the first item hold down the key and click the last item All intermediate items are then also selected double click Two quick successive clicks with the left mouse button e g to open dialogs of selected items Double clicks are mostly shortcuts for single clicks followed by an additional action right click A single click with the right mouse button to access additional functionality of the user interface e g context sensitive menus Clicking the right mouse button also ends interactive drawing functions in HDevelop drag Keeping the left mouse button pressed while moving the mouse and finally releasing the mouse button Typically used to move items resize windows select multiple items at once e g program lines or to draw shapes drag and drop HDevelop supports drag and drop of image files and HDevelop programs from other applications You can e g drag an HDevelop program icon from a file browser and drop it on the HDevelop window to load it middle mouse button With three button mice the middle mouse button is used under UN
548. ut window and a variable of class HWindowX directs the output to this window Finally the class HOperatorSetxX is used as a container for all HALCON operators There is no need for other classes as long as the program has the same functionality as in HDevelop When editing a generated program you are free to use any of the classes of HALCON COM to extend the functionality 9 4 3 Limitations and Troubleshooting Besides the restrictions mentioned in this section and in section 9 6 on page 392 please also check the description of the HDevelop operators in section 6 2 6 2 on page 123 9 4 3 1 Variable Names In contrast to C C or HDevelop Visual Basic has many reserved words Thus the export adds the prefix ho_ to all iconic and hv_ to all control variables respectively in order to avoid collisions with these reserved words 9 5 Code Generation tor C 391 9 4 3 2 Exception Handling In HDevelop every exception normally causes the program to stop and report an error message in a dialog window This might not be useful in Visual Basic The standard way to handle this in Visual Basic is by using the On Error Goto command This allows to access the reason for the exception and to continue accordingly Thus for HDevelop programs containing error handling dev_error_var the corresponding code is automatically included Please note that a call of dev_ set_check give_error has no influence on the operator call The exception will a
549. v_display Iconic variables are displayed in the active graphics window by this operator It is rea sonable to do this when the automatic output is suppressed see dev_update_window below and Menu Edit gt Preferences gt Runtime Settings gt Runtime Settings page 95 dev_clear_obj This operator deletes the iconic object stored in the HDevelop variable that is passed as the input parameter In the variable window the object is displayed as undefined with a as its icon dev_inspect_ctr1 This operator opens an inspection window displaying the values of the variable passed to the operator To inspect multiple variables at once you can pass a tuple of variable names In most cases a list dialog is opened which shows all values of the variable see also section Inspecting Variables on page 177 In the case of an image acquisition device handle a description of this image acquisition device is opened In addition this dialog allows online grabbing of images see page 176 This operator is not supported for exported code dev_close_inspect_ctrl This is the opposite operator to dev_inspect_ctrl and closes the in spect window This operator is not supported for exported code dev_map_par dev_unmap_par These operators open and close the parameter dialog which can also be opened using the menu Menu Visualization gt Set Parameters This operator is not supported for exported code dev_map_var dev_unmap_var These operators ico
550. viously created training file and maybe edit it open the Training File Browser page 215 which provides an overview of the content of training files which can easily be modified 7 5 4 OCR Classifier 321 7 5 4 2 Teaching This section allows you to teach characters which are displayed in the window right next to the text field Steps for teaching 1 Use the text field to enter characters that correspond to the segmented characters in the im age As you enter the characters into the text field the image of the corresponding character is displayed on the right side of the text field The characters are highlighted in the Graphics Window as well 2 After you have entered the characters press the button Add To Training Data 3 Repeat this process for each sample image 4 After having added a representative number of samples click the button Train Now in the sec tion Training 5 Once the classifier has been trained for the first time results of the OCR are available in the text field at the bottom of the Teaching dialog to assist with further teaching 6 If the results of the OCR are correct click the button Suggestion to quickly add the results to the text field during further teaching If you want to view the results of the OCR classification continue to the Results tab page 326 If you want to improve the OCR classification you can change Basic Features that may improve a classification and train again You c
551. visualization settings will insert the corresponding operator call s into the current program Unlike the entry Insert Code which dumps the current settings in one block using Record Interactions you can selectively adjust the settings you want to replay in your program This includes opening activating and closing graphics windows displaying or clearing iconic objects adjusting the image or window size from the menu or the tool bar as well as adjusting the draw colors draw mode line width region shape LUT and paint mode 6 2 4 18 Insert Code Synopsis Insert current visualization settings into the current program at the IC Shortcut Ctri ShifG 1 or Ctrl Shift G Ctrl Shift Using this entry you can insert code into the current program that will restore the current state of the graphics window The parts to be restored are selected from the dialog shown in figure 6 33 m W Insert Code x Insert code into the active Program window for reconstructing the current state of the active Graphics window Selected Aspects v Iconic objects from the graphics stack Y Visualization parameters V Window geometry Co Figure 6 33 Insert Code g la c i E 2 5 0 Iconic objects from the graphics stack Insert operator calls to display all iconic objects that are currently visible in the active graphics window Visualization parameters Insert operator calls to restore the
552. w page 248 Once you are finished with configuring the options check the position of the insert cursor and click Insert Code page 250 under Calibration or Sample Usage to insert the code into your HDevelop program Note that if you have already inserted code into your program and you click insert code again the previous code will be replaced regardless of the cursor position 246 HDevelop Assistants 7 2 4 1 Calibration Choose your Export Mode either e Calibration Procedure which exports the generated code e Calibration Data Tuple which exports the resulting calibration parameters CameraParameters and CameraPose as tuples e orCalibration Results File which writes the calibration results into the specified files and generates code lines for reading those files For the last one you can click the folder icons to browse for a stored file Subsequently select Parameter File and Pose File In order to save the calibration results to files it is necessary that e a successful calibration took place before and e a file name exists for both files To generate code for initializing the image acquisition when using the Image Acquisition Assistant page 225 enable Initialize Acquisition Once you are finished check the position of the insert cursor and click Insert Code page 250 to insert the code into your HDevelop program 7 2 4 2 The Browse button The Browse button on the Code Generation tab is similar to the
553. w Export 9 Use HALCON Windows Use Export Template Encoding 9 Native UTF 83 Keep dialog open Figure 6 5 Export 6 2 1 Menu File 61 The file name extension corresponding to the selected export format is appended to the specified file name Export Range The export range specifies which parts of the current program are to be exported The following options are available Program The entire program is exported main procedure and all local procedures All used external procedures are exported depending on the setting of the external procedure options see below Current Procedure The current procedure and all used local procedures are exported All used external procedures are exported depending on the setting of the external procedure options see below External Procedures All external procedures are exported depending on the setting of the external procedure options see below Current Library The current library is exported all procedures that are part of the cur rent library All used external procedures that are not part of the current library are ex ported depending on the setting of the external procedure options see below The short description and chapter information of procedures are exported as comments Arbitrary code can be embedded with special comment lines see section 9 6 on page 392 Procedure Options Defines the export behavior for procedures Export local proc
554. window Special Keyboard Shortcuts in the Graphics Window Left Right Up Down move mouse cursor 1 pixel Alt Left Right Up Down move mouse cursor 10 pixels Ctrl Left Right Up Down pan image 1 pixel Ctrl Alt Left Right Up Down pan image 10 pixels Graphics Window Tool Bar Icons le Clear the graphics window and its history A Switch to select mode In this mode you can select regions or XLDs that are displayed in the graph ics window A selected item is highlighted with a dashed border If multiple layers of region XLD data are displayed in the graphics window the first click selects the uppermost region XLD under the mouse cursor Each subsequent click at the same position selects the region XLD below the currently selected item The variable name of the selected item is displayed in the title bar of the graphics window for reference You can use the select mode to inspect gray value histograms and features of individual regions or XLDs In the example image illustrated in figure 6 66 on page 182 the displayed image of a pizza is overlaid with region data A single region is selected e Combined move zoom tool Drag the displayed image with the left mouse button to alter the dis played portion Use the mouse wheel to zoom in and out al Magnifying glass Click into the graphics window to magnify the area at the mouse cursor See figure 6 69 for an illustration of this tool g la c
555. window The graphics window is saved as is including displayed regions and XLDs A file dialog pops up Select the destination directory enter a file name and select the output format TIFF BMP JPEG PNG or PostScript Afterwards click Save to actually save the image file or Cancel to abort 6 2 5 Menu Procedures The menu Procedures contains all functionality that is needed to create modify copy or delete HDe velop procedures To save procedures refer to the Menu File menu page 54 6 2 5 1 Create New Procedure Synopsis Create a new internal or external procedure Shortcut ctrl Snift P c or Ctrl Shift P Ctrl Shift C Selecting this item opens the procedure interface dialog page 150 window The procedure interface dialog and the mechanism of creating procedures are described in section Creating Procedures on page 150 6 2 5 Menu Procedures 119 6 2 5 2 Duplicate Synopsis Copy a procedure under a different name Selecting this menu item opens a dialog with which it is possible to copy existing procedures The dialog is displayed in figure 6 34 The combo box Source contains all local procedures in the current program and all external procedures In the Target text field the name of the copied procedure can be entered Clicking the OK button creates a copy of the source procedure Cancel dismisses the dialog The copy retains the status local or external of the source procedure The c
556. window displays the name of the current procedure You can select all available procedures from this box The first element of the list will always be the main procedure followed by the local procedures of the current program followed by the available external and library procedures The procedure groups are sorted alphabetically Procedures may be protected with a password Those procedure can still be selected from the list but unless the correct password has been entered they will remain in a locked state If the procedure is locked a password button is displayed instead of the procedure body For more information about protected procedures see section 5 6 on page 49 To view and modify the interface of the current procedure o D 2 Q a 0 156 Graphical User Interface Select Procedure E init_image y Type El Local Program Procedure hdev dev Parameter Language Documentation English en_US wv Y Adapt program Eso Cancel Apply Help Figure 6 46 Editing a procedure e select Procedures gt Edit Interface page 119 e or click the button Eu Using the upper buttons of this dialog you can select the data associated with the current procedure The button General Settings provides access to the procedure name its type and its parameters e General Settings See section 6 4 5 1 on page 150 e Parameters section 6 4 5 2 on pa
557. with the results go on to the Code Generation page 250 tab 7 2 3 1 Calibration Status This box displays the Status of the calibration i e whether the calibration was successful and the Mean Error in pixels If you either delete calibration images page 237 or change Calibration Plate Extraction Parameters page 243 or Camera Parameters page 233 after having calibrated the former calibra tion data is not valid any more Therefore the Status will display that no calibration data is available To continue working with your changed camera parameters calibration parameters or images just click Calibrate page 237 again on the Calibration tab Mean Error Mean Error designates the average error in pixels during the calibration process Once the system has been calibrated the ideal centers of the calibration marks are calculated and compared to the real mark centers Mean Error is the deviation value between the ideal and the real mark centers A value of 0 1 and lower can be regarded as a good result Possible calibration errors are described in the tables about quality issues under Quality Issues page 239 most of them can usually be solved quite easily often just by taking better calibration images page 235 7 2 4 Generating Code 245 7 2 3 2 Camera Parameters The internal camera parameters include Cell Width Sx and Cell Height Sy in micrometer Focal Length in mm Center Column Cx and Center Row Cy
558. with tuples and strings e If one of the tuples is of length one all elements of the other tuples are combined with that single value for the chosen operation e If both tuples have a length greater than one both tuples must have the same length otherwise a runtime error occurs In this case the selected operation is applied to all elements with the same index The length of the resulting tuples is identical to the length of the input tuples e If one of the tuples is of length 0 a runtime error occurs In table 8 5 you can find some examples for arithmetic operations with tuples Pay special attention to the order in which the string concatenations are performed The basic arithmetic operations in HDevelop are Please note that is a dimorphic operation If both operands are numeric it adds numbers If at least one of the operands is a string it concatenates both operands as strings 8 5 2 Assignment 345 8 5 2 Assignment In HDevelop an assignment is treated like an operator To use an assignment you have to select the operator assign Input Result This operator has the following semantics It evaluates Input right side of assignment and stores it in Result left side of assignment However in the program text the assignment is represented by the usual syntax of the assignment operator Result Input The following example outlines the difference between an assignment in C syntax and its transformed vers
559. within the currently selected scope A11 refers to all proce dures Program refers to the main procedure and all procedures it uses and Current Procedure refers to procedure displayed in the active program window Hopefully you can set the scope to A11 without cluttering your display Clicking an entry focuses the corresponding program line in the active program window so you fix the error If the selected procedure is already displayed in a program window tab the corresponding tab is activated Otherwise the current view switches to the selected procedure If you make changes to the program while the display of invalid program lines is still open you will need to click the button Refresh to update the entries 6 2 2 Menu Edit 75 G W Program Line View koba Invalid Lines Find All Breakpoints Bookmarks Scope 9 All Program Current Procedure Refresh Procedure Line Context Problem main 5 read_image Image invalid Wrong parameter number main 24 threshol Image R invalid Unresolved procedure call dev_update_on 3 flag invalid Syntax error Figure 6 13 Managing invalid program lines in the program line view window Using the context menu you can perform the following actions on the selected program lines e Copy page 67 e Cut page 67 e Delete page 68 also by pressing e Activate page 68 e Deactivate page 68 GUI Reference 76 Graphical User Interfa
560. wo digit hexadecimal number or using the format Onnn where nnn is a three digit octal number Less digits may be 8 2 Control Types and Constants 339 Meaning Abbreviation Notation line feed NL LF n horizontal tabulator HT t vertical tabulator VT v backspace BS b carriage return CR r form feed FF f bell BEL a backslash single quote 2 A arbitrary character hexadecimal xnn arbitrary character octal Onnn Table 8 1 Surrogates for special characters used if the string is unambiguous For example a line feed may be specified as xa unless the string continues with another hexadecimal digit 0 F For example The string Sobel s edge filter has to be specified as Sobel s edge filter A Windows directory path can be entered as C Programs MVTec Halcon images boolean The constants true and false belong to the type boolean The value true is internally represented by the number and the value false by 0 This means that in the expression Val true the effective value of Val is set to 1 In general every integer value other than 0 means true Please note that some HALCON operators take logical values for input e g set_system In this case the HALCON operators expect string constants like true or false rather than the boolean values true or false In addition to these general types there are special constants and the type tuple which are specific to HALCON or HDevelop
561. xecuted if lt condition1 gt is false and lt condition2 gt is true elseif may be followed by an arbitrary number of additional elseif instructions The last elseif may be followed by a single else instruction if lt condition1 gt sent lt condition2 gt endif This is syntactically equivalent and thus a shortcut for the following code block if lt condition1 gt else if lt condition2 gt endif endif while endwhile This is a looping control flow structure As long as the condition is true the body of the loop is executed In order to enter the loop the condition has to be true in the first place The loop can be restarted and terminated immediately with the operator continue and break respectively see below To enter both while and endwhile at once select the operator while in the operator window and make sure the check box next to the operator is ticked 366 HDevelop Language while lt condition gt endwhile repeat until This loop is similar to the while loop with the exception that the condition is tested EOP vs at the end of the loop Thus the body of a repeat until loop is executed at least once Also in contrast to the while loop the loop is repeated if the condition is false i e until it is finally true To enter both repeat and until at once select the operator until in the operator window and make sure the check box next to the operator is ticked repeat until lt con
562. xed 5x5 grid Symbol Features Used for Classification In this part of the dialog three characteristics defining the classification of symbol features can be acti vated Activate e Ratio if the ratio width to height of a symbol should be used 324 HDevelop Assistants e Anisometry if the anisometry of the equivalent ellipse of the symbol shape should be used and e Convexity if the convexity of the symbol shape should be used 7 5 4 5 Advanced Training Parameters and Features This selection allows a precise specification of the classifier as well as of the classification parameters The following table can help you choose suitable classifier parameters Parameter Method Selection Explanation Classifier All Type Preprocessing MLP SVM Components MLP SVM Hidden Units MLP MLP Multilayer Percep tron SVM Support Vec tor Machine KNN k Nearest Neighbor Box Hyperboxes default MLP if no classifier has been trained before or the last classifier that has been trained None Normalization Principal Components Canonical Variates default None Number of components default 10 Number of hidden units 1 150 default Auto Choose a method for the classification of the sym bols The last classifier that has been trained is loaded automatically The settings for this clas sifier are preserved even if one of the pretrained classifiers is used
563. xel 0 1811 gt mm imm 5 5217 Pixel Edit Mode Modify Regions 0 Set 2D Calibration Operation C Region Primitive Value Unit 4 ROI O 4 s 2 Line Row1 72 6927 mm Column1 19 6498 mm Row2 66 4193 mm Column2 27 4372 mm Length 10 00 mm Orientation 38 854 Degrees Figure 6 74 Performing 2D calibration 6 8 Help Window The help window provides access to HALCON s online documentation The window is split into two areas On the left navigational panels are available as tab cards They are described below The main area resembles a web browser and displays the actual hypertext content The size of the two parts of the help window can be adjusted by dragging the dividing line Parts of the documentation are available in PDF format The help window does not display these files itself but launches the default viewer when a PDF link is being followed If a link to a PDF file appears in the navigation either as the result of a full text search or from the selection of index keywords it will be marked by a PDF icon A single click will select the entry and display a link to the file in the contents area A double click or pressing Return will open the corresponding file in the external viewer This way you can quickly browse the search or index results in the navigation without accidentally running the PDF viewer Contents This tab card presents the chapters and sections of the online documentation as a
564. xternal procedure directories see section 6 2 2 16 on page 82 If no directories are configured you can select a target directory from a dialog HDevelop will add the selected target directory to the list 1f you tell it to Otherwise the operation will be canceled For changing the status of a procedure see section 5 6 on page 49 6 2 6 Menu Operators 121 6 2 5 9 Manage Procedures Synopsis Configure procedure settings This menu entry opens the dialog Preferences gt Procedures See section 6 2 2 16 on page 82 ff for a complete description 6 2 5 10 Edit Procedure Synopsis Select a procedure for editing in the program window This submenu lists all procedures in submenus grouped by chapter and section title see section 6 4 8 1 on page 158 Procedures without a chapter title are listed directly in the menu Edit Procedure If you click on a procedure name it will become the current procedure in the program window You can also select procedures in the combo box of the program window page 138 6 2 6 Menu Operators Synopsis Select HALCON operators and procedures This menu item comprises all HALCON and HDevelop operators including the HDevelop control con structs Furthermore procedures can be selected from a submenu at the bottom of this menu The following descriptions provide an overview of the operators specific to HDevelop programs For detailed information about all operators it is highly recommended to rea
565. xternal procedure relative to the search directory Used by Usage counter and the names of the callers of this procedure Modifications The number of modifications to the external procedure after it has been loaded Using the context menu basic file system operations can be executed You can copy delete or rename the selected procedure file in the file system la 7 ES E 2 a 5 0 86 Graphical User Interface Procedures gt Manage Procedure Libraries se this tab card to e e create new libraries e delete existing libraries add procedures to libraries e remove procedures from libraries The table on the left lists all libraries the number of contained procedures and the path name to the library file The special entry Procedures contains all local procedures and all external procedures that are not contained in a library e Select a list entry to display the contained procedures e Double click a library from the list to edit its properties see below The following buttons are available Sl Create a new procedure library See below la Save changes in the selected procedure library Modified libraries are marked with an asterisk Es Delete the selected procedure library After a confirmation the procedure library file is irreversibly lost de Cut the selected procedures i e mark them for moving ES Copy the selected procedures i e mark them for d
566. y default Display the image unmodified row column Display the height information of a single horizontal vertical image line The gray values are scaled by the specified factor The corresponding row column can be selected by clicking into the graphics window or by entering the exact value contourline Display height lines The gray value difference of the lines is defined by the parameter Step 3d_plot_lines _hidden_lines _point Display as a 3D plot using lines computed hidden lines or points 3d_plot Display a 3D plot using OpenGL which can interactively be modified in the graphics window This mode can also be enabled from the tool bar of the graphics window See page 182 default row 128 scale 20 column 128 scale 20 contourline step 15 3d_plot_lines 3d_plot_hidden_lines 3d_plot_point 3d_plot Figure 6 31 Comparison of the different paint settings g la c i E 2 5 0 114 Graphical User Interface Zoon settings See also dev_set_part As opposed to the mouse based zoom functionality that is available in the tool bar of the graphics win dow the tab card Zoom is parameterized You can specify the bounding box of the visible area of an image or set the center position A Colo Pen Lut Paint zoom Row Column Set part Upper Left Corner 0 Lower Right Corner 0 0 Set center Center Point 0 0 Reset Zoomout Zoomin Aspect
567. y other special characters that further specify where the code block will be placed upon exporting For example the line define NO_EXPORT_APP_MAIN puts the line define NO_EXPORT_APP_MAIN at the very beginning of the exported program Code lines in this format are collected from the main procedure first followed by lines in other procedures The recognized special markers are summarized in table 9 1 If you are using the operator window to enter arbitrary code lines you will have to select the special operator export_def Its first parameter specifies the destination of the exported code line see the last column of table 9 1 for reference The second parameter is the code line itself When you submit the operator to the program window the operator call will be converted to the special prefix characters for better readability 9 6 2 Assignment In HDevelop each time a new value is assigned to a variable its old contents are removed automatically independent of the type of the variable In the exported code this is also the case for iconic objects HALCON C Hobject HALCON NET HObject HALCON COM HUntypedObjectX and for the class HTuple HALCON C HALCON NET the type Variant Visual Basic 6 and the class object HALCON COM for NET languages as they all have a destructor that removes the stored data Because C does not provide destructors the generated C code calls the operators clear_obj and destroy_tuple to
568. y the shapes of contours instead of using the gray values of pixels and their neighborhood as template In particular shape based matching should be chosen if occlusions or clutter can not be avoided or if a matching of objects with changing color is applied e Deformable Matching Like shape based matching the local deformable matching extracts contours and matches their shapes against the shapes of previously created models But in contrast to shape based matching even slightly deformed objects are found and the defor mations are returned as an additional result This matching approach also allows to rectify the image part containing the deformed object Therefore only the objects position is deter mined whereas the orientation and scale are interpreted as part of the deformation e Correlation Based Matching The correlation based matching approach is based on gray values It uses a normalized cross correlation to evaluate the correspondence between a 7 3 1 Introducing the Matching Assistant of HDevelop 253 model and a test image It can compensate both additive as well as multiplicative variations in illumination In contrast to the shape based matching also objects with slightly changing shapes lots of texture or objects in blurred images contours vanish in blurred images e g because of defocus can be found e Descriptor Based Matching In contrast to the perspective deformable matching the tem plate is not built by the sha
569. y used local procedures e All Local Procedures print all local procedures e Used External Procedures also print used external procedures Only Procedure Interface If this box is checked the procedure body is not printed Instead only the interface of the procedure is printed The bodies of locked procedures see section Protected Procedures on page 49 are not printed g la c i E 2 5 0 66 Graphical User Interface 6 2 1 18 Quit Synopsis Quit HDevelop Checks for Unsaved changes page 222 Shortcut See also exit This menu item terminates HDevelop 6 2 2 Menu Edit In this menu you find all necessary functions to modify the current HDevelop procedure body displayed in the program window Furthermore a comprehensive find and replace functionality is offered You can also access the preferences of HDevelop from this menu 6 2 2 1 Undo Ctr1 Z Synopsis Undo your previous editing activities Shortcut You may undo your previous editing activities via this menu item For example by selecting it three times you cancel the last three editing actions The menu entry always states the last editing action that will be undone e g Undo Insert Program line at 23 read_image The undo functionality purely applies to editing activities No file operations will be undone Thus if you create an external procedure from some selected lines and undo the operation the external proc
570. y value and change the mode that handles the expected gray value range On the Input tab there are three modes available that allow you to control how much adaption of the program to gray value ranges is necessary e The default mode is the adaptive mode which checks the gray values of an image and automat ically adapts these values for each image This mode is useful if the gray value range is unknown or differs between images The downside to this default setting is that the highest value might differ from image to image which results in the fact that also the curves in the graphs that define the edges appear shifted which can be confusing e The increasing mode checks the values for the first image and keeps these values if the gray value range of the following images is either the same or smaller It only corrects the values for a wider range which is only a problem if values should be adapted for an image with data that is significantly smaller than the one of the previous images and the values on the graph are therefore so close together that it is impossible to distinguish the edges e The simplest mode is the fixed mode as it uses only the gray value range that has been entered and does not adapt any values This mode is a good choice if it is known that all images have the same gray value range or deviations do not contain necessary information in those values that exceed the given gray value range so that their variation of range can be di
571. ymbol name or e the corresponding button in the menu Edit e Delete a symbol Select the symbol you want to delete and e press the Del button on your keyboard e press the toolbar button Delete the selected samples or e choose the menu item Edit gt Delete e Rename a symbol To assign the samples to another symbol just edit the symbol name This action is equal to moving the symbol and therefore all samples that are assigned to this symbol via drag and drop to another symbol Note that it is also possible to assign single samples to a new symbol To learn more about assigning samples to a new symbol class read the information about modifying samples in the paragraph Improve your training file in the section Sample Inspection Window page 216 e Copy a symbol A symbol and all samples that are assigned to this symbol can be copied to another training file This can be achieved by using e drag and drop while keeping the Shift button pressed e using the Copy and Paste buttons in the toolbar or e selecting the corresponding buttons in the menu Edit e Move asymbol A symbol can also be moved e to another symbol in the same training file 6 14 3 Actions within the Training File Browser 219 e to another symbol in a different training file or e itcan also be added to a different training file by moving it there via drag and drop Moving a symbol and therefore all samples that are assigned to this symbol to another sym

Download Pdf Manuals

image

Related Search

Related Contents

OPT-4 – Manuel d`utilisation  STT Tablets french REV122011  ASN.1 Compiler Version 6.2 C# User`s Manual Objective Systems  Untitled - Paintball Solutions  DMU10-00-0100-132 Rev 2.indd    FS2001 Field Manual rev 1    

Copyright © All rights reserved.
Failed to retrieve file