Reference Manual IVC 2D
Reference Manual IVC 2D
Reference Manual IVC 2D
Application Programming
IVC-2D
ISM Radio Frequency Classification - EN55011 –
Group1, Class A
Warning:Class A equipment is intended for use in an industrial environment. There may be potential difficulties in
ensuring electromagnetic compatibility in other environments, due to conducted as well as radiated disturbances.
Explanations:
Group1 – ISM equipment (ISM = Industrial, Scientific and Medical)
Group 1 contains all ISM equipment in which there is intentionally generated and/or used conductively coupled
radio-frequency energy which is necessary for the internal functioning of the equipment itself.
Class A equipment is equipment suitable for use in all establishments other than domestic and those directly
connected to a low voltage power supply network which supplies buildings used for domestic purposes.
Class A equipment shall meet class A limits.
Note: Although class A limits have been derived for industrial and commercial establishments, administrations
may allow, with whatever additional measures are necessary, the installation and use of class A ISM equipment in
a domestic establishment or in an establishment connected directly to domestic electricity power supplies.
German versions of the Operating Instructions and Reference manual are available on the CD.
Eine deutsche Version der Bedienungsanleitung und des Referenzhandbuchs finden Sie auf der
beigelegten CD.
© SICK AG 2013-09-09
All rights reserved
Contents
1 Functional Overview.......................................................................................................................................7
4.1 Image....................................................................................................................................................................48
Grab Setup .................................................................................................................................................48
Start Snapshot ..........................................................................................................................................49
Grab...............................................................................................................................................................50
Ping-Pong Grab .........................................................................................................................................51
Copy Image Bank.....................................................................................................................................52
Image Bank Operation ...........................................................................................................................53
Add Text.......................................................................................................................................................55
Draw Line ....................................................................................................................................................56
Draw ROI......................................................................................................................................................57
Reset Image Banks.................................................................................................................................58
Display..........................................................................................................................................................59
Mirror Image...............................................................................................................................................60
Rotate Image .............................................................................................................................................61
4.2 Region of Interest (ROI).................................................................................................................................62
ROI Rectangle ............................................................................................................................................62
ROI Rotated Rectangle...........................................................................................................................63
ROI Circle.....................................................................................................................................................65
ROI Ellipse ...................................................................................................................................................66
ROI Perimeter ............................................................................................................................................67
ROI Union.....................................................................................................................................................68
ROI Intersection ........................................................................................................................................69
ROI Difference ...........................................................................................................................................70
4.3 Filter ......................................................................................................................................................................71
A Mathematical Expressions........................................................................................................................245
B Setting Device Parameters .......................................................................................................................249
1 Functional Overview
Working Memory
x1=1.273
y1=9.742
z1=6.37
...
Flash Memory
1 1 1
2 2 2
3 3 3
4 4 4
5 5 5
... ... ...
The camera also has a working memory, which contains the following:
Active program, which is a sequence of commands that are used for analyzing the
images.
Active table, which is used for reading and storing values that are used during the
analysis.
A number of image banks, which each contains an image captured and processed by
the camera.
Data blocks, which are used by some tools for storing or reading additional data. For
example, some pattern recognition tools (Teach tools) create and save data in a data
block, which can later be used by other tools (Match tools).
In addition, the camera has a flash memory, which is used for additional storage. The flash
memory contains the following:
Program banks, which are used for storing programs and tables that can be loaded into
the camera’s working memory. A program bank always contains both one program and
one table.
Saved images, which can be used for example as a basis when teaching the camera
patterns to recognize.
Saved data blocks, containing for example pattern recognition data to be used by
Match tools, so that the pattern does not have to be taught before running a program.
Product
Devices
Label LabelTable
FillLevel FillTable
Program steps
Table values
Images
Result values
When the development of a program is finished and it is ready to be used, the program
(and table) is downloaded to the device and started.
After this it is not necessary to use IVC Studio any more. It may be used to display the
results from the program, for example to signal when faults occur. But the device can also
be used as a stand-alone unit, where other equipment is used for controlling the device
and displaying the output. For example, you could set up a web page on the camera and
then monitor the camera from a web browser on any computer on the network.
Programs
Tables
Input
Output
Camera 1 Associated
Program Active 1
2
3
4
Program 5
...
Program
Camera 2 Banks
Associated Save in
Table Active Flash
Copy values
Table
manually
The programs and tables may be stored manually on the device as well. The flash memory
in the device contains a number of program banks, each of which can contain a program
and a table.
When you store a program in the flash memory, you always store the active program and
table, which are currently in the working memory of the device.
A program stored in program bank 0 will automatically be started when the device is
powered up.
Device 3
Device 2
Device 1 Device 1
Product: Bottle Product: Jar
Dev Program Table Dev Program Table
1 Label Bottle_Label_Table 1 Label Jar_Label_Table
2 Bottle_FillLevel Bottle_FillLevel_Table
3 Jar_FillLevel Jar_FillLevel_Table
To achieve this we create two products in IVC Studio with the following contents:
Product: Bottle
Device Program Table
1 Label Bottle_Label_Table
2 Bottle_FillLevel Bottle_FillLevel_Table
Product: Jar
Device Program Table
1 Label Jar_Label_Table
3 Jar_FillLevel Jar_FillLevel_Table
When switching between producing the two products, we can simply open the product in
IVC Studio to load the corresponding programs and tables into the devices. If we would
change the design of the label for the bottle, we can just change the values in the table
Bottle_Label_Table to suit the new design. If necessary we could also make a copy of the
program Label, modify it, and associate the modified program with device 1.
2 Getting Started
In this chapter we will introduce the basics in IVC Studio, and learn how to:
Set up IVC Studio to write a program
How to write the program - that is adding program steps and setting parameters
How to test and debug the program
As an example we will build a simple program that checks whether or not a label has been
placed correctly on a bottle, that is if it is tilted or not.
OK Fail
When writing a program in IVC Studio you can use either a hardware camera or, if no such
is available, the Emulator.
In the following sections it is assumed that a hardware camera is used, and that both the
camera and IVC Studio are installed and are working properly. How to install the camera
and IVC Studio is described in the installation instruction.
How to use the Emulator is described in section Using IVC Studio in the IVC-2D Reference
Manual.
Product
Devices
Label LabelTable
FillLevel FillTable
The main window shows the contents of the currently open product. The left pane shows
the different types of objects that the product may contain, that is; devices, programs and
tables.
Clicking on one of the categories will display the objects contained in the product. Since
the product was just created, all the categories are empty, with the exception of Devices,
which displays all available devices.
There is also a fourth type that we haven’t mentioned yet - macros. Macros are basically
small programs that you can call from within regular programs. They can be useful for
reusing blocks of program steps when writing advanced programs.
You should always select the devices that you intend to use in your product. IVC Studio
periodically updates the information in the device list by polling the devices that are selec-
ted in the list.
If no device is selected in the list, IVC Studio will poll every device it can find for information.
This slows down IVC Studio may affect the performance of devices used by other users.
5. Right-click Programs in the left pane in the main window, and choose New Program
from the pop-up menu.
6. Fill in a name for the program in the dialog box, and click OK.
7. Click Devices in the left pane of the main window.
8. Right-click the device in the right pane that is selected for the product, and choose
Select Program from the pop-up menu.
9. Select the program in the list in the dialog box, and click OK.
10. Right-click Tables in the left pane in the main window, and choose New Table from the
pop-up menu
11. Fill in a name for the table in the dialog box, and click OK.
12. Click Devices in the left pane of the main window.
13. Right-click the device in the right pane that is selected for the product and chose
Select Table from the pop-up menu.
14. Select the table in the list in the dialog box, and click OK.
15. Finally, save your changes to the product on the PC by choosing File Æ Save Product.
2.2.1 Tools
A program is a list of commands – or tools – that are performed by the camera. When the
program runs, the commands are carried out one by one in the order that they appear in
the program list. So when you build a program in IVC Studio, you work with this list of
commands.
Most of the tools have a number of input parameters that can be set. For example when
starting to take a snapshot from a camera, you may specify the exposure time and which
input that should trigger the capture.
0. Retrieve an image Table
Row Value
#/
3. Calculate angle
Angle 45¡
4. Measurement OK?
" #
Result
(- . (-
5. Measurement OK
(
) *
6. Measurement not OK
(
Many tools also produce results that are available as output parameters. These parame-
ters can be stored in the table or be used directly by other steps in your program.
The toolbar actually contains several toolbars on which the tools are grouped into catego-
ries. You switch between the categories by clicking the tabs at the bottom of the toolbar.
The program list shows each step in the programs as a table. Each step contains:
The input parameters that can be set for the tool
The execution time for the tool when executed
The result (return values) from the tool
There are four columns in the program list, which are used for specifying parameter values;
Value, Table, Step and Result. Which column to use depends on what type of parameter
value you want to use; constant values, values stored in the table, or results from previous
steps.
Image banks are used for storing images, just like the table is used for storing values. This
can be very useful, for example if you want to modify the image, but need to use the
original image later on in the program. Note that the images are stored in the camera, and
that the images in the image banks remain there until they are removed or overwritten by
other images.
The preview window is used by some tools to visualize the result of the tool. This preview is
useful when you develop your program, but is not generated when the program is running.
The preview window may also be used for setting parameters for certain tools. This is
further described later on in this chapter.
1. Click on the name of your program in the left pane in the main window.
A toolbar is displayed at the top of the window, which contains a number of tools that
can be used with the device. Below the toolbar there is a row of tabs, which are used
for switching between different categories.
2. Click the Grab tool in the Image category on the toolbar to add the first step to the
program.
The Grab tool is added to the program’s folder in the left pane, and the Image Banks,
Program List and Previews are displayed in the right pane.
3. Double-click the blue field at the top of the program step, and type a description for
the step, for example “Retrieve an image”.
Previous result
Description Value Table
Step Result
Retrieve an image
0 - Grab
01 - Destination bank 0 ------ ------ ------
Time of execution (µs) 0
The command is now added to our program, but in order to see the effect of the com-
mand, it has to be executed by the camera.
4. Click the Grab step in the program list to select the step.
5. Press F1 to open up the Reference manual for the Grab step.
6. Close the manual again and remember to use the F1 button whenever you want to
learn more about a tool.
7. Choose Debug Æ Execute Step from the IVC Studio menu, or press the F5 key on the
keyboard.
An image is now retrieved from the camera and stored in image bank 0.
Scan line
Region of interest
(ROI)
Left point
We also need a step that finds the upper edge on the right side, but we will add that step
after we have set the necessary parameters.
Y coordinate
Interactive setup windows are also used for entering constant values, but in this case
captured images are used to provide feedback for the settings. Parameters can be set
interactively in three different ways:
In the Preview window
By clicking the button with three dots ( ), that is displayed when a parameter is
double-clicked
By double-clicking the Setup field that is displayed at the bottom left corner of certain
program steps
For example, when defining a ROI it is usually much easier to mark it directly in the image in
a preview window than entering coordinates for the rectangle in the Value column:
16. Move and resize the rectangle in the preview, so that it marks the area where you can
see a part of the upper edge of the label.
If you need a larger window to work in, you can double-click a preview to open it in a
separate window. In this window you can fine-tune the parameters settings, for example if
there are small details in the image.
Some parameters can be set in special interactive setup windows. These windows are
similar to the preview windows, but contain additional controls that are used for setting the
parameter values.
19. Double-click the Value column for the parameter 04=Gray low, and click the button with
the three dots.
A preview of the image is displayed in a separate window, which also shows the ROI,
the line along which the image is searched (yellow), and the edge that is detected
using the current parameter values (red/green).
20. Click on the H (Gray High) or L (Gray Low) button, and adjust the upper or lower gray
value with the slider, so that the edge of the label is clearly visible within the ROI.
Certain tools have interactive setup windows in which you can set all parameters. These
tools have a Setup field in the bottom left corner of the program step in the program list. To
open the setup window, double-click the Setup field.
When all parameters have been set for the Find Column Edge step, we can duplicate the
step and use the copy to find the edge on the right side – just change the line to search
along.
21. Select the Find column edge and choose Edit Æ Copy from the main menu.
22. Choose Edit Æ Paste.
23. Set the line to scan along in the new Find column edge step by moving it in the preview
window.
24. Change the description of the program step to “Find right edge”.
25. Select the “Find left edge” step, and copy the value of the parameter 02=Column.
This value is the x coordinate for the left point of the label.
26. Paste the value into an empty row in the Value on Device column in the table.
The row is now highlighted in the table, indicating that the value on the device differs
from the value in the database.
You may also enter a description for the row, describing what the value is used for.
27. In the table, right-click the value in the Value on Device column, and choose Copy
Device Value to DB to synchronize the value on the PC with the value in the device.
28. Select the “Find left edge” step again, and double-click in the Table column for the
parameter 02=Column.
29. Fill in the number of the table row in which you pasted the value of the x coordinate.
30. In a similar way, copy the value of the parameter 02=Column in the “Find right edge”
step to the table, and replace the value in the program step with a reference to the
table row.
Now we are ready to add a step that calculates the angle of the top edge of the label.
The tool we are going to add takes the x and y coordinates of two points as parameters.
We just stored the x coordinates in the table, and the y coordinates are the results (output
parameters) of the two Find Column Edge steps in the program.
31. Add a Distance and angle tool (from the Measure toolbar) to the program.
32. Set the parameters 01=Start point X and 03=End point X to refer to the table rows
where you stored the x coordinates of the left and the right point on the label edge.
33. Double-click the Step column of the parameter 02=Start point Y.
A Previous result dialog box is displayed, in which you can select which result from
which program step number to use as parameter value.
34. Choose the step number of the first Find column edge step and then the first result
from that step (there is only one result to choose from), and click OK.
The numbers of the step and the result are entered in the Step and Result columns of
the 02=Start point Y parameter and the current value is displayed in the Value column.
35. In a similar way, set the parameter 04=End point Y to the result of the second Find
Column Edge step.
In range, which tests if a value lies within a range specified by the upper and lower limit
of the range, and returns 1 if the value is within the range or 0 if it is not within the ran-
ge.
If then goto, which jumps to a specified program step if a value is not zero.
The Distance and angle tool returns an angle between 0 and 360 degrees, but we would
like to specify an angle between for example -5 to +5 degrees as being a valid angle. One
way to get around this is to state that angles between 5 and 355 degrees are not accep-
ted, and any other angle is accepted.
90° 90°
Angle Out of Range
Angle In Range
180° 0° 180° 0°
α α
270° 270°
• Angle of the label is OK • Angle is not OK
• The test if the angle is • The test if the angle is
within “Out of Range” within “Out of Range” re-
returns 0, and no jump is turns 1, and the program
made jumps
To make it even more flexible, we will store the highest angle that is accepted in the table,
and calculate the range directly in the program step.
The value of the parameter 03=Max value allowed is an expression that calculates a value
each time this step is performed. An expression always begins with an equal sign (=), and
may contain:
Constant values 360, 4/7, etc.
Table values Vn for the value in row n
Results from other steps SmRn for result n of step m
Parameters (arguments) in other steps SmAn input parameter n of step m
Functions sin(), abs(), etc.
Instead of writing an expression, we could have used a Mathematical operation tool. Which
to choose depends on the complexity of the calculation – the more complex a calculation
the more efficient is the Mathematical Expression.
Finally, we add program steps that set one of the outputs of the camera to high or low,
depending on the result of the analysis. This can be used for example to control a lever
that pushes the faulty bottle to the side.
43. Add a Set output tool (from the Communication toolbar), and set the following
parameters:
01=0utput number 0
02=Signal value Low
Name the step “Angle within range”
44. Add a Goto tool (from the Program toolbar) and set the parameters so that this step
jumps to step 0.
45. Add another Set output tool, and set the following parameters:
01=0utput number 0
02= Signal value High
Name the step “Angle out of range”
46. Add a Goto tool and make sure that this step jumps to step 0.
47. Select the If then goto step, and set the parameter 02=Goto step to the step number of
the “Angle out of range” step.
It is not necessary to add the last Goto step, since the program automatically jumps to
step 0 when it comes to the end. It is however a good practice to make sure that the
program jumps to the right place at the end. For example, you may add steps at the
beginning of the program that initialize the program, and that we only intend to run when
the program starts.
48. Use Debug Æ Execute Step and Debug Æ Step by Step to step through the program and
make sure that it gives the correct result. Move the bottle (or what you are using) to
get both accepted and rejected labels.
Another way is to add some program steps that show the result of the analysis, and run
the program.
49. Add a Copy image bank tool after the first Grab step.
We add this step in order to have a copy of the image to draw in. If we draw in the
original image the analysis is affected by our drawings.
50. Add a Draw ROI tool after the ROI rectangle step.
This step draws the region of interest in the image. Make sure to draw in the image
bank with the copy of the image.
51. Add a Add text tool after the “Angle within range” step. Set the following parameters:
04=String ‘OK
06=String color Choose a green color
08=Size 2
You should also specify the location of the text to be displayed with the parameters
01=X origin and 02=Y origin. Make sure to draw in the correct image bank.
52. Add a Display tool after the Add text step, and set the parameter so that it displays
image bank 1.
53. Copy the Add text and the Display steps to after the “Angle within range” step. Change
the text to be displayed to ”Failed” and coloured red.
54. Choose Debug Æ Run and watch the result in the Display window.
Camera 1 Associated
Program Active 1
2
3
4
Program 5
...
Program
Camera 2 Banks
Associated Save in
Table Active Flash
Copy values
Table
manually
When you save the program in the flash memory on the device, you choose the program
bank in which the program is saved. You always save the program that is currently in the
working memory of the device, and the table that is active is also saved with the program.
To save the program on the flash memory of the device:
4. Right-click the device in the list of devices and choose Flash Æ Write Program in Flash.
5. Select the program bank in which to save the program, and click OK.
The program is now saved in the selected program bank.
If you save a program in program bank 0, this program will start when the device is powe-
red up. If you want the device to run a different program, you can load that program using
a PC, either by using an existing product (containing the program to be used), or by down-
loading the program from the device’s flash memory.
Device 3
Device 2
Device 1 Device 1
Product: Bottle Product: Jar
Dev Program Table Dev Program Table
1 Label Bottle_Label_Table 1 Label Jar_Label_Table
2 Bottle_FillLevel Bottle_FillLevel_Table
3 Jar_FillLevel Jar_FillLevel_Table
To use several devices in the product, simply select the devices by clicking the checkbox in
front of them in the main window.
When the development is finished you can easily download the programs and tables to all
included devices at once by right-clicking Devices in the left pane of the main window and
choosing Product Transmission. This will also start the programs in the devices.
Using Several Programs
While there can be only one program in the working memory, additional programs can be
stored in the flash memory of the device. These programs can either be loaded manually
into the working memory, or they can be called from the active program.
To load a program manually, use IVC Studio to associate the program with the device
and then start the program. This requires that the program is available in the product
that is open in IVC Studio.
If the program is not available on the PC, you can retrieve it from the device by right-
clicking the device in the list of devices, and choosing Flash Æ Import Program from Flash.
To call a program stored in flash from the active program, please refer to the Tools
section of this manual for information on which tool to use.
Note that calling a program stored in flash will load both a program and a table into the
working memory of the device, replacing the previous program and table there.
To reset data block Right-click the device and choose Device Management Æ Reset
memory Data Block from the pop-up menu.
To reset image banks Right-click the device and choose Device Management Æ
Reset Banks from the pop-up menu. It is also possible to
reset the image banks one by one when a program is open.
See chapter Handling Images for more information.
To restore data block Right-click the device and choose Device Management Æ
memory from a PC file Load Data Block from File from the pop-up menu.
To view device infor- Right-click the device and choose Device management Æ Device
mation Information from the pop-up menu.
This window contains detailed information about the device,
such as hardware and software versions, Ethernet information
and the status of the device.
To view the status of Right-click the device and choose Device management Æ Signal
running program, Status from the pop-up menu.
inputs and outputs This window shows the status of inputs and outputs of the
device. If a program is running you can also see which program
steps that are performed at the moment
To refresh displayed Choose Options Æ Refresh from the IVC Studio menu bar or
information on a press F5.
checked device
To refresh and dis- Choose Options Æ Update All from the IVC Studio menu bar or
play information on press Ctrl F5.
all devices
To record images Use a camera of the same type that you will emulate.
Select or write a program containing a Grab Setup tool defining
how to captures images, a Grab tool to capture the images, and a
Send to FTP tool to store the images in raw format in a selected
folder. The PC receiving the images must have an FTP server
running.
To use recorded Choose Emulator Æ Settings… from the IVC Studio menu bar.
images in the The Emulator settings dialog box is opened.
3.2.2 Basics
To enable the Choose Emulator Æ Enable… from the IVC Studio menu bar.
Emulator The Emulator settings dialog box is opened.
Select which camera type to emulate from the drop-down list.
Enter a numeric camera ID. The ID must be unique within the
Product. Maximum length is 9 digits.
Click Browse… and select a folder containing pre-recorded
images. The Emulator camera type must be of the same type
that was used when recording the images.
Click OK.
To disable the Choose Emulator Æ Disable from the IVC Studio menu bar.
Emulator The Emulator disappears from the list of Devices.
To enable the Choose Emulator Æ Settings… from the IVC Studio menu bar.
Emulator automa- The Emulator settings dialog box is opened.
tically
Tick Enable Emulator when launching IVC Studio and click OK.
The Emulator is now automatically enabled when starting IVC
Studio.
To change the Choose Emulator Æ Settings… from the IVC Studio menu bar.
Emulator settings If Type, ID, Number of image banks or Number of profile banks
is changed, the Emulator will be restarted.
To access the flash The flash disk of the Emulator is found on the PC under My
disk of the Emula- Documents (Documents in Vista) for the current user. The default
tor path to the Emulator flash is:
My Documents\SICKIVP\SmartCameras\IVC Studio x.x\ Emula-
tor\flash
Product
Devices
Label LabelTable
FillLevel FillTable
3.3.1 Basics
To create a new Choose File Æ New Product from the IVC Studio menu bar.
product An empty product named New Product is opened.
To open a product Choose File Æ Open Product… from the IVC Studio menu bar.
Select a product in the dialog box and click OK.
To save a product Choose File Æ Save Product from the IVC Studio menu bar.
If you try to open another product or to close IVC Studio without
saving the presently active product a dialog box appears promp-
ting you to do so.
If the product has not yet been saved, a dialog box is displayed.
Type the name of the product and click OK.
To make a copy of Choose File Æ Save Product As… from the IVC Studio menu bar.
the current product Type the name of the new product and click OK.
To revert to the last Choose File Æ Revert… from the IVC Studio menu bar.
saved version of
the current product
The product files can be stored in two formats; the standard .prd and a new extended
format (.prc) that also contains a checksum. The checksum is used to verify the integrity of
the product file to ensure that the contents have not been altered, e.g. by a problem in a
zip/unzip-procedure.
The new format is not compatible with IVC Studio versions prior to 3.1 SR1. The old format
is still supported, and existing files can easily be converted to the new format by using
“Save As” in IVC Studio 3.1 SR1 or higher.
To start all devices Right-click Devices in the left pane and choose Product Trans-
in a product mission from the pop-up menu.
To stop all devices Right-click Devices in the left pane and choose Stop Product
in a product from the pop-up menu.
Camera 1 Associated
Program Active 1
2
3
4
Program 5
...
Program
Camera 2 Banks
Associated Save in
Table Active Flash
Copy values
Table
manually
Basics
To create a new Right-click Programs in the tree view and choose New Program
program from the pop-up menu.
To delete a program Right-click the program in the tree view and choose Delete
Program from the pop-up menu.
To rename a program Right-click the program in the tree view and choose Rename
Program from the pop-up menu. Write the new name in the
dialog box that is displayed.
To print a program Right-click the program in the tree view and choose Print
Program from the pop-up menu.
To view program Right-click program in the tree view and choose Program
information Information from the pop-up menu.
A pop up window displays information such as program name
and dates of creation and last change and who made the
latest changes to the program.
To write product in Right-click Devices in the left pane and choose Write Product in
flash Flash from the pop-up menu. The currently associated pro-
duct and table is stored on the camera flash in position 0 for
each of the devices in the Device list. No action is performed
if the device is not associated with a program in the current
product.
To store a program in Right-click the device and choose Device Management Æ Flash
flash memory on the Æ Write Program in Flash from the pop-up menu. Select a
device memory position in the dialog window and click Save. The
table is automatically stored with the program.
To delete programs Right-click the device and choose Device Management Æ Flash
stored in flash Æ Delete Stored Program in Flash from the pop-up menu. This
deletes the program in the selected position in the flash
memory. It is also possible to delete multiple programs by
selecting more than one position.
To clear unused When a program is deleted from flash, the flash blocks
memory on flash occupied by the program is not immediately reused but
marked as unused (dead). The unused memory will not be
reused until there is no more free memory on the device. This
is done in order to minimize the wear of the flash memory.
To reuse a block of unused memory, it must first be cleared.
Clearing the memory takes some time and may affect the
performance of the device. To restore the performance, the
unused memory can be cleared manually.
To clear unused memory, right-click the device and choose
Device Management Æ Flash Æ Clear unused memory from the
pop-up menu. In the dialog box that is displayed, click Start
and wait for the device to be finished.
To import programs Right-click the device and choose Device Management Æ Flash
from flash program Æ Import Program From Flash from the pop-up menu. Select a
bank to PC program in the pop-up dialog window and click Save. The
associated table is automatically imported with the program.
3.5.1 Basics
To create a new table Right-click Tables in the tree view in the left pane and choose
New Table from the pop-up menu.
To show the contents of Right-click the table in the tree view and choose Show Table from
a table the pop-up menu.
To rename a table Right-click the table in the tree view and choose Rename Table
from the pop-up menu.
To delete a table Right-click the table in the tree view and choose Delete Table
from the pop-up menu.
To make a copy of a Right-click the table in the tree view and choose Copy Table
table from the pop-up menu. Click YES to confirm and name the new
table.
To import a table Right-click Tables or a table in the tree view and choose Import
from a file on the PC Table from the pop-up menu.
To export a table to a Right-click the table in the tree view and choose Export Table
file on the PC from the pop-up menu.
To store a table in the flash memory on a device, store the program associated with the
table. To import a table from a device, import the associated program. When writing a table
to the flash memory on a device, the descriptions are not saved, and are therefore not
included when the table is imported from the device.
To enter a parameter Right-click the table in the tree view in the left pane and choose
value in the table Show table, or double-click the table in the tree view. A separate
table window opens. Double-click the cell in the Value on Device
column and enter a value. Close the table window and click
YES to save the entered values.
To copy a parameter Right-click the device and choose Show Table from the pop-up
value from the PC to menu. Right-click the row in the DB Value column and choose
the device Copy DB Value to the Device from the pop-up menu.
To set parameter Right-click the table in the tree view in the left pane and choose
comment in the table Show table, or double-click the table in the tree view. A separate
table window opens. Double-click the cell in the Description
column and enter a comment. Close the table window and click
YES to save the entered values.
To save the table in Right-click the device and choose Device Management Æ Flash Æ
the flash memory Write Program in Flash from the pop-up menu. Select a memory
position in the pop-up dialog window and click Save. The table
is automatically stored with the program.
3.8 Programming
To add program steps To add a program step click the icon for the tool.
To cut or copy steps Click the program step in either the right pane or in
the program list in the left pane and choose
EditÆCut or EditÆCopy.
Note that cut does not remove the step from the
program list until it is pasted in its new location.
To select multiple program steps press the Ctrl key
as you select steps.
To paste steps Click the program step in either the right pane or in
the program list in the left pane and choose
EditÆPaste.
To delete a program step Click the program step in either the right pane or in
the program list in the right pane and choose Delete
Step from the pop-up menu.
Setup button
Double-click the Setup button to open a
window enabling interactive setup.
To create a new Right-click Macro in the tree view and choose New Macro from
macro the pop-up menu.
To delete a macro Right-click the macro and choose Delete Macro from the pop-up
menu.
To make a copy of a Right-click the macro and choose Copy Macro from the pop-up
macro menu. Click YES to confirm and name the new macro.
To import a macro Right-click Macro or a macro in the tree view and choose
Import Macro from the pop-up menu.
To export a macro Right-click the macro in the tree view and choose Export Macro
from the pop-up menu.
To print a macro Right-click the macro in the tree view and choose Print Macro
To change name and Right-click the macro in the tree view and choose Macro
description of a macro Properties from the pop-up menu. This opens the Macro
Properties window. Enter macro name and a description in
the Name and Description fields and click OK.
To change a macro You need an icon with file extension .ico consisting of two
icon images. One 16 x 16 pixels and one 32 x 32 pixels. The
smaller is used in the IVC Studio tree view, and the larger in
the IVC Studio toolbar.
Right-click the macro in the tree view and choose Macro
Properties from the pop-up menu. Enter the path to the icon
image in the Icon field, or use the browse button, and click OK.
To specify arguments Right-click the macro in the tree view and choose Macro
and results Properties from the pop-up menu. Select one of the tabs
Arguments or Results. Add arguments and results by using the
+! button.
Note: If the execution time of a step exceeds the IVC Studio communication timeout
(default 2500 ms), an ITF-2 error is displayed in IVC Studio, even though the camera is still
executing the step. By pressing F5 or F8 again, the connection to the camera is restored,
and the results from the step will be displayed in the step program view.
2) subroutines
3) macros
Name step tools more specifically than the tool’s original name.
Example: Rename “Scan rows” to “Scan rows, find upper left edge” or “If go” to “If width
too small, go to fail”.
Name the first step in the sequence in accordance with the purpose of the entire high-
level function when a sequence of steps is grouped.
Example: If 12 steps are used to localize a blob and find its uppermost edge pixel, then
rename the first step to “Find top edge of blob” and indent the remaining 11 steps.
Add dummy steps with the only purpose to give a sequence of indented steps a good
name, and to retain the possibility to give a more specific name to the first image pro-
cessing step of the sequence. For example, a ‘Goto‘ tool that only goes to the next step
can be used.
4 Tools
IVC Studio contains about 100 advanced image processing tools. These tools are avail-
able on the toolbar in the programming window, and are grouped into the following catego-
ries.
Image The image tool group contains tools that are used for taking a picture
to work with, adding graphics to the images and editing the image
banks, which is the image memory in the camera.
Region of Interest The region of interest (ROI) tools are used for defining an area in
which the other tools should work. These tools speed up the image
processing since the entire image is not treated.
Filter The filter tools can be applied to enhance features in the image.
Available tools are erode and dilate tools as well as binarize tools for
transforming grayscale images to binary.
Edge The edge tools are used to find object edges in the pictures and
thereby the coordinates of the objects. It is possible to scan the im-
age from all different directions and also to find multiple edges on
one specific line.
Measure This category contains tools that measure area, center of mass, find
and measure blobs and measure distance and angle.
Matching The matching tools are used for teaching the camera to recognize an
object, and then using this for locating objects in images, counting
the number of objects, or for calculating the rotation of objects.
Circular The group of circular tool contains a specific set of tools. These tools
make it possible to check perimeters of objects, diameters, the sur-
face and the outer shape of objects.
Calculation Calculation tools are used for example for determining whether or
not values are in correct ranges, or calculating the deviation of round
objects from circles.
Program The step programming tools are used for defining loops and condi-
tions in programs. Some of the available tools are: For, If, Else, If
then goto, If in range goto, Run program, and Subroutine.
The subroutine is a powerful tool when optimizing the program. It
increases the overview and readability of your program.
System The system group contains tools for inserting delays in the program,
saving values or results to a permanent flash memory, and writing
and reading result or parameter values to a memory separate from
the actual program (the Table).
Communication The communication tools are used for sending values over RS485
and Ethernet.
Input/Output The tools in the Input/Output group handle reading of digital inputs
and setting digital outputs.
Reader The reader tools are used for reading barcodes and DataMatrix 2D
codes in the images. These tools are only available in the Reader
version of IVC-2D.
4.1 Image
Grab Setup
With Grab Setup the user can set properties on the device such as shutter and gain as
well as illumination properties and thereby control some parameters used for image
acquisition. Grab Setup is basically used to specify how to grab an image. Acquisition tools
such as ‘Grab’, ‘Start Snapshot’ and ‘Ping-Pong Grab’ specify when to grab images and
where the images should be placed.
Grab Setup is often used early on in a program, but can be used more than once if a
parameter has to vary during the program execution.
Input Parameters
01 = Exposure time (us) This parameter defines how many micro seconds the
shutter is open. Common values for this setting are
4000-25000.
02 = Gain This parameter sets the gain for the device. Common
values are 300-600 for this parameter.
03 = External trigger This parameter defines whether the acquisition tools
should be synchronized with an external trigger signal.
04 = Trigger slope If the External trigger parameter is set to true, this
parameter indicates if the synchronization should be on
a rising or falling flank of the external trigger signal.
05 = Strobe enable If a trigged source of illumination is used, this parame-
ter should be set true.
06 = Strobe time (us) If the Strobe enable parameter is set true this parame-
ter specifies the duration of each strobe flash in micro-
seconds. Allowed values are 10–400.000 us.
Returned Values
None
Start Snapshot
Start snapshot is to be used in combination with the ‘Grab’ tool for image acquisition in
applications where speed is of great importance. Start snapshot indicates the start of a
block of instructions executed in parallel with the image acquisition. The ‘Grab’ tool con-
cludes the parallel processing and makes sure that both processes are completed before
execution of any step following ‘Grab’ starts. When using ‘Grab’ in combination with Start
The Emulator does
not emulate this
snapshot, the Destination bank parameter is set in the Start snapshot tool and the pa-
tool. See section rameter in the ‘Grab’ tool is simply ignored.
Handling the
Emulator for more
Note that the execution time of ‘Grab’ in run mode is longer than what is indicated in step
information.
mode in the case where intermediate steps have shorter execution time than the time of
an image acquisition.
Input Parameters
01 = Destination bank The image is placed in the image bank indicated by this
parameter sometime after the execution of Start snapshot
but before the execution of Grab has completed.
Returned Values
None
Grab
Grab is the most common tool for image acquisition and has different functions depending
on how it is used, and depending on if the Emulator or a hardware camera is the selected
device. It can be used alone or in combination with the ‘Start Snapshot’ tool.
Input Parameters
01 = Destination bank When the Grab tool is used alone this parameter indicates in
which image bank the acquired image is placed.
Returned Values
01 = File Name The file name of the acquired image file.
Error Messages
Err. = 8605 A 3D image cannot be loaded into a 2D camera.
Err. = 8606 The image size is not correct.
Ping-Pong Grab
Ping-pong grab is an important tool in applications where new images must be acquired
fast and often. The first time Ping-pong grab is executed in your step program, an image is
grabbed and placed in the image bank indicated by the parameter Destination bank A.
The result value is then set to the same value as that parameter to indicate that the image
in this bank is available to work with. Then an acquisition of a new image, which is placed in
the image bank indicated by the Destination bank B parameter, is initiated in parallel with
execution of steps following Ping-pong grab. After the first time a Ping-pong grab is exe-
cuted in the program, the function is as follows.
Ping-pong grab waits for previously acquired images to be placed in an image bank if that
process is not yet completed. The result value states which bank that is and a new image
acquisition is initiated in parallel with steps following the Ping-pong grab step. The new
image should be placed in a different image bank indicated by one of the Destination bank
parameters. If n is a positive integer, the new image is placed in Destination bank A the
(2n)th time Ping-pong grab is executed and in Destination bank B the (2n+1)th time.
Note that the same Ping-pong step can be executed several times by using loops or jump
steps. The idea of this tool is that the execution time of the Ping-pong grab step is much
shorter than a regular image acquisition except the first time the tool is executed in a
program and in the case where intermediate steps have shorter execution time than the
time of an image acquisition. Also note that the execution time of Ping-pong grab in run
mode is longer than what is indicated in step mode for the latter case.
Input Parameters
01 = Destination bank A Indicates the image bank in which an image is placed the
(2n)th time the tool is executed in the program.
02 = Destination bank B Indicates the image bank in which an image is placed the
(2n+1)th time the tool is executed in the program.
Returned Values
01 = Result bank Indicates which bank contains an image ready to work on.
Note that the contents of the destination bank are replaced by the new copy. There is no
undo function. Replaced data in the destination bank is lost.
Input Parameters
01 = Source bank This parameter indicates the image bank number to copy
from.
02 = Destination bank This parameter indicates the image bank number where the
new copy is placed.
Returned Values
None
Input Parameters
01=Source bank The image bank containing the image to copy from.
02=ROI definition The step number in your program, which holds the definition of
step which region of interest in the image that the operation is per-
formed for.
03=Mathematical Specifies which mathematical operation to perform when copying
operation pixels from the ROI of the source image to the destination bank.
Min (and) The resulting image will contain the darkest of the
corresponding pair of pixels from the source and
the destination images.
For binary images the corresponding pixels in both
images must be white for the resulting pixel to be
white. This is equivalent to an AND operation.
Max (or) The resulting image will contain the brightest of the
corresponding pair of pixels from the source and
the destination images.
For binary images the resulting pixel is white if
either the source or destination pixel is white. This
is equivalent to an OR operation.
Diff (xor) The gray level of each resulting pixel is calculated
by:
absolute value of (gray level in source image -
gray level in destination image)
Two identical images results in a black image.
For binary images the resulting pixel is white if
either the source or destination images are white
but not both. This is equivalent to an XOR opera-
tion.
Inv (not) The gray level of each resulting pixel is calculated
from:
(243 - gray level in source)
Colored pixels (gray level > 243) are simply copied
by this operation.
For binary images the resulting pixel in the target
bank will be white if the source image is black and
vice versa. This is equivalent to a NOT operation.
Copy Copies every pixel in the ROI of the source image
to the destination bank.
04=Destination The image bank in which the resulting image is placed. For most
bank of the operations the result is affected by any image that is
stored in this bank prior to executing this tool.
Returned Values
None
Error Messages
Err. = 7704 The region of interest has parts that are outside the source bank.
Example
Source Destination
Min (and)
Max (or)
Diff (xor)
Inv (not)
Copy
Add Text
This tool adds a text strip to an image bank. The text itself as well as the background strip
can be drawn in the color or gray scale value of your choice.
The text can consist of a text string, a number or both. If the String type parameter is set
to Text, the text string can of course hold numbers, but they will be static. If String type is
set to Text and variable or Variable, variable values can be part of the text strip.
When double clicking the values of String color or Background color parameters, the
respective colors can be specified as numbers or chosen from an interactive menu. Possi-
ble inputs are numbers between 0 and 255, where 0 through 243 are gray scale values
and 244 through 255 are various colors.
Input Parameters
01 = X coordinate The x-coordinate of the upper left corner of the text strip.
02 = Y coordinate The y-coordinate of the upper left corner of the text strip.
03 = String type This parameter specifies whether the text strip is a static
text, a variable value or a combination. For the latter case,
the variable value will follow the static string with a space
in between.
04 = Text This parameter specifies the static text.
05 = Variable This parameter specifies the variable value. Note that the
value can be given as a constant value, evaluated by an
expression, a table value or be an argument or result from
a previous step.
06 = String color The gray scale value or color code that specifies the color
of the text. Allowed values are 0 through 255.
07 = Background color The gray scale value or color code that specifies the color
of the strip behind the text. The value 254 is transparent.
08 = Size This parameter specifies the size of the font where 1 is the
smallest and 8 is the largest font available.
09 = Destination bank The image bank in which to overlay the text.
Returned Values
01 = String length Number of letters in the text strip. Note that the space
between the string and the number is included in the count
if String type is set to Text and variable.
02 = Character width The number of pixels each letter is wide.
03 = Character height The text strip height in pixels.
Draw Line
This tool adds a line to an image bank. The line is 2 pixels wide and can be drawn in the
color or gray scale level of your choice. The line can for instance be used to separate
blobs, to enhance an edge between two known points or simply for visualization. When
double clicking the value of the Color parameter, the color of the line can be specified as a
number or chosen from an interactive menu. Possible inputs are numbers between 0 and
255, where 0 through 243 are gray scale values and 244 through 255 are various colors.
Input Parameters
01 = Start point X The x-coordinate of the first end point.
02 = Start point Y The y-coordinate of the first end point.
03 = End point X The x-coordinate of the second end point.
04 = End point Y The y-coordinate of the second end point.
05 = Color The gray scale value or color code that specifies the color of
the line. Allowed values are 0 through 255.
06 = Destination bank The image bank in which to overlay the line.
Returned Values
None
Draw ROI
This tool draws a previously defined ROI in a selected image bank. It is possible to choose
if the interior area or the contour of the ROI should be colored. To color the contour set the
Filling parameter to False, to color the whole area set the Filling parameter to True.
Drawing a ROI in a bank is used for visualization of the current ROI and to control the
selected area for next coming processing steps.
Input Parameters
01 = ROI definition step Number of the step with the ROI to show in the
selected image bank.
02 = Color Select a color to mark the ROI. Double-click on the
input field to choose from a color palette.
02 = Filling True whole area of the ROI will be color with
the selected color.
False only the contour of the ROI will be color.
03 = Destination bank Number of destination bank in which to draw the
selected ROI.
Returned Values
None
Input Parameters
01 = First bank to reset This parameter specifies the number of the first
image bank to reset.
02 = Number of banks to reset This specifies how many image banks to reset.
03 = Color The gray scale value or color code that specifies
with which color the image banks should be filled.
Color values are 0 through 255.
Returned Values
None
Display
The display tool is used for showing an image bank and a table with ten variable values in
a separate Run window when the program is running. The Run window is only displayed
when the program is running, and not when stepping through or debugging the program.
Each time the tool is executed, a new row is added to the table in the Run window, show-
ing the current values of the variables. The table can display up to 150 values. For each
numerical variable, the mean value and deviation is calculated and displayed at the bottom
of the Run window.
If the variable refers to a value stored in the table, the description in the table for that row
is used as header of that variable’s column. When displaying a value from a previous
program step, the name of that result is used as the header. For any other type of variable
(numerical value, string or expression) the column has the parameter name (Variable 1 –
10) as header.
It is possible to export the values of the variables to file. If the “Export variable values”
checkbox is checked when closing the Run window, a save dialog is displayed allowing the
user to specify a file name and location. Up to 10.000 of the rows displayed in the Run
window are saved to the file. If more than 10.000 rows have been displayed, it is only the
10.000 latest rows that will be saved to file. N.B. variables that are longer than 100 char-
acters will be truncated.
If the communication between PC and the device should be interrupted, for instance by
pulling the Ethernet cable from the PC, the execution in the device goes on but the up-
dates by the Display tool will be stopped until the connection is re-established.
Input Parameters
01 = Source bank The number of the image bank to display when the program is
running.
02 = Binarized color Specifies a color or gray level to mark out pixels that are ON in
an image returned by the 'Binarize' tool.
03 = Variable 1 The parameters 03–12 specifies the values to be displayed
04 = Variable 2 in the table
…
12 = Variable 10
Returned Values
None
Mirror Image
This tool mirrors an image by specifying the axis around which to mirror.
Input Parameters
01=Source bank Image bank containing the image to be mirrored.
02=Destination Image bank in which to display the mirrored image.
bank
03=Mirror around The axis around which to mirror:
axis Vertical Mirror around the Y axis.
Horizontal Mirror around the X axis.
Returned Values
None
Rotate Image
This tool rotates an image by specifying the angle and the center of rotation.
The image can be rotated around its center or around a specified point. The center of
rotation is in the latter case specified by the parameters X center and Y center.
The image can also be moved after rotation, but before being copied to the destination
bank. The parameters X offset and Y offset specifies the distance to move.
The rotated image is displayed in the Destination image bank. Note that only the part if the
image that after the rotation is located within the ROI will be displayed in the destination
bank.
The parameter Interpolation method controls how the pixel values are calculated in the
destination image. It is possible to choose between bilinear interpolation (gives higher
image quality) or nearest neighbor (gives faster execution time).
Input Parameters
01=Source bank Image bank containing the image to rotate.
02=Destination bank Image bank in which to display the rotated image.
03=ROI definition step Step number where the ROI to use was created.
04=Angle The counter-clockwire rotation angle, in degrees.
05=Rotation around True The rotation point is in the centre of the ROI and
center the following two parameters are ignored.
False The coordinates for the rotation point are set by
the following two parameters.
06=X center The X coordinates for the rotation point. X = 0 is on the left
side of the FOV.
07=Y center The Y coordinates for the rotation point. Y = 0 is at the top
of the FOV.
08=X offset The distance in pixels along the x axis to move the rotated
image.
09=Y offset The distance in pixels along the y axis to move the rotated
image.
10=Interpolation The interpolation method to use when calculating the pixel
method values in the destination image.
Returned Values
None
ROI Rectangle
This tool generates on every type of image a rectangular shaped ROI (Region Of Interest).
The ROI is used to define a rectangular limited working area to perform image processing
steps or other functions.
To set the position and dimension of the ROI it is possible to type the coordinates of the
top left corner of the rectangle and the size specifying the width and the height in pixels.
During the setup of the ROI it is also possible to set the size of the ROI and position in the
preview using the left mouse button. Double-clicking the image in the preview opens a
larger image to set the ROI with the mouse more precisely.
It is possible to define the position of the ROI relative to a previously generated result. This
is done by setting an offset of the top left corner of the ROI using the input parameters X
offset and Y offset. The values of the offset must come from a previous step result or from
the table.
The ROI is plotted in the current preview.
Input Parameters
01 = X offset Offset value of the upper left ROI corner in x direction. To set an
offset the value must come from the table or as a result from a
previously performed program step.
02 = Y offset Like above but for Y direction.
03 = X coordidate X coordinate for the top left corner of the ROI.
04 = Y coordinate Y coordinate for the top left corner of the ROI.
05 = Width Width of the ROI (in X direction) in pixels.
06 = Height Height of the ROI (in Y direction) in pixels.
Returned Values
None.
Error Messages
Err. = 148 Error in ROI means that parts of the ROI are out of the FOV.
Reduce size of ROI.
Check X and Y origin.
Check offset values.
Check Width and Height parameters.
Input Parameters
01 = Source Copy the selected image bank to the preview bank
bank
02 =X offset Offset value of the upper left ROI corner in x direction. To set an
offset the value must come from the table or as a result from a
previously performed program step.
03 = Y offset Like above but for Y direction.
04 = Rotation True means that the rotation point is in the centre of the ROI
around center and the following two parameters are ignored.
False means that the coordinates for the rotation point are set
by the following two parameters.
05 = Rotation Set the X coordinates for the rotation point. X = 0 is on the left
point X side of the FOV.
06 = Rotation Like above but for Y direction. Y = 0 is on the top of the FOV.
point Y
07 = X coordinate X coordinate for the top left corner of the ROI (before rotation).
08 = Y coordinate Like above but for Y direction (before rotation).
09 = Width Width of the ROI (in X direction) in pixels (before rotation).
10 = Height Height of the ROI (in Y direction) in pixels (before rotation).
11 = Angle Rotation angle with respect to the rotation point. Input values are
the rotation angle in degrees.
Positive values mean counterclockwise rotation.
Negative values mean clockwise rotation.
Value = 0 means no rotation.
12= Destination Number of destination bank (-1= no display of the ROI in the
bank preview window).
Returned Values
None
Error Messages
Err. = 107 points out of bank means that the rotation of the ROI
leads out of the FOV.
Reduce size of ROI.
Check offset values.
If using rotation point change coordinates of rotation point.
ROI Circle
This tool generates a circular shaped ROI (Region Of Interest). The ROI defines a circular
limited working area in which to perform image processing or other functions.
To set the position and dimension of the ROI it is possible to type the coordinates of the
center of the circle and radius length in pixels. During the setup of the ROI it is also possi-
ble to set the size of the ROI and position in the preview using the left mouse button.
Double-clicking the image in the preview opens a larger image to set the ROI with the
mouse more precisely.
It is also possible to define the position of the ROI relative to a previously generated result.
This is done by setting an offset to the top left corner of the bounding box of the circle
using the input parameters X offset and Y offset. The values of the offset must come from
a previous step result or from the table.
Input Parameters
01 = X offset Offset value of the upper left corner of the bounding box in X
direction. To set an offset the value must come from the table or
as a result from a previously performed program step.
02 = Y offset Like above but for Y direction.
03 = X center X coordinate of the center of the circle.
04 = Y center Like above but for Y direction.
05 = Radius Length of the circle radius in pixels.
Returned Values
None
Error Messages
Err. = 148 Error in ROI means that a part of the ROI is out of the FOV.
Reduce circle radius.
Check offset and center parameters.
ROI Ellipse
This tool generates on every type of image an elliptical shaped ROI (Region Of Interest).
The ROI is used to define an elliptic limited working area to perform image processing
steps or other functions.
The position and dimension of the ROI can be set by specifying the coordinates in pixels of
the center of the ellipse (X center and Y center) and radius of the axes in X and Y direction
(X radius and Y radius). The ROI can also be set by adjusting the position and dimension in
the Preview of the program step. Double-clicking on the preview image opens a larger
window with the image to work in.
It is also possible to define the position of the ROI relative to a previously generated result.
This is done by setting an offset of the top left corner of the bounding box of the ellipse
using the input parameters X offset and Y offset. The values of the offset must come from
a previous step result or from the table.
Input Parameters
01 = X offset Offset value of the upper left corner of the bounding box in X
direction. To set an offset the value must come from the table or
as a result from a previous program step.
02 = Y offset Offset value of the upper left corner of the bounding box in Y
direction. This value must come from the table or be a result from
a previous step.
03 = X center X coordinate of the centre of the ellipse.
04 = Y center Y coordinate of the centre of the ellipse
05 = X radius Radius of the axes in X direction in pixels.
06 = Y radius Radius of the axes in Y direction in pixels.
Returned Values
None
Error Messages
Err. = 148 Error in ROI means that a part of the ellipse is out of the
FOV.
Check radius parameters.
Check center and offset coordinates.
ROI Perimeter
ROI perimeter generates a ROI which shape, position and size is defined by the found
contour pixels from the ’Perimeter’ tool. The ’Perimeter’ tool traces the contour of an object
and returns the pixels which are found along the contour and this is used as input. The
’Perimeter’ tool is found in the Measure category.
Note: The ROI perimeter tool can only be used after the ’Perimeter’ tool is executed in a
previous program step.
With the Margin parameter it is possible to expand or shrink the ROI with respect to the
original shape. A positive margin value will expand the ROI in each direction by the typed
value in pixels. A negative margin will shrink the ROI. If a positive margin value is used
make sure that the resulting ROI is not larger than the total FOV of the camera. If a nega-
tive margin value is used make sure that the typed value will not produce negative results
for the size of the ROI.
The parameter Filling controls if the area inside the ROI is colored red (internal) or if only
the contour of the ROI (external) is colored red.
Input Parameters
01 = Perimeter definition Number of the step with the ’Perimeter’ tool which
step provides the contour pixels to process the ROI.
02 = Margin Positive or negative values to expand or shrink the size
of the ROI.
03 = Filling 0=internal whole area of the ROI will color red.
1=external only the contour of the ROI is color
red.
04 = Destination bank Number of destination bank to display the ROI.
-1= no display of the ROI.
Returned Values
None
Error Messages
Err. = 152 Error in ROI from perimeter
Check Margin values and make sure that the result will
not produce negative results or lead outside of the
FOV.
ROI Union
This tool unifies two different ROIs from previous program steps to one single ROI.
The two ROIs to be unified are named ROI A and ROI B. The resulting single ROI is the
addition of ROI A and ROI B. If it is necessary to display the unified ROI use the ‘Draw ROI’
tool in the Image category.
Input Parameters
01 = ROI A definition step Reference to program step to select ROI A
02 = ROI B definition step Reference to program step to select ROI B
Returned Values
None
ROI Intersection
This tool generates a new ROI from the intersection of two different ROIs.
The resulting single ROI is the intersection of ROI A and ROI B. If it is necessary to display
the unified ROI use the ‘Draw ROI’ tool in the Image category.
Note that if the selected ROI A and ROI B have no intersection at all this tool will not gene-
rate a new ROI. In that case this could be the cause for error messages if input parameter
ROI definition from a different tool refers to the result of this tool.
Input Parameters
01 = ROI A definition step Reference to program step to select ROI A
02 = ROI B definition step Reference to program step to select ROI B
Returned Values
None
ROI Difference
This tool performs a subtraction between two different ROIs and generates as result a new
ROI. The subtraction will be executed as follows:
Resulting ROI = ROI A – ROI B.
If it is necessary to display the unified ROI use the ‘Draw ROI’ tool in the Image category.
Note that if the selected ROI A and ROI B are identical this tool will not generate a new ROI.
In that case this could be the cause for error messages if input parameter ROI definition
from a different tool refers to the result of this tool.
Input Parameters
01 = ROI A definition step Reference to program step to select ROI A
02 = ROI B definition step Reference to program step to select ROI B
Returned Values
None
4.3 Filter
Dilate
This tool shifts a 3 by 3 matrix over the image and replaces the value of the center matrix
element with highest value out of the surrounding matrix elements. In general this tool
erodes dark pixels and can be used to reduce image artifacts due to single dark pixels.
Sometimes it is necessary to repeat this step several times until the desired result is
achieved.
250 80 80 250 80 80
Figure – The value of the center matrix element is changed to the highest value out of the
surrounding matrix elements.
Input Parameters
01 = Source bank Image bank containing the image to dilate.
02 = ROI definition step Step number where the ROI to use was created.
03 = Destination bank Image bank in which to display the dilated image.
Returned Values
None
Erode
This tool shifts a 3 by 3 matrix over the image and replaces the value of the center matrix
element with lowest value out of the surrounding matrix elements. In general this tool
erodes pixels with high values (bright or high) and can be used to reduce image artifacts
due to single white pixels.
Sometimes it is necessary to repeat this step several times until the desired result is
achieved.
250 80 80 250 80 80
Figure – The value of the center matrix element is changed to the lowest value out of the
surrounding matrix elements.
Input Parameters
01 = Source bank Image bank containing the image to erode.
02 = ROI definition step Step number where the ROI to use was created.
03 = Destination bank Image bank in which to display the eroded image.
Returned Values
None
Filter
This tool offers the following three filter types:
1. Smooth
2. Edge
3. Median
Smooth
The Smooth filter shifts a 3 by 3 matrix over the image. The value in the matrix center will
be replaced by the mean value out of the surrounding 8 matrix elements, as shown in the
following figure:
50 50 50 50 50 50
Figure – The value of the center matrix element will be replaced by the mean value out of
the surrounding 8 matrix elements.
Edge
The Edge filter is based on a sobel filter in x and y direction and detects edges in the
image.
Median
The Median filter is similar to the Smooth filter, but the value in the matrix center is repla-
ced by the median value of the surrounding elements, instead of the mean value.
The result of the median filter is an image where noise and small details (single pixels) are
removed but edges are preserved.
Note that the both filter types operate only inside the selected ROI. The results are
displayed in a user defined image bank.
Input Parameters
01 = Source bank Image bank containing the image to be filtered.
02 = ROI definition step Step number where the ROI to use was created.
03 = Filter type Smooth Smooth the part of the image inside the ROI.
Edge Detects edges of the image part inside the
ROI.
Median Smooth the part of the image inside the ROI.
04 = Destination bank The image bank in which to display the filtered image.
Returned Values
None
Stretch Gray
This tool rescales the distribution of gray values in the image. All pixels in the image with a
gray value below a lower threshold are set to gray value 0. All pixels with gray values above
an upper threshold are set to gray value 255. Gray values between the two thresholds are
rescaled. The lower threshold defines gray value 1 and the upper threshold gray value
244. In general the histogram is cut at both ends and the cut-out stretched between gray
value 1 and 254.
In a second step it is possible to adapt the thresholds to the particular distribution of the
gray values. For example the total amount of pixels between the thresholds is 10.000 and
the parameter Pixel percentage is set to 10 %. The tool cuts off 10.000 • 0.1 = 1.000
pixels on each side of the re-scaled histogram. See figure for further explanation.
The upper and lower thresholds can be set in an interactive setup by clicking button that is
displayed when double-click the parameters’ value field. This new window allows setting
the upper and lower thresholds for the gray values with a slider. All gray values of pixels
with gray values within the two thresholds are rescaled. Pixels above and below thresholds
are set to 255 and 0 respectively.
This tool is useful for adjusting the gray values in the image for specific program steps.
a)
b)
1.000 pixels
c)
Figure – a) Original histogram of the image. All gray values below the lower threshold are set
to gray value 0 and gray values above the upper threshold to 255.
b) The original histogram between the thresholds is stretched out from gray level
value 1 to gray level value 254. The example mentioned in the text cuts off 1.000
pixels (up to the dashed line) on each side of the re-scaled histogram. Depending
on the shape of the histogram two new thresholds are calculated.
c) Same procedure as from a) to b) the histogram between the dashed lines is
stretched from gray value 1 to gray value 2.
Input Parameters
01 = Source bank Image bank that contains the image to be processed.
02 = Gray low Threshold for lower gray value.
03 = Gray high Threshold for upper gray value.
04 = Pixel percentage Amount of pixels to cut beginning from lower and upper
threshold. Value in percent.
A value of 9.6 means that the brightest 9.6 % and the
darkest 9.6 % of the pixels are set to 255 and 0 respec-
tively, and the remaining 80,8% will be redistributed.
05 = Destination bank Image bank in which to store the resulting image.
Returned Values
01 = Gray low Calculated new lower threshold (depends on the parame-
ter Pixel percentage).
02 = Gray high Calculated new upper threshold (depends on the parame-
ter Pixel percentage).
Error Messages
Err. 162 Error in percentage threshold
Check the parameter Pixel percentage. The current setting
may have caused the returned values Gray low to be
higher than Gray high.
Detail Extraction
The Detail Extraction tool finds image details that “stick out” from the background. In 2D
images details that are in contrast with the background are enhanced, such as dark text on
bright background, bright text on dark background, spots, misprints or other defects on
surfaces.
It is recommended to use the interactive setup to customize the parameters. Double-click
on the Setup button to open the interactive setup window. For more information on the
interactive setup, see Detail Extraction Setup on page 232.
The result from the tool is a new image where only two intensity values are represented –
bright for details and dark for background.
Original image
Thresholded image
Figure –Filtering an image with the Detail Extraction tool, compared with thresholding the
image.
In the Operator Type parameter you set how the deviation search should be carried out.
Note: Pixels near the edges of the ROI are affected by pixels outside the ROI.
Input Parameters
01 = Source Bank Image bank containing the image to be filtered
02 = ROI Definition Step Previous program step defining the ROI to be used by
this tool
03 = Operator Type Defines which set of neighbouring points to consider
when locating deviating points:
Horizontal Compare the current point to
the horizontal neighbours.
Vertical Compare the current point to
the vertical neighbours.
Four points Compare the current point to
the horizontal and vertical
neighbours.
Eight points Compare the current point to
the horizontal, the vertical and
the diagonal neighbours.
Full Region(slow) All pixels inside the operator
radius are considered
04 = Threshold The minimum difference in gray value between a pixel
and the background that is allowed to consider the
pixel a detail.
05 = Operator Radius The radius in which the Operator Type will operate
within. This determines how far from the current point
the considered neighbour points should be.
06 = Destination Bank Image bank in which to store the filtered image
07 = Deviation Type Specifies whether the details to look for are brighter
(Bright), darker (Darker) or both brighter and
darker (Bright + Dark) than the background.
Note: If the Operator Type parameter is set to Full
region, the Bright + Dark option is not available.
Returned Values
01 = Number of Detail Pixels The total number of detail pixels found.
Binarize
This tool creates a binary image based on the image in Source Bank. All pixels inside the
ROI that have gray scale values between a lower and an upper threshold are set to a ‘high’
value. All other pixels are set to a ‘low’ value. Return values are the total number of pixels
in the ROI that are in range (within the threshold bounds) and the number of pixels that are
out of range (outside the threshold bounds). The resulting binary image is written to the
image bank pointed out by the Destination Bank parameter.
This tool is suitable as a pre-processing step to further image processing.
It is recommended to use the interactive setup to customize the parameters. Double-click
on the Setup button to open the interactive setup window. For more information on the
interactive setup, see Binarize Setupon page 234.
Input Parameters
01 = Source bank Image bank containing the image to binarize.
02 = ROI definition step Step number where the ROI to use was created.
03 = Gray low Lower threshold for gray value.
04 = Gray high Upper threshold for gray value.
05 = Destination bank Image bank in which to display the binarized image.
06 = Threshold mode Available options are:
Manual
Set the upper and lower thresholds yourself.
Automatic
Automatically sets the thresholds. Pixels within the
range become white, and the pixels outside the
range become black.
Automatic inverted
Automatically sets the thresholds, but with inverted
colors compared to the Automatic mode.
07 = Output level Defines which gray value to use for pixels within the
specified range. Allowed values are 0-255, where 0-
243 represent gray values and 244-255 represent
display colors.
Returned Values
01 = Pixels in range Total number of found pixels between the lower and
the upper threshold.
02 = Pixel out of range Total number of found pixels outside the lower and the
upper threshold.
03 = Low Threshold Low threshold value
04 = High Threshold High threshold value
4.4 Edge
Input Parameters
01 = Source bank Image bank containing the image to be processed.
02 = Row Row number for the row to be scanned. 0 = top of FOV
03 = Analysis direction Scan direction.
Left –> Right beginning from the left side of the
ROI.
Right –> Left beginning from the right side of the
ROI.
04 = Gray low Low gray value threshold.
05 = Gray high High gray value threshold.
06 = ROI definition step Step number where the ROI to use was created.
Note that only ROIs generated by the 'ROI rectangle' tool
can be used.
Returned Values
01= Column Returns the number of the column where the found pixel is
located. This could be used as the X-coordinate of the
found pixel.
Error Messages
Err. = 107 Error: points out of bank
Check if the specified ROI is generated by a 'ROI rectangle'
tool.
Err. = 108 Error in Find row edge
Check if selected row is inside the ROI.
Input Parameters
01 = Source bank Image bank containing the image to be processed.
02 = Column Column number for the row which will be considered.
0 = left border of FOV
03 = Analysis direction Direction of the analysis.
Down -> up beginning from the bottom of the ROI
Up -> down beginning from the top of the ROI.
04 = Gray low Low gray value threshold.
05 = Gray high High gray value threshold.
06 = ROI definition step Step number where the ROI to use was created.
Note that ONLY ROIs generated by the 'ROI rectangle' tool
can be used.
Returned Values
01 = Row Returns the number of the row where the found pixel is
located. This could be used as the Y-coordinate of the
found pixel.
Error Messages
Err. = 104 Error: points out of bank
Check if the specified ROI is generated by a 'ROI rectangle'
tool.
Check if the specified column is inside the ROI.
Find Row
This tool scans an image along a horizontal line to find a row that contains pixels with gray
level values that are in a specified range. Only the part of the image that is inside a ROI is
scanned.
The returned value is the y-coordinate of the found row. In the preview window, the found
row is marked with a yellow line.
The tool will “find” a row (and stop scanning the image) when the row contains a certain
amount of pixels with gray levels within the range. This amount is specified by the parame-
ter Level, and can be used for making the tool less sensitive for noise in the image.
0 5 10 15 20 25 30
Analysis
Direction
Row returned
by the tool
ROI
The parameter Type of transition is used for choosing whether the tool should stop scan-
ning when the amount of matching pixels in the line rises above the amount set in Level
(pixels > level), or when it sinks below the amount set in Level (pixels < level).
The lower and upper limits of the range of gray levels are set by the parameters Gray low
and Gray high.. These parameters can be set in an interactive setup window, which is
opened by clicking the button that is displayed when double-clicking the Value field of the
parameters. In the interactive setup window, all pixels inside the ROI with gray values within
the range are colored blue.
The image is scanned either from the top of the ROI to the bottom, or from the bottom to
the top depending on the setting of the parameter Analysis direction.
This tool requires a non-rotated rectangular ROI. The parameter ROI definition step points
out the program step in which the ROI is created. Note that only ROIs created with the 'ROI
Rectangle' tool are allowed. Do not use a ROI created by another ROI tool.
For some applications it is useful to combine this tool with the 'Find Column' tool to detect
the column as well. In some cases the column and the row could be used to establish the
x- and y-coordinates of the found pixel.
Input Parameters
01 = Source bank Image bank containing the image to analyze.
02 = Analysis direction Direction of the analysis.
Down→up beginning from the bottom of the ROI.
Up→down beginning from the top of the ROI.
03 = Gray low Lower gray value threshold.
04 = Gray high Upper gray value threshold.
05 = Level Amount of pixels with gray values in between Gray low and
Gray high.
Default setting = 2
06 = Type of transition Pixels > level Stop when the amount of matching
pixels in the line rises above Level.
Pixels < level Stop when the amount of matching
pixels in the line sinks below Level.
07 = ROI definition step Selected ROI from a previous program step.
Note that only ROIs created with the 'ROI rectangle' tool
are allowed.
Returned Values
01 = Row Y-coordinate of the found row.
Error Messages
Err. 107 Error: points out of bank
Check that the ROI is generated by the 'ROI rectangle' tool
and not by a different ROI tool.
Find Column
This tool scans an image along a vertical line to find a column that contains pixels with gray
level values that are in a specified range. Only the part of the image that is inside a ROI is
scanned.
The returned value is the x-coordinate of the found column. In the preview window, the
found column is marked with a yellow line.
The tool will “find” a column (and stop scanning the image) when the column contains a
certain amount of pixels with gray level values within the range. This amount is specified by
the parameter Level, and can be used for making the tool less sensitive for noise in the
image.
Column returned
by the tool
Analysis
Direction Pixels with gray
level between
Gray low and
Gray high
ROI
Amount of matching 30
The parameter Type of transition is used for choosing whether the tool should stop scan-
ning when the amount of matching pixels in the column rises above the amount set in
Level (pixels > level), or when it sinks below the amount set in Level (pixels < level).
The lower and upper limits of the range of gray level values are set by the parameters
Gray low and Gray high. These parameters can be set in an interactive setup window,
which is opened by clicking the button that is displayed when double-clicking the Value field
of the parameters. In the interactive setup window, all pixels inside the ROI with gray values
within the range are colored blue.
The image is scanned either from the left edge of the ROI to the right, or from the right to
the left depending on the setting of the parameter Analysis direction.
This tool requires a non-rotated rectangular ROI. The parameter ROI definition step points
out the program step in which the ROI is created. Note that only ROIs created with the 'ROI
Rectangle' tool are allowed. Do not use a ROI created by another ROI tool.
For some applications it is useful to combine this tool with the 'Find Row' tool to detect the
row as well. In some cases the column and the row could be used to establish the x- and
y-coordinates of the found pixel.
Input Parameters
01 = Source bank Image bank containing the image to analyze.
02 = Analysis direction Direction of the analysis.
L – R beginning from the left side of the ROI.
R – L beginning from the right side of the ROI.
03 = Gray low Lower gray value threshold.
04 = Gray high Upper gray value threshold.
05 = Level Amount of pixels with gray values in between Gray low and
Gray high.
Default setting: 2
06 = Type of transition Pixels > level Stop when the amount of matching
pixels in the column rises above Level.
Pixels < level Stop when the amount of matching
pixels in the column sinks below Level.
07 = ROI definition step Selected ROI from a previously program step. Note that
only ROIs generated by the 'ROI rectangle' tool can be
used.
Returned Values
01 = Column X-coordinate of the found column.
Error Messages
Err. 107 Error: points out of bank
Check that the ROI is generated by the 'ROI rectangle' tool
and not by a different ROI tool.
The figure above shows an example of evaluation method 1. The pixel with the first absolu-
te relative change of gray scale (in direction of evaluation) that is greater or equal to the
threshold is detected. In this case the amount of the last change is ≥ than the threshold.
The red circle indicates the detected point on the blue line. This point corresponds to the
location of the returned X and Y pixel coordinates. Red circle displayed in this example
only.
Direction of evaluation
The evaluation method and the geometrical definition of the line parameters are selected
by the input parameter Type. The following types are available:
Multiple & 2 Cartesian coordinates for start and end point of line.
Cartesian
Multiple & 2 Cartesian coordinates for start point and relative values
Interval delta X and delta Y for end point of line.
Multiple & 2 Cartesian coordinates for start point and distance and
Polar angle (anti clockwise with respect to x-axes) for end point
of line.
To reduce the influence of noise the input parameter Average pixels can be set to make
an average of the gray values in up to 10 pixels in line direction. This avoids faulty results
due to the influence on single pixels. This option is available with evaluation method 2:
Detect an absolute change of gray scale values only.
Input Parameters
01 = Source bank Selected image bank for the processing of this
function.
02 = Type Selects evaluation method and
geometric definition of line parameters (see table
above).
03 = Start point X X coordinate for start point of line.
04 = Start point Y Y coordinate for start point of line.
05 = End point X, width, L If Type is Cartesian:
X coordinate for end point of line.
If Type is Interval:
Relative distance delta X to end point of line.
If Type is Polar:
Absolute distance to end point of line.
06 = End point Y, height, angle If Type is Cartesian:
Y coordinate for end point of line.
If Type is Interval:
Relative distance delta Y to end point of line.
If Type is Polar:
Angle with respect to x-axes.
07 = Gray low Lower gray value threshold (method 2). Derivative
threshold (method 1).
08 = Gray high Upper gray value threshold (method 2). Derivative
threshold (method 1).
09 = Average pixels Available with evaluation method 2 only.
Allows to average over up to 10 pixels in the line
direction.
10 = Table index Works only for evaluation method 2.
Start index in table to write the found pixel coordina-
tes of transitions in the table.
11 = Max stored transitions Works only for evaluation method 2.
Upper limit for stored transitions in the table.
Counts from first found pixel.
12 = Destination bank Number of the destination bank in which to display
source bank, line and found points. Make sure that
Destination bank is different from Source bank.
Returned Values
Error Messages
Err. = 10 Error in Parameter 10.
Value has to be less than 11.
Input Parameters
01 = Source bank Image bank containing the image to be processed.
02 = Type Always set to Cartesian.
03 = Start point X X coordinate for start point of line.
04 = Start point Y Y coordinate for start point of line.
05 = End point X, X coordinate for end point of line, delta X, distance.
width, L
06 = End point Y, Y coordinate for end point of line, delta Y, angle.
height, angle
07 = Threshold Threshold for required relative change of gray value to
detect an edge.
08 = Destination Bank Image bank in which to draw the line that was searched
along, and lines for the returned X and Y coordinates.
Returned Values
01 = X transition X coordinate of the found edge with subpixel resolution.
02 = Y transition Y coordinate of the found edge with subpixel resolution.
Scan interval:
Distance of pixels that
Scan interval will be compared.
4 3 2 1
Figure – Edge finding with evaluation type Relative, which detects a relative change of gray
values. Note that the Min edge distance value should be greater than the Scan in-
terval value to avoid misplaced results.
Scan interval:
Distance of pixels that
will be compared.
2 1
Figure – Edge finding with evaluation type Absolute, which detects an absolute change of
gray values.
Input Parameters
01 = Source bank Image bank containing the image to be proc-
essed.
02 = Type Selected type of threshold and transition type:
Bright -> dark
Relative threshold and only transitions from
bright to dark pixels will be detected.
Dark –> bright
Relative threshold and only transitions from
dark to bright pixels will be detected.
Any relative transition
Relative threshold and any transition will be
detected
Absolute
Absolute threshold and any transitions above
or below the two thresholds will be detected.
03 = Start point X X coordinate for start point of line.
04 = Start point Y Y coordinate for start point of line.
05 = End point X X coordinate for end point of line.
06 = End point Y Y coordinate for end point of line.
07 = Gray low Lower gray value threshold.
Using any evaluation type with relative thresh-
old this value is the required changes in gray
values.
08 = Gray high Upper gray value threshold.
Available only with evaluation type absolute
threshold.
Note that this value will be ignored when using
evaluation type relative threshold.
Returned Values
01 = Found transitions Total number of found edges.
Error Messages
Error 135 The line is too short.
Error 136 The line is too long.
Input Parameters
01 = Source bank Image bank containing the image to be processed.
02 = ROI definition step Step number where the ROI to use was created.
Note that only ROIs generated by the 'ROI rectangle'
tool can be used.
03 = Analysis direction Direction of the evaluation to generate pixels for the fit.
The choices are:
Left -> right
Down -> up
Right -> left
Up -> down
04 = Scan interval Define gap between equidistant spaced columns or
rows in pixels.
To evaluate each column (row) type in 0.
05 = Threshold Amount of the minimum required change of gray
values.
06 = Pixel distance Maximum allowed distance in pixel from next found
neighbor pixel.
07 = Average pixels Allows to average gray values over up to 16 pixels
along the scan direction.
08 = Min connected transitions Defines minimum required number of connected pixels
with the allowed distance from next neighbor pixel
(combination with the input parameter Pixel distance).
09 = Destination bank Number of the destination bank in which to display
source bank, selected pixels and fitted line. Make sure
that Destination bank is different from Source bank.
Returned Values
01 = Mean of transition Returns the mean X respectively Y
coordinate of all fitted pixels (depends
on the evaluation direction).
02 = Max derivation of regression Maximum distance from the fitted line
in pixel (depends on the evaluation
direction).
03 = Points out of tolerance (%) Percentage of the found pixels which
will not be considered for the linear fit
04 = Lines without transition (%) Percentage of evaluated columns
(rows) without the required transitions
in gray values.
05 = Slope This is the slope of the line, i.e. the
value of k in the line equation.
06 = Y-intercept Indicates where the line crosses the
Y-axis, i.e. the value of m in the line
equation.
Example
The figure below shows an example to Find mean line and margin. Note that red circles are
ignored and are not considered for the linear fit. Chosen input parameters: Tolerance in
pixel = 5 and Filter in steps on isolated points = 3. Due to the fact that all pixels with a
distance of more than 5 pixels to the next found neighbor pixel are ignored (indicated with
A in the figure). Additionally all clusters with less than 4 connected pixels and a distance of
more than 5 pixels to the next found neighbor pixel are ignored as well (indicated with B in
the figure).
Figure – Evaluation direction is from top to bottom. Dashed yellow box indicates selected
ROI. Blue circles: found pixels which will be considered for the linear fit, red circles: found
pixels but ignored and not considered for the linear fit, green circles: fitted mean line. The
table below the image shows the result parameters.
4 3 2 1
Scan interval:
Distance of pixels that
will be compared.
2 1
Input Parameters
01 = Source bank Selected image bank for the processing of this
function
02 = Type Selected type of threshold
Absolute sensitive to absolute variations of gray
values.
Relative sensitive to relative variations of gray
values (Input parameter Gray high will
be ignored)
03 = X center X coordinate of the circle or ellipse center.
04 = Y center Y coordinate of the circle or ellipse center.
05 = X radius Value of the radius in X direction.
06 = Y radius Value of the radius in Y direction.
07 = Gray low Lower gray value threshold.
When using evaluation type Relative, this value
is the required change in gray values.
08 = Gray high Upper gray value threshold.
Note that this value will be ignored when using
evaluation type Relative threshold.
09 = Type of transition Only available with evaluation type Relative. Note
that this value will be ignored when using evaluation
type absolute threshold.
Defines direction of evaluated gray value transitions.
1 = transitions from dark to bright.
–1 = transitions from bright to dark.
0 = transitions in both directions.
10 = Scan interval Distance of compared pixels (in pixels).
11 = Average pixels Number of averaged pixels for gray value.
12 = Min edge distance Only available with evaluation type Relative. Note
that this value will be ignored when using evaluation
type Absolute.
Number of pixels that will be skipped if a transition
is found.
Returned Values
01 = Error flag Flag = 0 if the function was executed correctly.
02 = Found edges Total number of found transitions.
4.5 Measure
Centroid
This tool finds all pixels inside a ROI with gray values between a lower and an upper thres-
hold. The tool returns the coordinates of the center of gravity (centroid) of the found pixels
area.
Double-click the input field for lower and upper threshold and double-click the appearing
button. This opens an interactive window. This new window allows setting lower and upper
threshold with a slider and shows the image with the found pixels colored.
Note: If no pixels with gray values between Gray low and Gray high are found inside the ROI, the
resulting coordinates of the centroid are (0,0).
Input Parameters
01 = Source bank Selected image bank for the processing of
this tool.
02 = ROI definition step Select ROI from a previously program step.
03 = Gray low Threshold for lower gray value.
04 = Gray high Threshold for upper gray value.
05 = Destination bank Number of the image bank in which to
show the image with colored pixels and
calculated centroid.
Returned Values
01 = X center X coordinate of calculated center of gravity.
02 = Y center Y coordinate of calculated center of gravity.
Area
This tool calculates how many pixels inside a ROI that have a gray value between a lower
and an upper threshold. All found pixels inside the lower and upper threshold are defined
as “pixels in range” and all pixels outside this region of gray values are defined as “pixels
out of range”. Return values are the total number of pixels in range (within the region of
gray values) and pixels out of range (outside the region of gray values).
Double-click the input field for Gray high and Gray low and click the appearing button to
set the gray values with a slider. All pixels inside the ROI with gray values in between the
two thresholds are colored according to the parameter Color for marking pixels in range
and the pixels outside the thresholds are not affected.
Input Parameters
01 = Source bank Selected image bank for the processing of this
tool
02 = ROI definition step Select ROI from a previous program step.
03 = Gray low Threshold for lower gray value.
04 = Gray high Threshold for upper gray value.
05 = Color for marking pixels The pixels inside the ROI that are between the
in range two thresholds are marked with this color
Returned Values
01 = Pixels in range Total number of found pixels between the
lower and upper threshold.
02 = Pixels out of range Total number of found pixels outside the lower
and upper threshold.
Input Parameters
01 = Source bank Image bank containing the image to analyze.
02 = Start point X X coordinate to start evaluation of gray values.
03 = Start point Y Y coordinate to start evaluation of gray values.
04 = Gray low Threshold for lower gray value.
05 = Gray high Threshold for upper gray value.
06 = Color Select color to mark found pixels. Double-clicking
opens a color table.
07 = Destination bank Number of image bank to show image with colored
pixels and calculated centroid.
Returned Values
01 = Found pixels Total number of found pixels between lower and
upper threshold.
02 = X center X coordinate of calculated centroid.
03 = Y center Y coordinate of calculated centroid.
Example
Starting point
Gray High = 200
Gray Low = 74
Perimeter
This tool traces the contour of a blob. It requires an input starting point which should be
located inside or to the left of the blob. The contour of the blob must be completely inside
the image. The coordinates of the input starting point are usually a result from a previously
executed step, for example of the Edge category. Beginning at the starting point this tool
starts searching from left to right for the nearest edge on the horizontal line through this
point. The search is done in a binarized image which set by the thresholds Gray low and
Gray high.. When the edge is found the perimeter is traced along the object.
Double-click on the input field for the gray value thresholds and double-click again on the
appearing button. This opens an interactive window. This new window allows setting the
upper and lower thresholds for the gray values with a slider. The found contour pixels are
displayed in red color in the image.
This tool is useful for generating object specific ROIs in combination with the 'ROI perime-
ter' tool.
Notes: 1. The input starting point is not necessarily on the found contour (see examples below).
2. If the input starting point is outside of the blob, this tool finds white blobs best if the
starting point is at the left of the blob and black blobs best, if the starting point is on the
right of the blob. However, it is strongly recommended not to use any starting point out-
side of the contour.
Input Parameters
01 = Source bank Selected image bank for the processing of this tool.
02 = Start point X X coordinate of starting point to trace contour. Normally
this value is a result value form a previously executed step
of the Edge category.
03 = Start point Y Y coordinate of starting point to trace contour. Normally
this value is a result value form a previously executed step
of the Edge category.
04 = Gray low Threshold for lower gray value of allowed contour pixels.
05 = Gray high. Threshold for upper gray value of allowed contour pixels.
06 = Destination bank Number of image bank to plot the found contour pixels.
Returned Values
01 = Error flag Flag = 0 if the tool was executed correctly
Flag = -1 if no contour was found or in case of an error.
02 = Perimeter length Total number of pixels along the perimeter of the traced
contour. The upper limit is 2500 pixels.
Error Messages
Err. = 119 Parts of the contour are out of the FOV or no start point to
trace the contour was found. Check thresholds for gray
values.
Err. = 118 Number of found contour pixels is less then 20. Check
thresholds for gray values.
Examples
Mean Intensity
This tool selects all pixels inside a ROI with gray values between a lower and an upper
threshold and calculates the mean gray value out of them. Return values are the mean
gray value and the total number of the pixels with selected gray values.
Double-click the input field for lower and upper threshold and double-click the appearing
button. This opens an interactive window. This new window allows setting lower and upper
threshold with a slider and shows the image with found pixels colored.
Input Parameters
01 = Source bank Image bank containing the image to be proc-
essed.
02 = ROI definition step Step number where the ROI to use was created
03 = Gray low Threshold for lower gray value.
04 = Gray high Threshold for lower gray value.
Returned Values
01 = Mean intensity Mean gray value of the found pixels
02 = Found pixels Total number of found pixels
Line Intersection
This tool calculates the intersection, cross point, of two straight lines. Each line is defined
by the coordinates of two points. Return values are the coordinates of the lines cross
point.
Note: Cross points can be outside of the FOV but are still calculated correctly.
An error occurs if two points for one line coincide or in cases of parallel lines. In these
cases the step terminates with an error and the returned coordinates are set to 0.
Input Parameters
01 = Line A start point X X coordinate one on line A.
02 = Line A start point Y Y coordinate one on line A.
03 = Line A end point X X coordinate two on line A.
04 = Line A end point Y Y coordinate two on line A.
05 = Line B start point X X coordinate one on line B.
06 = Line B start point Y Y coordinate one on line B.
07 = Line B end point X X coordinate two on line B.
08 = Line B end point Y Y coordinate two on line B.
Returned Values
01 = X intersection X coordinate of cross point
02 = Y intersection Y coordinate of cross point
Errors
Err. 112 No cross point found.
Check that selected points for one line are different.
Check that lines are not parallel.
Notes:
1. The definition of the geometrical interpretation of the angle means that the direction of
rotation is counterclockwise in respect to the corresponding X-axis going through the
first point.
2. If both points are identical, both result values are 0.
This tool is useful for example for generating offset parameters in a ROI tool.
Input Parameters
01 = Start point X X coordinate of the first point.
02 = Start point Y Y coordinate of the first point.
03 = End point X X coordinate of the second point.
04 = End point Y Y coordinate of the second point.
Returned Values
01 = Distance Absolute value of the distance between the points in pixels.
02 = Line angle Angle between the points in degrees ( ).
Example
Geometrical interpretation of the angle between two points.
second point
α
X-axis
first point
Blob Finder
This tool finds regions of connected pixels, called blobs, based on their values. The values
of the blobs are defined with an upper and a lower threshold.
It is recommended to use the interactive setup to customize the parameters. Double-click
on the Setup button to open the interactive setup window. For more information on the
interactive setup, see Blob Finder Setup on page 235.
Input Parameters
01 = Source bank Image bank containing the image to be proc-
essed by this tool.
02 = ROI definition step The number of a previous program step where
an arbitrarily shaped ROI has been generated.
This may be a ROI rectangle, circle, union or
even a blob analyzer step.
03 = Destination Bank Image bank in which the found blobs are
rendered if Generate blob image is enabled.
04 = Generate Blob Image If enabled, generates a blob image in the the
destination bank. A blob image is an image
where all blobs are white (high) and all other
pixels are black (low). The image can be used
as input to other program steps for any kind of
processing. Note that the actual values of the
pixels in the image have no meaning in terms
of mm after blob binarization.
05 = Threshold Low (pixels) Sets the minimum height threshold limit. Pixels
darker than this value are ignored.
06 = Threshold High (pixels) Sets the maximum height threshold limit. Pixels
brighter than this value are ignored.
07 = Threshold Mode Choose to look for bright objects, dark objects
or to manually set the limits.
08 = Min Blob Area (pixels) Lower area limits for a found blob. Smaller
blobs are ignored.
09 = Max Blob Area (pixels) Upper area limits for a found blob. Larger blobs
are ignored.
10 = Timeout (ms) Sets the maximum time the tool is searching
for blobs. If this time limit is exceeded and the
tool has not yet scanned the entire ROI for
blobs, the result found so far will be returned.
Note that the actual elapsed time will be
somewhat longer than the timeout time since
the Blob finder needs to perform some clean-
ing up operations before returning.
11 = Ignore Edge Blobs If enabled, blobs on the edge of the ROI are
ignored.
If disabled, edge blobs are included, but
only the part of the blob inside the ROI is
considered.
Returned Values
01 = Number of Found Blobs The amount of blobs found.
02 = Low Threshold Used The lower threshold used when looking for
blobs.
03 = High Threshold Used The upper threshold used when looking for
blobs.
ERROR CODES
8200 Too many blob candidates are found. Please adjust the thresholds to limit
the number of small blobs.
Blob Analyzer
This tool analyzes the blobs found by the ‘Blob Finder’ tool. The Blob analyzer analyzes one
blob at a time and is typically used in a for loop. A range of different analysis methods can
be used as described below.
Note: To use the Blob Analyser the step program must contain a ‘Blob Finder’ step, and a valid
Blob Index number must be pointed out by the ‘Blob Finder’ step number and the Blob
Index parameter.
It is recommended to use the interactive setup to customize the parameters. Double-click
on the Setup button to open the interactive setup window. For more information on the
interactive setup, see Blob Analyzer Setup on page 238.
Input Parameters
01 = Blob Finder Step Number The step number of the used ‘Blob Finder’ tool.
02 = Blob Index The number of the blob to be analyzed. Valid
values are 0 to the number of found blobs -1
Note that the first blob has number 0.
03 = Destination Bank Image bank where the analysis results are
visualized.
04 = Visualize Results If enabled, the results are visualized in the
destination bank.
If disabled, the results are not visualized.
05 = Display Centroids Determines if the blob centroid is displayed (with
a + sign) or not.
06 = Orientation Method The method to compute the blob orientation:
none, Area based or Boundary based. See
the Compute bounding box parameter for more
information.
07 = Compute Bounding Box Determines if a bounding box is computed or
not. If Enabled, the Orientation Method pa-
rameter determines how to orient the bounding
box:
If the orientation method is None, only the XY-
aligned bounding box is returned.
If the orientation method is Area based or
Boundary based, a graphical representation
of the bounding box is generated in the destina-
tion bank.
08 = Compute Diameters If Enabled, computes the maximum, the
minimum and the average diameters for the
found blobs. Currently no visualization (En-
abled + Visualized) is available for diame-
ters.
09 = Angular Resolution (degrees) An advanced feature which determines what
resolution that will be used when computing the
orientation in Boundary based mode The
default value of 1 (degree) is a reasonable value
for most applications. Increasing the value
makes the analysis a bit faster at the cost of
lower angular resolution.
10 = Compute Perimeter If Enabled, calculates the perimeter length of
the blob in pixels. Select Enabled + Visu-
alized to vizualize the result.
11 = Create Blob ROI Creates a ROI of the blob. The blob ROI can be
referenced by other tools by giving the Blob
Analyzer step number as ROI Definition step.
Returned Values
01 = Blob Area (pixels) The number of pixels in the blob.
02 = Left Edge of Blob The horizontal position of the leftmost pixel of the
blob That is, the left edge of the blob in pixels
along the X-axis.
03 = Top Edge of Blob The vertical position of the topmost pixel of the
blob. That is, the top edge of the blob in pixels
along the Y-axis.
04 = Blob Width (pixels) The total width of the blob, defined as the right-
most pixel - the leftmost pixel + 1.
05 = Blob Length (pixels) The total length of the blob, defined as the bot-
tommost pixel - the topmost pixel + 1.
06 = Blob Centroid X The x-coordinate of the blob centroid (area-based
mass centre).
07 = Blob Centroid Y The y-coordinate of the blob centroid (area-based
mass centre).
08 = Blob Orientation (degrees) The orientation angle of the blob in degrees. 0
means that the blob is horizontally aligned. The
angle increases counter clock-wise. The valid
range is 0-180 degrees.
09 = Blob Ovality A measure of how oval (non-isotropic) a blob is. A
perfect circle (or square) has the value 1 whereas
a straight line has a very low value. Valid range is
0-1.
10 = Max Diameter of Blob The largest diameter found in the blob, where
(pixels) diameter is defined as the distance between the
two most distant points on a line through the blob
centroid.
11 = Min Diameter of Blob The smallest diameter found in the blob.
(pixels)
12 = Average Diameter of Blob The average of the diameters found in the blob.
(pixels)
13 = Blob Perimeter Length The length of the external perimeter of the blob
(pixels) (in pixels). If the blob has internal holes, their
perimeters are not considered as part of the
perimeter.
Note: Perimeters are difficult to measure and
are affected by a lot of factors. Make sure that
the value returned by this measure is relevant to
your application.
14 = Bounding Box Centre X The horizontal position of the centre of a rotated
bounding box. Rotated bounding boxes are
obtained when enabling the Compute Bounding
Box option and use an orientation mode different
from None. Note that if you use orientation mode
None, the bounding box will be defined by the left
edge, the top edge, the width and the length of
the blob.
4.6 Matching
Shape Locator
The Shape Locator tool finds a reference shape in an image. The reference shape is
created from a reference image and is then located (searched for by matching) in live
images.
Matching shapes or parts of shapes is complicated and it is essential to have a good set
of input parameters for this tool to compute a result in reasonable time. This tool has an
interactive setup to help you create reference shapes and fine tune input parameters so
that the locating algorithm will work as fast and efficient as possible. For more information
on the interactive setup, see Shape Locator Interactive Setup on page 209.
The section Locating Shapes (tips and tricks) on page 214 describes the algorithm used
when searching for shapes, and the section Examples on workflows on page 216 shows
some examples on how to use the suite of tools together in an efficient way.
The tool will return information about the first shape (according to the selected sorting
order). If a table index is specified, information about all found shapes is stored in the table
beginning at the specified index. For each shape, five entries are written in the table: x
position of the reference point, y position of the reference point, rotation angle, scale and
finally score of the located shape.
The coordinates of the reference point are given in pixels in the destination image. The
rotation and scale are given relative to the reference image.
Reference shapes can also be created in runtime using the ‘Add Shape Runtime’ tool.
The supplementary tools Get Shape on page 113, Transform Image on page 114 and
Transform ROI on page 116 can be used to traverse the list of found shapes.
Input Parameters
01 = Source bank The image bank where to search for matching shapes.
02 = Data block The slot in the memory where the reference shape is
stored.
03 = Search full image Controls if the whole image shall be used to search for the
shape, or if the ROI parameters shall be used to limit the
search area.
04 = ROI X coordinate The x coordinate of the upper left corner of the region to
search for matching shapes.
05 = ROI Y coordinate The y coordinate of the upper left corner of the region to
search for matching shapes.
06 = ROI width The width of the region to search.
07 = ROI height The height of the region to search.
08 = Allow scale Search for shapes with another scale compared to the
reference shape. Shapes with a scale variation of ±20%
can be found.
09 = Allow rotation Search for shapes with another rotation angle compared
to the reference shape.
10 = Rotation The greatest angle the search for a match should be
tolerance (degrees) performed for.
Example: 180 means ±180 degrees, i.e. full rotation.
11 = Max number of The maximum number of shapes that the tool shall search
shapes for in the live image. The shapes with the highest score are
selected if there are more shapes in the image. Maximum
value is 32.
12 = Min score The tool will only return shapes with a score above or
equal to this value.
13 = Overlap distance Threshold in pixels determining when two close matches
(pixels) shall be considered to belong to the same shape. A higher
value will in many cases help to reduce the execution time.
14 = Sort by Defines how the returned shapes shall be sorted. The
default sort order is with the highest score first in descend-
ing order.
15 = Sort order Defines if the sort order shall be ascending or descending.
16 = Table index The start position for result output to the table.
The value -1 indicates that no values shall be written to the
table.
17 = Timeout (ms) Sets the maximum time the tool is searching for shapes. If
this time limit is exceeded, the result found so far will be
returned. The status code will indicate if the tool has
exceeded the timeout. A value of -1 will let the algorithm
run to completion without any timeout limitation.
18 = Visualization Type of result visualization in the destination bank;
No visualization, First shape (according to specified sorting
order), All shapes.
19 = Destination bank The image bank where matched shapes are visualized.
The value -1 indicates that no visualization is performed.
This will help to reduce the execution time.
20 = Sorting point X The x coordinate of the sorting point. This value is only
used when the Sort by parameter is set to Sorting Point.
21 = Sorting point Y The y coordinate of the sorting point. This value is only
used when the Sort by parameter is set to Sorting Point.
Returned Values
01 = Search status The status of the execution of the shape locator.
02 = Number of shapes The total number of found shapes of satisfactory similarity
to the reference shape.
03 = Ref. point X coor- The x coordinate of the point that corresponds to the
dinate reference point in the reference shape.
04 = Ref. point Y coor- The y coordinate of the point that corresponds to the
dinate reference point in the reference shape.
05 = Angle (degrees) The angle of the found shape in the coordinate system
defined in the reference image.
06 = Scale The scale of the found shape compared to the scale of the
shape defined in the reference image.
07 = Score A measure of the resemblance of the shape found and the
reference shape. The score has an interval of 0 through
100, but it does not represent the similarity in percent.
Note: The results 3 through 7 refer to the first located shape according to the specified
sorting order.
SEARCH STATUS
0 All OK
8823 No shape found.
8824 Failure when writing results to the table.
8825 The reference point of one or more shapes is located outside the image.
8828 Failure when visualizing results.
8833 Search aborted due to timeout. The resulting shape may be less accurate.
ERROR CODES
7704 The ROI is partly or completely outside the image.
8828 Error in visualization of the located shape(-s)
Input Parameters
01 = Source bank The image bank holding an image of the reference
shape.
02 = ROI definition step An arbitrary shaped Teach ROI from a previous pro-
gram step.
03 = Data block The number of the slot in the memory (RAM) where
information of the reference shape will be stored
temporarily.
04 = Edge strength The edge strength is the image contrast needed for
defining shape edges. A higher value gives fewer edges
in the shape. Valid range 0-100
05 = Robustness vs. Speed This setting controls the tradeoff between execution
time and robustness when running the Shape Locator
tool. A high value prioritizes a short execution time.
Valid range 0-4
06 = Accuracy vs. Speed This setting controls the tradeoff between execution
time and the accuracy with which the shape is located
when running the Shape Locator tool. A high value
prioritizes a short execution time. Valid range 0-4
07 = Ref. point X coordi- The x coordinate of the reference point.
nate
08 = Ref. point Y coordi- The y coordinate of the reference point.
nate
09 = Destination bank The image bank where a visualization of the edges of
the reference shape shall be made. If set to -1 no
visualization will be made.
ERROR CODES
7704 The ROI is partly or completely outside the image.
8800 Initialization of the shape locating algorithm failed.
8838 The ROI Perimeter must have the parameter Filling set to 0=Internal. Otherwise,
the ROI will only contain the pixels on the circumference of the perimeter.
Get Shape
The Get Shape tool is used together with the Shape Locator tool to retrieve information
about a located shape.
The tool refers to a previous Shape Locator step and the zero-based index of a located
shape. It is possible to visualize the position of the specified shape if a destination bank is
specified. Note that only the green edges of the shape are drawn in the destination bank.
The actual live image must be copied separately to the image bank before calling this tool.
Input Parameters
01 = Shape locator step The Shape Locator step that was used to find shapes.
02 = Shape index The zero-based index of the shape to retrieve information
about.
03 = Visualization Determines how the result shall be visualized in the desti-
nation bank.
04 = Destination bank The image bank where the result shall be visualized. Set to
-1 if no visualization is used.
Returned Values
01 = Status code The status of the execution of the 'Shape Locator' step.
02 = Ref. point X coor- The x coordinate of the point that corresponds to the
dinate reference point in the reference shape.
03 = Ref. point Y coor- The y coordinate of the point that corresponds to the
dinate reference point in the reference shape.
04 = Angle (degrees) The angle of the found shape in the coordinate system
defined in the reference image.
05 = Scale The scale of the found shape compared to the scale of the
shape defined in the reference image.
06 = Score A measure of the resemblance of the shape found and the
reference shape. The score has an interval of 0 through
100, but it does not represent the similarity in percent.
SEARCH STATUS
The result Search status can have one of the following values
0 All OK
8825 The reference point of the shape is located outside the image.
ERROR CODES
8810 The referenced step is not a Shape Locator step.
8812 The index of the shape is not valid, e.g. larger than the number of located
shapes.
8813 No results found from the Shape Locator tool. This can happen if the execution
of the Shape Locator tool failed for some reason.
8833 Timeout in the shape locating algorithm
Transform Image
The Transform Image tool is used together with the Shape Locator tool. This tool trans-
forms the image from the source bank so that the located shape is moved to the same
position as the reference shape had in the reference image. It is possible to specify a ROI
so that only the interesting part of the image is transformed.
This functionality can be useful in applications where the inspections must be made in the
same position and rotation as in the reference image, for instance when using tools that
only handle non-rotated rectangle ROI:s. The tool is also useful when presenting results to
an operator.
However, it must be stressed that the transformation of the live image will affect the
information in the image, and that exact measurements cannot be performed on the
transformed image.
The parameter Interpolation method controls how the pixel values are calculated in the
destination image. It is possible to choose between bilinear interpolation (gives higher
image quality) or nearest neighbor (gives faster execution time).
The images below show an example where the upper image is used as a reference to
specify the shape of the clock. The lower images show the live image (to the left), and the
transformed live image. The shape of the clock in the transformed image is placed in the
same position as in the reference image.
The ROI specifies what part of the live image that shall be visible in the transformed image.
Pixels outside the ROI will be black in the transformed image.
Input Parameters
01 = Source bank The image bank where the live image is stored.
02 = ROI definition step A ROI that limits the part of the live image to transform.
03 = Shape locator step The Shape Locator step that was used to find shapes.
04 = Shape index The zero-based index of the shape to retrieve information
about.
05 = Interpolation The interpolation method to use when calculating the pixel
method values in the destination image.
06 = Destination bank The image bank where the result shall be visualized. Set to
-1 if no visualization is used.
Returned Values
01 = Search status The status of the execution of the 'Shape Locator' step.
SEARCH STATUS
The result Search status can have one of the following values
0 All OK
8825 The reference point of the shape is located outside the image.
ERROR CODES
8810 The referenced step is not a Shape Locator step.
8812 The index of the shape is not valid, e.g. larger than the number of located
shapes.
8813 No results found from the Shape Locator tool. This can happen if the execution
of the Shape Locator tool failed for some reason.
8833 Timeout in the shape locating algorithm
Transform ROI
The Transform ROI tool is used together with the Shape Locator tool. This tool moves and
rotates a ROI so that it is placed relative to the located shape as it was in the reference
image.
This functionality is useful when exact measurements must be performed relative to the
located shape. The transformed ROI will be moved, rotated, and possibly scaled to the
position of the located shape.
The tool refers to a previous Shape Locator step and the zero-based index of a located
shape. The tool itself can be referred to as a ROI for all tools that can handle arbitrary
shaped ROI:s.
Input Parameters
01 = ROI definition step The step where an arbitrary shaped ROI was created.
02 = Shape locator step The Shape Locator step that was used to find shapes.
03 = Shape index The zero-based index of the shape to retrieve information
about.
Returned Values
01 = Search status The status of the execution of the 'Shape Locator' step.
SEARCH STATUS
The result Search status can have one of the following values
0 All OK
8825 The reference point of the shape is located outside the image.
ERROR CODES
8810 The referenced step is not a Shape Locator step.
8812 The index of the shape is not valid, e.g. larger than the number of located
shapes.
8813 No results found from the Shape Locator tool. This can happen if the execution
of the Shape Locator tool failed for some reason.
8833 Timeout in the shape locating algorithm
Teach Rotation
This tool is used to learn the features of an object in order to calculate its rotation in
relation to the learnt position. The calculation of rotation is based on a comparison be-
tween the patterns along concentric circles centered in the rotation point. Two different
sized circles over the object to be learned are compared to the circles over the matching
object. The first of the circles is used for the measurement itself unless there is a symme-
try problem in which case the other one is used.
Input Parameters
01 = Source bank The image bank with the object you want to teach the
device.
02 = X centre X coordinate of the concentric circles that hold the
gray scale information about the object. This should
be also be the x coordinate of the center of rotation.
03 = Y centre Y coordinate of the concentric circles that hold the
gray scale information about the object. This should
be also be the y coordinate of the center of rotation.
04 = Radius A The radius of the outer most circle.
05 = Radius B The radius of the inner most circle.
06 = Destination bank The image bank with your resulting teach object.
Returned Values
None
Match Rotation
Match shape is a tool designed to find the rotation of a previously learnt object in a region
of interest. Simply set the parameters in the same fashion as in the ‘Teach Rotation’ tool
and specify where in the step program that step is located with the Rotation definition
step parameter.
Input Parameters
01 = Source bank The image bank with the object you want to match
with your teach object.
02 =Rotation definition step The step in your program which you have defined
your reference object.
03 = X center The x coordinate of the center of rotation.
04 = Y center The y coordinate of the center of rotation.
05 = Destination bank The image bank where the result of the matching will
end up.
Returned Values
01 = Angle The resulting angle of the object in reference to the
object of your teach object.
02 = Similarity (%) A measurement of the resemblance of the gray scale
information along the circles used.
Teach Pattern
The Pattern tools are used to locate and inspect patterns, for example labels, keypads and
fiducial marks.
The functionality is divided into two parts:
1. The Teach Pattern tool teaches the camera a pattern in a reference image.
2. The Inspect Pattern tool locates and inspects the pattern in a live image.
This page describes the specifics for the Teach Pattern tool. For a general introduction and
detailed explanation of the Pattern functionality and its use, see the Inspect Pattern tool
description on page 122.
A ROI (Region of Interest) determines the area in which to teach the pattern. When the tool
executes, the taught pattern is stored in a data block in the camera’s working memory.
This data block will be used by the Inspect Pattern tool.
The tools Save Data Block to Flash and Load Data Block from Flash, see pages 166 and
165, can be used to store and retrieve the taught pattern in a stand-alone application.
Each pattern has a reference point that defines the position of the pattern. The default
position is the centroid of the ROI, but it can be set to any position in the reference image.
When the Inspect Pattern step refers to a Shape Locator step, the expected position of
the reference point will move with the located object’s pose.
The reference point is not visualized, but it can be done with drawing tools right after the
Teach step if needed. To find suitable coordinates manually, double-click the preview bank,
and then hover with the mouse pointer to find the coordinate of the desired feature point.
Input Parameters
01 = Source Bank The image bank that contains the reference pattern to be
taught.
02 = ROI Definition Step The reference to the region of interest that defines which
part of the source bank shall be taught.
03 = Data Block The data block number in the working memory, where the
reference pattern shall be stored.
04 = Ref. Point X The X coordinate of the pattern’s reference point.
Coordinate
05 = Ref. Point Y The Y coordinate of the pattern’s reference point.
Coordinate
Returned Values
None.
ERROR CODES
7300 Memory allocation problem
8835 Error in internal ROI handling
8838 ROI type error, please use ROI perimeter with filling “0 – Internal”
9010 General error for pattern inspection algorithm
Inspect Pattern
The Pattern tools are used to locate and inspect patterns, for example labels, keypads and
fiducial marks:
The pattern is searched for inside a search rectangle. The main results of the Inspect
Pattern tool are the found pattern’s position, angle and score. The reported coordinates
are the position of the pattern’s reference point. For an explanation of the reference point,
see the Teach Pattern tool description on page 120.
The pattern is defined by its teach ROI in In run mode, the pattern (green) is found
the reference image. inside the search rectangle (blue).
Large pattern defects can either be found by setting the score threshold high, so that
defective patterns won’t be found, or by applying a pass/fail criterion to the score result.
Small defects can only be identified robustly by the score parameter if the pattern ROI is
small. For finding small defects in larger patterns, the difference image concept should be
used.
Difference Image
The tool has an optional visualization output called difference image, which is useful to find
defects that are too small to affect the score. They are found by post-processing of the
difference image, for example using Detail Extraction, Blob Finder or pixel counting.
To high-light small defects on a pattern visually, for example in an HMI or demo, the follow-
ing steps can be used:
1. Enable the parameter Create Pattern ROI
2. Generate the difference image with option Normalized diff with edge suppression
3. Locate the defects in the difference image by using Blob Finder. Optionally, pre-
process further with Erode and/or Stretch Gray
4. FOR each blob/defect, use the Blob Analyzer to create a blob ROI
5. Inside the FOR loop, draw the blob ROI by using Draw ROI
The Robustness vs. Speed parameter has some effect on the accuracy of the pattern
pose, where the robust and normal modes are twice as accurate as the fast mode.
Input Parameters
01 = Source Bank The image bank where to search for the pattern.
02 = Data Block The data block number in the working memory, where the
reference pattern is stored.
03 = Shape Locator Reference to a Shape Locator step, to enable automatic
Step pose adjustment of the search rectangle. The default value
-2 means that no Shape Locator pose is used.
04 = Shape Index A number that specifies which of the Shape Locator’s
found shapes to refer to. The default value 0 means the
first shape found by the Shape Locator.
05 = ROI X Coordinate The x coordinate of the search rectangle’s left edge.
06 = ROI Y Coordinate The y coordinate of the search rectangle’s top edge.
07 = ROI Width The width of the search rectangle.
08 = ROI Height The height of the search rectangle.
09 = Rotation Tolerance The greatest angle the search for a match should be
(degrees) performed for. The value is symmetric, so that for example
the value 180 means ±180 degrees, i.e. full rotation.
10 = Rotation Expected angle offset of the pattern in the live image
Offset (degrees) compared to the reference pattern. For example, if the
offset is 45 and the tolerance is 5, the pattern will be
searched for in the interval from 40 to 50 degrees.
11 = Min Score The minimum score in % that will result in a match. If the
best match is below the threshold, the pose and score will
still be returned, but the status flag and visualization will
indicate that no valid match was found.
12 = Robustness vs. The trade-off between robustness and speed: Robust,
Speed Normal and Fast.
13 = Create Pattern ROI If enabled (true), the found pattern will generate a ROI in
Returned Values
01 = Search Status The status of the execution of the tool, see explanation list
below.
02 = Ref. Point X Coor- The X coordinate of the found pattern’s reference point.
dinate
03 = Ref. Point Y Coor- The Y coordinate of the found pattern’s reference point.
dinate
04 = Angle The angle of the found pattern relative to the reference
image, which is defined as 0 .
04 = Delta X Not using Shape Locator:
The pattern’s X movement relative to the reference image.
Using Shape Locator:
The pattern’s X movement relative to the reference image,
adjusted for the Shape Locator pose.
05 = Delta Y Not using Shape Locator:
The pattern’s Y movement relative to the reference image.
Using Shape Locator:
The pattern’s Y movement relative to the reference image,
adjusted for the Shape Locator pose.
06 = Delta Angle (de- Not using Shape Locator:
grees) The pattern’s angle relative to the reference image.
Using Shape Locator:
The pattern’s angle relative to the reference image, ad-
justed for the Shape Locator pose.
07 = Score The similarity between the found pattern and the reference
pattern in %.
SEARCH STATUS
0 Pattern found
8980 Pattern found, but partly outside the image bank borders
8981 No matching pattern is found
9015 A pattern is found, but the score is below threshold
ERROR CODES
7300 Memory allocation problem
8983 Packing datablock failed
8984 Unpacking datablock failed
8985 No usable result from the Shape Locator step, please re-run the Shape Locator
step
8986 Shape index is too high, the Shape Locator step does not contain enough Num-
ber of Shapes
8994 Referenced step is of wrong type, please use a Shape Locator as reference or
use -1 for no reference
8995 General visualization error, please change visualization type
8997 No ROI data in the referenced step, please re-run the step or change the refer-
ence
8998 Cannot use filled ROI as input, please use a ROI perimeter
8999 General error for pattern inspection datablock, please re-teach a pattern
9010 General error for pattern inspection algorithm
9012 There is no reference pattern stored in the datablock, please re-teach a pattern
9013 The reference pattern is not configured correctly, please re-teach a pattern
9014 Could not allocate memory when generating ROI
4.7 Circular
External Perimeter
This tool traces the external contour of an object and is similar to the tool 'Internal Perime-
ter'. Return values are the center of gravity coordinates of the area inside the contour.
First this tool scans the gray values along a user defined line to find a point on the external
contour of the object. Beginning at the starting point of the line the first change in gray
values that is greater than a defined threshold is indicated as a point on contour. Note that
the line must be drawn from left to right to achieve correct results. The tool then traces
pixels with the required change of gray value starting at the point on the contour. To make
the algorithm more robust it is necessary to define a range on the gray scale with an upper
and lower threshold.
Recommend steps to set up the input parameters:
1. Double-click the input field for Relative threshold and double-click the appearing
button. This opens an interactive window. Set the line in the image with the left mouse
button. Remember that the line must be drawn from left to right. Modify the Relative
threshold with the slider on the left side until a point on the contour is found. This point
is marked with a cross. Close this window.
2. Double-click the input field for Gray low or Gray high threshold and double-click the
appearing button. This opens an interactive window. Modify the lower and upper
threshold with the slider on the left side until the external contour of the object is
traced completely. Control the traced contour in the image and make sure that the
traced contour is robust against small variations of the upper and lower thresholds.
The results of this tool can be used for the following tools:
Circular perimeter ROI
Circular analysis
Check circular shape
Input Parameters
01 = Source bank Image bank containing the image to be processed..
02 = Start point X X coordinate for start point of line.
03 = Start point Y Y coordinate for start point of line.
04 = End point X X coordinate for end point of line.
05 = End point Y Y coordinate for end point of line.
06 = Relative threshold Required absolute change of gray value to find contour
points.
07 = Gray low Minimum gray value of pixels along the contour.
08 = Gray high Maximum gray value of pixels along the contour.
09 = Angular interval Resolution for re-sampling the contour in degrees.
10 = Destination bank Image bank in which to show the image with colored
contour and calculated centroid of the external area.
Returned Values
01 = Error flag Flag = 0 external perimeter found
Flag = -1 no external perimeter found
02 = X center X coordinate of calculated center of gravity.
If no external perimeter was found
X center = 0.
03 = Y center Y coordinate of calculated center of gravity.
If no external perimeter was found
Y center = 0.
Example
Figure – Example of a successfully found external contour. Displayed is the line to find a
contour point (yellow line), the found contour (yellow circle) and the center of mass
(red cross).
Internal Perimeter
This tool traces the internal contour of an object and is similar to the tool 'External Perime-
ter'. Return values are the center of gravity coordinates of the area inside the contour. The
operation can be described as follows: First, the tool scans the gray values along a user
defined line to find a point on the internal contour of the object. Beginning at the starting
point of the line the first change in gray values that is greater than a defined threshold is
indicated as a point on the contour. Note that the line must be drawn from left to right to
achieve correct results. Then the tool traces pixels with the required change of gray value
starting at the found point on the contour. To make the algorithm more robust it is neces-
sary to define a range on the gray scale with an upper and lower threshold.
Recommend steps to set up the input parameters:
1. Double-click the input field for Relative threshold and double-click the appearing
button. This opens an interactive window. Set the line in the image with the left mouse
button. Remember that the line must be drawn from left to right. Modify the Relative
threshold with the slider on the left side until a point on the contour is found. This point
is marked with a cross. Close the window.
2. Double-click the input field for Gray low or Gray high threshold and double-click the
appearing button. This opens an interactive window. Modify the lower and upper
threshold with the slider on the left side until the internal contour of the object is
traced completely. Control the traced contour in the image and make sure that the
traced contour is robust against small variations of the upper and lower thresholds.
The results of this tool can be used for the following tools:
Circular perimeter ROI
Circular analysis
Check circular shape
Input Parameters
01 = Source bank Image bank containing the image to be processed.
02 = Start point X X coordinate for start point of line.
03 = Start point Y Y coordinate for start point of line.
04 = End point X X coordinate for end point of line.
05 = Endpoint Y Y coordinate for end point of line.
06 = Relative threshold Required absolute change of gray value to find contour
points.
07 = Gray low Minimum gray value of pixels along the contour.
08 = Gray high Maximum gray value of pixels along the contour.
09 = Angular interval Resolution for re-sampling the contour in degrees.
10 = Destination bank Image bank in which to show the image with colored
contour and calculated centroid of the internal area.
Returned Values
01 = Error flag Flag = 0 internal perimeter found
Flag = -1 no internal perimeter found
02 = X center X coordinate of the calculated center of gravity.
If no internal perimeter was found
X center = 0.
03 = Y center Y coordinate of the calculated center of gravity.
If no internal perimeter was found
Y center = 0.
Example
Figure – Example of a successfully found internal contour. Displayed is the line to find a
contour point (yellow line), the found contour (yellow circle) and the center of gravi-
ty (red cross).
Input Parameters
01 = External perimeter step Refer to step number which executes the
‘External perimeter‘.tool
02 = Internal perimeter step A Refer to step number which executes the
‘Internal perimeter‘tool to perform the first
cut out.
03 = Internal perimeter step B Refer to step number which executes the
‘Internal perimeter‘tool to perform the
second cut out.
04 = Internal perimeter step C Refer to step number which executes the
‘Internal perimeter‘tool to perform the third
cut out.
05 = Destination bank Image bank in which to display the resulting
ROI.
Returned Values
01 = Error flag flag = 0 tool terminated correctly.
flag = -1 an error occurred.
Example
Figure – Example of a ROI generated by an external contour with cut outs of three different
internal contours.
Circular Analysis
This tool provides several measurements of circularly shaped contours. It is possible to
perform the measurement for one external and one internal contour at the same time or
for one external contour only. This tool needs the results of an ‘External perimeter’ tool and
/or an ‘Internal perimeter’. tool
Input Parameters
01 = External perimeter step Refer to program step number which
executes the ‘External perimeter‘.tool
02 = Internal perimeter step Refer to program step number which
executes the ‘Internal perimeter‘ tool.
Type 0 to use ‘Circular analysis‘ for meas-
urements of an external perimeter only.
03 = Angular interval Angular resolution of the measurements.
Range: 1 – 90 in units of 0.5 .
Note that a high resolution increases the
processing time considerably.
04 = Destination bank Image bank in which to show the results.
Returned Values
01 = Error flag flag = 0 tool terminated correctly.
flag = -1 an error occurred.
02 = Mean external diameter Averaged external diameter.
03 = Max external diameter Maximum found external diameter.
04 = Min external diameter Minimum found external diameter.
05 = Mean internal perimeter Averaged internal diameter.
06 = Max internal perimeter Maximum found internal diameter.
07 = Min internal perimeter Minimum found internal diameter.
08 = Ovalization Performed for external perimeter only.
Ratio between minimum external perimeter
and maximum external perimeter. Perfect
circle will yield 1.
09 = Concentricity Distance between external and internal
center of gravity in pixels.
10 = Mean difference radius Distance between internal and external
contour.
Input Parameters
01 = Source bank Image bank containing the image to be
processed.
02 = Perimeter ROI definition step Refer to step number which executes the
'Circular perimeter ROI' tool. This ROI
defines the region where the surface check
is performed. Note that only ROIs gener-
ated by this tool can be used.
03 = Gray low Minimum required gray value for a pixel to
be considered by the check.
04 = Gray high Maximum required gray value for a pixel to
be considered by the check.
05 = Sensitivity Minimum required difference in gray values
to detect a pixel as surface defect.
06 = Grid distance Dimension of the matrix in pixels. It is
recommended to use uneven values only. If
you enter an even value x the dimension is
set to x+1.
07 = Destination bank Image bank in which to display the image
and any found defects as colored pixels.
Returned Values
01 = Error flag Flag = 0 tool terminated correctly.
Flag = -1 an error occurred.
02 = Found pixels Total number of detected pixels inside ROI.
a) b)
Figure – Example for the two categories of defects on an external circular shape:
a) category dent, b) category spike.
Input Parameters
01 = Perimeter definition step Select the desired contour for the shape check.
Refer to step program which executes either
Internal perimeter or External perimeter.
02 = Type Set which shape defects that will be detected.
-1 detect dents only
1 detect spikes only
0 detect both.
03 = Sensitivity Sensitivity to detect shape defects.
Range: 0 .. 100.
0 is most sensitive to defects.
04 = Scan interval The interval between scanned pixels for compari-
son.
05 = Average pixels Number of pixels to calculate mean distance from
center of gravity.
06 = Destination bank Image bank to display image and the point with
the first defect.
Returned Values
01 = Transition flag 0 at least one defect was found
-1 no defect was found
02 = X transition X coordinate of the first found defect.
03 = Y transition Y coordinate of the first found defect.
4.8 Calculation
Mathematical Operation
This tool offers basic mathematical operations of two input parameters.
Note that division by 0 will return the value 2147483647.
Input Parameters
01 = Variable A First value for operation.
02 = Variable B Second value for operation.
03 = Mathematical operation Operator
Basic mathematical operations
or Boolean operation.
Double click on input box and select one of follow-
ing operation:
= : writes parameter A in the specified table row
+, - , ×, / (basic mathematical operations)
OR
Max
Min
Mean
Absolute value of difference
unsigned subtraction
And
Square root: the square root of variable A.
Variable B can be used for setting the num-
ber of decimals in the result:
-1 Do not round off the result
0 - 9 Number of decimals in the result
04 = Table index Row in table where the result should be written.
Returned Values
01 = Operation result Result
Mathematical Expression
This tool performs a calculation based on the mathematical expression given as input
parameter. The evaluation is performed in the same way as when a mathematical expres-
sion is written directly in a tool’s parameter field. It can be used to enhance readability of
the step program by commenting the calculation in a meaningful way.
To maintain good readability when multiple mathematical expression steps are used after
one another, it is suggested to group them together by using Edit Æ Increase tabulation.
Input Parameters
01=Expression Mathematical expression. Always starts with a “=”, for example
=2*(S5R1-S4R1).
Returned Values
01=Result The result of the evaluated expression.
Example
Result values are sent from the camera to the PC by the tool ‘Display’. Instead of writing an
expression in each of the tool’s parameter fields, it can be useful to refer to previous
mathematical expression steps that are clearly commented.
In Range
This tool checks whether or not a value is within a defined range. Usually the value is the
result from a previously performed program step. To set the range use Min value allowed
for the lower bound and Max value allowed for the upper bound. If the value has to be
exact the value, lower and upper bound values should be identical.
If you want to continue your step program on a certain step depending on the comparison
result (conditional jump) you could use the ‘If in range goto’ tool from the Program cate-
gory.
Input Parameters
01 = Value Value to be compared if it’s within the range or not.
02 = Min value allowed Lower bound of the range
02 = Max value allowed Upper bound of the range
Returned Values
01 = Comparison result Return value = 1 if the Reference value is within the
range
Return value = 0 if the Reference value is out of the
range
Input Parameters
01 = X center X coordinate of the center of the circle.
02 = Y center Like above but for Y direction.
03 = Radius Radius
04 = Angle Radius. Direction of rotation is counter clockwise
independently if the input value is positive or negative.
Returned Values
01 = X coordinate Cartesian coordinate in X-direction
02 = Y coordinate Cartesian coordinate in Y-direction
Example
α
(X,Y) X-axes
Fit Circle
This tool fits a circle to four input coordinates and outputs the coordinates of the center of
the fitted circle and the radius in pixel units.
Note that you must enter all four coordinates; if you just type three coordinates the fourth
coordinates is set to the default values (X4=0, Y4=0).
If the circumference is touching the border of the FOV or if parts of the circle are outside
the FOV, the circle is not plotted in the destination bank. The calculation results for the
center of the circle and the radius are calculated anyway.
The result of the error flag may be used to check if the tool was executed correctly during
run mode.
Input Parameters
01 = Source bank Number of the source bank. In this case just to copy
02 = X1 X coordinate of the first point
03 = Y1 Y coordinate of the first point
04 = X2 X coordinate of the second point
05 = Y2 Y coordinate of the second point
06 = X3 X coordinate of the third point
07 = Y3 Y coordinate of the third point
08 = X4 X coordinate of the fourth point
09 = Y4 Y coordinate of the fourth point
10 = Destination bank Image bank in which to plot the fitted circle as an overlay on
the copied image from the source bank. Only executed at
debug mode.
Returned Values
01 = X center X coordinate of the circle center
02 = Y center Y coordinate of the circle center
03 = Radius Circle radius in pixels.
Error Messages
Error 2 Input parameter values are "impossible" (e.g. negative or
out of field of view)
Error 114 At least two points of the four input points are identical
Error 140 At least three points of the four input points are on the same
line
Fit Ellipse
This tool fits an ellipse to six input coordinates and outputs the coordinates of the center of
the fitted ellipse and the minor and major axes radiuses in pixel units.
Note that you must enter all six coordinates; if you just type five coordinates the sixth
coordinates are set to the default values (X6=0, Y6=0).
The result of an error flag may be used to check if the tool was executed correctly during
the run modus.
Input Parameters
01 = Source bank Number of the source bank. In this case just to copy the
source bank into the destination bank.
02 = X1 X coordinate of the first point
03 = Y1 Y coordinate of the first point
04 = X2 X coordinate of the second point
05 = Y2 Y coordinate of the second point
06 = X3 X coordinate of the third point
07 = Y3 Y coordinate of the third point
08 = X4 X coordinate of the fourth point
09 = Y4 Y coordinate of the fourth point
10 = X5 X coordinate of the fifth point
11 = Y5 Y coordinate of the fifth point
12 = X6 X coordinate of the sixth point
13 = Y6 Y coordinate of the sixth point
14 = Destination bank Image bank in which to plot the fitted circle as an overlay
on the copied image from the source bank.
Returned Values
01 = X center X coordinate of the ellipse center.
02 = Y center Y coordinate of the ellipse center.
03 = Minor diameter Radius of the minor axes.
04 = Major diameter Radius of the major axes.
Sort
This tool sorts a number of values or groups of values in the table in ascending or de-
scending order. When groups of values are sorted, the sorting is based on a certain ele-
ment in each group.
Note. Only table values are sorted, whereas table descriptions remain unsorted.
Input Parameters
01 = Table index Start index in the table, i.e. the position of the first
value of the first group
02 = Number of groups Number of groups stored in the table
03 = Elements per group Number of table values per group
04 = Element to order The element in each group by which the groups
should be sorted.
05 = Sort order Select the sorting order:
0= ascending order
1= descending order
Returned Values
None.
Example
A blob analysis tool found three blobs and wrote the result to the table, starting at row 5.
For each blob, the tool wrote three values; x coordinate of the centroid, y coordinate of the
centroid and area.
Now we would like to sort the blobs according to their size (area) with the largest blob first,
that is sort the groups in descending order by the third element in each group.
Update Statistics
This tool enables statistical operations on up to ten selected values. Typically these values
are results of previously performed program steps.
The statistical results are calculated for each value separately and in the following order:
1. Minimum out of all monitored values
2. Maximum out of all monitored values
3. Average value
4. Standard deviation
5. Number of collected values for the statistical operations on that specific value
The results are placed in the table and are ordered in blocks. The first block in the table
contains all 5 results for the first values followed by the second block for the 5 results for
the second value and so on. You need to select the start index on the table for the first
value of the first block. Please note that you need 5 rows for each monitored value in the
table for the results. Thus, the number of rows you need from the starting index is equal to:
Number of monitored values* 5.
The result parameter Counter starts at zero at program start or after a ‘Reset Statistics’
tool is executed, and is increased by 1 each time this step is performed (=number of
repetitions). By the help of this parameter it is easy to update the statistic if the desired
number of repetitions have been performed, simply by using this result in an ‘If then GoTo’
tool from the Program category.
If you would like to restart the statistical evaluation and delete the old data it is essential to
execute the ‘Reset Statistics’ tool before the new evaluation.
This tool is useful for teaching results from program steps that slightly change or to control
the process and stability of the results.
Input Parameters
01 = Number of variables Number of different values for the statistical evaluation.
02 = Table index Starting index of table for the statistical result values. The
first value (=Minimum) from the first block starts at that
row.
03 = Variable A Value for statistical evaluation.
…
12 = Variable J
Returned Values
01 = Counter Number of executions since program start or last ’Reset
statistics’ tool.
Reset Statistics
This tool resets a previously performed statistical evaluation executed by the ‘Update
statistics’ tool.
It sets the values in the rows of the table that the ‘Update statistics’ tool refers to, to
default values, which are not zero except for the average values. Furthermore it sets the
result value Counter of the ‘Update statistics’ tool to zero.
Make sure that this tool is not performed during your statistical evaluation loop since this
constantly resets your statistics.
Input Parameters
01 = Step with statistics to Select the update statistics tool in your step program
reset which you would like to reset.
Returned Values
None
Coordinate Alignment
The Coordinate alignment tool is used for calibrating the IVC-2D’s coordinates, and option-
ally for aligning the coordinate system to an external coordinate system (world coordi-
nates).
The result from the tool is a transform, which is stored in a data block in the IVC-2D, and
can be used later by the 'Get calibrated point' tool to get aligned measurement values.
This tool is used through an interactive setup. Therefore, the program step can be re-
moved from or disabled in the program after creating the transform.
Input Parameters
None.
This tool is used through the interactive setup, which is opened by double-clicking the
Setup button. See “Coordinate Alignment” on page 220 for more information on the
interactive setup.
Returned Values
None.
Please note the number of the data block to which the transform is saved. in the interacti-
ve setup This number is used when using the transform in the 'Get calibrated point' tool.
Input Parameters
01 = Source bank The image bank containing an image to get calibrated
coordinates from.
02 = X pixel The x coordinate of the pixel.
03 = Y pixel The y coordinate of the pixel.
04 = Transform data The number of the data block in which the transform
block to use is stored.
Returned Values
01 = Calibrated X (mm) Calibrated X coordinate in millimeters
02 = Calibrated Y (mm) Calibrated Y coordinate in millimeters
03 = Calibrated Z (mm) Calibrated Z coordinate in millimeters
4.9 Program
Goto
This tool jumps to the selected step in the step program. The program continues execution
from that point.
Input Parameters
01 = Goto step Step number where the program continues.
If selected step was deleted during the setup of the
program this row is marked red and the previously
set value changes to –1.
Returned Values
None
If Then Goto
This tool jumps to a defined program step if the condition in Control expression is true
(Conditional jump).
Input Parameters
01 = Control expression Condition.
Definition: 0 = false.
For example = (v2 > v5).
02 = Goto step Step number where the program continues
if condition is true.
Returned Values
None
If Error Goto
This tool handles upcoming errors in program steps. It is recommended to handle potenti-
ally occurring errors in critical program blocks with this tool. This avoids that the program
stops due to an error.
If a program step returns an error the program either skips this step and continues with
the following step or jumps to a defined program step.
Please select the Goto step carefully to avoid accidentally creating an infinite loop.
Return parameters are the step number where the last error occurred and the error code.
Input Parameters
01 = Goto step Step number where to continue in case of an error.
02 = Continue to next step? False The program continues at step number
given by Goto step.
True The step with error is skipped and the
program continues with the next step. In
this case parameter Goto step is ig-
nored.
Returned Values
01 = Last step with error Step number which evoked the last error.
02 = Last error code Error code of last error.
If in Range Goto
This tool checks if a value is inside a certain range. Depending on the setting of the Goto if
parameter the tool jumps to a defined step number if the value is within or outside the
range.
Input Parameters
01 = Value to be compared Value to be checked.
02 = Min value allowed Lower range.
03 = Max value allowed Upper range.
04 = Goto if Condition for jump.
In range perform jump if value in
range.
Out of range perform jump if value
out of range.
05 = Goto step Step number to which the program will
jump and continue if value in range.
Returned Values
01 = Comparison result 1 if condition in Goto if is true.
0 if condition in Goto if is false.
Input Parameters
01 = Value A First value to be checked.
02 = A min value Lower range first value.
03 = A max value Upper range first value.
04 = Value B Second value to be checked.
05 = B min value Lower range second value.
06 = B max value Upper range second value.
07 = Value C Third value to be checked.
08 = C min value Lower range third value.
09 = C max value Upper range third value.
10 = Value D Fourth value to be checked.
11 = D min value Lower range fourth value.
12 = D max value Upper range fourth value.
13 = If all in range goto step Step number to which the program jumps
and continues at if all values are in range.
Returned Values
01 = Comparison result 1 all values are in range.
0 at least one value is out of range.
If
The 'If' tool is used together with an 'End' tool and optionally an 'Else' tool for enclosing
programs steps that should only be executed if a certain condition is fulfilled:
If the condition in the Control expression is true all program steps are executed bet-
ween this tool and the tool referred to by the ELSE or END step parameter.
If the tool referred to is an 'Else' tool, the steps following that tool are skipped and the
program continues with the program steps following the 'End' tool referred to by the 'El-
se' step.
If the condition in the Control expression is false the following program steps are skip-
ped and the program continues with the program steps following the tool referred to by
the ELSE or END step parameter.
A construction with an 'If' tool must always end with an 'End' tool.
Input Parameters
01 = Control expression Definition: 0 = false.
Boolean operations and mathematical expres-
sions are allowed, for example
= (v2 > v5)
02 = ELSE or END step Step number that refers to the corresponding
'Else' or 'End' tool. .
Returned Values
None
Example
Else
This tool could be used after the ‘If’ tool and must be terminated with the ‘End’ tool. It
depends on the condition in the ‘If’ tool. If the condition is true all program steps between
‘Else‘ and ‘End’ are skipped. If the condition is false only the program steps between ‘Else‘
and ‘End' are executed. See figure below.
Input Parameters
01 = IF step This parameter refers to the step number
with corresponding ‘If‘ tool.
02 = END step This is the step number with the corre-
sponding ‘End‘ tool.
Note that no other step numbers are
allowed.
Returned Values
None
Example
Step 1 tool: If
01 = Control expression : (condition)
02 = END step: 4
For
This tool performs a for loop. It repeats the execution of program steps between ‘For‘ and
‘End’. It initializes the loop index with the start value and repeats program steps until Loop
index is equal to or greater than Stop value. After each repetition the Increment value is
added to Loop index.
The repetition of program steps terminates if the Loop index is equal to or greater than the
Stop value.
Input Parameters
01 = Start value Initialize start value for Loop index.
02 = Stop value Set stop value for Loop index.
03 = Increment Increment for Loop index.
04 = END step Step number with corresponding End.
Returned Values
01 = Loop index Current loop index.
Example
Input Parameters Returned Values
Start value = 1 Loop index = 1, 5, 9
Stop value = 10
Increment = 4
While
This tool performs a while loop. It repeats all program steps between ‘While’ and ‘End’ until
the condition in Control Expression is false. Due to that this tool must be terminated with
an ‘End’ tool.
Input Parameters
01 = Control Expression Condition.
Boolean operations and mathematical expressions are
allowed. For example:
= (v2 > v5).
02 = END step Step number that refer to the corresponding function
‘End’.
Note that no other step numbers are allowed.
Returned Values
None
Subroutine Start
This tool defines the beginning of a subroutine and must be followed by the ‘End’ tool.
When the subroutine is called it executes all program steps between Subroutine and End.
A subroutine can be called by the following tools:
- Goto
- If then go to
- If in range goto
- If all in range goto
After the subroutine is executed the program continues at the step following the step
calling the subroutine.
Input Parameters
01 = END step Step number of the ‘End‘ that belongs to the subroutine.
Returned Values
01 = Calling step Step number which called the subroutine
Example
Step number Step tool Execution order
1 Goto step 15 1
2 15
3 16
4 17
5 18
. 2
. 3
. 4
. 5
15 Subroutine Start .
16 Intermediate steps .
17 Intermediate steps .
18 End step .
End
The End tool must follow the following tools:
- If
- While
- For
- Subroutine
Input Parameters
01 = Start step Step number that refer to the corresponding
‘If‘, ‘While‘, ‘For‘, or ‘Subroutine‘ tool.
Returned Values
None
Input Parameters
01=Program number Number of the program bank in which the program
and table to load is saved.
02=Start step Step number in the loaded program where to start
the execution.
03=Start load table index Index of the first table row to be loaded from the
table stored with the step program and into the
active table.
04=Number of elements The number of table rows to be loaded from the
table saved with the step program and into the
active table.
Returned Values
None
Program Protection
The Program protection tool can be used for preventing a program from being imported
from the device and opened in IVC Studio, and for preventing a program to be copied to
and run in another device.
A program containing this tool cannot be imported from the Flash memory into IVC Studio.
The Emulator does If the Lock to device parameter is set, the program will only run on the device to which it
not emulate this was loaded from IVC Studio. If the program is copied from one device to another, it will
tool. See section refuse to run on the other device.
Handling the
Emulator for more If the Lock to device parameter is not set, the program can be copied to other devices
information. through FTP and run on those devices, but never imported back into IVC Studio.
Note: If you use this program step in a program, make sure that you keep the original
project file, since there is no way to recover the program from a device if the project file is
lost.
Input Parameters
02=Lock to device If this parameter is set, the program will only run on the device
that it was written to flash from IVC Studio.
If you try to copy this program from one device to another, it
will refuse to run on the other device.
Returned Values
None.
4.10 System
Get Timer
This tool allows monitoring of the system time. The total processing time or the processing
time of certain step sequences can be calculated by subtracting the results of two different
Get timer tools or of one tool in two cycles of the step program. Since it is not possible to
reset the timer the return value should be stored in the table to calculate cycle times of
step program sequences. The maximum value for system time is 1,157,627,903 (which
correspond to 44FFFFFF hexadecimal). When maximum value is reached the value
will be wrapped.
Input Parameters
None
Returned Values
01 = System time System time in microseconds (µs).
Wait
This tool sets a time delay in the step program. The program stops at this step and conti-
nues after the specified waiting time.
Note that the displayed Time of execution has no meaning in this step. Please ignore this
value.
Input Parameters
01 = Wait time (ms) Desired time delay in milliseconds.
Maximum time delay = 9999 ms.
Returned Values
None
Input Parameters
01 = Table index Index number of the table in which to select
a value.
Returned Values
01 = Value Returns the read value from the table.
Write to Table
This tool writes a value into the table.
Input Parameters
01 = Value Value to be written in the table.
02 = Table index Index in table where the value should be written.
Returned Values
None
Fill Table
This tool fills a value into a selected array in the table. The array is defined by a Start table
index at which this tool starts to fill the table and an End table index at which this tool
stops to fill the table. Either each cell in this array is filled with the value or only every nth
row.
Input Parameters
01 = Value Value to be filled in the table.
02 = Start table index Index number of the table to define first row of the
array.
03 =End table index Index number of the table with the last row of the array.
04 = Fill interval Number of skipped rows between each value. 1 means
all cells in the array are filled with the value.
Returned Values
None
Input Parameters
01 = File name Name of the file to be loaded.
02 = Data block The number of the data block in working
memory into which to load the data.
Returned Values
None
Error Messages
Err=2 A timeout occurred.
Err=159 Failed to read file from flash.
Input Parameters
01 = Data block The number of the data block in working memory in which the
data to be saved is stored.
02 = File name Name of the file in which to save the data.
Returned Values
None
Error Messages
ITF Error = 2 Timeout. The execution time to save the data block on
flash is too long. Increase the timeout limit (Options Æ
Configuration on the IVC Studio menu bar).
Err. = 8960 The amount of dead space on the flash exceeds the
specified threshold. Please defragment the disk by using
the Clear Unused Memory option on the Flash menu in the
Device list.
Err. = 8961 The automatic defragmentation failed. The camera may
need to be restarted to restore the flash.
Input Parameters
01 = Flash bank Number of the flash bank in which the image to be loaded
is stored.
Available numbers of flash banks: 0 – 9999.
02 = Destination bank Number of the image bank into which to load the image.
Returned Values
None
Error Messages
Err. = 361 Type of image to restore is different from image type
of bank.
Err. = 7304 The file could not be found.
Err. = 7306 The size of the image bank to be loaded from file
does not match current FOV settings.
Note: This tool may perform an automatic defragmentation of the flash disk if the amount
of dead space exceeds the specified threshold. Please refer to section Setting Device
Parameters in the appendix for information on how to set this threshold. This will signifi-
cantly increase the execution time of the tool. Note also that this is only the case when the
camera is running, not when executing the tool with F5/F8. In the latter situation, an error
code will be returned indicating that it is time to defragment the flash.
Input Parameters
01 = Source bank Image bank containing the image to be saved to flash.
02 = Flash bank Number of the flash bank in which the image will be
stored. Valid numbers for flash banks are 0 – 9999.
03 = Format Image format for the saved image:
Raw
Jpeg
Compressed raw
04 = Quality factor When Format is set to Jpeg, the amount of compression
of the image. Valid values: 1–100.
100 Highest quality of the image (no jpeg compression)
1 Low image quality and short execution time (maxi-
mum jpeg compression).
Returned Values
None
Error Messages
ITF Error = 2 Timeout. The execution time to save image bank on flash
is too long. Increase the timeout limit (Options Æ Configura-
tion on the IVC Studio menu bar).
Err. = 8960 The amount of dead space on the flash exceeds the
specified threshold. Please defragment the disk by using
the Clear Unused Memory option on the Flash menu in the
Device list.
Err. = 8961 The automatic defragmentation failed. The camera may
need to be restarted to restore the flash.
Input Parameters
01 = Table index Index of the first table element to be stored on flash.
02 = Number of The number of table elements to be stored on flash.
elements
03 = File name Name of the file on flash where the data will be stored.
04 = Warning! The tool will only work if this parameter is set to ‘Accept’. The
Wears down flash default value is ‘Do not accept’. This is a safety precaution to
reduce the risk of accidental inclusion of the step in your main
loop.
Returned Values
01 = Result 0 – Everything is ok.
-1 – Warning! Wears down flash was not set to Accept.
1 – The file could not be written, most likely because the flash
disk is full
Error Messages
ITF Error = 2 Timeout. The execution time to save image bank on flash
is too long. Increase the timeout limit (Options Æ Configura-
tion on the IVC Studio menu bar).
Err. = 8960 The amount of dead space on the flash exceeds the
specified threshold. Please defragment the disk by using
the Clear Unused Memory option on the Flash menu in the
Device list.
Err. = 8961 The automatic defragmentation failed. The camera may
need to be restarted to restore the flash.
Input Parameters
01 = Table Index The elements read from the flash will be stored in the current
table starting from this index.
02 = File Name Name of the file on flash
Returned Values
01 = Result 0 – Everything is ok.
1 – The file does not exist.
2 – The file could not be read and interpreted.
http://xxx.yyy.zzz.qqq/status.html
xxx.yyy.zzz.qqq is the IP address
of the device
Included variables
Input Parameters
01 = Source bank Selected image bank that will be included on the web
page.
02 = Copy bank Option if the image bank should be copied or not.
True The image bank is copied to a buffer and syn-
chronic with the execution of the Web Status
Page tool in the step program.
False The image bank will not be copied to a buffer
and is dependent on when the status page is
accessed by the browser.
03 = Description A Description for variable A that will be included on the web
page (only strings).
Returned Values
None
Errors
If you are unable to connect to the device with a web browser, try the following:
Check that the HTTP server is enabled
Go to: Options Æ ConfigurationÆ Ethernet Devices.
Click on button: Ethernet Device Configuration and check Device Parameters on the
right table. HTTP Server Enabled must set to 1.
4.11 Communication
Setup RS485
This tool initializes the RS485 port. It must be executed in the step program before using
following tools:
‘Write RS485 Values’
‘Read RS485 Values’
The Emulator does ‘Write RS 485 String’
not emulate this
tool. See section ‘Read RS 485 String’
Handling the
Emulator for more Input Parameters
information.
01 = Baud rate Select desired Baud rate (1200 – 115200).
02 = Parity Select parity:
None
Even
Odd
03 = Data bit Select how many data bits:
7
8
04 = Stop bit Select number of stop bits:
1
2
Returned Values
None
Returned Values
01 = Received bytes Total number received values.
Error Messages
Err. = 407 Serial protocol
Check if a ‘Setup RS485’ tool was executed before
using this tool.
Check Timeout in ms.
Check if the number of Expected values is equal to
Received bytes.
Returned Values
None
Error Messages
Err. = 407 Serial protocol
Check if a 'Setup RS485' tool was executed before
using this tool.
Example
Table index:20
Table index:21
Only values from index 21 – 23
Table index:22 will be sent via RS485
Table index:23
Table index:24
Table index:25
Input Parameters4
01 = Timeout Time limit about how long the tool waits to read string
via the RS485 port.
Returned Values
01 = Received bytes Number of received bytes.
02 = Received string Received string.
Error Messages
Err. 407 Serial protocol
Check if a 'Setup RS485' tool was executed before
using this tool.
Input Parameters
The Emulator does
not emulate this 01 = String String to write.
tool. See section Note that only up to 4095 characters can be sent.
Handling the
Emulator for more Returned Values
information.
None
Error Messages
Err. 407 Serial protocol
Check if a 'Setup RS485' tool was executed in the step
program before using this tool.
Err. 8006 The string to send is too long (more than 4095 charac-
ters)
Enable Ethernet
This tool handles transmission of result values and images from the device to PC via the
Ethernet port. Input parameter Status controls if the transmission will be enabled or di-
sabled. Transmission via Ethernet port = enabled is the default setting.
If Status = false transmission will be disabled. In this case the 'Display' tool will not be
updated with current result values and no image will be shown.
If Status = true transmission will be enabled again. After enable the transmission again it is
recommended to include a 'Wait' tool with a delay of at least 1 ms in the step program
before using tools that need result values or images. This ensures that the values will be
available for the following tool.
Input Parameters
01 = Status False Disable transmission of result values and images from
the device to PC via Ethernet port.
True Enable transmission of result values and images from
the device to PC via Ethernet port.
Returned Values
None
1 3
Connection Device C
Device A requests
Incoming TCP
2 Port: 2610
Connection
Device B
For Outgoing TCP connections, the Associated IP specifies which device to communi-
cate with and the Associated Port specifies which port the other device will listen on. The
IVC Device Port can be set to 0, in which case the camera’s port number will be set auto-
matically.
For Incoming TCP connections, the IVC Device Port must be set, while the parameters
Associated IP and Associated Port are ignored. This means that the camera will accept a
connection from any other device that connects to the IVC Device Port.
For UDP connections, setting the IVC Device Port to 0 will prevent the camera from receiv-
ing data over this connection. Likewise, leaving Associated IP empty and setting Associ-
ated Port to 0 will prevent the camera from sending data over the connection. If the Asso-
ciated IP is set, the camera will only receive data from that device.
If an Outgoing TCP or Incoming TCP connection could not be established before the
timeout, the camera will try to re-establish the connection on every subsequent read or
write operation. Furthermore, if a connection is closed for any reason, it cannot be used
again until it is closed (by using the 'Close Ethernet raw' tool) and reopened again.
Input Parameters
01=Timeout The time in milliseconds during which the camera will try to
establish the connection.
02=Transport Protocol Type of connection to be established and protocol (TCP or
UDP) for the connection.
Outgoing TCP
Incoming TCP
UDP
03=IVC Device Port The port number on which the camera will send or receive
data. Valid port numbers are 1500–65535.
For Outgoing TCP, this parameter can be set to 0. In this
case the port number will be set automatically.
For UDP, if this parameter is set to 0 the camera will not be
able to receive data on this connection.
04=Associated IP The IP address of the device to which to establish the
connection. If this parameter is set, the Associated Port
must also be set.
For Incoming TCP, this parameter is ignored and can be
left empty.
For UDP, if this parameter is empty the camera will not be
able to send data on this connection.
05=Associated Port The port number used on the device to which to connect. If
this parameter is set, the Associated IP must also be set.
Valid port numbers are 1–65535, however port numbers
1–1023 are usually reserved for the system
For Incoming TCP, this parameter is ignored and can be
left empty.
For UDP, if this parameter is 0 the camera will not be able to
send data on this connection.
Returned Values
None.
Error Messages
Err. = 8002 No connection possible to the associated address.
Error Messages
Err. = 1 The program step referred to by the parameter Open step does
not contain an 'Open Ethernet raw' tool.
Input Parameters
01=Open step The program step in which the connection was opened.
02=Timeout The time in milliseconds during which the camera will try to
receive data. This includes the time it takes to establish the
connection, if necessary.
03=Expected bytes The number of values that are expected to be received.
04=Table index Table row in which to store the first received value.
The tool will store values in the table rows from Table index to
(Table index + Expected bytes -1)
Returned Values
01=Received bytes The number of bytes that have been received and stored in the
table.
Error Messages
Err. = 1 The program step referred to by Open step is not an 'Open
Ethernet Raw' step.
Err. = 8000 Connection timed out.
Err. = 8001 Connection is broken.
Err. = 8002 Not possible to connect to the specified device.
Err. = 8004 The specified connection is for sending data only.
Formatting string
The format of the information to receive is specified in a string where the type and preci-
sion is specified for each value. The binary data is formatted according to the IEEE-754
standard. The following formats are available:
Format Description
Ix Integer with x bytes (1, 2 or 4 bytes)
Fy Float with y bytes (4 or 8 bytes)
Uz Unsigned integer with z bytes (1, 2 or 4 bytes)
Pn Pad with n bytes (0-999 bytes). The padded bytes will be set to 0.
Input Parameters
01=Open step The program step in which the connection was opened.
02=Timeout The time in milliseconds during which the camera will try to
receive data. This includes the time it takes to establish the
connection, if necessary.
03=Table index Table row in which to store the first received value.
04= Format string A string specifying how the values shall be formatted. See table
above.
05= Endian Controls Little or Big Endian for the byte order of the received
data.
Returned Values
01=Received bytes The total number of bytes that have been received.
Error Messages
Err. = 1 The program step referred to by Open step is not an 'Open
Ethernet Raw' step.
Input Parameters
01=Open step The program step in which the connection was opened.
02=Timeout The time in milliseconds during which the camera will try to
receive the string. This includes the time it takes to establish
the connection, if necessary.
Returned Values
01=Received bytes The length of the received string., that is the number of bytes
that was received.
02=Received string The received string.
Error Messages
Err. = 1 The program step referred to by 01=Open step is not an 'Open
Ethernet Raw' step.
Err. = 8000 Connection timed out.
Err. = 8001 Connection is broken.
Err. = 8002 Not possible to connect to the specified device.
Err. = 8004 The specified connection is for sending data only.
Returned Values
01=Sent bytes The number of bytes that was sent.
Error Messages
Err. = 1 The program step referred to by 01=Open step is not an
'Open Ethernet Raw' step.
Err. = 8000 Connection timed out.
Err. = 8001 Connection is broken.
Err. = 8002 Not possible to connect to the specified device
Err. = 8003 The specified connection is for receiving data only.
Err. = 7601 Some of the table entries that should be sent had an in-
compatible type (only numeric values are allowed).
Format Description
Ix Integer with x bytes (1, 2 or 4 bytes)
Fy Float with y bytes (4 or 8 bytes)
Uz Unsigned integer with z bytes (1, 2 or 4 bytes)
Pn Pad with n bytes (0-999 bytes). The padded bytes will be set to 0.
The format specified in the sting will have precedence over the format in the table cell. E.g.
if the table cell holds a float, and the string specifies an integer, the value will be truncated
to an integer.
For padding bytes, no table cell is accessed.
Example:
If the telegram holds two integers with 2 bytes, one integer with 4 bytes and three floats
with 4 bytes, the string shall have the following format:
I2I2I4F4F4F4
Input Parameters
01=Open step The program step in which the connection was opened.
02=Timeout The time in milliseconds during which the camera will try to
send data. This includes the time it takes to establish the
connection, if necessary.
03= Table index Table row in which the first value to send is stored.
04= Number of values The number of values to send.
05= Format string A string specifying how the values shall be formatted. See
table above.
06= Endian Controls Little or Big Endian for the byte order of the trans-
mitted data.
Returned Values
01=Sent bytes The total number of bytes that was sent.
Error Messages
Err. = 1 The program step referred to by 01=Open step is not an
'Open Ethernet Raw' step.
Returned Values
01=Sent bytes The number of characters (bytes) that were sent.
Error Messages
Err. = 1 The program step referred to by 01=Open step is not an 'Open
Ethernet Raw' step.
Err. = 8000 Connection timed out.
Err. = 8001 Connection is broken.
Err. = 8002 Not possible to connect to the specified device
Err. = 8003 The specified connection is for receiving data only.
Err. =8006 The string to send is too long (more than 4095 characters when
using TCP, more than 1472 characters when using UDP)
Communication Setup
The Communication setup tool is used for specifying which parameters the device should
publish and subscribe to, using either the Ethernet/IP or the OPC protocol.
This tool only specifies the parameters that should be read from or written to the network.
The actual reading and writing of values occurs when a 'Communication Read/Write' tool is
executed.
The Emulator does
not emulate this The Communication setup tool can be used several times in a program, and it is possible
tool. See section to change the definition of an already specified parameter. For example, if one Communi-
Handling the cation setup tool defines that the value from table row 1 should be published as a certain
Emulator for more parameter, and another Communication setup tool defines that table row 2 should be
information. published as the same parameter, the actual content of the parameter depends on which
Communication setup tool that was executed last.
Input Parameters
None.
This tool is set up by using the interactive setup, which is opened by double-clicking the
Setup button. See “Communication Setup” on page 223 for more information on the
interactive setup.
Returned Values
None.
Error Messages
Err. = 8101 There is a syntax error in the definition of the assembly.
Communication Read/Write
The Communication read/write tool is used for updating values for parameters that are
read from the network, and to publish updated parameter values on the network, using
either the Ethernet/IP or the OPC protocol.
This tool is used for updating all values read from and published on the network. The
Read/write parameter specifies whether the tool should update the values of subscribed
The Emulator does parameters, publish updated values for other devices to read, or both.
not emulate this
tool. See section To specify which parameters to subscribe to and publish, use the 'Communication setup'
Handling the tool.
Emulator for more
information.
Input Parameters
01 = Read/Write Specifies whether values should be read from the network,
written to the network, or both.
Read Read updated values for the subscribed
parameters.
Write Write updated values for the parameters
published on the network.
Read/Write Read and write updated values.
Returned Values
None.
Error Messages
Err. = 8103 The value to write was too large for the type of the published
parameter, or would need to be rounded (was real when ex-
pected integer).
Allowed value ranges are:
SINT: -128 … 127
INT: -32 768 … 32 767
DINT: -2 147 483 648 … 2 147 483 647
Err. = 8104 The value to write was a string when expecting a value, or a value
when expecting a string.
Send to FTP
Note: This tool replaces the previous version of the Send to FTP tool. The previous version is
made obsolete in IVC 3.1 SR1, and we recommend that the new tool is used instead.
The Emulator does This tool is used for saving files on an FTP server, files that contain an image, a data block
not emulate this or values from the table. The saved files can either be used for debugging purposes or
tool. See section
Handling the
when developing programs using the Emulator as device.
Emulator for more The device will log on to the FTP server using the supplied user name and password. If
information. there is a firewall between the device and the FTP server and there are problems connec-
ting to the FTP server, setting Passive mode to True may help.
The files are saved in the location and with the name specified by the Directory and File-
name parameters. You can use expressions to create filenames based on values from the
table and results from other steps. For example, by setting Directory to ‘images’, and
Filename to:
='image_no_' + str(V2) + '.jpg'
the image will be saved in the images directory on the FTP server with the file name
image_no_19.jpg, if the table row 2 contains the value 19.
Images can be saved in either raw, grayscale JPEG, or color JPEG format. Images saved in
raw format can be imported and used in IVC Studio. Use the raw format if the images are
to be used by the Emulator; make sure that the file names have the extension .raw (2D
and 3D images) or .img (3D images). Note that the raw format is no longer compatible with
bmp for 2D images. Use instead the bmp option for this. When saved in grayscale JPEG
the image is saved without any added graphics (such as ROIs and results added by other
tools), whereas they would be included if saved in color JPEG format.
The Quality factor parameter sets the compression ratio for the images when saving in
JPEG format.
When saving data, the tool saves the values from the table to the file, from row number
Table index and up to (but not including) row number Table index + Number of elements.
The tool can transmit images and table data in the same call. In this case, the filename and
folder will specify the location for the image file, and the table information will be stored in a
file called “TableData.txt”. This file will be stored in a folder called Data which is located in
the image folder. For example, if the image file is specified as ‘im-
ages\110114\image_xx.jpg’, the table data will be stored in the file ‘im-
ages\110114\data\TableData.txt’.
If a data block is transmitted, no other data type is allowed, and the parameters Table
index and Image bank must be set to -1.
Note: the parameter Timeout refers to interruptions during the transfer of FTP data. E.g. if
the parameter is set to 1000 ms (1 second), the transfer will still be successful even if the
total time of the transfer exceeds 1 second. The transfer will in this case report timeout
only if the time between two consecutive data packets containing the image exceeds 1
second.
The parameter Quote command can be used to send a generic command to the FTP
server. If this parameter is used, the command text entered in the parameter will be sent
to the FTP server immediately after a successful connection. If the parameter is empty
(default), no command will be sent. If the FTP server fails to interpret or handle the com-
mand, the connection will be terminated and no data will be sent.
The tool can store table data in two formats:
Configuration This format is compatible with the Get from FTP tool and the table
data file can only hold one set of data. The first row in the file speci-
fies the number of data rows, and each of the following rows con-
tain datatype and actual data.
Example:
3
0 429
2 1.717000e+01
3 6 ‘Hello
The file contains three rows of data from the table. The first row
contains an integer, the second row a double float and the last row
contains a string. The length of the string is also specified.
The available data types are:
0: Long integer
1: Single float
2: Double float
3: String
CSV Append / This format is compatible with Excel and each value is separated by
CSV Overwrite a comma. When the Append format is specified, each call to the
tool will result in a new row in the file.
Example:
429,17.17,Hello
429,18.18,World
The file contains two rows. Decimal separator is always ‘.’ for floating
values.
Input Parameters
01=IP address The IP address of the FTP server to connect to.
02=Port The port number used on the FTP server to connect to.
03=Username A user name used for connecting to the FTP server.
04=Password The password for the user on the FTP server.
05=Timeout Timeout in milliseconds for connection and transmission
of the data.
06=Passive mode Specifies whether or not to use passive mode when
connecting to the FTP server.
07=Directory Directory on the FTP server where the file shall be sto-
red. The directory will be created if it does not exist. The
folder name cannot contain backslash ‘\’. Use the slash
‘/’ character to separate folders.
08=Filename The name of the file where the information shall be
stored. The filename cannot contain slash nor backslash
characters.
09=Data block The ID of the data block to transmit. Set to -1 if not used.
10=Source bank The index of the image bank to transmit. Set to -1 if not
used.
11=Image format The image format in which the image should be saved:
raw
jpeg color
jpeg greyscale
bmp color
bmp greyscale
Choose raw or bmp greyscale if the images are to be
used by the Emulator.
12=Quality factor When Image format is set to Jpeg gray or Jpeg
color, this sets the compression ratio of the saved
image. Possible input values: 1–100.
100 Highest quality of the image (no jpeg compression)
1 Low image quality and short execution time (maxi-
mum jpeg compression).
13=Table index Table index of the first row of data to send. Set to -1 if
not used.
14=Number of elements Number of table rows to send.
16=Quote command A generic command that can be sent to the FTP server.
17=Table format Specifies the format of the information stored in the table
data file. The parameter can have the following values:
Configuration – The contents of the file can be
reloaded using the Get from FTP tool. The file will always
be overwritten if it exists.
CSV Overwrite – The data is stored with each value
separated with a comma. The file is always overwritten.
CSV Append – The data is stored with each value
separated with a comma. The data is appended if the file
exists.
Returned Values
None
Error Messages
Err=158 The specified data block is invalid or does not contain any data.
Err=8900 Could not connect to the FTP server.
Check IP address and port number.
Check user name and password.
Check firewall settings and try using Passive mode.
Err=8901 The account for the specified user name is invalid
Err=8902 Access denied.
Err=8903 Timeout
Err=8904 No connection to the FTP server
Err=8906 The specified directory was not found
Err=8907 The FTP server did not understand or could not handle the Quote
command.
Err=8909 At least one of the data types (datablock, image or table) must
be specified.
Input Parameters
01=IP address The IP address of the FTP server to connect to.
02=Port The port number used on the FTP server to connect to.
03=User name A user name used for connecting to the FTP server.
04=Password The password for the user on the FTP server.
05=Timeout Timeout in milliseconds for connection and transmission
of the data.
06=Passive mode Specifies whether or not to use passive mode when
connecting to the FTP server.
07=Directory The directory on the FTP server where the file is stored.
08=Filename The name of the file in which the information is stored.
09=Data block The number of the data block in working memory in
which the information shall be stored. Set to -1 if not
used.
10=Image bank The index of the image bank where to store the image
file. Set to -1 if not used.
11=Table index The index of the table where the elements from the file
shall be stored. Set to -1 if not used.
12=Save Mode Controls how the retrieved file shall be stored in the
camera:
RAM Only – The file will be stored in RAM only in an
image bank, data block or in the table.
FFS Only – The file will be stored only on the flash. The
parameters 9-11 must in this case be set to -1
RAM and FFS – The file will be stored both in RAM and
on the flash.
Returned Values
None
Error Messages
Err=8900 Could not connect to the FTP server.
Check IP address and port number.
Check user name and password.
Check firewall settings and try using Passive mode.
Err=8901 The account for the specified user name is invalid
Err=8902 Access denied.
Err=8903 Timeout
Err=8904 No connection to the FTP server
Err=8905 The specified file was not found
Err=8906 The specified directory was not found
Err=8909 At least one datatype (image, datablock or table) must be speci-
fied.
Err=8910 When storing a file to the flash, the parameters Data block,
Image bank and Table index must be set to -1.
Err=8911 Only one datatype (image, datablock or table) can be specified in
the same call.
Err. = 8960 The amount of dead space on the flash exceeds the specified
threshold. Please defragment the disk by using the Clear Unused
Memory option on the Flash menu in the Device list.
Err. = 8961 The automatic defragmentation failed. The camera may need to
be restarted to restore the flash.
The tool returns the synchronized time, both as seconds, and as a date/time string as
specified in the table above.
Input Parameters
01=IP address The IP address of the SNTP server to connect to.
02=Timeout Timeout in milliseconds to wait for the SNTP server to
respond.
03=Time format The format that the date/time string shall use.
04=Time zone The offset in hours from UTC.
Returned Values
01=Seconds The number of seconds since 1 January 1970.
02=Time A string holding date and time in the format specified in
the Time format parameter.
Error Messages
Err=8002 Could not connect to the SNTP server.
Check IP address.
Check firewall settings, SNTP uses UDP on port 123.
Err=8000 The SNTP server did not respond within the specified timeout.
4.12 Input/Output
Read Input
This tool reads the state of an input signal and returns the current status (High or Low).
This enables synchronization of the step program with an external input.
In addition, it is possible to set the tool to wait until the input signal has a specified state,
by setting the Wait parameter to True and Wait for to the state to wait for. Please note
The Emulator does that when running a program that contains such a step, the execution will be halted indefi-
not emulate this nitely until the signal changes to the selected state. When executing the program step
tool. See section using Execute Step or Step by Step, the tool will time out after 100 ms.
Handling the
Emulator for more
information.
Input Parameters
01 = Input number The input signal to read the status of:
Value Signal Pin Color
0 Trigger In/In 0 Power connector, pin 1 White *
1 In 1 Power connector, pin 5 Gray *
2 In 2 Power connector, pin 6 Pink *
3 In 3 (IVC-2D) RS485 connector, pin 8 Red **
* Color is valid for cable type DOL-1208-
** Color is valid for cable type STL-1208-
02 = Wait True Wait until the input signal is high or low, as specified by
Wait for.
False Read the status immediately. The input parameter Wait
for is ignored.
03 = Wait for The input signal to wait for.
High
Low
Returned Values
01 = Signal value Actual status on selected pin.
0 = Low
1 = High
Set Output
This tool sets an output status on a selected pin.
Input Parameters
01 = Output number Selects pin where to set output status.
Value Signal Pin Color
0 Out 0 Power connector, pin 3 Green *
1 Out 1 Power connector, pin 4 Yellow *
2 Out 2 RS485 connector, pin 3 Green **
* Color is valid for cable type DOL-1208-
** Color is valid for cable type STL-1208-
02 = Signal value Status :
High
Low
Returned Values
None
Input Parameters
01 = Set all outputs Value Outputs
Out 0 Out 1 Out 2
0 Low Low Low
1 High Low Low
2 Low High Low
3 High High Low
4 Low Low High
5 High Low High
6 Low High High
7 High High High
Returned Values
None
Output signal
High
Trigger
Low
Time
Delay On duration
Delay from trigger
Signal value = High
High
Low
Delay On duration
Delayed
Signal value = High
High
Low
High
Low
Since this tool runs as independent task it does not affect the execution time of the pro-
gram steps.
Input Parameters
01 = Output number Specifies which output signal to set.
0 = Out 0
1 = Out 1
2 = Out 2
02 = Type Delay from trigger
When triggered by the Trigger In signal, it waits
for the Delay time before setting the output to
Signal Value. After the time in On duration, the
signal is reversed.
How and when to trigger is set in the 'Grab
setup' tool.
Delayed Waits for the Delay time before setting the
output to Signal Value. After the time in On du-
ration, the signal is reversed.
Pulse on Starts a pulsing output. Immediately sets the
output to high for the time in On duration, then
sets it to low for the time in Off duration. This is
repeated until a 'Set timed output' tool is exe-
cuted with Type set to Pulse off, the output
is set by another tool, or the camera is powered
down.
Pulse off Stops a pulsing output that has been started by
a 'Set timed output' tool with Type set to
Pulse on,
Fixed on Immediately sets the output to high.
Fixed off Immediately sets the output to low.
03 = Delay time (ms) The delay time when Type is set to Delay from trigger
or Delayed. 0 – 10.000 ms.
04 = On duration (ms) The time during which the signal is set to Signal value (Type is
Delay from trigger or Delayed) or high (Type is Pulse
on). 0 – 10.000 ms.
05 = Off duration (ms) The time during which the signal is set to low when Type is set
to Pulse on. 0 – 10.000 ms.
06 = Signal value Specifies how to set the output signal when Type is set to
Delay from trigger or Delayed.
Can be set to High or Low.
Returned Values
None
Set LED
This tool sets the color of the LED with the label “function” on the device, or turns it off.
Input Parameters
01 = Set LED Select one of the four options:
Off
Green on
Red on
Yellow on
Returned Values
None
4.13 Reader
Read Barcode
The Read barcode tool is used for reading linear barcodes in images. The tool can read the
following barcode formats:
Pharmacode Code 32
EAN-8 Code 39
EAN-13 Code 128
UPC-A Interleaved 2of5
UPC-E Code 2/5 industrial
PDF417
This tool has an interactive setup in which you can set the input parameters and immedia-
tely see how the result is affected by the changes. The interactive setup is opened by
double-clicking the Setup button.
This tool has a number of options for improving the reliability of the reading, but which also
may affect the execution speed:
With the Interpolation method parameter you can choose which interpolation method
to use for analyzing the thickness of the bars.
Setting the Variable bar length parameter can compensate for differences in thickness
of the bars, for example if the barcodes are viewed from an angle, or if they are
wrapped around a bottle.
By setting the Normalization parameter, the images will be normalized before reading
the barcode to reduce variations in exposure, which may make the reading more accu-
rate.
If the barcode type supports checksums, the tool will verify the read barcode if the Use
checksum parameter is set.
The tool returns the code that was read as a string in Read string. In addition Edge has
defects indicates whether there was any dark areas found in the edge of the barcode.
When reading Pharmacode barcodes, the tool returns a quality factor for the reading in
Reading reliability. This quality factor is the percentage of the readings that were success-
ful, based on the number of reading set by the Max number of readings parameter.
The reading of PDF417 barcodes requires stable lighting conditions and at least 3.5 pixels
per “cell” in the barcode to perform reliably.
Input Parameters
01=Source bank Image bank containing the image with the barcode
to be read.
02=ROI definition step The program step where the ROI was defined.
03=Code type The type of barcode to read.
04=Max number of readings The maximum number of times the tool should try
to read the barcode before reporting an error.
05=Reading direction The direction in which to read the barcode.
Horizontal reads the barcode from both from
left to right and from right to left. Similarly, Verti-
cal reads the barcode in both directions: up and
down.
Returned Values
01=Error flag Flag = 0 if the barcode was read without problems.
02=Read string A string containing the code that was read.
03=Reading reliability For Pharmacode barcodes, the percentage of the rea-
dings that were sucessful.
04=Edge has defects Flag = 1 if there was any dark areas found in the edge
around the barcode
2D Code
The 2D Code tool is used for reading 2D codes in images. The tool can read DATAMATRIX
codes, and supports error correction according to ECC200.
This tool has an interactive setup in which you can set the input parameters and immedia-
tely see how the result is affected by the changes. The interactive setup is opened by
double-clicking the Setup button.
The tool returns the code that was read as a string in Read string, the amount of unused
error correction after decoding the 2D code in Unused error correction, and Error flag
indicates whether any error occurred when reading the 2D code.
In addition, the tool can write detailed results to the table:
Table row Result
Table index A string containing the grades that indicated the print quality of the
2D code, according to ISO/IEC 16022:2000
+1 The symbol size of the 2D code
+2 X coordinate of the decoded 2D code
+3 Y coordinate of the decoded 2D code
+4 The angle that the 2D code is rotated
+5 1 if the 2D code is mirrored, 0 if not
Input Parameters
01 = Source bank Image bank containing the image with the 2D code to
be read.
02 = Search full image Indicates if the algorithm shall search for a code using
the whole image, or the search area specified by the
parameters 03-06.
03 = X coordinate X coordinate for the upper left corner of the ROI in
which to search for the 2D code.
04 = Y coordinate Y coordinate for the upper left corner of the ROI in
which to search for the 2D code.
05 = Width Width of the ROI in which to search for the 2D code.
06 = Height Height of the ROI in which to search for the 2D code.
07 = Table index First row in the table where detailed results should be
written. The detailed result occupies 6 rows.
If set to -1, detailed results will not be written to the
table.
08 = Destination bank Image bank in which the resulting image will be stored.
Returned Values
01 = Read string A string containing the code that was read
02 = Unused error correcti- The amount of error correction that was left after
on decoding 2D code, in percent.
03 = Error flag Indicates whether or not any error occurred when
reading the 2D code.
0 = String was decoded successfully.
1 = No string was read.
5 Interactive Setups
Image banks
The source bank holds the live image in which the matching is performed. The destination
bank will hold a visualization of the resulting shape (-s).
Reference shape
The reference shape used in the matching process is stored in a data block in the memory
of the camera. From the interactive setup it is possible to add a new data block containing
a reference shape, edit the contents of an existing data block, or permanently delete a
data block from the working memory.
The Add Shape and Edit shape buttons open the Add/Edit Shape Interactive Setup, see
page 212.
Note: A data block created by the Add Shape Runtime tool cannot be edited. The reason
for this is that the Teach ROI used in runtime can be of arbitrary shape and no definition of
this is stored in the data block.
ROI settings
It is possible to search the full image, or to specify a rectangle area in order to limit the
search. The tool behavior is depending on these settings; if the full image is searched,
shapes that are partly outside of the image are also found. If a search ROI rectangle is
specified, only shapes with all edges inside the ROI are returned.
Match Settings
In addition to the settings in the data block, there are some runtime parameters that affect
the performance of the tool. The scale of the shape can be allowed to vary up to ±20%. It
is also possible to allow the shapes to be rotated. The Rotation tolerance parameter is
specifying this tolerance in degrees. I.e. ±180 means that full rotation is allowed. By not
allowing scale or rotation tolerances it is possible to optimize the execution time of the tool.
Limiting the number of shapes that the tool shall look for is also affecting the performance,
as poor matches are discarded early in the process. The same can be said for the Min
score parameter.
The Overlap distance parameter is recommended only for advanced users. It controls the
performance of the tool in difficult situations, such as cluttered images. By reducing the
allowed overlap distance, matches that are too close (closer than the overlap distance) are
regarded as duplicates and only the one with the highest score will continue through the
process. The overlap distance is based on the center of gravity of the reference shape (i.e.
the center point of the Teach ROI). This point is visualized in the interactive setup for Add
Shape as a blue circle with a cross.
The example below shows how the Overlap Distance parameter affects the result of the
matching algorithm. The top image shows the reference shape with the center of gravity
marked with a blue cross. The two lower images show the results with different Overlap
Distance settings.
Result with Overlap Distance set to 100 Result with Overlap Distance set to 200
pixels pixels
Result Handling
If more than one shape is located, it is possible to specify the order in which the shapes
are returned by the tool. It is possible to sort the shapes by any of the attributes (x, y,
scale, angle, score), and if the shapes shall be returned in ascending or descending order.
It is also possible to sort the shapes by the distance to a user specified sorting point. In
this case, the shapes are sorted by the distance (measured in pixels) between the refer-
ence point of the shape and the specified sorting point.
If a table index is specified, information about all shapes will be stored in the table starting
at the specified index.
It is also possible to limit the execution time of the algorithm. This can be useful in situa-
tions where the total cycle time is limited. If the algorithm returns prematurely, the Search
Status result will indicate if the returned shapes are valid or not.
Finally, it is possible to determine how the results shall be visualized in the destination
bank. It is possible to show the first shape (by the specified sorting order), all shapes, or no
shapes at all.
Results
The tool will return information about the overall search status, and the number of shapes
that was found. In addition to this information about the first shape is returned. The interac-
tive setup can show information about all shapes, but this is only available in the GUI and
not in the step program.
Image Banks
The Source bank specifies where the reference image is stored. It is recommended to not
use the same source bank as for the Shape Locator tool as this may lead to the image
data being overwritten during the execution of the step program.
Reference Shape
The ID of the data block that holds the reference shape is specified in the Shape Locator
GUI and cannot be modified in this interactive setup. IT is however possible to edit the
name of the data block.
mended to arrange the setup so that the edges of the shape cover at least 5% of the
image size.
Performance
Some settings affecting the performance of the tool are necessary to perform already
when creating the reference shape. The Edge strength slider controls the number of edges
included within the Teach ROI. A reference shape containing too many edges may slow
down performance.
The sliders for Robustness and Accuracy are used for trade-off between execution per-
formance and the integrity of the results. For instance, in an application that is only used to
verify the presence of a shape within an image the Accuracy slider can safely be set to
High Speed. On the other hand, in an application where the exact position of the shape is
crucial, e.g. when picking objects, the slider will probably need to be pulled closer to High
Accuracy. In situations where the image is cluttered with similar shapes or other forms of
distortion, the Robustness slider should be set to High Robustness.
Image handling
It is possible to zoom in and out of the image by using the Zoom buttons. E.g. if the Zoom
in button is pressed, each mouse click in the image will zoom in around the clicked posi-
tion, and vice versa for the Zoom out button. The Pan button can be used to move the
visible part of the image when it is zoomed in. When the Pointer button is pressed, it is
possible to work with the ROI:s and Masks composing the Teach ROI using the mouse.
Reference point
This is an arbitrary point that can be specified anywhere in the reference image. The
reference point is marked with an encircled red cross. The position of the located shape
will refer to the position of this point. This point shall not be confused with the blue centre
of gravity of the Teach ROI which is used when discarding duplicate matches using the
Overlap Distance parameter in the Shape Locator tool.
The position of the reference point can either be specified by entering the exact coordi-
nates in the text boxes or by moving the point using the mouse. It is also possible to refer
to a table cell by entering “=Vn” where n is the index of the table cell.
The purpose of the Shape Locator tool is to find the best possible match or matches of a
reference shape. This section holds important information on how to set up the tools, and
also some examples on how to use the combine the tools to achieve the best performan-
ce.
Teach tips
The selection of edges defining the reference shape is an important key to a fast and
robust location of shapes. The reference shape edges are controlled by a combination of
the Region Of Interest (ROI) selecting a part of the reference image and the Edge strength
parameter setting the threshold for which gray scale gradients (i.e. variations in gray scale)
that should be regarded as an edge.
More edges will increase the execution time. Adjust the Edge strength parameter so that
the characteristic major edges of the shape are extracted but minor details are ignored.
Also select an Edge strength value where the extracted edges stay more or less constant
when the Edge strength value is varied around the selected value. This ensures that the
same edges will be extracted even if the illumination changes.
Excluding parts of the reference shape that may vary during runtime will improve the
robustness. Such variations may stem from the inspected objects themselves (e.g. varying
date codes on packages), from illumination effects (e.g. shadows or direct reflexes) or
from occlusion effects. Masks can be used to exclude the parts of the reference shapes
that are affected by variations.
If the ROI perimeter is used with the ‘Add Shape Runtime’ tool to define the ROI for the
reference shape, please use the filling 0 = internal to get all edges within the ROI.
Locate tips
The region of interest defines the area to be searched. If using a search ROI, only shapes
with all edges completely inside the ROI will be found.
If using the Search full image setting, also shapes with edges partly outside the image
may be returned in the search result. The criterion for being regarded inside using the
“Search full image” mode is that the center of gravity point of the ROI used when creating
the reference shape must be inside the image. Note that there therefore is a difference
between the “Search full image” mode and to search within a ROI covering the whole
image.
The value of the Edge strength parameter of the reference shape is also used when
searching for shapes. Having a similar contrast level in the reference image and in the
search image will therefore increase the robustness of the tool.
It is good practice to set the parameter Max number of shapes = 1 if only searching for
one shape. Using a higher value will lead to a longer execution time even if only one shape
is present in the image.
To improve speed
Reduce the rotation search interval.
Disable the scale search.
Adjust the two trade-off parameters towards speed.
Decrease the max number of shapes.
Mask away extracted edges that are not part of the characteristic shape.
Reduce any background clutter in the image.
Environmental considerations
2D Select optics with low lens distortion.
Mount the camera straight to avoid perspective distortion.
Select an illumination that reduces direct reflections and shadows.
3D Use the square pixels option together with an encoder in the IVC-3D grab setup.
Mask away edges due to missing data areas that may vary between images.
Do not include edges that are result of occlusion.
Mount the camera straight to avoid skewed height data.
Examples on workflows
The suite of tools for locating shapes can be used in a number of various workflows. These
examples show some of the most common ways to use the tools. In all examples (exclu-
ding the last), the reference shape is created using the interactive setup Add/Edit Shape
available in the interactive setup for Shape Locator.
During the configuration phase of the development, the interactive setup for the Shape
Locator tool is used to create one or more reference shapes and to adjust the parameters
to the correct settings. Once the configuration is done, the Shape Locator tool is executed
directly from the step program, using the reference shape (-s) created during the configu-
ration.
Figure – Screenshot of interactive setup Find line edge. Upper left: input boxes for Input
Parameters; upper right: displayed image with line and found transition points (red crosses)
as overlay; lower left: result table with the coordinates of the found points; lower right: plots
of a relative histogram, gray scale values and derivation of gray scale values along the line.
scale values (lower right in the figure above). If you can’t see a horizontal line, pull it from
the top (upper threshold) or bottom (lower threshold) of the plot area.
Input parameter Filter in pixels allows on average over up to 10 pixels in line direction. This
option is available with Evaluation Method 2: Detect absolute change of gray scale values
only.
To select an upper limit of how many found points should be stored in the table and the
table index for the first entry edit the input boxes with the caption Table settings.
Results
The total number of found transitions is displayed in the field Number of transitions found.
A table shows the table index number and the coordinates that are stored in the table
beginning with the first found pixel. The maximum number of shown and stored coordina-
tes depends on the selected value in the input field Max number of transitions.
Coordinate Alignment
The Coordinate alignment tool is used for calibrating the IVC-2D’s coordinate system, and
optionally for aligning the coordinate system to an external coordinate system (world
coordinates).
The calibration can be made with two different methods:
Linear Compensates for perspective.
Non-linear Compensates for perspective and lens distortion.
You select which method to use on the Advanced tab in the interactive setup window.
The result from the tool is a transform, which is used later by the 'Get calibrated point' tool
to get calibrated or aligned measurement values.
The transform is stored in a data block in the IVC-2D’s working memory. To avoid having to
re-align after restarting the camera, the result can be saved to the camera‘s flash memory
by using a 'Save data block to flash' tool.
To create a transform with the Coordinate alignment interactive setup, do the following:
• Print the calibration target and grab an image of it.
It is not necessary to have the entire calibration target in the image – only the centre
squares (with the dots) must be visible in the image. However, the more of the target
is visible, the better the accuracy in the transform.
The crosses around the target (A to D) do not need to be visible in the image at all.
• If the IVC-2D’s coordinate system should be aligned to an external coordinate system,
import the world coordinates for the reference points (A to D on the calibration pat-
tern) into the interactive setup.
• Fill in the width of each square in Target spacing, and if necessary adjust the threshold
value.
• Mark one of the black squares in the pattern by placing the cross inside the square,
and click Find calibration points.
• Click Create to calculate the transform and save it in a data block in the IVC-2D’s
working memory. When the transform is calculated, the estimated transform error is
displayed in the window.
Note the number of the data block in which the transform is created. This number is
used later when referring to the transform in the 'Get calibrated point' tool.
When creating a transform without aligning to an external coordinate system, the resulting
coordinate system will be aligned with the surface of the calibration target, with the origin in
the middle of the pattern.
The file containing the coordinates should have the following format:
xA1;yA1;zA1;xA2;yA2;zA2; ... ;xAn;yAn;zAn<return>
xB1;yB1;zB1;xB2;yB2;zB2; ... ;xBn;yBn;zBn<return>
xC1;yC1;zC1;xC2;yC2;zC2; ... ;xCn;yCn;zCn<return>
xD1;yD1;zD1;xD2;yD2;zD2; ... ;xDn;yDn;zDn<return>
where:
xA1 is the x coordinate for the first measurement of reference point A,
xA2 is the x coordinate for the second measurement of reference point A,
xB1 is the x coordinate for the first measurement of reference point B,
etc.
Important: The following rules apply to the format of the file with external coordinates.
• Measurements for all four reference points must be entered.
• All points must have the same number of measurements.
• There must be a <return> after the last line of values.
• Each value shall be separated by a semi-colon.
• There shall be no semi-colon after the last value on each line.
x1;y1;xT1;yT1;zT1<return>
x2;y2;zt2;yT2;zT2<return>
…
xn;yn;xTn;yTn;zTn<return>
Communication Setup
The Communication setup tool is used for specifying which values the device should
publish and subscribe to, and whether to use the Ethernet/IP or the OPC protocol for the
communication.
This tool only specifies the values that should be read from or written to the network. The
actual reading and writing of values occurs when a 'Communication Read/Write' tool is
The Interactive executed.
Setup for this tool
is not available
when using the
Emulator.
Working Memory
Program Table
Communication
read/write Communication
read/write
Buffer
Output Input
SINT0 SINT0
SINT1 SINT1
... ...
SINT49 SINT49
INT0 INT0
... ...
Ethernet/IP
or OPC
PLC: get parameter value
Parameter Types
Each parameter in the buffer can store values of a certain type. The following types are
supported by the IVC devices:
Short integer SINT -128 … 127
Integer INT -32 768 … 32 767
Double integer DINT -2 147 483 648 … 2 147 483 647
Floating point REAL -3.40282347e+38 … 3.40282347e+38
Short string SSTRING 61 characters
Long string LSTRING 497 characters
Since an integer in the IVC’s working memory is always represented as a double integer
(4 bytes), integer values will automatically be converted when read or written between the
IVC’s working memory and the buffer, as long as the value fits into the value range of the
parameter type in the buffer.
In a similar manner, the IVC device will try to convert between floating point values and
integers, and between strings in the working memory (max 4096 characters), and
SSTRING:s (61 characters) and LSTRINGS (497 characters) in the buffer.
If the value from the IVC device is outside the value range for a parameter, the IVC device
will either round or truncate the value, or issue an error, depending on the settings in the
'Communication setup' tool. For example, the result from trying to publish the following
values from a table in the working memory depends on what was selected in the 'Commu-
nication setup' interactive setup:
Value in IVC table Buffer Stop with error Round/truncate
parameter
Note that the maximum length of strings in the buffer is either 61 characters (SSTRING) or
497 characters (LSTRING), but when read from the buffer by an external device, the
strings will occupy 64 bytes and 500 bytes respectively. The format of the strings when
read from the buffer is shown in the following figure:
OPC
To use the OPC protocol for reading and writing data on an IVC device, the OPC server
from SICK must be running on a PC in the network. The OPC server is included with the
installation of IVC Studio, and the setup file is stored in the folder OPC Server in the
installation folder for IVC Studio. Note that IVC Studio must be installed on a PC for the OPC
server setup to be available.
When reading and writing values using OPC, the parameters are referred to by the name
specified in the Communication setup interactive setup. Before these names can be used
with the OPC server, they must first be exported from IVC Studio, and then imported to the
OPC server.
The names are exported by clicking Export OPC mappings on the OPC tab in the Communi-
cation setup interactive setup. For information on how to import the names to the OPC
server, see the documentation that comes with the server software.
Ethernet/IP
When reading and writing to the IVC buffer using Ethernet/IP, there are a number of as-
semblies available that are defined in the IVC device.
When using the assemblies from a PLC, you select assembly type by specifying the as-
sembly instance number. This number is different depending on whether the assembly is
used for input or for output.
Note: “Input” and “output” here means from the IVC device’s point of view – that is,
the input assembly should be used when writing data to the IVC device, and the
output assembly is used for reading data from the IVC device.
The assemblies available when communicating with the IVC device using Ethernet/IP are
listed in the following table:
Name Description Input assembly Output assembly
instance instance
(to IVC device) (from IVC device)
No strings
Type No. of values Parameters Offset to first Size per value
parameter (bytes)
SINT 50 SINT0 … 49 0 1 byte
INT 50 INT0 … 49 50 2 bytes
DINT 30 DINT0 … 29 150 4 bytes
REAL 50 REAL0 … 49 270 4 bytes
SSTRING – – – 64 bytes
LSTRING – – – 500 bytes
Total size 470 bytes
Large string
Type No. of values Parameters Offset to first Size per value
parameter (bytes)
SINT – – – 1 byte
INT – – – 2 bytes
DINT – – – 4 bytes
REAL – – – 4 bytes
SSTRING – – – 64 bytes
LSTRING 1 LSTRING0 0 500 bytes
Total size 500 bytes
Small
Type No. of values Parameters Offset to first Size per value
parameter (bytes)
SINT 10 SINT0 … 9 0 1 byte
INT 10 INT0 … 9 10 2 bytes
DINT 10 DINT0 … 9 30 4 bytes
REAL 10 REAL0 … 9 70 4 bytes
SSTRING 1 SSTRING0 110 64 bytes
LSTRING – – – 500 bytes
Total size 174 bytes
Export mapping as text Saves the settings made in this interactive setup to a text file.
Rounding/truncation Specifies whether the IVC device should, if necessary, round
handling or truncate the value before writing the value to the buffer.
2D Code
The 2D code tool is used for reading 2D codes in images. The tool can read DATAMATRIX
codes, and supports error correction according to ECC200.
Decoding 2D Codes
The tool locates the 2D code by finding the solid border (L-pattern) and the dashed border
(alternating pattern). It does so by searching the ROI of the image along horizontal and
vertical scan lines, and finding edges along those lines. To be able to locate the 2D code,
the angle of the L-pattern must lie inside the ROI.
L-pattern Alternating
pattern
Figure – The parts of a 2D code symbol
The number of scan lines used depends on the provided cell size – that is, the approxima-
te size in pixels of the modules (squares) in the 2D code, the symbol size – that is, the
number of cells in the symbol.
Scan lines
Must be in
the ROI
When the 2D code is located, a symbol grid is placed over the symbol and the grayscale
value of each cell is sampled from the intersections of the grid lines. If necessary the size
of the cells in the symbol can be adjusted before sampling by using a dilate/erode filer, set
by Dot size.
Cell dots
Symbol grid
Parameter Settings
Image Bank
The image settings are used for specifying which image to analyze, where to store the
resulting image and which area of the image to search for the 2D code.
Source bank The image bank that contains the image to analyze.
Destination bank The image bank in which to display the filtered image, and if so
specified the outline of the 2D code and the ROI.
You can switch between viewing the original image (Source) and the image with added
diagnosis graphics (Destination) by clicking on the corresponding button under the image.
By clicking Change image, you can grab another image from the camera to use for setting
the parameters for the tool.
The Test live button can be used for testing the tool with the current settings, without
closing the dialog box.
Region of Interest
The Region of Interest settings are used for setting where in the image the tool should look
for 2D codes. The ROI can also be set by moving and resizing the ROI rectangle in the
preview. If the check-box Search full image is selected, the entire image will be used when
searching for the code. This may slow down the performance of the tool.
X coordinate X coordinate and Y coordinate are the coordinates of the top left
Y coordinate corner of the ROI. Together with the Width and Height, they
Width specify the ROI in which to search for the 2D code.
Height
Decoder Settings
Cell size The approximate size in pixels of each cell (square) in the 2D
code. Setting a small cell size will result in a longer execution
time.
Mirrored codes Specifies whether the tool should try to decode normal codes,
mirrored codes, or both.
When selecting Search both, each 2D code will be decoded
Decoder Optimization
Tolerate L-pattern errors Use an algorithm that tolerates gaps in the L-pattern.
Requires empty space around the symbol that is at least
2 times the cells size.
Search contrast Sets the required difference in grayscale value between
white cells and black cells when locating the symbol.
Value in percent, where 100% means a difference of
255 grayscale levels.
Robustness Allows for trade-offs between speed and reading perfor-
mance. Use the Fast mode if the code quality is good and
the execution time is critical. Use Robust mode if the code
quality is poor or if there are other objects near the code
in the image.
Results
The tool returns the read string, the amount of unused error correction and an error flag,
indicating whether the string was successfully decoded.
By setting Diagnosis graphics level on the Advanced tab, the tool will also add graphics to
the image in the destination bank.
In addition, the interactive setup displays additional result information about the decoded
2D code on the Detailed results tab. This information can be written to the table, by setting
Output detailed results and Table index on the General tab.
Graphics
Diagnosis graphics level Specifies what additional graphics to add to the image in the
destination bank:
None Do not add any additional graphics.
Code outline Draw the outline of the 2D code.
Detailed Results
When writing the results to the table, all grades are written in one string (for example
“CACBAB”), making the detailed result occupying 6 rows in the table.
Symbol size The symbol size used when decoding the 2D code.
X coordinate The X and Y coordinates of the 2D code that was decoded in
Y coordinate the image.
Angle The rotation of the 2D code.
Mirrored code Indicated whether or not the 2D code was mirrored:
0 Not mirrored
1 Mirrored
Grades Print quality grades according to ISO/IEC 16022:2000
Overall grade Indicates the overall print quality of the 2D code.
Decode Indicates whether the symbol was successfully decoded (A)
or not (F).
Symbol contrast Indicates if the contrast between the dark and light cells in the
symbol is sufficient.
Print growth Indicates if the dark or light cells are larger than the nominal
size.
Axial nonuniformity Indicated if the 2D code is scaled unevenly.
Unused error correction Indicates the extent to which damages in the symbol has
eroded the reading safety margin provided by the error
correction.
Input/Output
Choose an image for the Detail Extraction by typing the number of the Source bank that
contains the desired image. Also choose a storage place for the resulting filtered image by
typing the number of a Destination bank.
Select a ROI from a previous program step.
Extraction parameters
Use the extraction parameters to define which details to extract from the image. Details
that deviate from the background are extracted. To check if a point deviates from the
background, it is compared to all or a limited set of its neighbouring points. The Operator
Type defines which set of neighbouring points that shall be considered, for example hori-
zontal, vertical or diagonal neighbours. Choose Horizontal to identify vertical patterns in
an image, and Vertical to identify horizontal patterns; choose Four points or
Eight points to identify smaller deviations of any form. It is also possible to consider
all points (Full region), but this slows down the program.
The Deviation Type defines in what way the details shall deviate from the background, that
is, if they are higher or lower than the background (or both).
Drag the Operator Radius bar to set the radius within which to pick neighbouring points for
comparison. Drag the Threshold bar to define the minimum difference between the current
point and the compared neighbours that is allowed to consider the point a detail. The
visual representation of the result image in the interactive setup window is of good help
when searching for suitable radius and threshold values.
Display
Click the Display Source button to display the source image.
Click the Display Result button to display a visual representation of the results:
• Detail pixels are white.
• Other pixels are black.
The image is by default stretched to fill the preview window. Click the Fit to Window button
to toggle between showing a stretched image and showing the image in its original size.
The stretching does not preserve the aspect ratio of the image. It is only when showing the
image in its original size that one pixel on the screen represents one pixel of the image.
Binarize Setup
The Binarize Interactive Setup creates binary images based on images in the Source Bank.
For an introduction to the tool, see Binarize on page 78.
Input/output
Choose an image for the Binarize tool by typing the number of the Source bank that
contains the desired image. Also choose a storage place for the resulting binarized image
by typing the number of a Destination bank.
Select a ROI from a previous program step, and choose an output level that defines which
gray value to use for pixels within the specified range.
Binarization Thresholds
Select a Threshold Mode for setting the upper and lower thresholds for the binarization
operation. Choose Manual to set the upper and lower thresholds yourself by dragging the
threshold bars. Choose an automatic mode when you know that the threshold level will
shift from scan to scan. You can use an automatic mode first to find suitable thresholds
while configuring the tool, and then switch to manual mode. The manual thresholds are
updated to the values found by the automatic method.
Note: Using the automatic threshold options makes the tool a bit slower.
Display
Click the Display Source button to display the source image.
Click the Display Result button to display a visual representation of the results. Pixels
within the range are white, unless the inverted threshold mode is used.
The image is by default stretched to fill the preview window. Click the Fit to Window button
to toggle between showing a stretched image and showing the image in its original size.
The stretching does not preserve the aspect ratio of the image. It is only when showing the
image in its original size that one pixel on the screen represents one pixel of the image.
Input/Output
Choose an image for the Blob Finder by typing the number of the Source bank that con-
tains the desired image. Also choose a storage place for the resulting image with found
blobs by typing the number of a Destination bank. Make sure that the evaluation bank is
different from the destination bank.
Select a ROI from a previous program step. ROIs of any form are possible to use. The
Timeout sets the maximum time for how long your program keeps looking for blobs.
Enable the parameter Generate Blob Image to store a binary image of the blobs (white) on
black background in the destination bank. This function makes the Blob Finder step suit-
able as a pre-processing step to other tools. You can create a binary image where only
objects of appropriate sizes are included. Disable this option to allow for faster execution
of the tool if you do not intend to use the output image.
Binarization Thresholds
Select a Threshold Mode for setting the upper and lower thresholds for the binarization
operation. Choose Manual to set the upper and lower thresholds yourself by dragging the
threshold bars. Choose an automatic mode when you know that the threshold level will
shift from scan to scan. You can use an automatic mode first to find suitable thresholds
while configuring the tool, and then switch to manual mode. The manual thresholds are
updated to the values found by the automatic method.
Note: For 3D images: If there is a need to include missing data in the binarization, set the Lower
threshold to zero by typing 0 in the input field. For a better resolved scale, the range of the
slider only covers the height of the chosen FOV, and therefore the slider cannot be pulled
to zero.
Note: Using the automatic threshold options makes the tool a bit slower.
Blob Selection
Limit the result to blobs of adequate sizes by setting a Maximum Blob Area and a Minimum
Blob Area. The area is measured in pixels. If holes are filled, the examined area includes
the holes.
Check the Discard edge blobs checkbox to ignore blobs that are partly outside the ROI or
that are touching the border of the ROI.
Note: If edge blobs are not discarded, only the part of the blob inside the ROI is detected and
compared with the Minimum blob area and Maximum blob area parameters.
Check the Fill Holes in Blobs checkbox when you know that a part of the blob may consist
of missing data due to patterned or shadowed objects, or to occlusion or poor reflectance
on your scanned object. It is also useful if you wish to compute the area of the full object,
including the holes inside the blob.
Sorting
Blobs can be sorted in different ways using the parameter Sort By: The following options
are available:
Vertical position
Horizontal position
Distance to Sorting Point
Blob Area
No sorting
If Distance to Sorting Point is chosen, you must set the Sorting Point X- and Y-coordinates.
The Sorting Order has two options:
Ascending The sorting is done in increasing order, for example from small to large
or from bottom to top.
Descending The sorting is done in decreasing order, for example from large to
small or from top to bottom.
Display
Click the Display Source button to display the source image.
Click the Display Result button to display a visual representation of the results:
• Pixels within the threshold range are white.
• Pixels within the specified area range are red.
• Pixels out of range are left as they are in the source bank. This simplifies threshold
tuning.
• Pixels not part of the ROI are blue.
The image is by default stretched to fill the preview window. Click the Fit to Window button
to toggle between showing a stretched image and showing the image in its original size.
The stretching does not preserve the aspect ratio of the image. It is only when showing the
image in its original size that one pixel on the screen represents one pixel of the image.
Table
Use the Table Index to set the starting position (row number) in the table for where the
found blob centroids and areas are stored. The default value is 1000.
Note: This is only an extra option. All blobs are always stored internally and are thus accessible
using the ‘Blob Analyzer’ tool. Storing in the table is intended for simple applications where
only centroids and area are desired.
The Max number of blobs in the table limits the number of blobs that are stored in the
table. This value also determines the number of listed blobs in the Interactive Setup win-
dow, since that list uses the table values for display. If the maximum number of blobs in
the table is set to 5, then the list will contain 5 blobs as well. However, all blobs are still
stored internally.
Figure – The interactive setup window for the Blob Analyzer. The currently selected blob is
shown in green, and it is surrounded by a bounding box that defines its orientation. The
blob that is not selected is shown in red color.
Use the input parameters on the left of the interactive setup window to select the blob to
be analyzed, and to select what features to compute for it. The results of the settings for a
specific blob can be visualized in the image display.
6 Troubleshooting
This section contains information that may be helpful when troubleshooting problems with
the IVC camera.
If it is not possible to solve the problem using the information in this section, please con-
tact technical support in your SICK sales subsidiary. Ask your SICK sales representative for
guidance if needed.
When reporting a trouble, please write a trouble report as described at the end of this
section. The purpose of the trouble report is to shorten the response time and enable
more qualified support.
If technical support cannot assist, it may be necessary to send the camera in for repair. In
this case, the same type of trouble report information should be attached.
No live image A firewall may be blocking all or some of the communication between
from IVC-2D the device and IVC Studio.
Solution
Disable the firewall on the PC, or create an exception for IVC Studio.
Connecting to a Make sure that the device is not used from any other PC.
device results in Only one PC at a time can be connected to a device, for viewing live
a lot of error images or editing programs.
messages.
Sometimes the
PC will crash
PLC communi- The communication between the device and a PLC can be disturbed if
cation fails there is a lot of traffic on the network. Try the following:
• Use a separate network for the PLC communication, or at le-
ast try to isolate the PLC-IVC network from the rest of the
network environment.
• Do not run the device with F6 from IVC Studio. In this mode,
there is a lot of communication between the device and IVC
Studio, e.g. images, and this may disturb the PLC communica-
tion. Try to start the device in standalone-mode instead
(Choose Start Program from the context menu in the Device
list).
Function LED is If the initialization of the Flash File System (FFS) fails when the camera
flashing Red, is powered up, the camera stops and signals an error. In this situation
Green, Yellow there are two options:
and the camera 1. Restart the camera by cycling the power off and on. If the
cannot be problem with the FFS initialization was intermittent, the came-
accessed ra will now start normally.
2. Apply 24V to the digital input In3. This will force a complete
formatting of the FFS, and all user specific information (e.g.
IP-configuration settings, programs and data blocks) will be
lost. After the formatting of the FFS, the camera will restart
automatically. Note that the calibration files for the IVC-3D
camera will also be lost. These files can be requested from
tech support by referring to the serial number of the camera.
Saving to Flash If the execution time for saving to flash using 'Save data block to
suddenly takes flash' or 'Save image to flash' suddenly increases, the device may
much longer time have run out of free flash memory blocks. In this case the device
needs to clear a previously used (but now unused) memory block
before saving, something that takes some time. The execution time
can in this case be shortened by manually clearing the unused
memory.
Solution
• Check the amount of free memory on the device by right-
clicking the device in the device list and choosing Device Mana-
gement Æ Device information.
• If FFS free size is low and FFS dead size is large,
clear unused (dead) memory by right-clicking the device and
choosing Flash Æ Clear unused memory.
Note that excessive writing to the flash memory may shorten its
working life. The flash memory is specified for 100.000 re-writings.
To access the The flash disk of the Emulator is found on the PC under My Docu-
flash disk of the ments (Documents in Vista) for the current user. The default path to
Emulator the Emulator flash is:
My Documents\SICKIVP\SmartCameras\IVC Studio x.x\ Emula-
tor\flash
Automatic defragmentation
All tools that write to the flash disk can automatically clear dead space and perform a
defragmentation of the flash disk. This functionality is controlled by the parameter Dead-
SpaceThreshold in the Smartreader.ini configuration file. It is also possible to configure the
parameter in the Ethernet Device Configuration dialog, available on the Op-
tionsÆConfigurationÆEthernet Devices menu of IVC Studio. If the amount of dead space
exceeds the threshold, the flash disk will be cleared from dead space before the informa-
tion is written to the disk. This means that the tools may take substantially longer to exe-
cute in some situations. In general, it is not recommended to use these tools in the normal
measurement loop of the program. An error code will be returned when the tools are
executed by F5/F8 if the amount of dead space exceeds the threshold.
The threshold is specified as (amount of dead space)/(amount of dead space + free
space) in percent. The functionality for automatic defragmentation can be disabled by
setting the threshold to -1. The lower limit for the threshold is set to 20%, and the upper
limit is set to 80%. The reason for not allowing less than 20% is that the defragmentation
shall not be performed too often. The default value for the threshold is set to 50%.
If the automatic defragmentation is enabled, the camera may perform a defragmentation
of the flash disk when powered up. During this operation, the function LED is set to yellow.
Note that the time to start the camera will in this situation be longer than usual.
Appendix
A Mathematical Expressions
It is possible to create strings that contain mathematical expressions. This is useful for
performing calculations in a program that cannot be performed by the tools.
A mathematical expression always begins with an equal sign (=). String parameter values
that begin with an equal sign will be treated as expressions. If a string parameter needs to
begin with an equal sign, preceed it with a single quotation mark, for example '=Hello.
When using strings in expressions, the strings must always be enclosed in single quotation
marks, for example 'Hello world'. If you need to include a single quotation mark in a
string, preceed it with a backslash ('\'Hello\', she said.').
Note: If fractional values are used in expressions, the decimal delimiter must always be a
dot (.), regardless of any local settings made on the PC. Commas (,) are always used in
expressions for separating parameters.
The following operands are used for referring to table and parameter values:
Operand Meaning
Vx Value in table row x
V(x*n) Value in table row (x * n)
SaAb Argument (input parameter)
b of Step a *
SaRb Result b of step a *
Symbol Meaning
Asin(x) Arcsine, result is in radians
Acos(x) Arccosine, result is in radians
Atan(x) Arctangent, result is in radians
Sinh(x) Hyperbolic sine
Cosh(x) Hyperbolic cosine
Tanh(x) Hyperbolic tangent
Exp(x) Exponential (ex)
Log(x) Natural logarithm (ln)
Log10(x) Base 10 logarithm
Sqrt(x) Square root
Floor(x) Integer part of a decimal value.
For example: Floor(3.1415) = 3
Ceil(x) The smallest integer that is larger than or equal to a
decimal value. For example: Ceil(3.1415) = 4
Round(x, decimals) Rounds off a value to a specified number of decimals
Abs(x) Absolute value
Deg(x) Conversion from radians to degrees
Rad(x) Conversion from degrees to radians
Min(x, y, ...) Minimum
Max(x, y, ...) Maximum
Equ(x, y) Equality
Not Logical not
& Bitwise and
| Bitwise or
<> Not equal to
= Equal to
<= Less than or equal to
>= Greater than or equal to
! Logical not
~ Bitwise not
>> Bitwise shift to left
<< Bitwise shift right
( ) Parenthesis, used for giving priority to operands
. Dot. Separates the integer part of a number from the
fractional part
, Separator, for example Max(5,7) = 7
Symbol Meaning
+ Concatenation
= Comparision. Returns 1 if both strings are identical.
Asc(char) Returns the ASCII code for the specified character. For exam-
ple asc(‘A’) returns the value 65.
Chr(number) Returns the character for the specified ASCII code. For exam-
ple chr(66) returns ’B’.
Sub(str, index) The character at position index. Note that the first character
in the string has index 0.
Negative values will count the positions from the end, for
example -1 will return the last character.
Sub(str, start, A substring with the characters at positions from start to
stop) stop-1. Note that the first character in the string has index 0.
If start is empty, all characters from position 0 to stop are
returned.
If stop is empty, all characters from position start to the
end of the string are returned.
For example sub(‘Hello World’, 0, 5) returns
‘Hello’ and sub(‘Hello World’, 6, 11) returns
‘World’.
Len(str) The number of characters in the string.
Eval(str) Evaluates the string as if it were an expression. For example
eval('1+2+3') returns 6.
Str(number) A string representation of the number. For example
Str(1.23) returns the string '1.23'
Repr(number) A string representation of the number that can be re-evaluated
to its original value. For example Repr(1.23) returns the
string '1.230000e+000'
Symbol Meaning
time(timeZone) Returns the local time in seconds, UTC time with offset. time-
Zone is the local offset from UTC time in hours.
timestr(timeZone, Returns the local time and date as a string, timeZone is the
format) local offset from UTC time in hours. Three formats are possible:
Format value Example
0 2008-10-02 14:27:42
1 02.10.2008 14:27:42
2 10/02/2008 02:27:42 PM
Example
=Not( S3R1 * V( 5 * S2R1 ) < 10 )
This expression uses the first result from program step 3 (S3R1), and a value from the
table (V( 5 * S2R1 )). Which table row to get the value from is calculated by using a
result from program step 2.
Assume that we have the following values:
Variable Value
Result 1 from step 2 S2R1 7
Result 1 from step 3 S3R1 6
Row 35 in the table V35 2