Thermal Camera SDK 10.1.0
SDK for Optris Thermal Cameras
Loading...
Searching...
No Matches
Example Applications

Contents

Preparations

On Windows the installer copied the source code of the examples to your Documents folder. On Linux you have to manually copy them from the installation directory to a place in your Home folder where you can edit them as you please.

cp -r /usr/share/doc/otcsdk/examples ~
Note
On Windows you can find the source code of the examples in the <SDK Install Directory>\examples folder as well. Copy it from there, if messed up the examples in the Documents folder too much.

The examples folder contains a directory for each supported programming language. In them you can find the same examples. Only the Simple View example has a slightly different feature set across the different languages.

Please refer to the Toolchains section of the Start Developing chapter to get detailed instructions on how to install all the required tools to compile and run the examples.

Enumeration

This example illustrates how to use the EnumerationManager. The EnumerationManager allows you to detect devices that are currently attached to your computer. The example continuously lists events indicating newly attached or removed devices.

You can quit the program at any time using Ctrl + C.

Enumeration example.
Note
The EnumerationManager can currently only detect devices attached to your computer via USB.

Please refer to its respective README.md for details on how to compile and to start the application.

Minimal

The purpose of this example is to show the minimum amount of code required to get thermal data from a device. To do this, it defines the class SimpleImagerClient which is derived from the IRImagerClient. It is used to observe the IRImager instance that is connected to your device. The SimpleImagerClient does not extensively process the thermal data but displays the dimensions of the thermal frame, the frame rate, the temperature of the center pixel in °C and the current state of the internal shutter flag of the device.

You can quit the program at any time using Ctrl + C.

Minimal example.
Note
The example expects the serial number of the device it should connect to. If none is provided, the SDK will use the EnumerationManager to locate a suitable device on the USB port and connect to it.

Please refer to its respective README.md for details on how to build to start the application.

PIF

This example is based on the Minimal example but also shows some ways to access and configure the Process Interface (PIF).

Setting Modes

The configuration of the PIF is grouped in the configurePif() method. It checks which PIF device is connected and, dependent on the available inputs and outputs, sets these following modes for the first pin of each channel:

Channel (DeviceIndex,PinIndex) Mode
Analog input (AI) [0, 0] Uncommitted Value
Analog output (AO) [0, 0] Internal Temperature
Digital input (DI) [0, 0] Flag Control
Digital output (DO) [0, 0] External Communication
Dedicated FailSave (FS) [0, 0] On

The screenshot below shows the output for a Xi410 with three connected "stackable" PIFs:

Output PIF Channel Configuration

The following sections explain the settings of each mode in this example in greater detail.

Analog Input

For the analog input, the Uncommitted Value mode was selected for this example. It simulates that a pressure sensor is connected to the input and that its voltage level reflects the current pressure. The unit is set to "Pa" and the offset to 0. With a gain of 0.1 this means that a voltage of 2.16 V translates into 21.6 Pa. Every time the input value changes it will be made available via the onPifUncommittedValue(), which in this example just prints the value.

Example PIF Uncommitted Value

Analog Output

For the analog output, the Internal Temperature mode was selected for this example. With a gain of 0.1 and a offset of 0, this means that a internal temperature of 34.5 °C would translate into 3.45 V on the pin.

Digital Input

For the digital input, the Flag Control mode was selected for this example. Since the parameter openIfLow is set to true, the flag is open if the input voltage is below 2 V.

Attention
If a PIF with a digital input is in use (e.g. standard, industrial,... ), the Flag Control mode will be active. Therefore, the input voltage is solely responsible for cycling the flag.

Digital Output

For the digital input, the External Communication mode was selected for this example. You can set the output to high or low using the setDoValue() method.

Fail Safe

If available, this example turns the dedicated fail safe pin on. The fail safe remains active as long as the camera and the processing chain of the SDK is working correctly. While active the dedicated fail safe pin outputs a voltage level higher than zero and the LED next to the pin lights up. If inactive, the voltage level will be zero and the LED will be off.

Note
When setting an analog or digital output to the Fail Safe mode the corresponding pins will provide an alternating signal instead of level based one. See the Fail Safe chapter for more detail.

An SDK client can interrupt the all-clear fail safe signal with the help of the interruptFailSafe() method of the IRImager interface.

Directly Accessing the Input Values

The direct access of the PIF input values is performed in the onThermalFrame() callback via the FrameMetadata object. Since this example is supposed to be as generic as possible, there are some extra checks to determine how many inputs are actually available. The access happens through the getPifXXValue() method, where XX is either Ai or Di.
This example prints the value of each available channel for every received frame.

Like before, this is what the output for a Xi410 with three "stackable" PIF looks like:

Output PIF Direct Access

In this screenshot: The AI1.1 is actively used and displays the current input voltage. AI1.2 is pulled to ground but still displays 0,1 V. The other pins are left floating (no voltage connected) and display 0.11 V.

Attention
If the remaining voltages of a floating pin (~0.11 V) or a pin that is pulled to ground (0.01 V) could cause problems in your applications, make sure to add some kind of check.

Some important notes:

  • This example will use only one camera, either via USB or Ethernet
  • If a DI is available, the flag must be controlled by the input signal
  • It is also possible (and for real applications more flexible) to configure the PIF via the configuration file. This example overwrites the modes for the first pin of each channel type that was stated in the configuration file.
  • This is only a small subset of the possible modes for the PIF channels. Please have a look at the documentation to learn more about configuring the modes used in this example as well as the other available modes.

Simple View

This is the most elaborate example. It illustrates, at least, how to retrieve thermal frames from your device and how to convert them into false color images. Its feature set varies across the supported programming languages with the C++ version being the most comprehensive one. All three of them define an IRImagerClient child class named IRImagerShow that observes an IRImager instance. Received thermal frames are buffered until a rendering loop converts them into false color images using the ImageBuilder class. The C++ version also illustrates how the ImagerBuilder can be used to locate hot and cold spots and how to calculate the mean temperature within a predefined area. Furthermore, it shows how a MeasurementField can be added.

C++ Simple View example.
Note
The cross-hairs denoting the hot and cold spots as well as the one in the center are not displayed, if one of the frame dimensions is to small. The MeasurementField is a square with an edge length of 20 pixels and located slightly inwards from the upper left corner. It will not be added, if the frame dimensions are too small.

The C++ and Python 3 versions expected the serial number of the device to connect to as a command line argument. In this regard they behave like the Minimal example. The C# example offers the menu option Device - Quick Connect instead.

Note
The C# Simple View example is only available on Windows since it uses Windows Forms as basis for its GUI.

Please refer to its respective README.md for details on how to compile and to start the application.