OptrisOptrisDocumentation

Documentation/OTC SDK/Overviewv12.0

Operation Modes

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

An operation mode is a valid combination of optics, temperature range, and video format supported by a device. optris::sdk::OperationMode (declared in optris/sdk/device_info.h) carries:

Field Description
optics_fov The number that characterises the optic. Read optics_unit to know what it means.
optics_unit Whether optics_fov is a field of view in degrees or a focal length in millimetres. kDegrees, kMillimetres, or kUnknown for a mode that did not come from a calibration.
optics_text How the camera labels the optic beyond its angle, often empty. Tells apart two optics with the same field of view.
temp_min, temp_max The calibrated range this mode measures, in degrees Celsius: always, never the range in force. TemperatureRange::extended does not move them: the pair is part of this mode's identity, and it is the pair DeviceInfo::available_ranges lists and every lookup matches on, so a record taken from DeviceInfo::operation_modes or Imager::GetOperationMode() can be handed back whatever the extension is doing. Read extended_temp_min / extended_temp_max for the extended pair.
width, height Frame dimensions in pixels, sensor-native and unrotated.
framerate Frame rate in whole Hz.
extendable Whether this mode's calibration says the range can be stretched past its calibrated limits at reduced accuracy. True when either end extends; extended_temp_min / extended_temp_max say which. Switched on with TemperatureRange::extended.
extended_temp_min, extended_temp_max The limits the extension would give, or empty when the mode is not extendable.
high_precision_available Whether this mode's calibration offers the high-precision temperature table. A property of the mode: a mode that does not offer it cannot be made to, and switching modes is the only way to get it. Rare, and offered only on some -20..100 °C calibrations. Nothing to do with frame rate.

Available modes depend on:

  • Device type: different cameras support different resolutions, frame rates, and optics.
  • Optics: each optic requires its own calibration data.
  • Connection interface: Ethernet typically offers higher bandwidth, enabling larger formats or higher frame rates.
  • Calibration availability: without calibration data, modes are derived solely from supported video formats. Those entries carry placeholder values, not measurements: optics_fov is 0, optics_unit is kUnknown, and both temperature limits are -100. A mode whose optics_unit is kUnknown did not come from a calibration; kUnknown is not a synonym for degrees, so show no unit rather than a possibly wrong one. Ask Imager::GetCalibrationStatus() whether this is the situation you are in; see Calibration File Acquisition.

Listing Available Modes

The modes are facts about the device, so they are part of DeviceInfo rather than a separate call:

const auto& info = imager->GetDeviceInfo();
for (const auto& m : info.operation_modes) {
  std::println("{}x{} @{}fps, {}, {:.0f}-{:.0f} C",
               m.width, m.height, m.framerate, m.optics_text,
               m.temp_min, m.temp_max);
}

DeviceInfo::available_ranges lists the distinct temperature ranges those modes cover, as {min, max} pairs.

The list is sorted by: FOV > optics text > lower temperature limit > upper temperature limit > the camera's own video format order.

Query the currently active mode:

OperationMode active = imager->GetOperationMode();

Setting the Active Mode

Pass one of the listed modes back:

const auto& modes = imager->GetDeviceInfo().operation_modes;
// Select the mode with the highest resolution.
auto best = std::ranges::max_element(modes,
    [](const auto& a, const auto& b) {
      return a.width * a.height < b.width * b.height;
    });
imager->SetOperationMode(*best);

The mode is looked up by field of view, both temperature limits, frame size and frame rate. A combination the camera does not have throws ConfigException.

If only the temperature range matters, set that instead. The pair is matched on both ends against DeviceInfo::available_ranges; anything else throws ConfigException, with the ranges that do exist listed in the log. Read them from the camera rather than assuming: no particular range is required to exist on every camera, so the sample below selects the warmest range the camera offers rather than naming one.

const auto& ranges = imager->GetDeviceInfo().available_ranges;
auto hottest = std::ranges::max_element(ranges,
    [](const auto& a, const auto& b) {
      return a.second < b.second;
    });

TemperatureRange range;
range.min_c = hottest->first;
range.max_c = hottest->second;
imager->SetTemperatureRange(range);

Zero at both ends is the one pair that is not matched: it means "whichever mode is listed first" and always succeeds. That is a default, not a range; do not reach it by leaving a struct zeroed and expecting a refusal.

Note: TemperatureRange::extended and TemperatureRange::high_precision are implemented. Both rebuild the energy-to-temperature table.

Two things to know before using them.

The extension is not a measuring range

The extended part lies outside the calibration and reads with poor precision. It exists so the field of view can be aimed, and so a visual check is possible, on a camera whose range has a high lower limit: a 150..900 °C range typically extends down to 20 °C, which is what lets a room-temperature scene be seen while in it. On a -20..100 °C range it is worth close to nothing, because the table already carries a 25 K accommodation band at each end. Nothing marks a value as being outside the calibrated range, per frame or per region, so an application that wants to show that has to compare against the mode's own limits itself.

Both switches are camera-wide, not per mode: the request is recorded whether or not the active mode can act on it, so switching the extension on and then selecting an extendable mode works. Whether it is in force is extendable / high_precision_available together with the limits the mode reports. A mode that extends at neither end keeps its limits and its accommodation band exactly.

Either switch can take seconds on a running camera, and neither may be set from inside a frame callback. Rebuilding the energy-to-temperature table rebuilds the processing chain, which frees what the frame being processed, and a shutter calibration in progress, are using, so the call waits for both first, exactly as a change of operation mode does. Setting a switch to the value it already holds returns at once and rebuilds nothing, which is what keeps the read-modify-write idiom above cheap: SetTemperatureRange() passes both switches through on every write, whatever moved. A switch that does move throws if it is set from inside a frame callback, and says why, rather than waiting for the pass it is part of, which is already how a change of operation mode behaves.

High precision does not currently change the step size the SDK reports

It selects the finer calibration table where the mode offers one, and the pipeline then carries every thermal pixel as T*10 + 1000 in an int16: 0.1 °C steps. What it trades is the span the 16-bit value can represent, and not the frame rate, which is identical either way: (T + 100) * 10 reaches +6453 °C in 0.1 °C steps, (T + 100) * 100 gives 0.01 °C steps but is clamped at +300 °C. That is why it is a per-range property of the calibration. SDK 11 reported in 0.01 °C steps; reproducing that needs the pipeline's representation changed, and SDK 12 has not changed it.

Neither switch can tell you whether the finer step is arriving, and that is what Imager::GetHighPrecisionState() is for (ThermalCamera.HighPrecisionState in .NET, Camera.high_precision_state in Python, Camera::high_precision_state() in Rust, optris_sdk_imager_get_high_precision_state() in C). high_precision accepts true and reads back true on every camera, including one whose calibration offers no finer table, so "this mode has no finer table" and "it has one, you selected it, and the pipeline rounds it away" were the same observation through the public API. They need different responses: the first is fixed by choosing another mode, the second cannot be fixed by a caller at all. The query answers one of five states: Unavailable for the first and SelectedNotDelivered for the second; Disabled when the mode does offer the finer table and you have switched high_precision off; Unknown = 0 for a camera that has not been asked, which is what a zeroed variable reads as rather than a claim; and Delivered, which is declared and not produced today: it begins appearing on every surface at once when the pipeline stops rounding, so write your switch against all five now.

What the finer table is actually worth, by statistic

0.01 °C is the step of the encoding, not of the measurement. The SDK's per-pixel temperature is a lookup on an integer corrected detector count, so the finest difference it can distinguish between two pixels is the gap between two adjacent entries of that table. Measured over the 76 real characteristic curves on the cameras Optris tests with, each restricted to the range it belongs to and joined to the Decimal flag that decides whether a range gets the finer table at all:

statistic, on the four Decimal 2 ranges best of the four worst of the four
finest adjacent step (top of the range) 0.0093 K 0.0216 K
median adjacent step 0.0125 K 0.0301 K
coarsest adjacent step: a step guaranteed across the range 0.0274 K 0.0772 K
mean (span ÷ steps): the figure previously quoted alone 0.0140 K 0.0347 K

Quote the statistic with the figure. A single number for "the step a range offers" is ambiguous between the finest, the median, the coarsest and the mean, and the four differ by a factor of three on the same curve, which is why the table above names all four. The one to design against is the coarsest, because it is the only one guaranteed across the whole range.

And the Decimal flag does not track the data. Some Decimal 1 ranges source finer than the best Decimal 2 one, and 66 of the 72 Decimal 1 curves carry data finer than the 0.1 K they report, 44 of them finer than 0.05 K. The resolution the pipeline's rounding discards is therefore present on nearly every range, not only on the four that advertise a finer table: the flag gates the finer table, it does not describe the detector.

SDK 11 genuinely resolved this rather than merely printing it. Its delivered pixel carried centidegrees (T*100 + 10000, with TemperatureConverter's factor following the precision) and its table builder stretched the energy axis to ~200 index steps per kelvin where SDK 12 uses 20. So this is a capability SDK 12 lost, not a number SDK 11 displayed over coarser data.

Reading A Setting Back

A settings page has to show what the camera is doing now, and a saved layout has to be restored against what is actually in force. Caching the last value an application wrote is not the same thing: it is wrong the moment the camera restarts with its stored configuration, a mode switch resets something, or another client changes it.

So each of these is readable, and each says honestly how much its answer is worth.

Setting Reading it gives you
the automatic shutter interval the interval in force. Authoritative.
distortion correction the mode being applied. Authoritative.
the subsampled frame rate the rate that was requested, clamped to the sensor's own.
the frame-rate report what the SDK intends to deliver, and why. Derived from configuration.
the measured frame rate what was actually counted: real frames over a recent window.
the shutter forecast the state in force. Authoritative. On by default. It compensates for drift between shutter cycles; to be told about a cycle itself, use the shutter callback.
temperature-range extension the state in force. Authoritative. Off by default.
high precision the request, camera-wide. On by default, and it reads back true even on a camera whose calibration offers no finer table.
the high-precision state whether the finer step is actually delivered, and when it is not, why not.

Authoritative means the SDK is the thing doing the work, so what it reports is what is happening: the automatic shutter is scheduled by the SDK against its own clock and distortion correction is a stage of the SDK's own pipeline, so neither can be changed behind its back.

Requested applies to the subsampled rate. Subsampling is the SDK dropping frames on the host, the camera keeping its native rate, and the request clamped to that rate before it is reported, so it can never name a rate no frame will arrive at. On an export-restricted camera the delivered rate never exceeds 9 Hz whatever is requested, because that ceiling is a legal requirement.

The automatic shutter interval is the example to hold the others against: write a schedule, read it back, and the answer is the schedule in force rather than the last value written.

AutoNucConfig schedule = imager->Detector().GetAuto();
schedule.min_interval_secs = 15.0F;
schedule.max_interval_secs = 300.0F;
imager->Detector().SetAuto(schedule);

schedule = imager->Detector().GetAuto();
std::println("shutter every {:.0f} to {:.0f} s",
             schedule.min_interval_secs,
             schedule.max_interval_secs);

What the SDK intends, and what actually arrived

Two different questions, and two answers, because the first cannot see what the second measures.

The frame-rate report answers "what will I get, and why": the sensor's own rate, what was asked for, what the SDK will deliver, and a sentence explaining the difference. Every figure in it comes from configuration.

const FrameRateInfo rate = imager->Processing().FrameRate();
std::println("{}", rate.explanation);
// "Delivering 9 Hz: this camera is export-restricted and may not
//  exceed 9 Hz by law. The limit applies on every pipeline and cannot
//  be changed. 15 Hz was asked for."

if (rate.reason == FrameRateLimitReason::kExportRestricted) {
  // Worth telling the user about; the others mostly are not. This one
  // cannot be changed by the application or by the operator.
}

The measured rate counts. It reports the number of frames that carried new pixels, the window they were counted over, the rate that follows, and how many frames in the same window were repeats. Use it wherever you were about to divide a configured rate to budget work per frame; that is the one use a configured number is wrong for, because no configured figure can know about a shutter calibration, a frame held because the shutter was in the way, a frame lost under load, or a camera that is not keeping up.

A held frame is marked as repeated and is not counted. The repeat count is what tells a healthy camera mid-calibration, where the rate dips and recovers, from one that has stopped: a camera that really has stopped reads a measured rate of 0 with the reading marked valid, which is a measurement of zero rather than an absence of one.

That dip is right for the measured rate and wrong for a number shown beside a picture: a tile that reads 0 fps through every shutter calibration, and through every pause of a recording, says nothing about the camera. So the SDK reports a third figure beside the two, the live rate, from a call of its own. It is the same count over the time the scene was actually being measured: the time the shutter was in the way (closed, moving, or settling for the few frames after it reopens, which are exactly the frames marked as repeated) and the time a recording was paused are left out of the clock it counts against. A healthy shutter calibration reads the camera's rate throughout, a paused recording keeps the rate it had and reads the file's rate again as soon as it resumes, and a camera that stops delivering still reads 0. Frames lost under load still lower it, and a reduced or export-limited rate reads as what arrives. With nothing held and nothing paused it is exactly the measured rate.

const LiveFrameRate live = imager->Processing().GetLiveFrameRate();
if (live.valid) {
  // For the user: does not fall to 0 while the shutter is closed.
  std::println("{:.1f} fps", live.hz);
}
// The scene over the last window, closures included, and why.
const MeasuredFrameRate rate = imager->Processing().RealFrameRate();
std::println("{:.1f} Hz measured, {} repeats in {:.0f} ms",
             rate.measured_hz, rate.repeated_frames, rate.window_ms);

The live figure is not valid until the stream has been live for a moment, which for a camera that starts with its shutter closed is a little later than the measured one. A recording answers all of this too; in C++ the calls are Player::RealFrameRate() and Player::GetLiveFrameRate(), and only frames the recording delivered while playing are counted, so stepping through a paused recording does not move it.

Behavior During Mode Switch

Setting the mode before Start() is the cheapest route, and changing it on a running camera is supported. An Xi 400 opened on -20..100 and on 0..250 reads the same room within 0.7 K, each through its own calibration, and a switch now lands in the same place: the residual is about 0.7 K, re-measured on a second camera at 0.16 to 0.51 K, which is inside the accuracy the camera claims for itself.

What a switch costs is time, not correctness. It restarts the camera's startup calibration, because it re-establishes both the dark reference and the auto-skim for the range being entered, see Thermal Measurement Basics. Measured on an Xi 410, a -20..100 -> 0..250 °C change marked 556 of the 557 frames after the write as not measurements, over 29.9 s; an extended-range change 13.0 s. Wait for the first frame reporting FrameMetadata::thermal_data_reliable; that flag is the whole of the signal, and there is deliberately no timer to run. If you need a measurement immediately, open the camera in the range you want rather than changing into it.

When the active operation mode changes:

  1. The data stream is reconfigured for the new video format.
  2. The calibration for the new mode is loaded and the processing pipeline is rebuilt for it.
  3. The startup calibration runs again; thermal data during this phase is unreliable.

A new mode can have a different frame size and frame rate. GetWidth(), GetHeight() and GetDeviceInfo() report the new values afterwards, and a callback registered with SetVideoFormatCallback() is told when the geometry changes.

The Spellings, Per Binding

Every sample above carries a tab per language. The names behind them:

list the modes read the active one set it
C++ GetDeviceInfo().operation_modes GetOperationMode() SetOperationMode()
C optris_sdk_imager_read_operation_modes() optris_sdk_imager_get_active_operation_mode() optris_sdk_imager_set_active_operation_mode()
.NET ThermalCamera.OperationModes ThermalCamera.ActiveOperationMode the same property, assigned
Python Camera.operation_modes() Camera.operation_mode the same property, assigned
Rust Camera::operation_modes() Camera::active_operation_mode() Camera::set_operation_mode()

Setting a mode on a recording is refused: OPTRIS_SDK_ERROR_NOT_SUPPORTED in C, and the binding's not-supported exception elsewhere. A mode the camera does not have is OPTRIS_SDK_ERROR_CONFIGURATION, which is ConfigException in C++ and the equivalent in each binding.

Complete Example

#include <optrissdk.h>
#include <chrono>
#include <print>
#include <thread>

using namespace optris::sdk;

int main() {
  auto imager = Imager::Create();

  // List all operation modes.
  const auto modes = imager->GetDeviceInfo().operation_modes;
  std::println("Available operation modes:");
  for (size_t i = 0; i < modes.size(); ++i) {
    const auto& m = modes[i];
    std::println("  [{}] {} {}x{} @{}fps, "
                 "{:.0f}-{:.0f} C{}{}",
                 i, m.optics_text,
                 m.width, m.height, m.framerate,
                 m.temp_min, m.temp_max,
                 m.extendable ? " [ext]" : "",
                 m.high_precision_available
                     ? " [hi-prec]" : "");
  }

  // Show current mode.
  const auto current = imager->GetOperationMode();
  std::println("\nCurrent: {} {}x{} @{}fps",
               current.optics_text,
               current.width, current.height,
               current.framerate);

  // Switch before starting -- see the warning above.
  for (const auto& m : modes) {
    if (m.width != current.width ||
        m.temp_min != current.temp_min) {
      std::println("\nSwitching to: {} {}x{} "
                   "{:.0f}-{:.0f} C",
                   m.optics_text,
                   m.width, m.height,
                   m.temp_min, m.temp_max);
      imager->SetOperationMode(m);
      break;
    }
  }

  // Stream some frames with the new mode.
  imager->SetThermalCallback(
      [](const 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("Frame: {}x{} max={:.1f} C",
                     f.GetWidth(), f.GetHeight(),
                     f.GetMaxTemperature());
      });

  imager->Start();
  std::this_thread::sleep_for(std::chrono::seconds(5));
  imager->Stop();

  return 0;
}