OptrisOptrisDocumentation

Documentation/OTC SDK/Overviewv12.0

API Reference

This chapter answers one question: where is the exact declaration of a thing, and what is its contract?

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.

It does not restate that declaration. The reference proper is generated from the headers this package installs, into this same manual: every class, struct, enum and free function in optris::sdk, each with its signature, its default values and the comment the header carries. Those comments are the contract: they are written at the declaration, they are compiled beside it, and they cannot describe a different version of it. 260 types are reachable that way.

A hand-written copy of that cannot be better than the generated one and does drift away from it. Two examples found while this chapter was being rewritten: it gave AutoNucConfig::forecast_enabled a default of false where the header initialises it to true, and it said SkipStartupCalibration() "must be called before Start()" where the header says it need not be and names what calling it later does. So this chapter is now the map, and the generated pages are the territory.

How to read it

  • Every type name in this manual is a link. optris::sdk::Imager, optris::sdk::AutoNucConfig, optris::sdk::pif::PifController: written anywhere in these pages, in prose or in a table, they take you to the generated page for that type. Member names work too: optris::sdk::AutoNucConfig::drift_filter_secs.
  • Three indexes cover the surface from the other direction: the class and struct list, the alphabetical member index for when you know a method name but not its type, and the namespace members for free functions, enums and constants.
  • Deprecated list is generated too, so what is on the way out is in one place rather than scattered through prose.
  • The header is the unit of documentation. Where a page in this manual and a header comment disagree, the header is right: it ships with the code. #include "optris/sdk.h" reaches all of it; the individual headers are listed in Public Headers.

The API compiles at C++17. The SDK's CMake targets declare cxx_std_17 on their interface, and the public headers use optris::sdk::Span and optris::sdk::Result rather than std::span and std::expected. Every installed header is compiled at -std=c++17 on every build, so the claim is checked rather than remembered.

Other languages reach the same engine through the flat C ABI in include/optris/sdk_c.h, which is documented in this manual alongside the C++ headers. Its names differ from the C++ names; see Other languages.

The four frame sources

Everything that produces frames derives from optris::sdk::FrameSource, and that base is what starting and stopping, thermal and BGRA frames, palettes, colour scaling, regions and alarm rules all live on. Code written against it works on all of them.

Type What it is Opened with
optris::sdk::Imager A camera, real or simulated. The whole camera-specific surface hangs off it through the accessors below Imager::Create()
optris::sdk::Player A recording being replayed. Frames, palettes, regions and alarms; no shutter, focus or network Player::Open()
optris::sdk::StillSource A saved snapshot reopened as a measurable source. Exactly one frame, delivered repeatedly StillSource::Open()
optris::sdk::FrameSource The base the three share (none)

optris::sdk::Imager is polymorphic and move-only; its default constructor is protected so that it can be subclassed into an observer-style shape (see Subclassing instead of callbacks). Each accessor returns a handle that refers to that imager and is valid for exactly as long as it is.

The accessors on a camera

This table is the one piece of the reference a generated page cannot give you, because it maps a question to a place rather than describing a declaration.

Accessor Type Header What it covers
Regions() optris::sdk::RegionEngine region_engine.h Measuring areas and their readings
Alarms() optris::sdk::RuleEngine region_engine.h Rules, alarm state, signals, alarm callbacks
Radiometry() optris::sdk::Radiometry radiometry.h Emissivity, transmissivity, ambient, reference correction
Detector() optris::sdk::Detector radiometry.h Shutter correction schedule, manual trigger, chip heating
Processing() optris::sdk::Processing processing.h Outputs, filters, picture corrections, which pipeline ran
Optics() optris::sdk::Optics optics.h Focus capability and position
Display() optris::sdk::Display display.h Colour windows, overlays, GPU surface rendering
Buffers() optris::sdk::Buffers buffers.h External buffers the SDK writes each frame into
Motion() optris::sdk::Motion motion.h Temperature-band motion zones
Recorder() optris::sdk::Recorder recorder.h Recordings, snapshots, interval capture, attachments
Canvas() optris::sdk::CanvasControl canvas_control.h Where this camera's frame sits in view space
Device() optris::sdk::DeviceControl device_control.h Network settings, fail-safe, name and metadata
GetPif() optris::sdk::pif::PifController pif/pif_controller.h The process interface. shared_ptr, and nullptr only for a simulated camera or a recording

Configuration records

One rule governs every one of these, and getting it wrong silently resets settings you did not touch: a group setter writes the whole record. Read it, change the fields you mean, write it back.

auto p = imager->Processing().Get();
p.dde_enabled = true;
imager->Processing().Set(p);

A default-constructed record passed to a setter writes defaults over everything, including settings a later SDK version added that your code has never heard of. That is why optris::sdk::Imager::GetConfig() and ApplyConfig() exist as a pair, and why saving a camera's state setting by setting cannot be complete.

Record Set with Header
optris::sdk::ImagerConfig Imager::Create(), ApplyConfig(), LoadConfig() imager_config.h
optris::sdk::ProcessingConfig Processing().Set() imager_config.h
optris::sdk::ProcessingOutputConfig inside ProcessingConfig::outputs imager_config.h
optris::sdk::RadiationConfig Radiometry().Set() imager_config.h
optris::sdk::AutoNucConfig Detector().SetAuto() imager_config.h
optris::sdk::TemperatureRange SetTemperatureRange() imager_config.h
optris::sdk::OperationMode SetOperationMode() device_info.h
optris::sdk::SimulatedConfig Imager::Create(), UpdateSimulatedScene() simulated_config.h
optris::sdk::ExternalBuffer Buffers().Add() external_buffer.h
optris::sdk::ReconnectConfig EnableAutoReconnect() reconnect.h
optris::sdk::EnumerationOptions EnumerateDevices() device_enumerator.h
optris::sdk::DeviceMonitorOptions StartDeviceMonitor() device_enumerator.h
optris::sdk::ColorWindow Display().SetColorWindow() display.h
optris::sdk::MotionZone Motion().SetZone() motion.h
optris::sdk::Canvas, optris::sdk::Placement Canvas().Set(), EditPlacement() canvas.h
optris::sdk::rec::RecordingOptions, optris::sdk::rec::SnapshotOptions Recorder().Start(), SaveSnapshot(), and the two alarm actions rec/options.h

Read optris::sdk::AutoNucConfig in full before setting any of it. Its drift_filter_secs and drift_band_steps fields carry the measured account of why a camera the SDK calls settled still corrects every twelve seconds, what to set, and what the setting costs, including the one case it makes worse, a camera opened cold and measured immediately.

The enumerations these records take (optris::sdk::Palette, optris::sdk::NoiseFilter, optris::sdk::RdcMode, optris::sdk::ChipHeatingMode, optris::sdk::Transport, optris::sdk::SensorBitDepth, optris::sdk::FrameQueuePolicy, optris::sdk::AutoScaleMode, optris::sdk::DriftProbes, optris::sdk::FlagWhileRecording) are listed with their enumerators under namespace members and on the page of the header that declares them.

Noise filters change reported temperatures; they run inside the radiometric path. Detail enhancement does not; it is ProcessingConfig::dde_enabled and is display-only. Both pipelines honour every optris::sdk::NoiseFilter value, but they do not return identical temperatures for the same filter, and filter_strength multiplies a different nominal on each. Filters has the account.

Frames

Type Payload Coordinates
optris::sdk::ThermalFrame Calibrated temperatures, int16_t internal format as oriented
optris::sdk::BgraFrame BGRA8 false-colour picture as oriented
optris::sdk::RgbFrame The visual-camera image, on models that have one as oriented
optris::sdk::RawFrame Uncalibrated sensor counts, uint16_t sensor, never rotated or mirrored
optris::sdk::EnergyFrame Radiometric energy before the temperature lookup, int32_t sensor, never rotated or mirrored

Every one of them carries an optris::sdk::FrameMetadata through GetMetadata(): the capture timestamp, the sequence number, the three internal probe temperatures, the shutter position and the two fields that say how far the frame can be trusted. Read FrameMetadata's own page before reading any of those fields; four of them are each false or zero for more than one reason, and the header says which:

  • thermal_data_reliable is a bool over five unrelated conditions (no dark reference yet, the startup calibration running, the detector still warming, raw data that is one value across the detector, the camera's calibration missing), and is true on a camera whose detector the SDK cannot judge at all.
  • detector_settling is the three-state answer that bool is a reduction of.
  • chip_temp_known false means there is no detector reading, and chip_temp_c is then 0.0, which is not a detector at 0 °C.
  • is_repeated_frame true means the SDK held the previous frame and delivered it again through a shutter closure. Such a frame is a repeat and is still reliable; the two questions are not the same one.

optris::sdk::ThermalFrame stores internal = (celsius * 10) + 1000, and the free functions InternalToCelsius(), CelsiusToInternal() and IsEncodableTemperature() convert single samples. For a whole frame use CopyTemperaturesTo() and not the formula, see Reading temperatures out of a frame for why that matters.

Regions, rules and signals

optris::sdk::Region is one model for a measuring area: its geometry, its statistics and the rules watching it. optris::sdk::RegionEngine owns them; optris::sdk::RuleEngine owns the rules. Regions and Alarms are the chapters; the types are:

Three properties cut across all of it:

A statistic that was not measured is NaN, never zero. optris::sdk::RegionStats::valid is the gate, and when it is false the temperatures are quiet NaN and min_loc/max_loc collapse onto centre_loc. Nothing can be plotted, averaged or compared against a limit by accident. pixel_count and coverage stay truthful either way, so a caller can see how short the sample was.

A rule's input names a signal slot, not a region id. RuleEngine::RegionOf() is how you get back from a rule to its region; nothing on the Rule itself carries it.

An alarm action writes its file through the same options struct the manual call takes, deliberately, so two stills of one frame cannot differ by who asked for them. The one setting there that is not cosmetic is rec::RecordingOptions::max_segment_bytes: at zero a recording never rolls over, so an alarm recording onto a destination that caps a single file fails at that cap instead of continuing in a new part.

Devices, enumeration and reconnection

  • Identity: optris::sdk::DeviceInfo (cached, refreshed on connect and on a mode change), optris::sdk::DeviceCapabilities, optris::sdk::DeviceMetadata, and the enums optris::sdk::DeviceType and optris::sdk::ConnectionType. The type predicates IsPI(), IsXI(), HasFocusMotor() and the rest are deprecated: compiled into your binary, they drift from what the device reports. Ask DeviceInfo::capabilities, or the connected imager.
  • Finding cameras: the free functions in device_enumerator.h: optris::sdk::EnumerateDevices(), optris::sdk::ProbeNetworkDevice(), optris::sdk::StartDeviceMonitor(), optris::sdk::StartHotplugMonitor(), and the simulated-device registry. optris::sdk::EnumerationOptions, optris::sdk::DeviceMonitorOptions, optris::sdk::NetworkProbe and the enum optris::sdk::DeviceChangeKind go with them. Device Enumeration is the chapter.
  • Reconnection: optris::sdk::ReconnectConfig, optris::sdk::ReconnectEvent, optris::sdk::ReconnectPhase. Prefer Imager::EnableAutoReconnect() to the process-wide free function of the same name. After any phase but kGaveUp and kRecovered another attempt is coming, so a handler that tears something down keys off those two.
  • Network configuration: optris::sdk::DeviceNetworkConfig and optris::sdk::NetworkConfigOutcome on Device(). The outcome matters: some changes keep the connection and some require reopening the camera at its new address, and one is only written the next time the camera is reached over Ethernet.

The process interface

optris::sdk::pif::PifController, reached through Imager::GetPif(). Its fallible calls throw, like everything else on this API: a refusal arrives as optris::sdk::pif::PifException, whose code() is an optris::sdk::pif::PifError saying which refusal it was and whose what() names the specifics. Through API version 33 these fifteen calls returned a value instead, and they were the last part of the public C++ API shaped that way; API version 34 converted them, which completes the rule that no public header returns a value-or-error type. A polling loop still does not have to catch: reading an input before the first frame has brought one is a reading rather than a refusal, so a loop over a working interface never throws.

Channels carry no meaning until Configure() gives them one. The types: optris::sdk::pif::PifChannelConfig, optris::sdk::pif::PifIdentity, optris::sdk::pif::PifHardwareInfo, optris::sdk::pif::IoSnapshot, optris::sdk::pif::PifFailSafeConfig, optris::sdk::pif::PifFailSafeStatus, optris::sdk::pif::PifAnalogCalibration, optris::sdk::pif::AnalogRange, and the enums DigitalState, PifDeviceKind, PifDetection, PifDirection, PifSignal, PifAutonomy, PifChannelKind. Process Interface (PIF) and Fail Safe are the chapters.

Detection is advisory. Every physical camera hands back a controller whether or not anything was found on the connector, so a handle is not evidence that a process interface is attached. IsConnected() is, and SetIdentity() declares one that detection missed.

Telemetry, calibration and the picture pipeline

  • optris::sdk::Telemetry: a live reading built per call by GetTelemetry(), with the probe temperatures, the shutter and correction state, the focus position and the active range. Not every field has a source in the current engine; the ones that do not stay at their defaults and the header says which.
  • optris::sdk::ShutterEvent, and the enums optris::sdk::ShutterState, optris::sdk::NucStatus, optris::sdk::CalibrationState.
  • optris::sdk::CalibrationStatus and Imager::GetCalibrationDiagnosis(): a camera whose calibration files could not be found still opens and streams, and its temperatures are wrong. This is how to tell. Calibration File Acquisition is the chapter; the process-wide settings are the free functions in calibration.h, and the per-camera ones are ImagerConfig::calibration_path and ImagerConfig::allow_calibration_download.
  • optris::sdk::PipelineInfo and optris::sdk::GetGpuInfo(): which pipeline computes this camera's frames and why. optris::sdk::PictureCorrection: whether radial distortion and size-of-source correction are actually in effect, as against having been asked for. optris::sdk::FrameRateInfo and optris::sdk::MeasuredFrameRate: the configured rate and the counted one. optris::sdk::ReferenceCorrection and optris::sdk::RadiationSources.
  • optris::sdk::VideoFormat and its VideoConfig/Subframe parts describe a camera's stream geometry.

Versions

Two numbers, and only two.

The product version is the number on the installer: optris::sdk::GetProductVersion(), GetProductVersionString(). It comes from the newest released heading in CHANGELOG.md, not from a number typed into a build file.

The API version is a single integer, and it is the number in the library's name: otcsdk-34.dll on Windows, libotcsdk.so.34 on Linux. It rises only when something a compiled program depends on changes incompatibly, which happens only in a new major version. A 12.0 update that adds functions leaves it, and the library's name, alone. There is one of them, not one per language: OPTRIS_SDK_API_VERSION is defined as the flat C ABI's OPTRIS_SDK_C_ABI_VERSION, and optris::sdk::GetApiVersion(), optris_sdk_c_abi_version() and Optris.Sdk.Sdk.ApiVersion always return the same value.

A function added in a 12.0 update says which release added it, and the product version is the number to compare for it: a program that uses a function added in 12.0.10 needs GetProductVersion() to be 12.0.10 or later. Linked against an older library of the same API version, a C, C++ or Rust program stops with an error naming the missing function at its first call (on Linux) or does not start (on Windows). C# and Python raise an error naming the missing function when it is called, and everything else keeps working.

The macro is what your translation unit compiled against; GetApiVersion() is what the library you loaded implements. They differ exactly when a header and a shared library have come from different builds, which is the one thing worth testing at start-up:

#include <optrissdk.h>

#include <print>

int main() {
  if (optris::sdk::GetApiVersion() < OPTRIS_SDK_API_VERSION) {
    std::println("loaded an older library than this build expects");
    return 1;
  }
  const auto build = optris::sdk::GetBuildInfo();
  std::println("{} ({} on {})", optris::sdk::GetProductVersionString(),
               build.commit, build.branch);
}

optris::sdk::BuildInfo is display-only: the commit, the branch, the build type and the dates. None of the version functions can fail or throw. otc_version prints all of it in one command; see Command-line tools. What changed in each release is in the changelog, and Migration Guide: v11 to v12 is the page to read if you are moving an application from SDK 11.

Exceptions

Everything the SDK raises derives from optris::sdk::SdkException, which derives from std::exception. The generated class hierarchy draws the tree; exception.h's page lists them with what each one means.

catch (const SdkException&) is not exhaustive, and that is deliberate rather than an oversight: argument validation in some calls throws std::invalid_argument, because a value outside an enumeration is a programming error rather than a device condition. Error Handling has the full hierarchy, which calls throw what, and the .NET, Python and Rust equivalents.

Two of them are worth distinguishing before you write a retry:

Across the C ABI these become OPTRIS_SDK_ERROR_DEVICE, _TIMEOUT, _BUSY, _CALIBRATION, _CONFIGURATION, _CAPTURE, _IO, _INVALID_STATE and _NOT_SUPPORTED.

What is on the way out

The deprecated list is generated from the headers and is the authority. The three worth naming here, because v11 code reaches for them:

  • optris::sdk::Roi and optris::sdk::RoiContainer in roi.h are superseded by optris::sdk::Region. The type stays, with ToRegion() and ToRoi() converters, so stored ROI shapes can be brought across; it is no longer reachable from Imager, and it no longer carries an alarm. Regions is what to use.
  • Measurement fields and alarm channels are gone from optris::sdk entirely. A measurement field is a Region and its alarm is a Rule; Measurement Fields gives the mapping. The v11 alarm-channel shape remains available behind include/legacy/otcsdk/alarms/.
  • Detector().PerformNuc() was a second name for TriggerShutter() calling the identical code, and it was removed at API version 30. A correction on this hardware is a shutter cycle, so there is one call.