You are here: Start » Program Examples » HMI Recorder
HMI Recorder
Aim
This example shows how to record images using different camera interfaces.
Program overview
The program allows acquiring and saving images from cameras of different interfaces. The chosen camera can be changed while the programs is running. The user can trigger acquisition manually or set it to recording mode where every given period an image is acquired.
The program takes care of naming new image files to be saved on the disk. It has built-in mechanism to avoid overwriting previous files. While using the program the user can see a live image preview.
The interface consists of five panes. The pane Image Source Settings lists all possible image source and allows the user to choose one of them. Only one source can be active at a time. Choosing a source which requires specifying a device address enables the "..." button next to it (as seen next to GigE Vision and GenICam GenTL). Clicking it opens a dialog where the user can choose the device.
The next pane, Saving image Settings, the user can specify where the images will be saved, the file format of them, and the name prefix. There are four available formats to choose: BMP, JPEG, PNG, TIFF. Additionally, the user can set the period of between acquiring image in recording mode.
The third pane lets the user start and stop recording or save only a single frame. It additionally shows the number of images saved during the current session.
The fourth pane is an image preview. The user can see a live feed of the camera.
The last pane has instructions how to use the program. Below that some of the error messages are displayed.
Program structure
The main part of the program is inside a task macrofilter MainLoop. This enables error handling and prevents the program from closing after encountering an error.
Error handling
As previously mentioned, one of the reasons to put most of the program into a task macrofilter MainLoop was to allow error handling. This prevents the application from crashing after encountering an error. Information about error handlers and creating them is available in the Error Handling tutorial.
In this program there are 2 error handlers -- one for input/output errors and one for system errors. System errors can happen when the computers does not have the appropriate third-party driver installed. IO errors happen when the user tries to connect to a disconnected camera.
Both error handling filters have identical contents. First an error message is shown in the HMI. The program then waits for one second and resets the state off all the radio buttons.
Macrofilter Main
Macrofilter GrabImage_GenICam
Macrofilter GrabImage_GigEVision
Macrofilter GrabImage(Allied Vision)
Macrofilter GrabImage(Basler)
Macrofilter GrabImage(GenICam GenTL)
Macrofilter GrabImage(GigE Vision)
Macrofilter GrabImage(Matrix Vision)
Macrofilter GrabImage(NET ICube)
Macrofilter GrabImage(NET SynView)
Macrofilter GrabImage(Point Grey)
Macrofilter GrabImage(The Imaging Source)
Macrofilter GrabImage(Web Camera)
Macrofilter GrabImage(Ximea)
Macrofilter SavingImagesControl
Macrofilter MakeFileNameUnique
Macrofilter SaveGrabbedImage
Macrofilter GrabAndSaveImage
Macrofilter GetImageSource
Macrofilter ShowHideErrorLabel
Macrofilter ResetImageSourceRadios
Macrofilter MainLoop
Used Filters
Icon | Name | Description |
---|---|---|
![]() |
TestFileExists | Checks if a given file is present. |
![]() |
JoinArrays | Concatenates the input arrays one after another. |
![]() |
GigEVision_GrabImage_WithTimeout | Use this filter if the trigger may be not coming for some time, while the application should be performing other operations continuously (e.g. processing HMI events), or when timeout condition on missing frame must be detected |
![]() |
Roseek_GrabImage | Captures images from a Roseek device. |
![]() |
Delay | Suspends the program workflow for inTime milliseconds. |
![]() |
Exit | If the specified condition is true, exits the macrofilter loop. |
![]() |
Smart_GrabImage | Captures an image from a smart camera using AvSMART interface. Allows for remote access to the runtime system. |
![]() |
Pylon_GrabImage_WithTimeout | Captures an image stream from a camera using Pylon library; returns Nil if no frame comes in the specified time. |
![]() |
CopyObject | Use this filter to create a source of data, e.g. that needs to be send to HMI or used in several places of a macrofilter. |
![]() |
CurrentDateTime | Returns a string containing the date time information in selected format and all of the date time data separately. |
![]() |
GetClockTime | Stops clock to measure performance. |
![]() |
WebCamera_GrabImage | Not recommended for industrial operation. |
![]() |
FlyCapture_GrabImage | Captures images from a PointGrey camera. |
![]() |
SynView_GrabImage_WithTimeout | Use this filter if the trigger may be not coming for some time, while the application should be performing other operations continuously (e.g. processing HMI events). |
![]() |
ConcatenateStrings | Joins two or more strings into a single one. |
![]() |
ChooseByPredicate | E.g. to choose GREEN color to visualize correct objects or RED to visualize defective ones. |
![]() |
ICImagingControl_GrabImage | Captures a frame from The Imaging Source cameras using ICImagingControl. |
![]() |
MakeConditional | Introduces conditional data flow on a condition defined by the user. This filter can be used to skip some parts of the program - e.g. when a detected object does not fulfill some quality criteria. |
![]() |
GetArrayElement_OrNil | Extracts a single element from an array at the specified index; returns NIL if the index is out of range. |
![]() |
Vimba_GrabImage | Captures an image from an Allied Vision camera. |
![]() |
Loop | Put this filter into a task that should have a loop, but does not have any other loop generators (e.g. GrabImage). |
![]() |
SaveImage | Saves an image to a file. |
![]() |
EnumerateIntegers | In each consecutive iteration produces a consecutive number from an arithmetic sequence. |
![]() |
GenICam_GrabImage_WithTimeout | Use this filter if the trigger may be not coming for some time, while the application should be performing other operations continuously (e.g. processing HMI events), or when timeout condition on missing frame must be detected. |
![]() |
XiApi_GrabImage | Captures an image from a XIMEA camera. |
![]() |
MergeIntoArray | Creates an array from all the non-Nil input elements. |
![]() |
Spinnaker_GrabImage | Captures images from a PointGrey camera using Spinnaker interface. |
![]() |
ICube_GrabImage | Captures an image from an ICube camera. |
![]() |
Thorlabs_GrabImage | Captures an image from a Thorlabs device. |
Further Readings
- Formulas - Detailed information about using formulas.
- Working with Gen TL devices - This article describes the basic concept of working with Gen TL devices.
- Working with GigE Vision Devices - This article describes the basic concept of working with GigE Vision devices.