Hello
I wrote a small and simple program which helped me a lot for vision data acquisition and I wanted to share it with you.
AutoVisionAcquisition.zip (1.8 MB)
Use case
When starting with a new vision application, I want to take images with different flash colors, exposure times and with or without additional filters. I took these images in the vision cockpit and downloaded the bitmaps. Usually I stored the images according to a name pattern, such as e.g. ColorRed_Exp2000.bmp
. I used these images for later offline evaluation and offline vision application teaching.
Doing this can be quite cumbersome and has also source for error. So, if you want to e.g. take images with 200us exposure time steps for 4 different flash colors, with and without pole filters you have to do many clicks and save many files with the proper name.
What does the program do
The program executes an image acquisition with an array of predefined acquisition settings. The image of each acquisition is read from the camera and saved as a bitmap file to the PLC user partition. The file name is generated based on all acquisition settings and a user defined prefix.
The program also provides a command FillArray
, which will fill the acquisition settings array based on a reference and exposure time / focus steps.
How to use
Acquisition
-
Fill the
Product
variable-
Set
Product.FileNamePrefix
or leave empty -
Set
Product.NumUsedSettings
if you need more / less acqusitions -
Fill the
Product.Settings
array with the acquisition settings
→ See also the chapter FillArray
-
-
Set
Command.ExecuteAcquisitions
-
Check
Status.Done
/Status.Error
→ Currently there is always an error on first call of GetImage, I will maybe fix it later when I have time. For now, just execute the command one more time -
Reset
Command.ExecuteAcquisitions
Get the images
- Open an FTP client, e.g. FileZilla
- Connect to the PLC
User: admin
Password: admin
Please change settings if you want to use it in the field - Copy images to your PC
Auto Fill Array
With the command FillArray
you can automate filling the settings.
-
Set the reference values in
Command.FillData
-
Set increment steps in
Command.FillSteps
-
Set
Command.FillAray
and checkStatus.Done
-
The settings were applied with increment steps
→Product.NumUsedSettings
still keeps the old value and must be adjusted manually!