Migration Guide: v11 to v12
In Fahrenheit: with the SDK switched to Fahrenheit (SetTemperatureUnit() and its counterparts, see Temperatures in Fahrenheit), every temperature on this page is read and written in Fahrenheit, and every difference in Fahrenheit degrees; the samples are unchanged.
Overview
SDK v12 introduces a new API in the optris::sdk namespace alongside the v11 API in the optris namespace. The new API uses concrete classes, std::function callbacks, and typed exceptions instead of abstract interfaces and observer inheritance.
The v11 API continues to work. Its headers (otcsdk/...) ship in v12, including IRImagerFactory, ImageBuilder and EnumerationManager, and existing applications compile against them. Two additions make it easier to use: IRImager::Create() creates an imager without going through the factory, and in C++ FrameEvent::rgbaFrame carries a colorized BGRA frame on every frame, so ImageBuilder is no longer needed for display. New features (recording and playback, the simulated imager, regions and rules, the canvas, external buffers) are only available through the new API.
Both halves need C++20 or later, and the half that forces it is the legacy one, which is the opposite of what you would expect. The new API's public headers compile at C++17 (they needed C++23 until API version 29). One shipped v11 header does not: otcsdk/enumeration/EnumerationManager.h declares std::jthread and std::stop_token in its class body, both C++20, so a v11 application pinned to C++17 stops compiling the moment it includes that header; nothing else in either surface needs more than C++17. See Breaking Changes, item 1.
For the new API, Using the API walks it area by area with compiled examples, and API Reference is where to look up an exact declaration.
What stands behind the samples on this page. Every cpp block below is compiled on every build. The six that show v11 code are also transcribed into examples/legacy/v11consumer, a v11 program that the release build compiles and links against the installed SDK package through find_package(otcsdk), the same way you build your own, in four link-mode and configuration combinations on Linux and on Windows. So where this page says v11 code still compiles, that is a measurement and not an assurance. What no check here makes is the stronger claim: none of these programs is run, because the machines that build them have cameras attached and a v11 sample that calls connect() and run() would open one. Read "still compiles" literally.
API Mapping
The left column is the v11 API, which v12 still provides. The right column is the equivalent in the new API.
Initialization and Construction
| v11 (Legacy) | v12 (New) |
|---|---|
optris::Sdk::init(logScreen, logFile, prefix) |
Not needed. Imager::Create() initializes on demand. |
optris::IRImagerFactory::getInstance().create("native")` |
optris::sdk::Imager::Create(). On the legacy API, optris::IRImager::Create() is an alternative to the factory. |
imager->connect(serialNumber) |
optris::sdk::Imager::Create(config) with config.serial = "12040042" (a string) |
imager->connect(deviceInfo) |
optris::sdk::Imager::Create(deviceInfo) |
imager->connect(irImagerConfig) |
optris::sdk::Imager::Create(imagerConfig) |
| (none) | optris::sdk::Imager::Create(SimulatedConfig{...})` (new) |
| (none) | optris::sdk::Player::Open(path): play back a recording (new) |
Streaming Control
| v11 (Legacy) | v12 (New) |
|---|---|
imager->run() (blocking) / imager->runAsync() |
imager->Start() (non-blocking) |
imager->stopRunning() |
imager->Stop() |
imager->isRunning() |
imager->IsRunning() |
imager->isConnected() |
imager->IsConnected() |
imager->disconnect() |
Destroy the Imager |
Frame Callbacks
| v11 (Legacy) | v12 (New) |
|---|---|
imager->addClient(myClient) |
imager->SetThermalCallback(fn) and the other Set...Callback() methods |
class MyClient : public IRImagerClient |
Lambda or std::function<void(const ThermalFrame&)> |
MyClient::onFrame(const FrameEvent&): evt.thermalFrame |
SetThermalCallback([](const ThermalFrame& f) { ... }) |
MyClient::onRawFrame(const RawFrameEvent&) |
SetRawCallback([](const RawFrame& f) { ... }) |
MyClient::onConnection(ConnectionEvent&) |
SetConnectionCallback([](bool c) { ... }) or SetConnectionStatusCallback() |
MyClient::onVideoFormatChanged(const VideoFormatEvent&) |
SetVideoFormatCallback([](uint32_t w, uint32_t h, float fps) { ... }) |
imager->setFlagStateObserver(observer) |
SetShutterCallback([](const ShutterEvent& e) { ... }) |
| (none) | imager->AcquireFrame(): pull-based, no callback needed (new) |
| (none) | imager->TryAcquireFrame(): non-blocking pull (new) |
On the shutter, specifically. v11 carried the full FlagState on every frame, including the frames captured while the flag was closed, so a v11 application could follow the shutter from the frame stream alone. v12 can too, and the field to read is FrameMetadata::flag_open. Those frames are not measurements (the sensor is looking at the flag), so the SDK holds the last frame taken with the shutter open and delivers that through the closed window, with flag_open false and is_repeated_frame true, on every source. There is no gap in the stream.
In earlier v12 builds the closed window was withheld rather than held, so a cycle appeared as one to two seconds in which no frame arrived at all, and flag_open was true on every frame received. thermal_frame.h records the change at flag_open's own declaration. If you wrote a watchdog against the gap, read flag_open or is_repeated_frame instead; the frames keep arriving.
SetShutterCallback() remains the way to get the transitions themselves, with timestamps, and it reports the same Open/Closed/Opening/Closing/Initializing/Error set v11's flag state did. It is also the only way to tell a shutter on its way from one that has arrived, which a per-frame boolean cannot say.
False Color Visualization
| v11 (Legacy) | v12 (New) |
|---|---|
ImageBuilder builder(colorFormat, widthAlignment) |
imager->SetBgraCallback(fn) |
builder.setPalette("Iron") |
imager->SetPalette(Palette::kIronBow) |
builder.setTemperatureScaling(min, max) |
imager->SetColorRange(min, max) |
builder.setThermalFrame(frame) + convertTemperatureToPaletteImage(...) |
Automatic: the BGRA callback fires each frame |
builder.copyImageDataTo(dest, size) |
BGRA data in BgraFrame::GetData() |
Sdk::getPaletteColors("Iron") |
GetPaletteColors(Palette::kIronBow), by enum rather than by name, no loadPalettes() first, and it covers the five built-in palettes that have no CSV file |
Device Enumeration
| v11 (Legacy) | v12 (New) |
|---|---|
EnumerationManager::getInstance() |
Free functions in optris/sdk/device_enumerator.h |
manager.getDetectedDevices(seconds) |
optris::sdk::EnumerateDevices() |
manager.addClient(myEnumClient) + runAsync() |
StartDeviceMonitor(options, callback) for arrivals and departures; it owns its thread. Set DeviceMonitorOptions::watch_network for the Ethernet half; see below. For one sweep off your UI thread, optris::sdk::EnumerateDevices() inside a std::jthread of your own; it returns its vector by value, so there is nothing to keep alive. See Enumerating Off The Calling Thread. There is no EnumerateDevicesAsync(), see the note on that page |
MyEnumClient::onDeviceDetected(info) |
StartHotplugMonitor([](const DeviceInfo& d, bool added) { ... }) for USB, or StartDeviceMonitor() when the detections should include Ethernet cameras |
Ethernet cameras are opt-in now
v11's EnumerationManager under runAsync() registered network detectors as well as USB ones (EnumerationEthernetDetector::isNetworkDetector() returns true), so a v11 application that watched for cameras appearing did see the ones on the network. StartDeviceMonitor() reports network arrivals and removals too, but only when DeviceMonitorOptions::watch_network is set. Without that option it reports USB only, which is strictly less than the v11 facility it replaces.
The option has to be set, which v11 did not require, because v11 always paid for it: broadcasting and waiting out the replies on every pass whether the application had an Ethernet camera or not. In v12 that cost is asked for rather than assumed. Two consequences a v11 application should expect when porting: a camera appears up to one network_poll_interval (5 s by default) after it is powered and leaves two intervals after it stops answering, where v11's detector ran on its own schedule; and the broadcast reaches the local network segment only, as v11's did, so a camera behind a router still has to be reached with ProbeNetworkDevice().
Sdk::init() no longer starts the detection loop
This is the one v11 behaviour that changed under an application's feet, and an application using EnumerationManager should know about it. In v11, Sdk::init() started the detection loop unconditionally, so every process that initialised the SDK ran a detection pass every 500 ms for as long as it lived, and on this platform a pass opens every attached camera to read its serial-number string descriptor, so a program that never asked for a device list was still touching every camera twice a second. The loop now starts when something asks for its answer: addClient() starts it, and so does getDetectedDevices(seconds) with a non-zero seconds. Both of those are what a v11 application already calls, so the ported code needs no change. What has changed is getDetectedDevices(0), which neither starts the loop nor waits: on a process that has not detected anything yet it returns an empty list where it used to return whatever the loop had found since init. If you want that call to mean "tell me what is attached", give it a timeout (getDetectedDevices(-1) or getDetectedDevices(2)) or call runAsync() yourself, which is still there and still does exactly what it did.
Temperature and Processing
| v11 (Legacy) | v12 (New) |
|---|---|
imager->setRadiationParameters(params) |
imager->Radiometry().Set(radiation): emissivity, transmissivity, ambient temperature |
imager->getRadiationParameters() |
imager->Radiometry().Get() |
imager->setActiveOperationMode(...) |
imager->SetOperationMode(mode) or imager->SetTemperatureRange(range) |
imager->getOperationModes() |
imager->GetDeviceInfo().operation_modes |
imager->setTemperatureRangeExtensionEnabled(e) |
TemperatureRange::extended in SetTemperatureRange() |
imager->setTemperatureHighPrecisionEnabled(e) |
TemperatureRange::high_precision in SetTemperatureRange() |
imager->setRdcMode(mode) |
imager->Processing() record, field rdc |
imager->setSoSCorrectionEnabled(e) |
imager->Processing() record, fields sos_correction and sos_strength |
imager->setSubsampledFramerate(fps) |
imager->Processing() record, field subsampled_framerate |
Device Information
| v11 (Legacy) | v12 (New) |
|---|---|
imager->getSerialNumber() |
imager->GetDeviceInfo().serial (a string) |
imager->getDeviceType() |
imager->GetDeviceInfo().type |
imager->getWidth() / getHeight() |
imager->GetWidth() / GetHeight() |
imager->getHardwareRevision() |
imager->GetDeviceInfo().hardware_revision |
imager->getFirmwareRevision() |
imager->GetDeviceInfo().firmware_revision |
imager->getTemperatureFlag() |
imager->GetTelemetry().flag_temp_c, with flag_temp_known, see below |
imager->getTemperatureBox() |
imager->GetTelemetry().box_temp_c, with box_temp_known, see below |
imager->getTemperatureChip() |
imager->GetTelemetry().chip_temp_c, with chip_temp_known, see below |
On the three probe temperatures, and this changed the v11 surface too. Some cameras cannot report their internal temperatures at all (there is no room in the picture for the telemetry row that carries them) and until API version 26 those cameras published 0 °C for the shutter and the housing on every frame, with nothing saying otherwise. 0 °C is a believable temperature, so a reading was indistinguishable from the absence of one.
Each of the three now has a companion flag beside it: flag_temp_known, box_temp_known and chip_temp_known on Telemetry (and the same three on a frame's FrameMetadata). The value is only a reading when its flag is true. Check the flag before you display or act on the number; if you do not, you see what you saw before.
On the v11 surface, getTemperatureFlag() and getTemperatureBox() now answer INVALID_TEMPERATURE on a camera that has never decoded a telemetry row, the sentinel they already answered for a camera that is not connected. A v11 application that displayed those readings unchecked used to show 0 °C and now shows the sentinel. An alarm rule on either reports that it has no reading, rather than comparing its limits against a zero. Nothing stops compiling, so check every place you display or compare one of those two readings.
Camera Control
| v11 (Legacy) | v12 (New) |
|---|---|
imager->forceFlagEvent() |
imager->Detector().TriggerShutter() |
imager->setAutoFlagEnabled(enabled) |
imager->Detector().SetAuto(config), field enabled |
imager->setFlagInterval(min, max) |
imager->Detector().SetAuto(config), fields min_interval_secs / max_interval_secs |
imager->isFlagOpen() |
imager->GetTelemetry().flag_open, or track SetShutterCallback() |
imager->setChipHeatingMode(mode, temp) |
imager->Detector().SetChipHeating(mode, temp) |
imager->setFocusMotorPosition(pos) |
imager->Optics().SetFocus(pos / 100.0f): v11 took percent of the travel, SetFocus() takes a fraction of it. SetFocusPosition() takes the motor's own steps and is not the same call. Out of 0 to 100 % v11 clipped; SetFocus() refuses |
imager->interruptFailSafe(active, reason) |
imager->Device().InterruptFailSafe(active, reason) |
Process Interface (PIF)
| v11 (Legacy) | v12 (New) |
|---|---|
imager->getPif() returns ProcessInterface& |
imager->GetPif() returns std::shared_ptr<pif::PifController>, null when there is none |
pif.setConfig(...), setAiConfig(...), setDiConfig(...) |
pif->Configure(channels) |
| Reading and writing pins | pif->ReadDigitalInput(i), WriteDigitalOutput(i, state), ReadAnalogInput(i), WriteAnalogOutput(i, value), ReadAll(); each returns a result object instead of throwing |
Measurement Fields and Alarms
| v11 (Legacy) | v12 (New) |
|---|---|
imager->addMeasurementField(field) |
imager->Regions().Add(region), see Regions |
imager->removeMeasurementField(field) |
imager->Regions().Remove(id) |
FrameEvent::fields |
imager->Regions().States() |
imager->addAlarmChannel(config) |
imager->Alarms().Add(region_id, rule), see Alarms |
IRImagerClient::onAlarm(evt) |
imager->Alarms().SetCallback(fn) |
Error Handling
| v11 (Legacy) | v12 (New) |
|---|---|
SDKException |
SdkException (base), DeviceException, ConnectTimeoutException, DeviceBusyException, CalibrationException, ConfigException, ConfigLoadException, CaptureException, IoException, InvalidStateException, FeatureNotSupportedException |
| (none) | imager->SetErrorCallback(fn): non-fatal errors from background threads (new) |
Two of those are new distinctions, not renames. A v11 mode switch that failed because the camera would not bring the stream back up arrived as a configuration error, which reads as "you asked for something invalid", the one thing it is not. SetOperationMode() now raises DeviceBusyException, a DeviceException, and retrying the same call unchanged is the sensible response. InvalidStateException separates "not now" from "never": a second Recorder().Start() used to return normally and go on writing the first file, telling the caller it had a file that was never created.
Configuration
| v11 (Legacy) | v12 (New) |
|---|---|
IRImagerConfigReader::read(xmlPath) + connect(config) |
Imager::Create(ImagerConfig); settings can be imported afterwards with LoadConfig(jsonPath) |
imager->saveConfig() (the SDK's per-camera XML archive) |
imager->SaveDeviceConfigArchive() |
| (none) | imager->SaveConfig(jsonPath) / LoadConfig(jsonPath): export and import one camera's settings, regions and rules as JSON (new) |
New Features (no v11 equivalent)
| Feature | v12 API |
|---|---|
| Recording | imager->Recorder(): EnablePreRoll(), Start(), Stop(), IsRecording(), SaveSnapshot() |
| Playback | Player::Open(), SeekToFrame(), SeekToTimestamp(), SetSpeed(), SetLoop() |
| Simulated imager | Imager::Create(SimulatedConfig{...}) |
| RGB callback | SetRgbCallback() |
| Energy callback | SetEnergyCallback() |
| External buffer | imager->Buffers().Add(buffer) |
| Regions and rules | imager->Regions(), imager->Alarms(), see Regions and Alarms |
| Pipeline information | imager->Processing().Info(): GPU or CPU, and why |
| Hotplug monitor | StartHotplugMonitor(), StopHotplugMonitor(), StartDeviceMonitor() |
| Auto-reconnect | imager->EnableAutoReconnect() |
| Snapshots | imager->Recorder().SaveSnapshot(), or optris::sdk::rec::Snapshot::SavePng() / SaveTiff() |
Breaking Changes
The following changes may require code modifications:
- C++17 for the new API, but C++20 for
EnumerationManager, and this one breaks v11 code. Theoptris/sdk/headers compile at C++17 or later. They required C++23 until API version 29, and the installed CMake target forced it on anything that linked the SDK; neither is true now. The exception is on the legacy surface.otcsdk/enumeration/EnumerationManager.hdeclaresvoid runThread(std::stop_token stoken);and the memberstd::jthread _runThread;. Both are C++20 and both are in the class definition, so neither can be hidden behind the pimpl: the member decides the layout and the method is part of the declaration your compiler parses. A v11 application built at C++17 that includes that header does not compile against v12. It is the only shipped header in either surface that needs more than C++17, it is checked on every build, and the fix in your project is one line:target_compile_features(your_target PRIVATE cxx_std_20), orset(CMAKE_CXX_STANDARD 20), or-std=c++20if you do not use CMake. Nothing else changes: the class, its members and its behaviour are what they were. If you cannot move off C++17, the new API'soptris::sdk::EnumerateDevices()andStartDeviceMonitor()cover the same ground and compile at C++17. - ImageProcessing class removed. The Op* processing chain (OpNuc, OpGainCorrection, OpFilter, etc.) has been replaced by the CPU and GPU pipeline backends. There is no public way to access individual processing stages.
- SoSCorrection external dependency removed. Size-of-source correction is implemented natively in both pipeline backends, and the SDK's CMake package no longer looks for or links a separate SoSCorrection library.
- Size-of-source correction needs a strength. It is on by default as in v11, but in v12 it is a switch plus a strength (
ProcessingConfig::sos_strength), and the strength defaults to0, which subtracts nothing. The calibration data carries only the shape of the correction, not its size; set a strength measured for your camera and optics to get a correction. - OTC.SDK.View and OTC.SDK.Record absorbed. These are no longer separate libraries. Their code is part of
libotcsdk. You do not need to link against separate View or Record libraries. - Namespace change. New API uses optris::sdk::
. Legacy API remains inoptris::. Recording types live in [optris::sdk::rec](/documentation/sdks/otc-sdk/v12.0/api/namespaces/optris.sdk.rec)::, visualization types in optris::sdk::view::, process-interface types in [optris::sdk::pif](/documentation/sdks/otc-sdk/v12.0/api/namespaces/optris.sdk.pif)::.
What Was Removed
| Removed | Replacement |
|---|---|
ImageProcessing |
CPU and GPU pipeline backends (internal, automatic) |
OpNuc, OpGainCorrection, OpFilter, etc. |
Pipeline stages (internal) |
otcsdk/common/CalibrationFileSource.h (the header) |
The CalibrationFileSource enum itself still exists, unchanged, in otcsdk/Sdk.h. Only the separate header is gone, so a v11 #include "otcsdk/common/CalibrationFileSource.h" has to become #include "otcsdk/Sdk.h". The new API's equivalents are ImagerConfig::calibration_path / allow_calibration_download and optris/sdk/calibration.h. |
FieldStatus::getEmissivitySource(), getAmbientTemperatureSource(), getTransmissivitySource(); FrameMetadata::getTransmissivitySource(); IRImager::getTransmissivitySource() |
All five returned a compile-time RadiationParameterSource::Sdk and could never return anything else, in v11 too, so this is not a v12 regression. For the first two use the FrameMetadata accessors of the same name, which are populated from the real processing chain; the three transmissivity ones have no replacement because there is no transmissivity source to track. See the C# section for the detail, and Radiometry().Sources() for the version 12 answer. |
| SoSCorrection (external library) | Native size-of-source correction in both pipeline backends |
| OTC.SDK.View (separate library) | src/view/ in OTC.SDK |
| OTC.SDK.Record (separate library) | src/record/ in OTC.SDK |
That table is complete for the v11 C++ API, and it is checked on every build against v11's own public headers, so a removal cannot go unaccounted. On today's tree: 65 of v11's 66 headers survive, the one missing is the CalibrationFileSource.h relocation above, and the only members gone are the five radiation-source accessors above.
The comparison is by name, not signature: a member whose parameter list changed keeps its name, and the compiler catches that instead, through a complete v11 program compiled against the installed package on every release build. Enumerator values are checked separately against their own recorded baseline.
libirimager / irDirectSDK is not part of v12
If your application is built against libirimager, the flat C library also known as irDirectSDK and usually vendored into the application's own source tree rather than installed, then this section is your migration. The decision is plain, and it is a decision rather than an oversight: libirimager is not a v12 deliverable. No v12 package contains a library or a header by that name; it is not built, not installed, not packaged and not supported. Its build system has been removed from this repository. There will be no v12 libirimager, so there is nothing to wait for and no compatibility shim coming.
Use the flat C ABI instead. optris/sdk_c.h is what libirimager was for: one C99 header, plain C types across the library boundary, no C++ in your translation unit and no dependence on how your compiler mangles names. It is a first-class part of v12 rather than a side door (the shipped .NET, Python and Rust packages are all written on it), and Installation shows how to compile against it with CMake and without. It is a port and not a recompile: it is a different interface with different names, so expect to rewrite the SDK-facing layer of your application rather than to change an include path.
Two notes if you are scoping that port. The C ABI reaches considerably more of the camera than libirimager did, including recording, playback, measuring regions and alarms, so the port is also where those become available to you. And if the reason you vendored a C library in the first place was to avoid matching a C++ runtime on Windows, the C ABI is the documented answer to exactly that problem; see Start Developing.
Before and After Examples
Connect and Stream
v11 (before):
#include "otcsdk/IRImager.h" #include "otcsdk/IRImagerClient.h" #include "otcsdk/IRImagerFactory.h" #include "otcsdk/Sdk.h" #include <iostream> class MyClient : public optris::IRImagerClient { public: void onFrame(const optris::FrameEvent& evt) noexcept override { std::cout << "Center: " << evt.thermalFrame.getTemperature(80, 60) << " C\n"; } }; int main() { optris::Sdk::init(optris::Verbosity::Info, optris::Verbosity::Off, "app"); auto imager = optris::IRImagerFactory::getInstance().create("native"); MyClient client; imager->addClient(&client); imager->connect(12040042); imager->run(); // Blocks until stopRunning() }
v12 minimal migration (legacy API, one-line change):
#include "otcsdk/IRImager.h" #include "otcsdk/IRImagerClient.h" #include "otcsdk/Sdk.h" #include <iostream> class MyClient : public optris::IRImagerClient { public: void onFrame(const optris::FrameEvent& evt) noexcept override { if (evt.rgbaFrame) std::cout << "Got BGRA frame\n"; } }; int main() { optris::Sdk::init(optris::Verbosity::Info, optris::Verbosity::Off, "app"); auto imager = optris::IRImager::Create(); // Replaces the factory MyClient client; imager->addClient(&client); imager->connect(12040042); imager->run(); }
FrameEvent::rgbaFrame is C++ only; the C# and Python legacy bindings keep using ImageBuilder.
v12 new API (recommended):
#include "optris/sdk.h" #include <iostream> #include <print> int main() { try { auto imager = optris::sdk::Imager::Create(); imager->SetThermalCallback( [](const optris::sdk::ThermalFrame& f) { // Frames from before the startup calibration has finished // arrive too, and are not measurements. if (!f.GetMetadata().thermal_data_reliable) return; std::println("Max: {:.1f} C", f.GetMaxTemperature()); }); imager->SetConnectionCallback([](bool connected) { if (!connected) std::println(stderr, "Disconnected!"); }); imager->Start(); // Non-blocking std::println("Press Enter to quit."); std::cin.get(); imager->Stop(); } catch (const optris::sdk::SdkException& e) { std::println(stderr, "Error: {}", e.what()); return 1; } }
False Color Visualization
v11 (before):
#include "otcsdk/ImageBuilder.h" optris::ImageBuilder builder(optris::ColorFormat::BGR, optris::WidthAlignment::OneByte); builder.setPalette("Iron"); builder.setTemperatureScaling(20.0f, 80.0f); // In onFrame(): builder.setThermalFrame(evt.thermalFrame); builder.convertTemperatureToPaletteImage(); builder.copyImageDataTo(buffer, size);
v12 (after):
#include "optris/sdk.h" auto imager = optris::sdk::Imager::Create(); imager->SetPalette(optris::sdk::Palette::kIronBow); imager->SetColorRange(20.0f, 80.0f); imager->SetBgraCallback( [](const optris::sdk::BgraFrame& f) { // f.GetData() is BGRA8, ready for display. // No manual conversion needed. const uint8_t* pixels = f.GetData(); uint32_t stride = f.GetStride(); });
Device Enumeration
v11 (before):
#include "otcsdk/enumeration/EnumerationManager.h" auto& manager = optris::EnumerationManager::getInstance(); auto devices = manager.getDetectedDevices(); for (const auto& d : devices) { std::cout << d.getSerialNumber() << "\n"; }
v12 (after):
#include "optris/sdk.h" #include <print> auto devices = optris::sdk::EnumerateDevices(); for (const auto& d : devices) { std::println("{} (S/N {})", d.model, d.serial); }
Measurement Fields
v11 (before): measurement fields were added with IRImager::addMeasurementField() and their results arrived in FrameEvent::fields.
v12 (after):
#include "optris/sdk.h" #include <print> auto imager = optris::sdk::Imager::Create(); auto region = optris::sdk::Region::Rect({0.5f, 0.375f}, {0.3f, 0.2f}); region.name = "Center"; const uint64_t id = imager->Regions().Add(std::move(region)); // After frames arrive: for (const auto& state : imager->Regions().States()) { if (state.region_id == id && state.stats.valid) { std::println("min={:.1f} max={:.1f} mean={:.1f}", state.stats.min_c, state.stats.max_c, state.stats.mean_c); } }
Error Handling
v11 (before):
#include "otcsdk/Exceptions.h" #include "otcsdk/IRImagerFactory.h" const unsigned long serialNumber = 12040042; try { auto imager = optris::IRImagerFactory::getInstance().create("native"); imager->connect(serialNumber); } catch (const optris::SDKException& e) { std::cerr << e.what() << "\n"; }
v12 (after):
try { auto imager = optris::sdk::Imager::Create(); // Non-fatal errors from background threads (new: no v11 equivalent): imager->SetErrorCallback( [](const std::string& msg) { std::println(stderr, "Async error: {}", msg); }); } catch (const optris::sdk::DeviceException& e) { std::println(stderr, "Device: {} (serial: {})", e.what(), e.serial()); } catch (const optris::sdk::CalibrationException& e) { std::println(stderr, "Calibration: {}", e.what()); } catch (const optris::sdk::SdkException& e) { std::println(stderr, "SDK: {}", e.what()); }
Legacy API Compatibility
The legacy optris::IRImager interface continues to work in v12. It is implemented as a facade over the v12 internals. Existing applications do not need to migrate immediately.
// This still compiles and works in v12. #include "otcsdk/IRImager.h" #include "otcsdk/IRImagerClient.h" #include "otcsdk/IRImagerFactory.h" class MyClient : public optris::IRImagerClient { void onFrame(const optris::FrameEvent& evt) noexcept override { // Works as before. } };
However, new features are only accessible through the new API. If you need recording, playback, the simulated imager, regions and rules, or pipeline information, use optris::sdk::Imager.
The recommended migration strategy:
- Keep existing code working with the legacy API.
- Write new features using the new API.
- Gradually migrate legacy code to the new API when convenient.
- Both APIs can coexist in the same application.
Migrating a SWIG C# Application
This section describes the SWIG-generated C# bindings over the v11 API, namespace Optris.OtcSdk. If your application references the Optris.OtcSdk NuGet package, this is your migration.
First: change the package reference
In version 12 the SWIG binding ships inside the Optris.Sdk package, beside the v12 interface, as the assembly Optris.OtcSdk.dll with the same namespace and the same types. There is no separate Optris.OtcSdk package any more. Replace
<PackageReference Include="Optris.OtcSdk" Version="11.*" />
with
<PackageReference Include="Optris.Sdk" Version="12.0.*" />
Your using Optris.OtcSdk; stays as it is. The same reference also gives you the v12 interface, namespace Optris.Sdk, so you can move code over one file at a time.
Then: the package needs .NET 10
The v11 package targeted net9.0. Optris.Sdk targets net10.0. Before anything else, retarget your application:
<TargetFramework>net10.0</TargetFramework>
and build with the .NET 10 SDK (update global.json if you pin one).
Do this straight away, because the failure you get otherwise does not point here. A net9.0 project restores the v12 package without any error: dotnet restore exits 0, because the package's data files and native libraries are framework-neutral and NuGet is satisfied by them alone. It just silently selects no assembly, and the first symptom is the compiler failing on every file that touches the SDK with
error CS0234: The type or namespace name 'OtcSdk' does not exist in the namespace 'Optris'
Measured on PIXConnect: 0 errors at restore, then 292 compile errors, every one of them this shape. If you see Optris.OtcSdk suddenly "not existing" after a package update, check your TargetFramework before anything else.
The managed API: five accessors are gone, and nothing else is
The generated C# surface is compared type by type and member by member (including every enum member's numeric value) against release/v11.x at 19ef5d721, the commit the published Optris.OtcSdk 11.*-* resolves to, and so the one you actually have.
On today's tree: 155 types and 1,839 members, against v11's 146 and 1,773. Nothing lost a type, and the member count reconciles as 1773 − 5 + 48 + 23:
| 5 members removed | The radiation-source accessors listed below. This is the only thing a v11 application can trip over. |
| 48 members added to types you already have | |
| 9 types added, carrying 23 members | Four you can use (OpticsUnit, FlagCorrectionReport, FlagCorrectionOutcome and Sdk.CalibrationAcquisitionScope) and five SWIGTYPE_p_… handles, which are SWIG placeholders for C++ types it cannot wrap and have no members to call. See "What is still not on the C# surface" below. |
No enum member changed its numeric value, so a setting your application persisted as an integer still means what it meant.
That comparison runs on every build against the recorded v11 surface, so a removal cannot go unaccounted.
The five removed members
All five returned a compile-time RadiationParameterSource.Sdk for the whole shipped life of the SDK, in v11 as well as v12. Two were hardcoded literals with no member behind them, and the third on FieldStatus had a member that was written once in the constructor and never again. None of them could ever return a different answer, so no application can have had a working dependency on the value. Removed:
| Removed | What to use instead |
|---|---|
FieldStatus.getEmissivitySource() |
FrameMetadata.getEmissivitySource(), which is populated from the real processing chain |
FieldStatus.getAmbientTemperatureSource() |
FrameMetadata.getAmbientTemperatureSource(). Every field is processed with the standard ambient, so a per-field answer could only ever equal the frame's |
FieldStatus.getTransmissivitySource() |
Nothing, and nothing is needed: no process-interface signal drives the transmissivity on any camera, so "set by the program" is the only truthful answer there will ever be |
FrameMetadata.getTransmissivitySource() |
Nothing, for the same reason |
IRImager.getTransmissivitySource() |
Nothing, for the same reason |
If you call any of these, delete the call: the only value it ever gave you was Sdk. The go-forward answer for radiation provenance is Radiometry().Sources() on the version 12 API.
Source that compiled against the v11 package otherwise compiles against the v12 package unchanged; this was checked by building OptrisConnect.Core (the assembly that holds all of PIXConnect's SWIG director subclasses and its whole SDK call surface) against both, with no source edits: 0 errors either way. That build predates the five removals above, so a consumer calling them is the one case it would not have caught.
If you compare against an older v11 than the published one, expect differences that are v11-to-v11, not v11-to-v12. The OTC.SDK submodule pin some branches still carry (710de2df2) is 320 commits behind release/v11.x.
Additions:
| Added in v12 | Notes |
|---|---|
IRImager.Create() |
Static factory; IRImagerFactory.getInstance().create("native") still works. |
ConnectionState.Error |
New member, value 14, appended. Existing members keep their values. |
IRImager.isNucInProgress(), supportsNetworkConfig() |
|
IRImager.get/setFlagDriftThreshold() |
|
IRImagerConfig.addressProbeTimeoutMs, controlConnectTimeoutMs |
Both int, both milliseconds. The older connectionTimeout on the same class carries no unit in its name. |
OperationMode.getOpticsUnit() and the OpticsUnit enum |
|
Sdk.addCalibrationFallbackServer() and friends |
|
ProcessingOutputConfig.energyFrames, rgbaFrames |
What is still not on the C# surface
FrameEvent.rgbaFrame is a C++-only addition. SWIG cannot wrap std::optional<BgraFrame>, so it is excluded from the C# bindings; keep using ImageBuilder to colorize. For the same reason FrameEvent.energyFrame and FrameEvent.rawFrame appear in C# as opaque SWIGTYPE_p_std__optionalT_... handles with no members; they cannot be read from C#. Use the new API if you need those frames.
Exception behaviour improved; two v11 crashes are gone
Several v11 catches directives named methods that did not exist or omitted the class qualifier, so SWIG silently generated no exception translation for them and the C++ exception unwound through the P/Invoke frame into std::terminate. In v12 those are corrected. Against an unconnected imager, one call per process:
| Call | v11 | v12 |
|---|---|---|
new IpAddress("not-an-ip") |
process abort (std::terminate) |
SDKException |
FrameMetadata.getPifDiValue(99, 99) |
process abort | SDKException |
IRImager.setRdcMode(...) while disconnected |
process abort | SDKException |
IRImager.configureOperationInfo(...) while disconnected |
process abort | SDKException |
If your application had a catch that never fired, or a crash you could not explain around these calls, it becomes a normal exception in v12. Make sure you handle it.
One note on the type to catch: SDKException is internal to the binding assembly (in v11 as well), so your code cannot name it in a catch clause. Catch its public base System.ApplicationException; the SDK's message text is preserved. Measured against the v12 package: new IpAddress("not-an-ip") throws a catchable ApplicationException with Failed to parse IP address string: Invalid format. where the v11 package aborts the process with terminate called after throwing an instance of 'optris::SDKException.
New native runtime dependencies on Linux
libotcsdk.so gained hard DT_NEEDED entries that v11 did not have:
libavcodec.so.61 libavformat.so.61 libavutil.so.59 libswscale.so.8 libswresample.so.5 libpng16.so.16 libssl.so.3 libcrypto.so.3 libidn2.so.0 libnghttp2.so.14 libpsl.so.5
The package now bundles the five FFmpeg libraries itself under runtimes/linux-x64/native/ (with the GPL v3 notice beside them), so those resolve from the application directory and no distribution package is needed for them. The rest still come from the system: on Debian 13 they are satisfied by libpng16-16t64, libssl3, libidn2-0, libnghttp2-14 and libpsl5. Anything that installs your application has to pull those in; the NuGet package cannot. Without them the first P/Invoke fails with DllNotFoundException.
Conversely, libSoSCorrectionLib is gone: v11's libotcsdk.so linked it and packages had to ship it, and v12 links nothing of the kind: size-of-source correction is native to both pipelines, and no .so or .dll by that name is built, linked or packaged. The name survives in comments describing what v11 did, and in one stale copy filter in scripts/build-windows.ps1, which is a glob and copies nothing when the file is absent.