OptrisOptrisDocumentation

Documentation/OTC SDK/OTC SDK — C++ API referencev12.0

optris::sdk

The unified alarm model.

Everything the SDK can observe is a signal: a packed (domain, field, index) key and a double value. A rule is a plain value: one input signal, one condition, optional inhibit sources, and a list of actions. Measuring-area alarms, PIF alarms and "free" alarms on arbitrary values are the same machinery; they differ only in the SignalId the rule names.

using namespace optris::sdk;

// The slot is not the region id -- it carries a generation counter
// so a rule outliving its region resolves to "orphaned" rather
// than to whatever reused the slot. Ask the engine for it:
const auto slot = *imager->Regions().SignalSlot(region_id);

Rule hot;
hot.name = "over temp";
hot.input = SignalId::Region(slot, SignalField::kMax);
hot.condition.compare = Compare::kAbove;
hot.condition.alarm.high = 60.0F;
hot.condition.alarm.hysteresis = 2.0F;
hot.actions.push_back({ActionTrigger::kOnActivate, SnapshotAction{}});

// Rules().Add(region_id, rule) fills the slot in for you and is
// the easier route; this one-argument form does not.
imager->Alarms().Add(std::move(hot));

The canvas: a view-space scene a camera's frame is placed into, so it can be rotated, zoomed and moved without a single measured temperature changing.

The idea: The idea A Canvas is a coordinate space with an extent. A camera's frame is placed into it by an affine Placement: rotation, zoom, pan. Rendering composites the frame into the canvas and is allowed to resample, because it is display. Measurement never touches the composite. A region lives in canvas coordinates and is measured by composing its transform with the inverse placement, which lands it in the camera's own frame, where the original pixels are sampled. Nothing radiometric is ever interpolated.

using namespace optris::sdk;
Canvas canvas = Canvas::Of(1024, 768);
canvas.placements.push_back(
    Placement::Centred(imager->GetWidth(), imager->GetHeight(),
                       {0.5F, 0.375F}, 0.8F, 30.0F));
imager->Canvas().Set(canvas);

// A region placed on the canvas still reads sensor pixels: the
// 30-degree rotation above changes where it is drawn and not what
// it measures.
auto id = imager->Regions().Add(Region::Circle({0.5F, 0.375F}, 0.1F));
if (auto region = imager->Regions().Get(id); region->stats.valid)
  float unchanged_by_the_rotation = region->stats.mean_c;

Coordinates: Coordinates Canvas coordinates follow region.h exactly: the origin is the top-left of the canvas and both axes are divided by the canvas width, so x runs 0..1 and y runs 0..height/width. Frame coordinates are the same convention over the camera's own frame. A Placement is the affine that takes the second into the first, and its inverse is the affine that takes a region the other way. There is no third space and no second geometry model; everything here is region.h's Matrix3 algebra.

One camera, and what happens where placements overlap: One camera, and what happens where placements overlap Canvas::placements is a list, but nothing here resolves two cameras: there is no seam correction, no radiometric reconciliation and no coverage-weighted combination. One camera is placed, and where placements overlap the later one simply paints over the earlier.

The split with Orientation: The split with Orientation optris/sdk/orientation.h turns the thermal data: quarter turns and mirrors only, an exact index remap, no voids ever. A canvas places the view: arbitrary angles, resampled for display, voids expected and harmless. They compose: orientation maps sensor to oriented frame, the canvas places that oriented frame into the scene. Nothing in this header needs to know which of the two it is looking at, because "the frame" here means whatever the imager delivers.

An internal error-reporting mechanism for operations whose failure is ordinary rather than exceptional.

Warning: Result is not part of any external API surface. Karl's direction, 2026-08-24: it is an internal mechanism and the binding layer is where it stops. It does not appear in the C ABI (include/optris/sdk_c.h), in the .NET package, or in the documentation of either. The C ABI has exactly one error convention -- a status code -- and the .NET package has exactly one, an exception hierarchy. Neither has a Result shape in it, in disguise or otherwise.

The public C++ API throws, through the types in optris/sdk/exception.h. Karl, 2026-11-06: "convert, the public api should emit exceptions".

All 58 declarations on the rec:: surface are converted -- VideoExporter, Recorder, Player, Snapshot, ContinuousRecorder, SessionRecorder, SessionPlayer, RecordingController, FrameIndex, OpenSeries and the metadata parsers, and optris::sdk::internal::ThrowRecording() in src/otc_sdk/recording_exception.h is the one place a RecordError becomes an exception.

The fifteen on optris::sdk::pif::PifController are converted too, at API version 34, and they were the last: no public header declares a Result now. A refusal there throws pif::PifException, carrying the PifError as code(). The per-frame objection did not survive the headers: reading an input before a frame has brought one answers DigitalState::Unknown or NaN, a reading and not an error, so a poll loop over a working interface never throws.

The Unwrap() / UnwrapVoid() pair that turned a PIF Result into a status in src/capi/capi_internal.h went with that conversion, as the UnwrapRec* pair did for recording.

Result is an alias for Expected below, which is ours rather than std::expected: the SDK compiles itself at C++23 and asks its callers for C++17, and std::expected is C++23. The SDK's own internal Result types are untouched and stay on std::expected -- src/hal/result.h, src/gpu/gpu_error.h and src/otcsdk/pipeline/error.h -- because nothing outside the library parses them.

Serialization for the PIF channel table.

Same shape and same carrier as regions (region_json.h): one schema, written into ImagerConfig, into a recording's config.json attachment, and into a snapshot's metadata. A PIF configuration is part of how a measurement was taken -- which pin supplied the emissivity, what the relay meant -- so a recording that does not carry it cannot be fully interpreted later.

Version 11 persisted this inside its own XML configuration, in a format built around the channel classes that no longer exist. This is the descriptor table as it stands, and it round-trips.

Recording that is always on, and a recording that is a selection over it rather than a capture that starts.

The model, and why this one: The model, and why this one A surveillance recorder, a broadcast replay server and a game capture overlay all do the same thing: write every frame to disk continuously, delete the oldest when the disk budget is reached, and cut a keepable file out of the window the operator points at. Nothing is "started" at the interesting moment, because by then it is already recorded.

That is the whole of this header. A ContinuousRecorder writes a rolling set of ordinary .mkv segments into a directory, prunes the oldest against a RetentionPolicy, and cuts clips out of the result with ExtractClip(). A clip is a container copy: no decode, no re-encode, and -- with ContinuousConfig::all_intra, which is on by default here -- a cut at any frame rather than at the nearest seek anchor.

Pre-roll answers the same question at a different scale: Pre-roll answers the same question at a different scale RecordingController::EnablePreRoll() answers the same question at a different scale: it keeps a ring of deep-copied frames in RAM, so its depth is seconds and its cost is memory. This keeps FFV1 segments on disk, so its depth is hours and its cost is disk. Measured on real recordings: 7.4 GB/h for a 640x480 sensor at 32 Hz, 3.1 GB/h for a 382x288 at 27 Hz.

They are the same job at two scales, not two mechanisms for one job, and both still work. What is refused is running them at once on one camera, which would encode and store every frame twice; see RecordingController::StartContinuous(). Pre-roll remains the right answer when there is no disk to spend and a few seconds of history is enough, and it is still what a bounded alarm recording uses.

Thread safety: Thread safety WriteFrame() must be called from one thread, as Recorder requires. When a camera drives this through RecordingController that thread is the controller's writer thread, not the camera's frame thread: an encode and a write() are not things to do on the thread acquisition runs on. Everything else (GetTimeline(), GetStats(), ExtractClip(), Stop()) may be called from any thread at any time, including while frames are arriving. ExtractClip() reads closed segment files and cannot be given a segment the pruner is about to delete: a clip holds its segments for as long as it is being written.

Example: Example cpp #include "optris/sdk/rec/continuous.h" namespace rec = optris::sdk::rec; rec::ContinuousConfig config; config.directory = "/var/lib/otc/history"; config.retention.max_duration = std::chrono::hours{8}; config.retention.min_free_bytes = 4ULL << 30; // leave 4 GiB // Throws on failure, like the rest of the SDK's C++ surface: // InvalidArgumentException for a policy with no bound at all, // IoException for a directory that cannot be written. auto history = rec::ContinuousRecorder::Create(config); rec::StreamConfig stream; stream.width = imager->GetWidth(); stream.height = imager->GetHeight(); stream.frame_rate = 32.0f; (void)history->AddVideoStream(stream); imager->SetThermalCallback([&](const optris::sdk::ThermalFrame &f) { (void)history->WriteFrame(f); }); // Later, when something happened. The timestamps are the stream's // own microseconds, the same clock ThermalFrame reports, so an // application that wants a clip around an event has to have kept // the frame time it saw -- there is no "now" to subtract from. std::int64_t event_us = /* the frame time the event was seen at */ 0; auto clip = history->ExtractClip(event_us - 30'000'000, event_us + 10'000'000, "alarm.mkv");

See also: Recorder for the segment files this writes, which are ordinary recordings in every respect.

See also: FrameIndex, which is how a cut finds its frames without decoding any.

The RecordingController orchestrates always-on pre-roll capture and recording lifecycle. It is fed thermal frames by the Imager, maintains a ring buffer of recent frames, and starts/stops recording on request.

It does not decide when to record. Trigger evaluation lives in the alarm engine: a recording trigger is a Rule with a RecordingAction, so a PIF input, a measuring-area limit and an application value all reach recording through one path instead of the four separate edge-detectors this class used to carry.

State machine: State machine Two independent columns: without pre-roll on the left, with it on the right. There is no transition between them at the Recording step -- EnablePreRoll() and DisablePreRoll() are the only way across, and they act from Idle.

///   without pre-roll            with pre-roll
///
///        Idle    ──EnablePreRoll()──>   Buffering
///          |                                |
///          | StartRecording()               | StartRecording()
///          |                                |  (API or alarm action)
///          v                                v
///      Recording                        Recording
///          |                                |
///          | StopRecording()                | StopRecording()
///          v                                v
///        Idle     <──DisablePreRoll()──  Buffering
/// 
The names above are the states, not an API: there is no state
enum to read back. IsPreRollEnabled() tells the column and
IsRecording() tells the row.

@par And a third thing, which is not on that diagram
StartContinuous() writes everything the camera sees to disk for as
long as it runs, prunes the oldest against a retention window, and
hands out files cut from the result through SaveClip(). It is not a
state of the machine above: `IsRecording()` stays false while it
runs, a take can start and stop underneath it, and
`IsContinuous()` is a separate question. The one interaction is
with pre-roll, which it is mutually exclusive with -- see
EnablePreRoll() for why, and rec/continuous.h for the model. 

The unified region model: one type replacing Roi and MeasurementField.

A region's geometry is a boolean expression tree whose leaves are canonical unit primitives (the unit circle; the unit square spanning (-1,-1)..(1,1)) each carrying a 3x3 affine transform. Size, position, rotation and shear are inherent in the matrix, so no primitive needs its own parameters and recorded motion is a handful of floats per frame.

Coordinates: Coordinates Region coordinates are frame-normalized isotropic: the origin is the top-left of the frame and both axes are divided by the frame width. So x runs 0..1 and y runs 0..height/width (0.75 on a 4:3 sensor). This is what makes a unit circle a true circle in pixels at any resolution and gives an aperture radius the same meaning on both axes. Converting from the old Roi's [0,1]x[0,1] space multiplies y by height/width.

The matrix is not the primary API: The matrix is not the primary API Direct matrix manipulation is an escape hatch for shear, arbitrary transforms and animation. The everyday surface is centre / size / radius / rotation and Region::FromDrag().

On a live camera, go through Imager::Regions() -- a RegionEngine, which measures every added region on every frame:

using namespace optris::sdk;
auto id = imager->Regions().Add(Region::Circle({0.5F, 0.375F}, 0.1F));
// Edit(), not Get(): RegionEngine::Get() hands back a copy, so
// moving one has to go through the engine to take effect.
imager->Regions().Edit(id, [](Region &r) { r.SetCentre({0.6F, 0.4F}); });
// The next frame measures it in its new position.

A bare RegionStore, below, is the same container without a camera behind it. Nothing feeds it frames -- you call Measure() yourself -- and unlike the engine it hands out pointers:

RegionStore store;
auto id = store.Add(Region::Circle({0.5F, 0.375F}, 0.1F));
if (auto *r = store.Get(id))
  r->SetCentre({0.6F, 0.4F});

// The internal encoding, (celsius * 10) + 1000, straight from
// ThermalFrame::GetData().
store.Measure(frame.GetData(), frame.GetWidth(), frame.GetHeight());

Serialization for regions and rules.

Two forms, deliberately separate:

  • The static definition (SerializeRegions) carries geometry, styling, apertures and rules. It is written once: into ImagerConfig, into a recording's config.json attachment, and into a snapshot's metadata JSON. One schema, three carriers.
  • The per-frame state (SerializeFrameState) carries only what changes: the leaf matrices when a region moved, the readings, and the alarm state. Styling and rule definitions are never re-serialized, so recording a moving region costs tens of bytes a frame rather than a re-dump of the whole model.

The geometry tree serializes nested -- {"op": "subtract", "left": ..., "right": ...} -- and parses back into the flat node array. The nesting exists in the document, never in memory.

A non-owning view over a contiguous sequence, for the public API.

The same shape and the same layout as std::span, available to a caller at C++17. std::span is C++20; this SDK's public headers compile at C++17, so a std::span on a declaration a customer parses would force every consumer to C++20.

Two deliberate omissions, so that you do not go looking for them:

  • No static extent. Every view on this surface is dynamic-extent, so there is no Span<T, N>`.
  • No comparison operators. A view has no one obvious equality -- identity of the range, or of the elements -- and std::span declines to pick one for the same reason. Compare the elements yourself if that is what you mean.

There is deliberately one Span, not a std::span for a C++20 caller and this for a C++17 one: the library's idea of a parameter's layout must not depend on the standard its consumer picked.

// A Span is returned where the SDK hands out a view it owns.
Span<const Rgb24> iron = GetPaletteColors(Palette::kIronBow);
for (const Rgb24 &colour : iron) {
  std::println("{} {} {}", colour.r, colour.g, colour.b);
}

// And a container converts to one implicitly, exactly as it does
// to std::span, so a caller passes what it already has.
std::vector<Rgb24> mine(iron.begin(), iron.end());
Span<const Rgb24> view = mine;

The unit a person reads a temperature in, the SDK's own temperature unit, and the one way the SDK converts, rounds and labels a temperature for that person.

One switch for the whole SDK: One switch for the whole SDK SetTemperatureUnit() chooses the unit of the whole API, for the whole process. Celsius is the default, so a program that never calls it sees nothing change. With TemperatureUnit::kFahrenheit, every temperature the SDK takes or returns is in degrees Fahrenheit, and every temperature difference in Fahrenheit degrees: frames, regions, alarm limits, the colour range, camera settings, process-interface mappings, values read back from a recording or a snapshot, callbacks. A field or a parameter whose name says _c or celsius follows the switch as well; the name is older than the switch.

The SDK keeps storing and computing in Celsius and converts where a value crosses the API. So a limit set in one unit keeps its meaning after a switch and reads back in the new unit, and every file the SDK writes stays Celsius (a recording, a snapshot's metadata and temperature grid, the configuration file), byte for byte the same whichever unit was chosen, so a file means the same on every machine. The CSV snapshot keeps its own explicit unit, rec::CsvOptions::temperature_unit. The int16 sample format (InternalToCelsius()) is Celsius by definition and does not change.

A temperature and a difference are converted differently: A temperature and a difference are converted differently A temperature is a point on the scale: F = C x 9/5 + 32. A difference is a distance on it: F = K x 9/5, with no offset. An alarm's hysteresis, the limits of a rule with a reference (which are offsets), a standard deviation and a colour-scale span are all differences. Converting 2 K like a temperature shows 35.6 F; the right answer is 3.6 F. The SDK does this itself for everything that crosses its API. The Temperatures functions below are for a program that converts one value itself, and they name which one a number needs.

// Once, at start, before opening a camera: the whole SDK now
// speaks Fahrenheit.
optris::sdk::SetTemperatureUnit(optris::sdk::TemperatureUnit::kFahrenheit);

using optris::sdk::Temperatures;
using optris::sdk::TemperatureUnit;
const auto unit = TemperatureUnit::kFahrenheit;

// Show a Celsius reading from somewhere else: "70.3" and the symbol.
std::string shown = Temperatures::Format(21.3, unit, 1) + " " +
                    Temperatures::Symbol(unit);

// Show a hysteresis of 2 K: "3.6", not "35.6".
std::string band = Temperatures::FormatDifference(2.0, unit, 1);

Enumerations

SignalDomain

enum SignalDomain

Which producer a signal comes from.

Value Initialiser Description
kRegion A statistic of a Region.
kDevice Camera telemetry and SDK state.
kPif A PIF input, output or flag.
kMotion A motion-detection zone.
kUser Published by the application.

SignalField

enum SignalField

Which quantity within the domain.

Note: The values are written explicitly, and must stay that way. An integer here is written into a recording's otc-meta.json, a snapshot's metadata and the camera config file, by src/otc_sdk/region_json.cc, and it is the one enum the C ABI mirrors BY VALUE rather than through a switch. A member inserted in the middle would renumber every member after it -- removing nothing and renaming nothing, so a check that looks for removals reports the tree clean. Explicit values make that insertion a decision somebody takes rather than an accident, and PublicEnumValueGuard refuses a change to any of them.

Value Initialiser Description
kMin = 0
kMax = 1
kMean = 2
kMedian = 3
kStdDev = 4
kCoverage = 5
kArea = 6
kHotSpotX = 7
kHotSpotY = 8
kColdSpotX = 9
kColdSpotY = 10
kBlobCount = 11
kThresholdShare = 12
kP01 = 13
kP05 = 14
kP95 = 15
kP99 = 16
kFlagTemp = 100
kBoxTemp = 101
kChipTemp = 102
kFpaTemp = 103
kAmbientTemp = 104
kSceneMin = 105
kSceneMax = 106
kFocusPosition = 107
kFrameRate = 108
kDroppedFrames = 109
kFlagOpen = 110
kNucInProgress = 111
kConnected = 112
kProbeTemp = 113
kDeliveryShare = 114
kDigitalIn = 200
kDigitalOut = 201
kAnalogIn = 202
kAnalogOut = 203
kFlag = 204
kFailSafe = 205
kMotionBlobCount = 300
kMotionArea = 301
kMotionVelocity = 302
kValue = 400

Compare

enum Compare

How the input value is compared against the limits.

"value" below is the rule's input, or the input minus its reference for a rule given one with RuleEngine::SetReference().

Value Initialiser Description
kAbove value > limits.high
kBelow value < limits.low
kOutside value < limits.low || value > limits.high
kInside limits.low <= value <= limits.high
kEqual |value - limits.high| <= limits.epsilon
kChanged |value - previous| > limits.delta
kInvalid the signal stopped being produced (watchdog)

SnapshotFormat

enum SnapshotFormat

Still-image format for a snapshot action.

Value Initialiser Description
kPng
kTiff
kCsv
kJpeg

ActionTrigger

enum ActionTrigger

Which state transition runs the action.

Each of these matches more transitions than its old one-line: Each of these matches more transitions than its old one-line summary said, so here is the full list The summaries used to read Clear/Warning -> Active, Active/Warning -> Clear and Clear -> Warning. Each named the typical transition and was tested against none of the others, so three of the four understated what they fire on -- and two of those gaps are behaviour an application can be surprised by. The predicate is ActionRunner::Matches() and the lists below are read off it rather than from anyone's recollection.

Note what is not here: nothing distinguishes "this alarm stopped being Active" from "a pre-alarm cleared without ever becoming an alarm". That distinction has been asked for and it needs a new enumerator; adding one is additive, while changing what kOnClear matches would break whoever relies on today's meaning.

Value Initialiser Description
kOnActivate
kOnClear
kOnWarn
kOnAnyChange Every state transition, with no filtering at all.

AlarmState

enum AlarmState

The five v11 states, plus kInhibited, which an HMI has to show differently from kDisabled: "the operator turned this off" and "a process signal is suppressing it right now" are not the same fact.

Note: The values are written explicitly, and must stay that way. The ordinal is written into every recording's per-frame region-state record (src/otc_sdk/region_json.cc), so a renumbering re-reads every alarm state in every take already on disk. A member inserted in the middle would renumber every member after it -- removing nothing and renaming nothing, so a check that looks for removals reports the tree clean. Explicit values make that insertion a decision somebody takes rather than an accident, and PublicEnumValueGuard refuses a change to any of them.

Value Initialiser Description
kUnknown = 0 no input received yet
kDisabled = 1
kOrphaned = 2
kInhibited = 3 suppressed by an Inhibit source
kClear = 4
kWarning = 5
kActive = 6

LimitKind

enum LimitKind

Which limit the value crossed.

Value Initialiser Description
kNone
kAlarmLow
kAlarmHigh
kWarningLow
kWarningHigh
kDelta
kEqual
kInvalid

ActionOutcome

enum ActionOutcome

What became of an action that did not fail.

The counterpart to ActionError, and the reason it is a separate enum rather than a bool ok: two of these are not errors and not successes either. A snapshot its own spacing skipped and one dropped from a full queue both leave an activation with no picture, which an application has to be able to say out loud instead of guessing from a file that is not there.

Every enumerator here has a producer, and that is enforced: Every enumerator here has a producer, and that is enforced SignalField has had an enumerator nothing published four times over, each one a value an application could branch on that could never arrive, with no refusal and no log line to say so. AlarmSignalProducerGuard exists for that enum; ActionOutcomeProducerGuard exists for this one, reads scripts/action_outcomes_without_producer.txt in both directions, and requires the exemption to be written on the declaration itself rather than in prose somewhere above it.

Value Initialiser Description
kUnknown = 0
kWritten = 1
kSkippedByMinimumInterval = 2
kDroppedQueueFull = 3
kDroppedFrameBudget = 4

AutoScaleMode

enum AutoScaleMode

How the colour scale is chosen for a frame when no fixed range is set.

It decides the picture and nothing else. Every temperature the SDK reports -- the frame's own minimum and maximum, every measuring area, everything written to a recording -- is produced before colouring and is the same under either mode.

Value Initialiser Description
kPercentile
kAbsolute
kSigma1
kSigma3

CalibrationStatus

enum CalibrationStatus

Where this camera's calibration came from, or why it has none.

A reason rather than a boolean, because the situations are not equivalent to whoever has to act on them. "Not calibrated" is a camera whose numbers must not be shown. "Acquired" is a camera that is fully calibrated but had to fetch its files on this open, which is worth knowing on a machine that is about to be taken offline and is not worth warning a user about.

Value Initialiser Description
kUnknown = 0
kCalibrated = 1 Every file the camera needs was already on this machine.
kAcquired = 2
kMissing = 3

ConfigSection

enum ConfigSection

The parts of a configuration file, as a set.

A bitmask rather than a list so that "what the file had", "what took effect" and "what did not" are the same type and can be compared, and so the set survives the C ABI as one integer.

The division is the one a user recognises from an import dialog, not the SDK's internal layering: kRegions covers the measuring areas and the alarm rules attached to them, because no dialog offers to import an area without its rules.

Value Initialiser Description
kNone = 0U The empty set.
kRadiation = 1U << 0U Emissivity, transmissivity and ambient temperature.
kTemperatureRange = 1U << 1U
kPalette = 1U << 2U The built-in palette.
kCustomPalette = 1U << 3U A custom colour table saved with the file, if it carried one.
kOutputDirectory = 1U << 4U Where recordings and snapshots are written.
kMotionZones = 1U << 5U The motion zones.
kColorWindows = 1U << 6U The colour windows.
kCanvas = 1U << 7U
kRegions = 1U << 8U The measuring regions and the alarm rules attached to them.
kRules = 1U << 9U The free alarm rules -- the ones not attached to a region.
kAll = (1U << 10U) - 1U Every section above. Not a section itself; a mask to test with.

ConfigLoadOutcome

enum ConfigLoadOutcome

How an import ended.

Four values, and the division is by what happened to the camera rather than by what went wrong. An application deciding whether to re-read its settings, warn the operator, or do nothing at all needs that division and no other.

Value Initialiser Description
kApplied = 0
kAppliedWithOmissions = 1
kPartiallyApplied = 2
kRefused = 3

ConnectionStatus

enum ConnectionStatus

What the link to the camera is doing.

This is the answer to "can I trust the picture on screen", which is not the same question as Imager::IsConnected(). That one reports whether the device is open -- whether somebody called Open() and has not closed it. A camera can be open, enumerated by the operating system, listed as healthy in Device Manager, and still not be delivering a single frame; a host that suspends and resumes leaves a USB stream in exactly that condition. IsConnected() says true throughout. Stalled is how you find out.

The states are ordered from least to most established, so a caller that only wants "is it live" can compare against Connected.

Value Initialiser Description
Disconnected = 0 No device is open. Either one was never opened, or it was closed.
Connecting = 1
Connected = 2 The device is open and frames are arriving.
Stalled = 3
Lost = 4
Failed = 5

DeviceBusyReason

enum DeviceBusyReason

Why an operation reported the camera as busy.

Listed in the order the SDK decides them, which is also the order that applies: the claim is examined before the stream is opened, so a refusal reporting kFormatNotAccepted met no claim at all.

Value Initialiser Description
kUnknown = 0
kClaimedByAnotherProcess = 1
kAlreadyOpenInThisProcess = 2
kHandoverInThisProcess = 3
kFormatNotAccepted = 4

NetworkConfigOutcome

enum NetworkConfigOutcome

What a network write did -- to the camera, and to this connection.

Four things can happen and they need four different responses. Until v12 API version 8 this had two values, and kApplied meant three of them at once: nothing was written, the camera moved and the SDK followed it, and the settings were written over USB and are not in effect yet. A consumer read the two names, concluded that an address change ends the connection, and shipped a dialog that dropped a live camera every time an operator moved one. The names below are chosen so that reading them, and nothing else, cannot lead there.

Refusal is not in here at all -- that is an exception, because nothing was written.

Which one you get is decided by which fields changed, and the division is not the one most callers assume:

  • nothing changed -> kUnchanged
  • only ip_address and/or port -> kAppliedConnectionKept
  • stream_destination or subnet_mask -> kAppliedConnectionLost
  • any change, over USB -> kAppliedPendingEthernet

The one case this cannot be predicted from the fields is an in-place recovery that throws: that reports kAppliedConnectionLost even though the change was recoverable in principle.

Value Initialiser Description
kAppliedConnectionKept = 0
kAppliedConnectionLost = 1
kUnchanged = 2
kAppliedPendingEthernet = 3

NetworkConfigRefusal

enum NetworkConfigRefusal

Why a camera refused a network configuration, as the camera states it.

Only a camera whose firmware states a reason fills this in: the Xi 640 ETH, from the firmware that reports revision 4200. Every refusal means the same thing for what is stored: nothing. The camera keeps the configuration it had, and NetworkConfigReply::camera_config says what that is. Added in 12.0.16.

Value Initialiser Description
kNone = 0 Not refused.
kSubnetMask = 1 The subnet mask is 0 or not contiguous (such as 255.0.255.0).
kAddress = 2
kGateway = 3
kDestinationAndPort = 4 The stream destination and the port must be both 0 or both set.
kReservedPort = 5
kOther = 255

DeviceChangeKind

enum DeviceChangeKind

What happened to a device.

kClaimed and kReleased report every claim, including the ones this process takes and gives back -- not only another process's. Read DeviceInfo::claimed_by_this_process on the device the change carries to tell your own open from somebody else's. A camera on the network is reported only when DeviceMonitorOptions::watch_network is set, and arrives and leaves on the poll interval rather than the instant it is powered. Without it the monitor reports USB cameras only -- which is all it could ever do, while these comments said "came onto the network".

Value Initialiser Description
kArrived = 0
kRemoved = 1
kClaimed = 2 some process opened it, this one included
kReleased = 3 the process holding it let go

BroadcastConfigStatus

enum BroadcastConfigStatus

The camera's verdict on a network setting sent by broadcast.

Value Initialiser Description
kTaken = 0 Taken. BroadcastNetworkReply::effect says when it applies.
kInvalid = 1
kNotPossible = 2
kRefused = 3 Refused, nothing stored. BroadcastNetworkReply::refusal says why.
kOther = 254
kNoAnswer = 255

BroadcastConfigEffect

enum BroadcastConfigEffect

When a setting the camera took applies.

Value Initialiser Description
kAlreadyActive = 0 Already in effect: the camera is at the new address now.
kAtNextStart = 1
kOther = 255

BroadcastConfigRefusal

enum BroadcastConfigRefusal

Why a camera refused a setting (BroadcastConfigStatus::kRefused).

Value Initialiser Description
kNone = 0
kPolicy = 1
kAuthenticationRequired = 2 The camera requires an authenticated channel.
kLockedUntilRestart = 3 The camera is locked until it restarts.
kHeldByAnotherOperator = 4 Another operator holds the camera.
kOther = 255

DeviceType

enum DeviceType

Supported Optris camera models.

Value Initialiser Description
kUnknown
kPi1
kPi160
kPi200
kPi230
kPi400
kPi450
kPi640
kPi640I
kPi1M
kXi80
kXi160
kXi320
kXi320MT
kXi400
kXi410
kXi410MT
kXi440
kXi640
kXi1M
kXi640Eth

ConnectionType

enum ConnectionType

Device connection type.

Value Initialiser Description
kUsb
kNetwork
kSimulated

EmissivityConversionSupport

enum EmissivityConversionSupport

Whether a measured temperature can be re-evaluated at a different emissivity on this source.

A reason rather than a boolean, because the negatives are not equivalent to whoever has to act on them. A camera that has not loaded its calibration yet will be able to do this shortly; a sample-point camera never will; a recording that carries no characteristic curve cannot, and a newer recording of the same camera can.

Value Initialiser Description
kUnknown = 0
kSupported = 1
kNoEnergyCurve = 2
kCurveNotInvertible = 3

ExternalPixelFormat

enum ExternalPixelFormat

Pixel format for external output buffers.

Value Initialiser Description
kThermalInt16
kThermalFloat32
kBgra uint8 BGRA (4 bytes/pixel). False-color with alpha.
kRgb uint8 RGB (3 bytes/pixel). False-color without alpha.
kEnergyInt32

FocusCapability

enum FocusCapability

Whether this camera has a focus motor, or why the question has no answer yet.

A reason rather than a boolean, for the same cause CalibrationStatus is one: "no" and "not yet known" call for opposite behaviour in a user interface. A camera that is not open must not have its focus control hidden -- it must have it disabled until the camera says something -- whereas a PI camera must have it hidden for good.

Value Initialiser Description
kUnknown = 0
kFixed = 1
kMotorized = 2

DetectorSettlingState

enum DetectorSettlingState

What the SDK has concluded about whether this camera's detector has warmed up and stopped drifting.

Three states, because two were not enough. The SDK waits for a detector to stop moving before it calls a frame a measurement: a dark reference describes the detector at the temperature it was taken at, so a reference taken while the detector was still warming makes every frame after it wrong by however far the detector has since moved. Measured on a PI 4x0 (serial 16030066) from cold: the reported scene mean stepped by -5.9, -7.5, -5.5, -4.2, -3.4 and -2.9 K at successive shutter cycles while the detector climbed from 42 C to 71 C.

The criterion compares each new dark reference's detector temperature with the previous one's. On some cameras it cannot: a frame format with too few metadata pixels carries no detector reading at all -- a PI 160x120 @ 100 Hz has two metadata pixels -- and a detector count whose conversion does not finish inside the physical band is not a reading either. Those cameras report kUnknown, and the SDK deliberately does not withhold anything from them: see FrameMetadata::chip_temp_known for the probe side of the same question.

Warning: This is not "the detector is fully settled". Optris's own figure for a full thermal settle is 60 to 90 minutes, and that is a policy statement rather than something this SDK measures. What the criterion answers is narrower and is the question a per-frame gate can answer: has the violent part of the warm-up stopped -- the 1.2 K/min of a PI 450's second minute, and the 2 to 20 K/min five more cameras showed about 24 s after power-on. kSettled means that; it does not promise the slow hour-long tail is over. An application that wants to tell an operator "wait an hour before you trust this to a tenth of a kelvin" needs its own clock, not this field.

Note: The values are written explicitly, and must stay that way. Cast straight across the C ABI by value (src/capi/capi_common.cc), not translated by a switch, and pinned there by three static_asserts. A member inserted in the middle would renumber every member after it -- removing nothing and renaming nothing, so a check that looks for removals reports the tree clean. Explicit values make that insertion a decision somebody takes rather than an accident, and PublicEnumValueGuard refuses a change to any of them.

Value Initialiser Description
kUnknown = 0
kSettling = 1
kSettled = 2

FrameRateLimitReason

enum FrameRateLimitReason

Why FrameRateInfo::effective_hz is what it is.

Listed in the order the SDK applies them: the first that fires wins.

Value Initialiser Description
kUnknown = 0
kNotLimited = 1
kAsRequested = 2 The requested rate is in force exactly.
kClampedToSensorRate = 3
kNotSupported = 5
kExportRestricted = 6

Palette

enum Palette

Color palette for thermal visualization.

Value Initialiser Description
kIronBow = 0
kGrayscale = 1
kRainbow = 2
kIronHi = 3
kRainbowHi = 4
kGrayscaleBW = 5
kGrayscaleWB = 6
kMedical = 7
kAlarmBlue = 8
kAlarmBlueHi = 9
kAlarmGreen = 10
kAlarmRed = 11
kJet = 12
kHot = 13
kPlasma = 14
kArctic = 15
kLava = 16

FlagWhileRecording

enum FlagWhileRecording

What a running recording does to the automatic shutter schedule.

A shutter cycle interrupts the measurement for something over a second. On a live stream that is a gap the operator sees and forgets; in a recording it is written down and kept, and some processes cannot have one at all -- the same requirement that Detector::IsShutterExternallyControlled() exists to serve, reached without a process interface.

Suppressing the flag is not free, and the cost cannot be undone later. Drift goes uncorrected, so the temperatures degrade over a long recording, and a recording stores finished temperatures -- the drift is in the file permanently and no amount of reprocessing on replay removes it. A recording made under anything other than kUse therefore says so in its own metadata, per frame, with the drift that had accumulated. See Turning the flag off while recording.

kUse is the default and is what every camera has always done.

Value Initialiser Description
kUse = 0
kAvoid = 1
kAvoidUnlessDrift = 2

DriftProbes

enum DriftProbes

Which internal temperature probes may trigger a shutter correction.

The camera has three: the housing (box), the detector itself (chip), and the shutter blade (flag). The drift arm fires when any of them has moved further than AutoNucConfig::temp_drift_threshold_c since the last correction.

This is not the fix for a 12-second shutter cadence: This is not the fix for a 12-second shutter cadence Measured in the field over 2,113 automatic cycles on six cameras, the box probe leads on every floating or auto camera and the chip probe on every regulated one; the blade leads in one session of ten. So excluding the blade does not change these schedules. What does is that 0.1 °C is one number for three probes that do not share a granularity -- it is 1.60 counts of a 0.0625 °C box, 4.14 of a 0.0242 °C chip and 30.30 of a PI 640i's -- and 303 of 305 measured triggers fired at exactly 0.125 °C. Use #drift_filter_secs and #drift_band_steps for a cadence.

What it is for, and it is the only thing that does it: What it is for, and it is the only thing that does it A blade feedback loop: the flag probe sits on the shutter blade, and the blade is moved through the optical path by the very cycle the drift arm triggers, so a closure disturbs the probe whose excursion authorises the next closure. Filtering only attenuates such a loop -- the smallest blade kick that sustains one rises from 0.19 °C unfiltered to 0.95 °C at a 120 s time constant and 1.96 °C at 300 s. Excluding the blade ends it at any kick, because the probe stops voting.

Why the default consults all three: Why the default consults all three Because that is v11's behaviour, and every camera in the field closes its shutter on it. Changing it is a deliberate divergence.

Value Initialiser Description
kBoxChipAndFlag = 0
kBoxAndChipOnly = 1

HighPrecisionState

enum HighPrecisionState

Whether the high-precision table's finer step is reaching the temperatures this SDK reports -- and when it is not, which of the two reasons applies.

This exists because TemperatureRange::high_precision accepts true and returns true, on every camera, while the step the caller then reads is 0.1 C either way. Without this query a caller cannot tell "this camera has no finer table" from "it has one, you selected it, and the SDK is rounding it away". Those are different situations with different answers -- the first is fixed by choosing another mode, the second cannot be fixed by the caller at all -- and they were indistinguishable through the public API.

A deliberate four-state enum rather than a second boolean beside OperationMode::high_precision_available: a pair of booleans can spell "no finer table exists, and its resolution is reaching you", which is nonsense, and this cannot.

Note: kUnknown is zero so a zeroed struct reads as "nobody said" rather than as a claim, which is the convention this SDK uses for every field of this shape -- FrameMetadata::chip_temp_known, optris_sdk_image::has_frame_metadata, DetectorSettlingState::kUnknown. Never infer the answer from a temperature value instead: a value-derived sentinel claims a real measurement is missing, in both directions.

Warning: This reports what is delivered, not what the detector could source. The two are different and the second one is not a number this SDK offers, because it is not a single number: on the four high-precision ranges across the cameras Optris tests with, the gap between two adjacent entries of the calibration table varies by 3x across one range's own span (0.0093 to 0.0274 K on the best of them). See TemperatureRange::high_precision for the measured figures.

Value Initialiser Description
kUnknown = 0
kUnavailable
kDisabled
kSelectedNotDelivered
kDelivered

ChipHeatingMode

enum ChipHeatingMode

Chip heating mode.

Value Initialiser Description
kFloating
kAuto
kFixed

RdcMode

enum RdcMode

Radial distortion correction mode.

Three values and not a boolean, because kNormal and kWide are two different remap tables built from the same coefficients, not one correction at two settings. Collapsing them to on/off would make the wide table unreachable from the public API -- it is selected by this value alone, and nothing else in the SDK chooses it.

It has "only an impact if the required parameters are provided by the calibration", as v11 put it: a camera and optics with no radial distortion coefficient has no table to build and the correction is a documented no-op. That is the ordinary case on longer optics and is not an error, so asking for it does not throw. Ask Processing::Correction() whether it is actually running -- RdcStatus::kNoCoefficients is the answer for a camera that cannot.

Value Initialiser Description
kOff No correction. The picture keeps the lens's own geometry.
kNormal
kWide

TemperaturePrecision

enum TemperaturePrecision

Temperature precision mode.

Value Initialiser Description
kStandard
kHigh

RadiationParameterSource

enum RadiationParameterSource

Radiation parameter source.

Value Initialiser Description
kSdk
kPif

NoiseFilter

enum NoiseFilter

Which spatial noise filter runs inside the radiometric path.

One value means one filter on every backend. That is the whole point of this type: until v12 the filter was a bare int cast straight into whichever backend's private enum happened to be running, and the two disagreed from 4 upwards -- 7 was detail enhancement on the CPU pipeline and anisotropic diffusion on the GPU one, which is the default on every real camera. The same call, documented one way, moved measured temperatures the other way.

These filters change reported temperatures. They run before the scene statistics, the measurement regions, the alarms, the recordings and the thermal callback, because denoising a measurement is what they are for. Detail enhancement is not one of them and is deliberately absent from this enum: it is a visualization operation, it lives on ProcessingConfig::dde_enabled, and it never touches a temperature.

Not every backend has every filter. kNone through kTemporal are honoured everywhere; the rest are GPU-only today. Asking for one a backend does not have fails with FeatureNotSupportedException (OPTRIS_SDK_ERROR_NOT_SUPPORTED) rather than quietly selecting a different filter -- ask Processing::IsFilterSupported() first if you would rather not offer it at all.

Value Initialiser Description
kNone = 0 No filtering. The default, and an exact identity.
kMedian3x3 = 1 3x3 median. Removes single-pixel spikes.
kGaussian3x3 = 2 3x3 Gaussian blur.
kBilateral3x3 = 3 3x3 edge-preserving, intensity-weighted.
kMedian5x5 = 4 5x5 median. Stronger, slower.
kBoxBlur3x3 = 5 3x3 box mean.
kUnsharpMask = 6
kTemporal = 7
kGaussian5x5 = 8 5x5 separable Gaussian.
kBoxBlur5x5 = 9
kGuided = 10
kAnisotropic = 11 Perona-Malik anisotropic diffusion.
kNlm = 12
kGradient = 13
kMorphMin = 14 3x3 morphological erosion.
kMorphMax = 15 3x3 morphological dilation.
kKuwahara = 16 5x5 Kuwahara, edge-preserving.
kWiener = 17 3x3 adaptive Wiener.

FrameQueuePolicy

enum FrameQueuePolicy

What the pull-mode acquisition queue does when it is already full.

The queue behind Imager::AcquireFrame() and Imager::TryAcquireFrame() holds four frames. This says which frame is lost when a fifth arrives before the consumer has taken any.

Until v12 there was no choice and no policy: the queue simply stopped accepting once it was full, so it kept the first four frames of the stream for as long as the camera ran and every frame after them was discarded. A pull consumer that started late was handed the beginning of the stream and had no way to tell.

Value Initialiser Description
kDropOldest
kDropNewest

SensorBitDepth

enum SensorBitDepth

Sensor bit depth for raw ADU values.

Value Initialiser Description
k14Bit
k16Bit

Transport

enum Transport

How the SDK reaches a camera.

The default is kAuto and it is the answer for nearly every application: name the camera by serial and let the SDK work out whether it is on USB or on the network. An application that already knows -- or that must not pay for a network broadcast, or must not silently fall back to the wrong transport -- says so here.

Value Initialiser Description
kAuto Look on USB first, then on the network. The default.
kUsb USB only. Fails rather than searching the network.
kNetwork Ethernet only. Fails rather than falling back to USB.

LogLevel

enum LogLevel

How severe a log message is.

Ordered by increasing severity, so level >= LogLevel::kWarning` is a meaningful test.

Warning: These values are not the legacy optris::Sdk::LogCallback numbers, which run the other way -- there 0 is Error and 4 is Trace. Code being ported from Sdk::setLogCallback() must remap rather than pass the integer through, or every message will arrive with its severity mirrored.

Value Initialiser Description
kTrace = 0 Very fine detail. Off in a normal build.
kDebug = 1 Detail useful when diagnosing a problem.
kInfo = 2 Normal progress: what the camera path is doing.
kWarning = 3 Something unexpected that was recovered from.
kError = 4 Something failed.

OpenPhase

enum OpenPhase

How far along opening a camera is.

Opening is not instant. The first connect to a given camera has to acquire its calibration, which means reading it off the device, copying it from a directory, or downloading it -- seconds each on a slow link. These are the stages an operator can be shown so that a blank tile reads as progress rather than as a hang.

The set mirrors the stages the SDK actually goes through; it is not a superset invented for the API. Every value here corresponds to a legacy optris::ConnectionState the connect path already emits.

Note: Not every open reports every phase. A camera whose calibration is already on disk goes straight from kLocating to kEstablished -- the calibration phases appear only when something is actually missing. Treat these as "what is happening now", never as a fixed sequence to step through.

Value Initialiser Description
kLocating = 0 Looking for the camera and claiming it.
kCalibrationFromDevice = 1
kCalibrationFromDirectory = 2 Copying missing calibration files from a local directory.
kCalibrationDownload = 3 Downloading missing calibration files over the internet.
kCalibrationReady = 4 Every missing calibration file was acquired.
kCalibrationMissing = 5
kEstablished = 6 The camera is open and ready.

OpticsUnit

enum OpticsUnit

The unit of the number in OperationMode::optics_fov.

Branch on this to label the value. Never infer the unit from the value itself.

Value Initialiser Description
kUnknown = 0
kDegrees = 1
kMillimetres = 2

Mirror

enum Mirror

Mirror, applied after rotation. The two do not commute, so the order is part of the contract.

Value Initialiser Description
kNone
kHorizontal left/right, about the vertical axis
kVertical top/bottom, about the horizontal axis
kBoth equivalent to a 180-degree turn

Resampling

enum Resampling

How a non-quarter-turn angle would be resampled. Quarter turns ignore this entirely; they are an exact index remap in every case, so on everything this release accepts it has no effect.

It is here so the contract is stated before the angles arrive, and so a caller that reaches for kWeighted is refused by name rather than by an angle check that says nothing about why.

Value Initialiser Description
kNearest
kWeighted

PaletteValidation

enum PaletteValidation

Why a CustomPalette was rejected, or kOk if it was not.

Value Initialiser Description
kOk
kEmptyName name is empty.
kWrongLength
kSingleColour

PaletteSource

enum PaletteSource

Where the colours a library entry hands back actually come from.

Value Initialiser Description
kBuiltIn
kFile

RdcStatus

enum RdcStatus

Whether radial distortion correction is reshaping the picture.

Value Initialiser Description
kUnknown = 0
kActive = 1
kOff = 2
kNoCoefficients = 3

SosStatus

enum SosStatus

Whether size-of-source correction is subtracting the halo.

Four outcomes rather than a boolean because three different things all present as "enabled and the picture did not change", and they need different actions from whoever reads them.

Value Initialiser Description
kUnknown = 0
kActive = 1
kOff = 2
kNoTable = 3
kZeroStrength = 4

PipelineKind

enum PipelineKind

Which pipeline computes this camera's frames.

Value Initialiser Description
kNone = 0
kCpu = 1 The CPU pipeline (MicroPipelineBackend).
kGpu = 2

PipelineReason

enum PipelineReason

Why PipelineInfo::kind is what it is.

Listed in the order the SDK applies them, which is also the order that decides: the first rule that fires wins, so a camera reporting kSamplePointCalibration was never considered for the size rule.

Value Initialiser Description
kNotApplicable = 0 Nothing chose. There is no pipeline to explain.
kSamplePointCalibration = 1
kForcedCpuEnv = 2 OTC_FORCE_CPU was set in the environment.
kCallerPreference = 3 The caller asked for this pipeline by name.
kModeTable = 4
kSizeRule = 5 The frame size decided it, against PipelineInfo::gpu_min_pixels.
kGpuUnavailable = 6
kGpuInitFailed = 7
kSimulatedSource = 8

StreamingBackendSource

enum StreamingBackendSource

Where the streaming backend name came from.

Value Initialiser Description
kNone = 0 Nothing is streaming, so nothing chose.
kDefault = 1 Nobody asked; the platform default applies.
kEnvironment = 2 The OTC_STREAMING_BACKEND environment variable named it.
kConfiguration = 3 The saved per-camera configuration named it.

FrameRefreshResult

enum FrameRefreshResult

What a Player::Refresh() call did.

A status rather than a bool, because "nothing happened" has three different causes on a replay and a caller that shows a picture needs to tell them apart: one of them is a programming error, one is the ordinary state of a player nobody has started, and one is a file that has no measurement to re-derive at all.

Value Initialiser Description
kDelivered = 0
kNoHeldFrame = 1
kRunning = 2
kPictureRecording = 3

ReconnectPhase

enum ReconnectPhase

Where a reconnect attempt got to.

Value Initialiser Description
kStarted = 0
kAttempting = 1 An attempt is about to be made. attempt counts from 1.
kAttemptFailed = 2 An attempt failed. message says why.
kRecovered = 3
kGaveUp = 4
kWaitingForDevice = 5

ReferenceCorrectionSupport

enum ReferenceCorrectionSupport

Whether a reference-body correction can be applied to this source.

A reason rather than a boolean, because the negatives are not equivalent to whoever has to act on them. A simulated camera cannot be corrected and never will be; a real camera whose mode delivers raw counts cannot be corrected until the mode changes; an SDK that does not implement the feature is a different problem again, and it is the one an application has to survive without being rebuilt.

Value Initialiser Description
kUnknown = 0
kSupported = 1
kNoEnergyTable = 2
kNotImplemented = 3

Primitive

enum Primitive

The canonical shapes. Each is defined in unit space and placed by its node's transform.

Value Initialiser Description
kPoint the origin
kRect unit square, (-1,-1) .. (1,1)
kEllipse unit circle, r = 1
kLine segment (-1,0) .. (1,0)
kPolygon
kSpline

NodeKind

enum NodeKind

A node is either a shape leaf or a binary boolean operator.

Value Initialiser Description
kShape
kUnion left | right
kIntersect left & right
kSubtract left & !right

ApertureShape

enum ApertureShape
Value Initialiser Description
kPixel a single pixel: the historical behaviour
kSquare (2r+1) x (2r+1) pixels: r=1 -> 3x3, r=2 -> 5x5
kCircle radius r pixels

RegionEmissivityState

enum RegionEmissivityState

What a region's own emissivity is doing to it, this frame.

Region::emissivity reaches three places -- the statistics, the per-pixel map either pipeline applies, and the own-scale shading -- and which of them it reaches depends on the camera's settings and on the value itself. An operator looking at a measuring area has no way to tell from the picture that it is being read at a different emissivity from everything around it, and a wrong emissivity silently in force is a measurement error rather than a cosmetic one. This is what a label draws to say so.

Differing, not merely set. A region whose emissivity equals the camera's is not interesting: it measures identically either way, so it reports kCameras and a display that marks every region would be saying nothing. The comparison is against the emissivity the frame was corrected at, not the one currently configured -- they differ on a replayed recording and for a frame or two after a settings change, and marking a region against the wrong one would be a badge that flickers for no reason the operator can see.

Value Initialiser Description
kCameras Measured at the camera's own emissivity. Nothing to show.
kOwnValue Its own value, and the picture carries it too.
kReadingOnly
kOwnScale

SpotSearchMode

enum SpotSearchMode

What a tracked spot is looking for.

A RegionKind::kHotSpot with an Aperture has two defensible readings and they are different measurements:

  • kAperture: the position whose aperture average is the highest. "Where is the hottest patch of this size." This is what an operator who gave the spot a size means, it is what PIX Connect did, and it is the default.
  • kPixel: the single hottest pixel, with the aperture then averaged around it. "How warm is the neighbourhood of the hottest point." A legitimate question, and the wrong answer to the first one.

They differ exactly when the hottest pixel is not in the hottest neighbourhood: a noise spike, a dead element reading high, or a glinting edge outranks the object being watched and drags the spot off it, which is what was reported against a heater.

With ApertureShape::kPixel the two are identical (the average over one pixel is that pixel), so a spot that was never given a size reads exactly what it always read, whichever mode it is in.

Value Initialiser Description
kAperture the extreme aperture average (default)
kPixel the extreme single pixel, then averaged around

RegionKind

enum RegionKind

What the region is for. Geometry is orthogonal to this: a hot spot searches inside its parent's geometry, a blob group searches inside its own.

Value Initialiser Description
kArea measure statistics over the enclosed pixels
kSpot measure at a fixed point, through the aperture
kHotSpot track the maximum within the parent (or the frame)
kColdSpot track the minimum within the parent (or the frame)
kBlobGroup detect connected hot regions inside the geometry
kLabel annotation only, never measured

MarkerStyle

enum MarkerStyle

How a spot or tracked point is marked in the overlay.

Note: The values are written explicitly, and must stay that way. Written as an integer into the region document, as LabelAnchor is. A member inserted in the middle would renumber every member after it -- removing nothing and renaming nothing, so a check that looks for removals reports the tree clean. Explicit values make that insertion a decision somebody takes rather than an accident, and PublicEnumValueGuard refuses a change to any of them.

Value Initialiser Description
kCrosshair = 0
kCircle = 1

LabelAnchor

enum LabelAnchor

Where a region's label sits relative to the region itself.

Note: The values are written explicitly, and must stay that way. Written as an integer into the region document (src/otc_sdk/region_json.cc), which a recording, a snapshot and the camera config file all carry. A member inserted in the middle would renumber every member after it -- removing nothing and renaming nothing, so a check that looks for removals reports the tree clean. Explicit values make that insertion a decision somebody takes rather than an accident, and PublicEnumValueGuard refuses a change to any of them.

Value Initialiser Description
kNorth = 0
kSouth = 1
kEast = 2
kWest = 3
kNorthEast = 4
kNorthWest = 5
kSouthEast = 6
kSouthWest = 7
kCentre = 8

BlobRenderMode

enum BlobRenderMode

Whether a detected blob is drawn as its bounding box or its outline.

Note: The values are written explicitly, and must stay that way. Written as an integer into the region document, as LabelAnchor is. A member inserted in the middle would renumber every member after it -- removing nothing and renaming nothing, so a check that looks for removals reports the tree clean. Explicit values make that insertion a decision somebody takes rather than an accident, and PublicEnumValueGuard refuses a change to any of them.

Value Initialiser Description
kBox = 0
kContour = 1

Easing

enum Easing

How a MotionPath accelerates between waypoints.

Note: The values are written explicitly, and must stay that way. Written as an integer into the region document, as LabelAnchor is. A member inserted in the middle would renumber every member after it -- removing nothing and renaming nothing, so a check that looks for removals reports the tree clean. Explicit values make that insertion a decision somebody takes rather than an accident, and PublicEnumValueGuard refuses a change to any of them.

Value Initialiser Description
kLinear = 0
kEaseIn = 1
kEaseOut = 2
kEaseInOut = 3

LoopMode

enum LoopMode

What a MotionPath does when it reaches its last waypoint.

Note: The values are written explicitly, and must stay that way. Written as an integer into the region document, as LabelAnchor is. A member inserted in the middle would renumber every member after it -- removing nothing and renaming nothing, so a check that looks for removals reports the tree clean. Explicit values make that insertion a decision somebody takes rather than an accident, and PublicEnumValueGuard refuses a change to any of them.

Value Initialiser Description
kLoop = 0 jump back to the first waypoint
kPingPong = 1 reverse along the same path
kOnce = 2 stop at the last waypoint

ThresholdDirection

enum ThresholdDirection

Which side of the threshold counts, for RegionThresholdShare.

Value Initialiser Description
kAbove pixels strictly warmer than the threshold
kBelow pixels strictly cooler than it

RoiType

enum RoiType

ROI field type.

Deprecated

Superseded by Region (optris/sdk/region.h), which unifies this type with MeasurementField and carries its alarms as part of the model rather than as a separate RoiAlarm field.

It is no longer reachable from Imager. AddRoi/RemoveRoi/GetRoi/ GetRois/ClearRois/SetRois/SetViewRois/GetViewRois and UpdateRoiTracking are gone: a measuring area is a Region, the overlay is drawn from the regions, and per-region emissivity now reaches the image through them rather than through this type.

What survives is the type itself and the two converters below, so code holding a flat ROI shape -- a stored preset, an editor's working model -- can convert at the boundary rather than being rewritten. It will not appear in the C ABI. It no longer declares its own MarkerStyle/LabelAnchor/BlobRenderMode/Easing/LoopMode -- those now come from region.h, with k-prefixed enumerators.

Converting between the two applies the coordinate change: Roi is normalized [0,1] on both axes, Region normalizes both axes by the frame width. See ToRegion()/ToRoi() at the bottom of this file.

Value Initialiser Description
Rectangle
Circle
Oval
Polygon
Line
Point
PointMax
PointMin
PointAvg
Spot
Label
BlobGroup

TestPattern

enum TestPattern

Test pattern for the simulated imager.

The first six are flat synthetic fields -- a ramp, a plane, a disc, a checkerboard, noise, and frames replayed from a file. They are what a test asserts against, because what they do is arithmetic a test can restate. kFrameCycle, the last value, is one more of those: it sits after the scenes only because values are appended.

The four between them are scenes: compositions that look like thermal imagery, for demonstrations, screenshots, the pipeline viewer and every example someone runs without a camera on the desk. They share three properties that a demo picture would not normally be held to:

  • Deterministic. A frame is a pure function of the pattern, the frame size, the frame index and SimulatedConfig::seed. Same inputs, same bytes, on every machine -- which is what lets the replay-diff parity gate use one as a reference.
  • Resolution-independent. Composed in normalised coordinates, so the same scene appears at 160x120, 382x288, 640x480 and beyond, rather than a corner of it.
  • Inside the configured range. Each is composed as a heat field and mapped onto [SimulatedConfig::temp_min_c, SimulatedConfig::temp_max_c], ambient included. No scene hardcodes a room temperature.

Values are appended and never renumbered, and a withdrawn one is retired rather than reused: the C ABI mirrors this enum by value, and a value can already be sitting in a configuration file that an application exported months ago. Renumbering would make such a file load as a different scene without an error, which is the one outcome worse than refusing it. They are therefore written out explicitly here rather than left to the compiler to count.

7 is retired. It was kFaceAndHand, withdrawn after v12's scenes were reviewed; a configuration still carrying it is rejected as an unknown pattern, which is what should happen.

Value Initialiser Description
kGradient = 0
kUniform = 1
kHotSpot = 2
kCheckerboard = 3
kNoise = 4
kFromFile = 5
kLogoRadiant = 6
kCircuitBoard = 8
kSteamPipe = 9
kRotatingMachine = 10
kFrameCycle = 11

GradientDirection

enum GradientDirection

Gradient direction for kGradient pattern.

Value Initialiser Description
kHorizontal
kVertical

NucStatus

enum NucStatus

Non-uniformity correction (shutter) cycle status.

Value Initialiser Description
kIdle
kInProgress
kCompleted
kFailed
kScheduled

ShutterState

enum ShutterState

Position of the internal shutter (flag).

A cycle runs kOpen -> kClosing -> kClosed -> kOpening -> kOpen. kInitializing is the startup calibration, during which thermal data is not yet reliable. kError means the cycle did not complete: the shutter was commanded and never reported the state asked of it.

The two transitional states are not symmetric, and the difference is worth knowing if you are timing a cycle. kClosing is the command -- it is published when the shutter is told to close, before the hardware has confirmed anything. kOpening is an observation: it is published when the flag reports itself open again, which happens well after the reopen was commanded. So the kClosing -> kClosed gap measures how long the shutter took to answer, while kOpening -> kOpen measures only how long the SDK then took to resume delivering frames.

Not every camera reports every state. What a given device can distinguish is a property of its firmware, so a consumer must treat the transitional states as optional and drive its display from kOpen and kClosed alone if it wants to work everywhere.

Value Initialiser Description
kInitializing
kOpen
kClosed
kOpening
kClosing
kError

ShutterCorrectionOutcome

enum ShutterCorrectionOutcome

What a closure the SDK did not command did to the dark reference.

Only a process interface can make one: an input configured as PifChannelKind::kFlagControl -- Shutter Control -- hands the camera's flag to the wire, and every closure the wire makes is a chance to correct. See the Process Interface guide.

This is a different question from ShutterState::kError, and that separation is the point. kError means the shutter was commanded and did not take the position asked of it. A closure too short to average a reference from is a shutter that moved exactly as it was told, in a break the production line made brief. An application that cannot tell those apart cannot act on either.

Value Initialiser Description
kApplied
kSkippedTooShort
kAppliedWithoutAReferenceToKeep

NucCycleOutcome

enum NucCycleOutcome

What came of one shutter cycle the SDK itself commanded.

A different event from ShutterCorrectionEvent, deliberately. That one reports a closure the SDK did not command -- a process interface in Shutter Control handing the flag to the wire -- and it is published only from that path. This one reports the SDK's own periodic non-uniformity correction. The two were not merged for the reason this header gives for every other split of the kind: a line's break and a cycle the SDK planned are different facts, half the fields below describe a window only the SDK plans, and a consumer handed both through one callback would have to branch on which producer filled it to stay correct.

Value Initialiser Description
kApplied
kDiscardedTooFewFrames
kShutterNeverClosed

CalibrationState

enum CalibrationState

State of the calibration data currently loaded on the device.

Value Initialiser Description
kNotLoaded
kLoading
kValid
kExpired
kInvalid

TemperatureUnit

enum TemperatureUnit

The unit a temperature is shown in. Mirrors optris_sdk_temperature_unit, value for value.

Value Initialiser Description
kCelsius = 0
kFahrenheit = 1 Degrees Fahrenheit.

Typedefs

HotplugCallback

std::function< void(const DeviceInfo &, bool added)> HotplugCallback

Hotplug callback signature.

DeviceChangeCallback

std::function< void(const DeviceInfo &, DeviceChangeKind)> DeviceChangeCallback

Callback for StartDeviceMonitor().

Whether: Whether serial is set Normally yes, and it is what to act on. The SDK takes the serial out of the operating system's own record of the device -- on Linux the serial the kernel publishes in sysfs, on Windows the serial in the device-interface path -- so neither platform has to open the camera to find out which one arrived.

It can still be empty, and a watcher has to cope:

  • a camera whose USB descriptor carries no serial at all, or one that is not a number;
  • kArrived where the identity could not be read in the time the monitor allows, and the kRemoved that follows it -- a departure can only report what its arrival established, because by then the device is gone and cannot be asked.

An entry with an empty serial must NOT be passed to Imager::Create(): an empty serial there means "the first camera found" (ImagerConfig::serial_number), so opening such an entry opens whichever camera the SDK happens to list first. Check it, and fall back to EnumerateDevices().

Two unnamed arrivals are two cameras. The SDK will not merge them, and neither should a watcher: both being unknown is not evidence that they are the same device.

Result

Expected< T, Error< E > > Result

A value or the Error explaining its absence.

Warning: Internal. See the note at the top of this header: this type does not cross into the C ABI or the .NET package, and must not appear on a new external API surface.

Since API version 34 no public declaration returns one, so this is how the library's own code uses it, below the surface that throws:

auto channel = [](int index) -> Result<int, pif::PifError> {
  if (index < 0) {
    return Fail(pif::PifError::kOutOfRange, "no such channel");
  }
  return index;
};
auto value = channel(2);
if (!value) {
  std::println(stderr, "{}", value.error().message);
  return;
}
std::println("channel {}", *value);

Template parameters

Name Description
T Value type; use void for operations that only succeed or fail.
E Error enum type of the subsystem.

LogHandler

std::function< void(LogLevel, const std::string &)> LogHandler

Receives one SDK log message.

The message is the text only, with no level prefix, no timestamp and no trailing newline -- add whatever your own log format wants. It is passed by const reference and is not retained by the SDK after the call returns.

See SetLogHandler() for what the SDK guarantees about when and on which thread this is called. The short version: it may be called on any SDK thread, including yours, possibly by several at once, and it must return promptly and must not throw.

Geometry

std::variant< Point, Rectangle, Circle, Line, Ellipse, Polygon > Geometry

Variant type for any geometry shape.

OpenProgressCallback

std::function< void(OpenPhase)> OpenProgressCallback

Reports open progress.

Called while the open is still in progress, one phase at a time, and never after the Create() call it was passed to has returned. That last part is a guarantee rather than a hope: the open waits for the phases it has published and then clears the callback behind a fence, so by the time Create() returns the callback is not running and cannot be entered again. State captured for the duration of the call -- which is what the C and .NET bindings do -- is safe to release the moment it returns.

Which thread. On a simulated camera, the thread performing the open. On a real camera, the SDK's internal event thread: the connect path publishes its phases through the same notification queue the connection callbacks use, so they arrive on that queue's thread and not on the caller's. It is not always the opening thread, whatever older advice said. An application that updates shared state from this callback must synchronise it.

Keep it short: a phase delivery is waited for before the open finishes, so time spent here is time the camera is not opening. It must not throw; an exception that escapes it is swallowed.

PipelineChangeCallback

std::function< void(const PipelineChange &)> PipelineChangeCallback

Handler for PipelineChange. See Processing::SetPipelineChangeCallback().

ReconnectEventCallback

std::function< void(const ReconnectEvent &)> ReconnectEventCallback

Reports each step of an automatic reconnect.

Invoked on the SDK's reconnect thread, which is neither the frame thread nor the event dispatch thread. It must not destroy the Imager it belongs to, and it must not call Imager::Reconnect(), Imager::EnableAutoReconnect() or Imager::DisableAutoReconnect() -- all four need state this call is holding. The SDK refuses those rather than hanging.

ReconnectAttemptCallback

std::function< bool(const DeviceInfo &device, int attempt, int max_attempts)> ReconnectAttemptCallback

Veto hook for a single attempt: return false to stop trying.

Called before each attempt, with the same threading rules as ReconnectEventCallback.

ReconnectSuccessCallback

std::function< void(const DeviceInfo &device, int attempts)> ReconnectSuccessCallback

The camera came back, after attempts attempts.

ReconnectFailureCallback

std::function< void(const DeviceInfo &device, int attempts)> ReconnectFailureCallback

The SDK gave up after attempts attempts.

Matrix3

std::array< float, 9 > Matrix3

Row-major 3x3. The bottom row is {0,0,1} for an affine transform; the full 3x3 is stored so a projective transform is a later extension rather than a serialized-format change.

Functions

FieldBase

auto FieldBase(SignalDomain domain) -> uint16_t

The first SignalField value in domain's block, so a dense index can be turned back into a field: SignalField(FieldBase(d) + i).

FieldIndex() is the inverse and the one to reach for -- it is the direction that can fail, and it says so. This one cannot report failure: a domain outside the enumeration returns 0, which is also kRegionFieldBase's real value. Every enumerator is handled, so that fallback is only reachable through a cast.

FieldCount

auto FieldCount(SignalDomain domain) -> uint16_t

How many fields domain defines, for iterating or bounds-checking.

FieldIndex

auto FieldIndex(SignalDomain domain, SignalField field) -> std::optional< uint16_t >

The dense index of field within domain, or nullopt when the field does not belong to that domain.

PackRegionSlot

auto PackRegionSlot(uint32_t slot, uint32_t generation) -> uint32_t

Combines a slot and its generation into a SignalId::index.

RegionSlotOf

auto RegionSlotOf(uint32_t packed) -> uint32_t

The slot out of a packed index.

RegionGenerationOf

auto RegionGenerationOf(uint32_t packed) -> uint32_t

The generation out of a packed index. A rule whose generation no longer matches the slot's is stale, and reports kOrphaned rather than measuring whichever region reused the slot.

Evaluate

OTC_SDK_API auto Evaluate(const Rule &rule, const RuleRuntime &previous, const SignalValue &input, Span< const SignalValue > inhibit_values, std::chrono::microseconds interval=std::chrono::microseconds::zero()) -> EvalResult

Evaluate one rule against one observation.

Pure: no allocation beyond the optional event's strings, no I/O, no clock, no globals. inhibit_values must be the same length as rule.inhibit, in the same order. interval is the time between two consecutive observations of this rule's input, used to turn Condition::on_delay and off_delay into counts of observations. Zero means "not known", and then any non-zero delay debounces exactly one observation -- the same floor a sub-interval delay gets, and never zero, so an unknown rate cannot silently switch a debounce off.

Evaluate

OTC_SDK_API auto Evaluate(const Rule &rule, const RuleRuntime &previous, const SignalValue &input, const SignalValue &reference, Span< const SignalValue > inhibit_values, std::chrono::microseconds interval=std::chrono::microseconds::zero()) -> EvalResult

Evaluate one rule as a comparison of its input with a reference signal: the bands are tested against input.value - reference.value.

This is how a rule given a reference with RuleEngine::SetReference() is evaluated; the overload above is the single-signal rule, and is unchanged. Everything else is as above. The observation is valid only when both input and reference are, so either missing orphans the rule exactly as a missing input does. The event, when there is one, carries the difference as AlarmEvent::value and the input's timestamp and sequence, because the input is what drives the evaluation.

inhibit_values has no default here, unlike above: with one, a call passing {} as the fourth argument would match both overloads.

Acknowledge

OTC_SDK_API auto Acknowledge(const RuleRuntime &previous) -> RuleRuntime

Clear a latch. Returns the runtime with the latch released; the state falls on the next evaluation, and only if the condition has actually released. Acknowledging an alarm that is still ringing must not silence it.

IsRinging

auto IsRinging(AlarmState s) -> bool

True when the state is one an operator would call "ringing".

WorseOf

OTC_SDK_API auto WorseOf(AlarmState a, AlarmState b) -> AlarmState

The more severe of two states, for rolling per-rule states up to a region or to a whole imager.

ToString

OTC_SDK_API auto ToString(AlarmState state) -> const char *

A stable English name for state: "Unknown", "Disabled", "Orphaned", "Inhibited", "Clear", "Warning" or "Active".

Returns a string literal with static lifetime, so it never needs freeing and outlives any caller. It is for a log line, a status bar or a test assertion -- not the persistence format. A saved configuration writes AlarmState as its ordinal, and there is no parse function here to pair with this one. Not localized.

ToString

OTC_SDK_API auto ToString(Compare compare) -> const char *

The enumerator name of compare without its k: "Above", "Below", "Outside", "Inside", "Equal", "Changed", "Invalid". Lifetime as for ToString(AlarmState). Note that the lowercase spelling a saved region file uses is a separate mapping with its own parser, not this function's output.

ToString

OTC_SDK_API auto ToString(LimitKind kind) -> const char *

Which limit an AlarmEvent crossed, as text: "None", "AlarmLow", "AlarmHigh", "WarningLow", "WarningHigh", "Delta", "Equal", "Invalid". Lifetime as for ToString(AlarmState).

"None" is the normal answer for a transition with no band behind it -- into kDisabled, kOrphaned or kInhibited, where the event carries no limit and AlarmEvent::limit stays 0 -- so it reports an ordinary cause rather than a failure to determine one.

SigmaFactorFor

constexpr auto SigmaFactorFor(AutoScaleMode mode) -> float

The sigma multiplier a mode implies, or 0 for the modes that are not sigma-based.

InternalToCelsiusPrecise

constexpr auto InternalToCelsiusPrecise(float value) -> float

Celsius from an internal value that is not a whole unit.

InternalToCelsius() takes an int16_t, which is right for a pixel -- pixels are integers. A filtered colour scale is not: it is a weighted average of two ranges and lands between the 0.1 K steps. Rounding it to a step before converting would throw away exactly the precision the filter exists to produce, and would put the effective range up to 0.1 K away from the number v11 reports for the same frame.

ResolveAutoScaleRange

OTC_SDK_API auto ResolveAutoScaleRange(AutoScaleMode mode, const SceneRangeStats &stats) -> AutoScaleRange

The one place the colour scale is decided.

Both pipeline backends and both software colorize paths call this, so a picture cannot differ between them -- which would be worse than either policy on its own.

Falls back to the absolute extremes whenever the percentiles are missing or degenerate, so a frame is never left without a usable scale. The result is always at least one degree wide: a scene of uniform temperature would otherwise divide by zero somewhere downstream.

MeasureSceneRange

OTC_SDK_API auto MeasureSceneRange(const std::int16_t *values, std::size_t count, bool with_percentiles, bool with_moments=false) -> SceneRangeStats

Measure a frame's own scene statistics, for the paths that are not handed them by a pipeline.

The percentiles use the same 16384-bin histogram both pipelines build, so a software-colorized frame lands on the same scale a hardware-colorized one would.

Parameters

Name Description
values internal-encoding pixels.
count number of pixels.
with_percentiles false to take the extremes only, which is one pass and no histogram. Pass false whenever the mode is kAbsolute: the percentiles would be measured and thrown away.
with_moments true to also compute the mean and standard deviation, which costs a second pass over the pixels. Only the sigma modes need them, so this is off by default and the modes that were here before pay nothing.

CollectUnmasked

OTC_SDK_API void CollectUnmasked(const std::int16_t *values, const std::uint8_t *excluded, std::size_t count, std::vector< std::int16_t > &out)

Copy the values a mask does NOT exclude into out.

For measuring the scene's colour range over part of a frame. A region carrying its own emissivity is corrected before the scene statistics are taken, so its pixels used to pull the auto range up to make room for themselves and the rest of the picture lost that much contrast. The outer frame sets the scale; the region sits in a slice of it, and runs off the end of the palette if it has to.

excluded is one byte per value, non-zero to leave it out. out is cleared and refilled, and is meant to be kept between frames so the pass does not allocate. Pass the result to MeasureSceneRange(), so one scene is measured one way wherever the question is asked.

NeedsMoments

constexpr auto NeedsMoments(AutoScaleMode mode) -> bool

Whether a mode needs the moments MeasureSceneRange can compute.

UnadaptedColorScaleDynamics

OTC_SDK_API auto UnadaptedColorScaleDynamics() -> ColorScaleDynamics

The dynamics as they shipped through 12.0.0: a plain one-pole filter, instant opening, no deadband and no adaptive rate.

Provided so that the parity fixtures and anyone comparing two captures frame by frame can say they mean the unadapted filter, rather than depending on what the defaults happen to be. A test that asserts v11 numbers and gets them from a default is only telling the truth until the default changes, which is exactly what 12.1 did to it -- and what happened again to seed_first_frame. This function names that one too.

It therefore includes the seed band: a filter configured from this eases out of -20..+20 C over the first frames, as every release through 12.0.0 did, where a filter left alone now adopts its first usable frame.

Pair it with CloseTimeForLegacyFactor() to pin the time constant as well, and set close_time to zero on top for a scale that is whatever each frame implies.

CloseTimeForLegacyFactor

OTC_SDK_API auto CloseTimeForLegacyFactor(float factor, std::chrono::microseconds frame_interval) -> std::chrono::milliseconds

The close_time that reproduces a legacy per-frame blend factor at a given frame interval.

The two are the same filter at a constant cadence: a per-frame survival factor f is exp(-dt / tau), and close_time is the 90% time tau * ln(10). Provided so a parity fixture can say which legacy factor it means instead of carrying a magic duration, and so the equivalence is stated once where it can be tested rather than rederived at each call site.

Returns 0 -- damping off -- for a factor outside (0, 1) or a non-positive interval, which are the inputs for which no finite close time exists.

GetCalibrationDir

OTC_SDK_API auto GetCalibrationDir() -> std::string

The directory the SDK keeps calibration files in on this machine.

This is where a download lands and where a copy from ImagerConfig::calibration_path is placed for reuse. Useful for pre-seeding an offline machine: put the files here and no camera will need the network.

Returns: absolute path to the calibration directory. The directory is not created by this call and may not exist yet.

AddCalibrationFallbackServer

OTC_SDK_API void AddCalibrationFallbackServer(const std::string &url)

Registers an additional server that calibration files may be downloaded from, after the built-in ones.

For a site that keeps its own mirror: a plant with no route to Optris but a host on the LAN that has the files. Registered servers are tried after the built-in ones, in registration order.

A registered server must mirror the REST layout of the built-in ones, including the Digest: sha-256=... response header used to verify what arrived. The URL must use https:// and carry the full API base path; the SDK appends /healthz and /v1/calibration/... to it.

optris::sdk::AddCalibrationFallbackServer(
    "https://mirror.example.com/api");

Note: This does not override allow_calibration_download. A camera opened with the download refused reaches no server at all, registered or built in.

Parameters

Name Description
url of the mirror, including the API base path.

Exceptions

Name Description
ConfigException if the URL is empty, does not start with https://, contains whitespace, a query or a fragment, or if the registration limit (8) is reached. A URL that is already built in, or already registered, is ignored rather than rejected.

ClearCalibrationFallbackServers

OTC_SDK_API void ClearCalibrationFallbackServers()

Removes every server registered via AddCalibrationFallbackServer(). The built-in servers are unaffected and remain in use.

GetCalibrationFallbackServers

OTC_SDK_API auto GetCalibrationFallbackServers() -> std::vector< std::string >

The servers registered via AddCalibrationFallbackServer(), in registration order. Built-in servers are not included.

GetBuiltinCalibrationServers

OTC_SDK_API auto GetBuiltinCalibrationServers() -> std::vector< std::string >

The servers the SDK ships with, highest priority first. These are always tried before any registered fallback and cannot be removed.

IsCalibrated

constexpr auto IsCalibrated(CalibrationStatus status) -> bool

Whether a temperature from this camera means anything.

The one question most applications have. Written as a function rather than left to a comparison so that a status added later -- a fallback calibration, say -- lands on the right side of it without every caller being revisited.

ToString

OTC_SDK_API auto ToString(CalibrationStatus status) -> const char *

Human-readable name of a calibration status.

FrameCentreOf

OTC_SDK_API auto FrameCentreOf(uint32_t width, uint32_t height) -> Vec2

The centre of a width x height frame, in that frame's own coordinates. Not (0.5, 0.5): the y axis is divided by the width too, so a 4:3 frame's centre is (0.5, 0.375).

MeasureSpaceOf

OTC_SDK_API auto MeasureSpaceOf(const Placement &placement) -> std::optional< MeasureSpace >

The MeasureSpace a placement implies: regions authored on the canvas, measured in the frame. std::nullopt for a singular placement.

This one function is the whole of the design. Everything else is bookkeeping around it.

ToCanvas

OTC_SDK_API auto ToCanvas(const Region &region, const Placement &placement) -> Region

region, authored in a camera's frame, as it appears on the canvas. The convenience direction for an application that has regions already and wants them to follow the picture when it is placed.

ToFrame

OTC_SDK_API auto ToFrame(const Region &region, const Placement &placement) -> std::optional< Region >

region, authored on the canvas, in the camera's own frame: the form it is actually measured in. std::nullopt for a singular placement.

operator|

constexpr auto operator|(ConfigSection a, ConfigSection b) -> ConfigSection

The union of two section sets.

These operators exist so a caller can write (report.applied & ConfigSection::kCanvas) != ConfigSection::kNone` without casting through the underlying integer.

operator&

constexpr auto operator&(ConfigSection a, ConfigSection b) -> ConfigSection

The intersection of two section sets.

See also: operator|

operator~

constexpr auto operator~(ConfigSection a) -> ConfigSection

Every section not in a. Bounded to ConfigSection::kAll, so the result never carries a bit no version has defined.

See also: operator|

operator|=

constexpr auto operator|=(ConfigSection &a, ConfigSection b) -> ConfigSection &

Adds b to a.

See also: operator|

operator&=

constexpr auto operator&=(ConfigSection &a, ConfigSection b) -> ConfigSection &

Narrows a to what it shares with b.

See also: operator&

Contains

constexpr auto Contains(ConfigSection set, ConfigSection wanted) -> bool

Whether set contains every section in wanted.

IsEmpty

constexpr auto IsEmpty(ConfigSection set) -> bool

Whether set contains anything at all.

ChangedTheCamera

constexpr auto ChangedTheCamera(ConfigLoadOutcome outcome) -> bool

Whether any part of the file reached the camera.

The one question an application has after an import: "do I have to re-read anything?". Written as a function so that an outcome added later lands on the right side of it without every caller being revisited.

ToString

OTC_SDK_API auto ToString(ConfigLoadOutcome outcome) -> const char *

Human-readable name of a load outcome. Never null, never empty.

ToString

OTC_SDK_API auto ToString(ConfigSection section) -> const char *

Human-readable name of a single section, e.g. "the canvas".

Expects exactly one bit. Returns "nothing" for ConfigSection::kNone and "an unknown section" for anything this version does not name.

DescribeSections

OTC_SDK_API auto DescribeSections(ConfigSection set) -> std::string

A set of sections as an English list, e.g. "the temperature range, the canvas and the measuring regions".

Returns "nothing" for an empty set. This is what the sentences in ConfigLoadReport::diagnosis are built from.

ToString

OTC_SDK_API auto ToString(ConnectionStatus status) noexcept -> const char *

The status as a stable, lowercase, human-readable word.

Stable across releases; safe to log and to compare in tests.

ToString

OTC_SDK_API auto ToString(DeviceBusyReason why) -> const char *

Human-readable name of a busy reason, for a log line or a UI row.

The short name of the enumerator, not the refusal's own sentence. For the sentence, use SdkException::message().

ToString

OTC_SDK_API auto ToString(NetworkConfigRefusal refusal) -> const char *

The name of a refusal reason, for logs ("subnet mask", "reserved port", ...). Never null.

EnumerateDevices

OTC_SDK_API auto EnumerateDevices() -> std::vector< DeviceInfo >

Enumerate all connected Optris thermal cameras.

Blocking, and a sweep with EnumerationOptions::include_network set blocks for as long as network_discovery_timeout -- 3 s by default -- because the broadcast has no way of knowing that every camera that is going to answer already has. That is too long to spend on a user-interface thread.

To sweep without blocking, call this on a thread of your own. There is nothing for the SDK to add: the result is a std::vector<[DeviceInfo](/documentation/sdks/otc-sdk/v12.0/api/classes/optris.sdk.deviceinfo)> returned by value, so there is no handle and no lifetime to manage across the hand-back, and a std::jthread that enumerates and then posts the vector is the whole of it. The Device Enumeration page has it written out. If what you want is arrivals and departures rather than one sweep, use StartDeviceMonitor() instead -- it owns the thread for you.

EnumerateDevices

OTC_SDK_API auto EnumerateDevices(const EnumerationOptions &options) -> std::vector< DeviceInfo >

Enumerate devices with filtering options.

Blocks exactly as the no-argument overload does; see it for how to keep a network sweep off a user-interface thread.

ProbeNetworkDevice

OTC_SDK_API auto ProbeNetworkDevice(const NetworkProbe &probe) -> std::optional< DeviceInfo >

Ask one address who is there, without opening the camera.

The unicast counterpart of EnumerateDevices(): the same discovery exchange, sent to one host instead of a broadcast address. It exists so a user interface can list a camera it was given the address of -- and learn its serial -- before deciding to open it.

Opens nothing and claims nothing, so it does not disturb a camera another process is streaming from.

Returns: the camera that answered, or nothing if none did within timeout or if the one that did was not the requested serial.

Exceptions

Name Description
ConfigException if address is empty.

RegisterSimulatedDevice

OTC_SDK_API auto RegisterSimulatedDevice(const SimulatedConfig &config) -> DeviceInfo

Add a simulated camera to this process's device list.

A simulated camera created with Imager::Create(SimulatedConfig) exists only as the handle that made it: it is not enumerated, no device watcher reports it, and a saved layout naming its serial cannot resolve. Registering one puts it in the device list instead, so it arrives, is opened and is watched by the same code paths as a camera on the end of a cable -- which is the point, since the alternative is every application keeping its own serial-to-scene table alongside the SDK's.

The registered device appears in EnumerateDevices() when EnumerationOptions::include_simulated is set, with ConnectionType::kSimulated, and Imager::Create(DeviceInfo) on that entry opens it with the scene registered here rather than with defaults.

If StartDeviceMonitor() is running, this reports a DeviceChangeKind::kArrived for the new device, so a watcher sees it the way it sees a camera being plugged in.

Parameters

Name Description
config The scene the camera should produce. An empty serial means "assign one" -- the lowest free serial in the block at kSimulatedSerialBase. Note that SimulatedConfig defaults serial to "9990001" rather than to empty, so registering two default-constructed configs is a collision and is refused; clear the field to have serials assigned.

Returns: The device as it will appear in enumeration.

Exceptions

Name Description
ConfigException if the serial is already registered, if the simulated serial block is exhausted, or if SimulatedConfig::frame_cycle_steps is neither zero nor in kFrameCycleMinSteps..kFrameCycleMaxSteps -- refused here rather than when the device is opened.

UnregisterSimulatedDevice

OTC_SDK_API auto UnregisterSimulatedDevice(const std::string &serial) -> bool

Remove a simulated camera from this process's device list.

Removes the list entry, not any camera opened from it. A simulated camera that is currently open keeps running until it is closed: it owns its own generator thread, and its holder is entitled to the frames it is midway through reading. Unregistering is an edit to a list, not a cable being pulled. What changes at once is that the serial stops being enumerated and can no longer be opened, so a later Imager::Create() on a DeviceInfo kept from before will fail.

Reports a DeviceChangeKind::kRemoved if a device monitor is running.

Returns: true if a device was registered under that serial.

GetRegisteredSimulatedDevices

OTC_SDK_API auto GetRegisteredSimulatedDevices() -> std::vector< DeviceInfo >

Every simulated camera registered in this process.

ClearSimulatedDevices

OTC_SDK_API void ClearSimulatedDevices()

Forget every registered simulated camera.

Chiefly for tests: the registry is process-wide and outlives any one of them, so a test that left a device registered would change what the next one enumerates.

StartHotplugMonitor

OTC_SDK_API void StartHotplugMonitor(HotplugCallback callback)

Start monitoring for USB hotplug events.

USB only, and that is this function's whole contract -- a camera on the network is reported by StartDeviceMonitor() with DeviceMonitorOptions::watch_network set, because seeing one means broadcasting for it and this call has nowhere to put the interval that would need.

Exceptions

Name Description
DeviceException on failure.

StopHotplugMonitor

OTC_SDK_API void StopHotplugMonitor()

Stop hotplug monitoring.

IsHotplugMonitorRunning

OTC_SDK_API auto IsHotplugMonitorRunning() -> bool

Check if hotplug monitoring is active.

StartDeviceMonitor

OTC_SDK_API void StartDeviceMonitor(const DeviceMonitorOptions &options, DeviceChangeCallback callback)

Start monitoring devices, with the kind of change reported.

The superset of StartHotplugMonitor(): the same arrival and removal events, plus claim transitions when asked for, plus cameras on the network when asked for. There is one monitor process-wide, so this and StartHotplugMonitor() replace each other rather than running side by side.

Which cameras are reported: Which cameras are reported USB always. Cameras on the network only with DeviceMonitorOptions::watch_network set -- the operating system pushes a bus event for a camera being plugged in and pushes nothing at all for one appearing on a network, so the two halves cost different things and are asked for separately. Without that option an application with only Ethernet cameras receives no events.

Exceptions

Name Description
DeviceException on failure.

StopDeviceMonitor

OTC_SDK_API void StopDeviceMonitor()

Stop the device monitor. The same monitor StopHotplugMonitor() stops; either call ends whichever is running.

EnableAutoReconnect

OTC_SDK_API void EnableAutoReconnect(const ReconnectConfig &config, ReconnectAttemptCallback on_attempt=nullptr, ReconnectSuccessCallback on_success=nullptr, ReconnectFailureCallback on_failure=nullptr)

Automatic reconnection

The mechanism belongs to Imager, because the thing that has to be re-opened is an imager and the SDK does not own the application's. See Imager::EnableAutoReconnect() and Imager::Reconnect(); the configuration record and its callbacks are in optris/sdk/reconnect.h.

The four functions below are a process-wide convenience over every camera this process currently has open. They are the shape the v12 API shipped with, and they still work, but a program holding an Imager should prefer the Imager methods: those say which camera, and a process that has two cameras open on one machine has always needed to. Enable automatic reconnection on every camera this process has open, and on every one it opens afterwards.

Equivalent to calling Imager::EnableAutoReconnect() on each. A camera opened later inherits config; one closed in the meantime is forgotten.

Parameters

Name Description
config the backoff policy. See ReconnectConfig.
on_attempt called before each attempt; return false to stop.
on_success called once the camera is delivering again.
on_failure called when the attempt budget runs out.

Exceptions

Name Description
ConfigException if config is not a backoff -- a multiplier below 1, or a non-positive initial delay.

DisableAutoReconnect

OTC_SDK_API void DisableAutoReconnect()

Stop reconnecting automatically, on every open camera and on any opened afterwards. Does not throw, and does not interrupt an attempt already in flight -- that attempt finishes and no further one is made.

IsAutoReconnectEnabled

OTC_SDK_API auto IsAutoReconnectEnabled() -> bool

Whether EnableAutoReconnect() is in force process-wide.

This answers for the process-wide switch only. A camera switched on individually through Imager::EnableAutoReconnect() does not make this true; ask that imager instead.

GetReconnectConfig

OTC_SDK_API auto GetReconnectConfig() -> ReconnectConfig

The configuration EnableAutoReconnect() was last given, or the defaults if it has never been called.

TriggerReconnect

OTC_SDK_API void TriggerReconnect(const std::string &serial)

Re-open the open camera with this serial number, now.

Synchronous: it returns when the camera is streaming again, or throws. Independent of EnableAutoReconnect() -- it makes exactly one attempt, with no backoff, whether or not automatic reconnection is on. Equivalent to Imager::Reconnect() on that camera.

Exceptions

Name Description
DeviceException if no camera with that serial is open in this process, or if the re-open failed.

GetNetworkDiscoveryInfo

OTC_SDK_API auto GetNetworkDiscoveryInfo(const std::string &serial) -> std::optional< NetworkDiscoveryInfo >

What the camera with this serial said the last time it answered discovery in this process.

Any discovery fills it in: EnumerateDevices() with EnumerationOptions::include_network, a device monitor watching the network, ProbeNetworkDevice(). Nothing is sent by this call: it reads what was heard, so run one of those first.

Returns: the record, or nothing if this process has not heard the camera answer discovery.

ConfigureNetworkByBroadcast

OTC_SDK_API auto ConfigureNetworkByBroadcast(const BroadcastNetworkConfig &config) -> BroadcastNetworkReply

Set the network address of a camera by its MAC address, by broadcast, without knowing the address it has now.

This is the way to reach a camera whose address is unknown or wrong (set at the factory, set for another site, or in another subnet than this host). The request is a broadcast, so it reaches every camera on this network segment (it does not cross a router); only the camera with the given MAC address acts on it, and that camera answers by broadcast, so the answer arrives whatever subnet the camera is in. Only cameras whose discovery record has protocol_version 1001 or later understand it; read NetworkDiscoveryInfo::answers_by_broadcast and NetworkDiscoveryInfo::accepts_broadcast_config first.

The camera checks the values itself and says what it did: taken, not plausible, not possible, or refused. Every answer except kTaken means nothing was stored. Silence means no camera with that MAC address answered.

The request goes out as a broadcast to 255.255.255.255 and to the broadcast address of every network this host is on. Nothing about the camera has to be open, and no camera is claimed.

Parameters

Name Description
config Which camera and what to set.

Returns: The camera's answer, or answered == false.

Exceptions

Name Description
ConfigException if the MAC address, an address, the mask or the gateway is not one, or attempts is 0. Nothing is sent.
DeviceException if the request could not be sent at all, or if OTC_SDK_NO_HARDWARE is set (it forbids contacting cameras).

ToString

OTC_SDK_API auto ToString(BroadcastConfigStatus status) -> const char *

The name of a status, for logs ("taken", "not plausible", ...). Never null.

ToString

OTC_SDK_API auto ToString(BroadcastConfigEffect effect) -> const char *

The name of an effect ("already active", "at next start", ...).

ToString

OTC_SDK_API auto ToString(BroadcastConfigRefusal refusal) -> const char *

The name of a refusal reason ("switched off by policy", ...).

ConnectionTypeToString

auto ConnectionTypeToString(ConnectionType type) -> const char *

Convert connection type to string.

IsPI

auto IsPI(DeviceType type) -> bool

Check if device is a PI model.

IsXI

auto IsXI(DeviceType type) -> bool

Check if device is a Xi model.

IsMTDevice

auto IsMTDevice(DeviceType type) -> bool

Check if device is an MT variant.

Is1MDevice

auto Is1MDevice(DeviceType type) -> bool

Check if device is a 1M variant.

IsEthernetDevice

auto IsEthernetDevice(DeviceType type) -> bool

Check if device supports Ethernet.

HasFocusMotor

auto HasFocusMotor(DeviceType type) -> bool

Check if device has a focus motor.

DeviceTypeToString

auto DeviceTypeToString(DeviceType type) -> const char *

Convert device type to string.

kPi200, kPi400 and kPi450 are families, and this writes them as "PI 200", "PI 400" and "PI 450", which is wrong for a PI 230, a PI 450 and every i camera. It is inline, so it is compiled into callers and keeps that spelling in 12.0.x; show DeviceInfo::model instead, which says "PI 2x0", "PI 4x0" and "PI 4x0i".

GetCapabilitiesForType

OTC_SDK_API auto GetCapabilitiesForType(DeviceType type) -> DeviceCapabilities

Get capabilities for a specific device type.

GetSensorDimensions

OTC_SDK_API auto GetSensorDimensions(DeviceType type) -> std::pair< uint32_t, uint32_t >

Get sensor dimensions for a device type.

ReadDeviceMetadata

OTC_SDK_API auto ReadDeviceMetadata(const std::string &serial) -> DeviceMetadata

Read the metadata recorded for serial.

Returns an empty DeviceMetadata for a camera nobody has written anything about, and for a store that cannot be read at all -- a missing name must never be the reason a device list fails.

Does not open, claim or otherwise touch the camera.

WriteDeviceMetadata

OTC_SDK_API void WriteDeviceMetadata(const std::string &serial, const DeviceMetadata &metadata)

Replace everything recorded for serial.

Writing empty metadata deletes the store, so a camera can be put back to having no name at all. An entry whose value is empty is dropped rather than stored, so that an absent key and a key with an empty value cannot both exist -- Get() could not tell them apart anyway.

Last writer wins. The file is replaced whole and atomically, so a reader never sees a half-written store and a crash cannot destroy the previous one. What it is not is transactional across processes: SetDeviceName() and the C ABI's per-key setters read, modify and write back, so if two processes change different keys on the same camera at the same moment, one of the two changes is lost. Naming cameras is something a person does occasionally from one place, so this is a deliberate trade rather than an oversight -- but an application that renames cameras from several processes at once should serialize that itself.

Exceptions

Name Description
SdkException if serial is empty, or if the store cannot be written.

ClearDeviceMetadata

OTC_SDK_API void ClearDeviceMetadata(const std::string &serial)

Forget everything recorded for serial. Doing this to a camera with no metadata is not an error.

Exceptions

Name Description
SdkException if serial is empty.

GetDeviceName

OTC_SDK_API auto GetDeviceName(const std::string &serial) -> std::string

The user's name for the camera with this serial, or an empty string. Shorthand for ReadDeviceMetadata(serial).Name().

SetDeviceName

OTC_SDK_API void SetDeviceName(const std::string &serial, const std::string &name)

Name the camera with this serial, keeping any other metadata it has. An empty name clears it.

Exceptions

Name Description
SdkException if serial is empty, the name is too long, or the store cannot be written.

ListDeviceMetadataSerials

OTC_SDK_API auto ListDeviceMetadataSerials() -> std::vector< std::string >

Every serial the store knows about, in order.

For a "which cameras have I named?" list that includes cameras that are not plugged in right now.

CanConvertEmissivity

constexpr auto CanConvertEmissivity(EmissivityConversionSupport support) -> bool

Whether a conversion will actually happen if you ask for one.

Written as a function rather than left to a comparison, for the same reason as IsCalibrated() and CanApplyReferenceCorrection(): the tempting shorthand is support != kNoEnergyCurve, and that makes an unopened camera report that it can convert. Only a source that has been looked at and found able counts.

ToString

OTC_SDK_API auto ToString(EmissivityConversionSupport support) -> const char *

Human-readable name of an emissivity-conversion support value.

For a log line or a support report, never for branching -- the enum is the closed set a program branches on. pipeline_info.h states the rule both halves of this pair follow: "neither substitutes for the other".

MakeError

auto MakeError(E code, std::string message) -> Error< E >

Parameters

Name Description
code Machine-readable error code.
message Human-readable description.

Returns: Error<E> instance.

Fail

auto Fail(E code, std::string message) -> Unexpected< Error< E > >

The error arm of a Result, so call sites read as return Fail(PifError::kNoDevice, "no PIF attached");.

BytesPerPixel

auto BytesPerPixel(ExternalPixelFormat fmt) -> size_t

Returns the byte size per pixel for a given format.

IsFocusable

constexpr auto IsFocusable(FocusCapability capability) -> bool

Whether this camera will accept a focus command.

The one question an application has. Written as a function rather than left to a comparison because the comparison that reads naturally -- capability != kFixed -- is wrong: it makes an unopened camera, and any model this SDK has never heard of, report that it can be focused. That is the same trap IsCalibrated() exists to close.

ToString

OTC_SDK_API auto ToString(FocusCapability capability) -> const char *

Human-readable name of a focus capability.

DetectorSettlingStateToString

auto DetectorSettlingStateToString(DetectorSettlingState state) -> const char *

A name for a settling state, in English, for a status bar or a log line.

Not an identifier: persist or compare the enum value instead. A value outside the enum -- which a cast can produce -- yields "Unknown" rather than reading past the switch.

InternalToCelsius

auto InternalToCelsius(int16_t raw) -> float

Convert internal format to Celsius.

CelsiusToInternal

auto CelsiusToInternal(float celsius) -> int16_t

Convert Celsius to internal format.

An input the encoding cannot hold gives kInvalidPixel or saturates; it never wraps. The old spelling was a bare static_cast<int16_t> of the scaled float, which is undefined for anything outside the int16 range rather than merely lossy -- measured on this box, gcc 14 and clang 19 at -O0 turn 3200 C into -32536 (reading as -3353.6 C, a plausible cold measurement) while clang 19 at -O2 turns the same input into 0 (reading as -100.0 C, an equally plausible one). That is the same defect in the opposite direction: a value that is not a measurement arriving as one.

And one tenth of a degree past the hot end was enough: CelsiusToInternal(3176.8f) returned kInvalidPixel itself on gcc 14 at every level, clang 19 at -O0 and MSVC 19.44 at both /Od and /O2 -- a real temperature arriving as "nothing was measured", which is the very ambiguity kMinFilteredPixel exists to prevent at the cold end.

The rule, which all four bindings now share and BindingAgreementGuard holds them to:

  • an input that is not a measurable temperature -- NaN, or at or below absolute zero, which includes the decoded sentinel kInvalidTemperatureC -- gives kInvalidPixel, the encoding's own reserved "nothing was measured". Test it with IsMeasurablePixel(), which already exists for exactly that.
  • anything hotter than kMaxEncodablePixel can express saturates there, so the answer stays monotonic in its input.
  • everything else is the format, truncated toward zero, as before. No value inside the encoding changes.

That makes the round trip exact for a pixel that was never measured: kInvalidPixel decodes to kInvalidTemperatureC (or to NaN through ThermalFrame::GetTemperature() and .NET's ToCelsius), and both convert back to kInvalidPixel. Before this it decoded to -3376.8 and came back as -32768 only by accident of the wrap, and the NaN came back as 0 -- an ordinary -100.0 C reading.

IsEncodableTemperature() is the companion that says which of the three branches you got.

ToString

OTC_SDK_API auto ToString(FrameRateLimitReason reason) -> const char *

Human-readable name of a limit reason, for a log line or a UI row.

IsPaletteValue

constexpr auto IsPaletteValue(int value) -> bool

Whether value names a Palette.

For the boundaries a value crosses without its type: a config file, a C enum parameter, a binding. Substituting a default for an unknown value would silently repaint the picture.

HighPrecisionStateToString

auto HighPrecisionStateToString(HighPrecisionState state) -> const char *

A name for a high-precision state, in English, for a status bar or a log line.

Not an identifier: persist or compare the enum value instead. A value outside the enum -- which a cast can produce -- yields "Unknown" rather than reading past the switch.

IsNoiseFilterValue

constexpr bool IsNoiseFilterValue(int value) noexcept

Whether value names a filter at all.

Public because anything that deserializes a filter selection -- a saved configuration, a protocol message, a settings file written by an older version -- has the same number in hand that the SDK used to cast without looking.

IsMeasurablePixel

constexpr auto IsMeasurablePixel(std::int16_t raw) -> bool

Whether a raw internal-encoding pixel is a measurement at all.

The guard every statistic needs, spelled once. The v11 equivalent is *pSource != INVALIDPIXEL, repeated at nine call sites.

IsMeasurableTemperature

constexpr auto IsMeasurableTemperature(float celsius) -> bool

Whether a Celsius temperature is a measurement at all.

False for kInvalidTemperatureC, for anything else below absolute zero, and -- because every comparison against NaN is false -- for NaN, which is what the reporting APIs hand back when they have nothing to report. One predicate covers all three.

IsEncodableTemperature

constexpr auto IsEncodableTemperature(float celsius) -> bool

Whether a temperature has a sample of its own in this encoding.

The companion to CelsiusToInternal(), and the reason that function can stay total without lying: it answers false exactly when the conversion is about to give something other than the sample for this temperature -- kInvalidPixel because the input is not a measurement, or kMaxEncodablePixel because the input is hotter than the format goes. True means the answer is the real encoding, to the usual tenth of a degree.

This is the distinguishability convention the SDK uses everywhere else (FrameMetadata::chip_temp_known, optris_sdk_image:: has_frame_metadata, DetectorSettling::kUnknown): a companion that says whether the value means anything, rather than a magic value inside the value space. A value-derived sentinel claims a real measurement is missing, because 0.0 and the bounds are legitimate readings.

There is no cold end to check, and that is a property of absolute zero rather than luck. The coldest measurable input is just above kAbsoluteZeroC, which is -1731.5 counts -- more than 31,000 counts above the cold end of the encoding -- so no measurable temperature can saturate downwards, and in particular none can be driven onto kInvalidPixel. That is the guarantee kMinFilteredPixel exists to give the filters, obtained here for nothing.

SetLogHandler

OTC_SDK_API void SetLogHandler(LogHandler handler, LogLevel minimum=LogLevel::kInfo)

Send the SDK's log output to handler.

Parameters

Name Description
handler Called for each message at minimum or above. An empty std::function clears the handler, exactly as ClearLogHandler() does.
minimum Messages below this level are not delivered. The default keeps the volume to what is useful in a diagnostics bundle; kDebug and kTrace are for reproducing a fault.

Installing a handler silences the SDK's own console and file output; clearing it restores them. See the note at the top of this header for why.

Threading: Threading -- what is guaranteed These are the rules the SDK holds itself to, and each one is covered by a test:

  • Any thread. The handler is called on whichever thread emitted the message. That is usually an SDK-internal thread, but it is your thread when a call you made logs before returning. This differs from every other callback in this SDK, which are only ever invoked on an internal thread.
  • Possibly concurrently. Two SDK threads logging at the same time call the handler at the same time. It must be safe to call from several threads at once. The SDK deliberately holds no lock across the call: serialising delivery would put every logging thread behind the slowest handler, and a handler that blocked would stall the frame path.
  • Promptly, please. The thread that emitted the message is blocked until the handler returns. Time spent here is time the frame pump is not running. Queue the line and return; do not write to a network socket from inside it.
  • Throwing is contained. Anything the handler throws is caught and discarded at the boundary. The message is lost and the SDK carries on. This is a safety net, not a supported way to signal anything -- an exception unwinding out of a handler into an SDK frame would be undefined behaviour, so it is stopped here.
  • Clearing waits. ClearLogHandler(), and SetLogHandler() with a different handler, block until every call already running has returned. After either returns, the old handler cannot be called again and anything it captured is safe to destroy. This is what makes it safe for a binding to free a delegate.
  • Re-entry is dropped. If the handler logs -- directly, or by calling an SDK function that logs -- that nested message is discarded rather than delivered. Otherwise a handler that logged would call itself forever.
  • Do not set a handler from inside one. Calling SetLogHandler() or ClearLogHandler() from within the handler would have to wait for itself to return. The SDK detects this and throws std::logic_error instead of deadlocking.

Exceptions

Name Description
std::logic_error if called from inside the log handler.

Shutting down: Shutting down Clear the handler before you tear down whatever it writes into. The SDK keeps logging for as long as it is doing anything, which includes closing cameras and releasing resources while an application is on its way out. A handler that is still installed then will still be called, and if the log it appends to has already been destroyed that is a crash during shutdown -- the least diagnosable kind.

ClearLogHandler() is the whole answer: it waits for calls in flight, so once it returns nothing can reach the handler again. Clearing is the only ordering requirement; the sink itself is owned by the logger and cannot be destroyed out from under a call in progress.

Example: Example cpp optris::sdk::SetLogHandler( [](optris::sdk::LogLevel level, const std::string &message) { my_app::Log(level, message); }, optris::sdk::LogLevel::kInfo);

ClearLogHandler

OTC_SDK_API void ClearLogHandler()

Stop sending log output to the handler.

Restores the SDK's own console and file output. Blocks until any call already in progress has returned, so afterwards the handler cannot be called again. Clearing when nothing is set does nothing.

Exceptions

Name Description
std::logic_error if called from inside the log handler.

HasLogHandler

OTC_SDK_API auto HasLogHandler() -> bool

Whether a handler is currently installed. Diagnostic. Cannot fail.

RegionFromGeometry

OTC_SDK_API auto RegionFromGeometry(const Geometry &geometry, uint32_t width, uint32_t height) -> Region

Build a Region from pixel-space geometry.

Regions are frame-normalized (both axes divided by the frame width), so this needs the frame size. A Line becomes a line region, a Point a spot with a single-pixel aperture, and the rest their matching area primitives.

ToString

OTC_SDK_API auto ToString(OpenPhase phase) -> const char *

Human-readable name for a phase, for logs and for display.

ToString

OTC_SDK_API auto ToString(OpticsUnit unit) -> const char *

Human-readable name of an optics unit.

The enumerator's name, not a symbol to put in front of a user: "Degrees", "Millimetres", "Unknown". A user interface wants "°" and "mm", which are a presentation choice and often a localised resource, so they are deliberately not decided here.

NormalizeRotation

auto NormalizeRotation(float degrees) -> float

Rotation folded into [0, 360). Negative and over-wound angles are accepted so a caller can say -90 or 450.

QuarterTurn

auto QuarterTurn(float rotation_deg) -> int

The quarter-turn index (0..3) if the angle is one, else -1.

Exact float comparison on purpose: 90.0F, 180.0F and 270.0F are representable, and a caller who computed 89.999 must be refused rather than silently snapped to 90; snapping would hide a mis-derived mounting angle behind an image that looks right.

IsQuarterTurn

auto IsQuarterTurn(float rotation_deg) -> bool

True if the rotation is an exact multiple of 90 degrees, and so an exact index remap with no resampling of any kind.

IsIdentity

auto IsIdentity(const Orientation &o) -> bool

True if this orientation leaves the frame exactly as it was.

SwapsDimensions

auto SwapsDimensions(const Orientation &o) -> bool

True if this orientation swaps width and height: a 90 or 270 degree turn. Mirroring never swaps dimensions.

OrientedSize

auto OrientedSize(std::uint32_t width, std::uint32_t height, const Orientation &o) -> std::pair< std::uint32_t, std::uint32_t >

The dimensions a sensor-native width x height frame reports once oriented.

IsRadiometricallyExact

auto IsRadiometricallyExact(const Orientation &o) -> bool

True if this orientation is safe on the measurement path: it relocates existing values without averaging any into existence and leaves no output pixel without a source. Today that means a quarter turn; resampling does not enter into it, because a quarter turn never resamples.

OrientationRejection

auto OrientationRejection(const Orientation &o) -> const char *

Why an orientation was refused, or an empty string if it is acceptable. Shared by Imager::SetOrientation() and its test so the wording lives in one place.

GetPaletteColors

OTC_SDK_API Span< const Rgb24 > GetPaletteColors(Palette palette)

The colours of palette, coldest first.

The span is over storage with static lifetime that is never modified, so it stays valid for the life of the process and needs no freeing. Every value of Palette returns a full table, and the compiled table is what this returns even where a CSV of the same name is installed.

Palette::kGrayscale and Palette::kGrayscaleBW return the same table. They are the same palette under two names, and the renderer already treats them as one.

GetPaletteDisplayName

OTC_SDK_API std::string_view GetPaletteDisplayName(Palette palette)

A name for palette fit to show a user, in English.

Not an identifier and not stable enough to persist or parse -- it is for a legend caption or a drop-down. Store the enum value.

IsAlarmPalette

OTC_SDK_API bool IsAlarmPalette(Palette palette)

Whether palette is one of the alarm palettes.

An alarm palette holds most of its range in a single flat colour and spends the rest on a narrow band at the top, so it shows "something is over the threshold" rather than the shape of a scene. A user interface usually wants them grouped apart from the measuring palettes for that reason.

GetAllPalettes

OTC_SDK_API Span< const Palette > GetAllPalettes()

Every value of Palette, in enum order.

So a caller can build a palette picker without hard-coding a list that goes stale when a palette is added.

Built-in palettes only, always. A palette an application supplied belongs to the source it was given to, not to the process, so there is no list of them here to return. See CustomPalette.

GetPaletteName

OTC_SDK_API std::string_view GetPaletteName(Palette palette)

The name that identifies palette in the palette library and on disk -- "Iron", "GrayBW", "AlarmBlueHi".

This is the stem of the palette's CSV file, and the name GetPaletteLibrary() lists it under. Unlike GetPaletteDisplayName() it is an identifier: it is stable, it is safe to persist, and FindPalette() takes it back.

Palette::kGrayscale and Palette::kGrayscaleBW are one palette under two enum values and both return "GrayBW".

ValidateCustomPalette

OTC_SDK_API PaletteValidation ValidateCustomPalette(const CustomPalette &palette)

Whether palette can be used, and if not, why.

Setting a custom palette on a source throws when it is invalid. This is here so a caller that would rather test than catch can, and so a file-format reader can say what was wrong with a table without treating it as an error.

DescribePaletteValidation

OTC_SDK_API std::string_view DescribePaletteValidation(PaletteValidation result)

A sentence naming what result means, in English.

For a log line or an error message. Not an identifier.

LoadPaletteCsv

OTC_SDK_API CustomPalette LoadPaletteCsv(const std::filesystem::path &path)

Read a palette from a CSV file.

The format the SDK's own palettes ship in and the one legacy Sdk::loadPalettes read: kPaletteColorCount lines, one R,G,B per line, coldest first, each channel 0-255. Blank lines and lines beginning with # are skipped. The palette's name is the file's stem, so Furnace.csv loads as "Furnace".

This is a plain function over a file. It reads nothing else, writes nothing, and registers nothing -- hand the result to SetCustomPalette() if that is what you want it for.

Throws IoException if the file cannot be read, and ConfigException if its contents are not a palette, with the reason in the message.

SavePaletteCsv

OTC_SDK_API void SavePaletteCsv(const CustomPalette &palette, const std::filesystem::path &path)

Write a palette to a CSV file, in the format LoadPaletteCsv() reads.

palette.name is not used for the filename -- path says where it goes, so a caller keeps control of that. Any existing file is overwritten.

Throws ConfigException if the palette is not valid, and IoException if the file cannot be written.

GetPaletteDirectories

OTC_SDK_API std::vector< std::filesystem::path > GetPaletteDirectories()

The directories searched for palette files, in scan order.

By default the SDK's own four, in the order legacy Sdk::loadPalettes used them with the library's own directory added:

Root Linux Windows
SDK the data that ships with the library, else $OTC_SDK_DIR/palettes, else /usr/share/otcsdk/palettes the data that ships with the library, else OTC_SDK_DIR%\palettes, else C:\Program Files\Optris\OTC SDK\palettes
Library <dir of libotcsdk.so>/palettes <dir of otcsdk-<abi>.dll>\palettes
Working $PWD/palettes CD%\palettes
User ~/.config/optris/palettes APPDATA%\[Imager](/documentation/sdks/otc-sdk/v12.0/api/classes/optris.sdk.imager)\palettes

"The data that ships with the library" is the library's own folder when it holds a Formats.def (the Python wheel, the NuGet package), otherwise the data folder of the installation it was loaded from. OTC_SDK_DIR is read only by a library that has neither, such as one linked statically into a program, so other software that sets it does not change what an SDK program reads.

OTC_SDK_DIR is a search path, not a single directory: it may hold several directories, separated by ; on Windows and : on Linux, because the Windows installer adds one entry per installation. The SDK uses the first entry that names an existing directory. Whenever the variable holds more than one entry, the SDK logs which entry it chose and which it passed over, so a machine with several SDK installations says which one is being read instead of choosing silently.

The SDK installs a CSV for every one of its own palettes -- sixteen files, one per name -- and an operator adds their own to any of these directories, the way they have with PIX Connect and SDK 11 for years. Which directory the shipped files land in depends on how the SDK was installed: the share directory for a system install, and for the NuGet package the directory the native library is in, which is the Library root above.

The Library root is what makes the NuGet layout work from anywhere. It used to be absent, so a .NET application started by a .desktop entry, over SSH or as a systemd service -- none of which starts the process in the application's own directory -- found none of the sixteen files and fell back to the compiled-in tables with a warning. In the RID-less layout, where the library sits in runtimes/<rid>/native and the data is copied to the application base directory, both of those directories are searched.

Precedence. Among the directories, later wins: a Furnace.csv in the user directory is the Furnace the library lists, and one in the working directory is not.

A built-in is never shadowed. A file named after one of the SDK's own palettes is compared against the compiled table. If it is the same colours it is the shipped copy, and PaletteEntry::path records where it is. If it differs it is refused, with a warning naming the file, and the compiled table is kept.

That is deliberate and conservative: it is the only thing that makes "Palette::kIronBow is iron bow" true on every machine regardless of what is on its disk, and it means GetPalette("Iron") and GetPaletteColors(Palette::kIronBow) can never disagree. Whether an operator should be allowed to override a built-in this way is an open question; today they cannot.

SetPaletteDirectories

OTC_SDK_API void SetPaletteDirectories(std::vector< std::filesystem::path > directories)

Search these directories instead of the SDK's own.

For an application that keeps palettes of its own somewhere the SDK would not look. Pass an empty vector to go back to the default. Rescans immediately, so the next GetPaletteLibrary() reflects it.

The same rules apply: later beats earlier, and a file named after one of the SDK's own palettes is accepted as the shipped copy only if its colours are the compiled table's, and refused otherwise.

RefreshPaletteLibrary

OTC_SDK_API size_t RefreshPaletteLibrary()

Re-read the palette directories. Returns how many palettes the library holds afterwards.

You do not need this to get started -- the library builds itself the first time it is asked for anything, and nothing else ever rebuilds it. Call it when a file may have been added while the program was running.

Because the library changes only when this is called, the order GetPaletteLibrary() reports is stable in between, which is what makes index-based enumeration over the C API safe.

Never throws and never leaves the library empty. A directory that does not exist is skipped; a file that is not a palette is logged with the reason and skipped, and the files either side of it still load.

GetPaletteLibrary

OTC_SDK_API std::vector< PaletteEntry > GetPaletteLibrary()

Every palette the machine has, sorted by name.

The sixteen built-in entries are always in it, so this is never empty and a picker built from it is never blank. If the SDK's palette directory is missing or unreadable you still get those sixteen, plus a warning in the log naming every directory that was searched -- an installation problem is loud, but it does not take the picture with it.

Note: Sixteen, where GetAllPalettes() returns seventeen. The library is keyed by name, and Palette::kGrayscale and Palette::kGrayscaleBW are one palette under two enum values sharing the name "GrayBW"; SeedBuiltInsLocked() skips the former so the entry that survives is the one whose name matches. A picker built from this call therefore has one row fewer than one built from GetAllPalettes(), which is a difference worth knowing before the two are compared.

Returned by value: it is a few dozen short strings, and a snapshot cannot be invalidated underneath you by a refresh on another thread.

FindPalette

OTC_SDK_API std::optional< PaletteEntry > FindPalette(std::string_view name)

The library entry called name, or nothing if there is none.

Matching is exact and case-sensitive, like the filenames it comes from.

GetPalette

OTC_SDK_API CustomPalette GetPalette(std::string_view name)

The palette called name, ready to use.

The result is a CustomPalette because that is what a table of colours with a name is on this API -- hand it to FrameSource::SetCustomPalette() to colorize with it:

for (const PaletteEntry &entry : GetPaletteLibrary()) {
  // u8string(), not string(): on Windows string() is the ANSI code
  // page and throws for a folder that code page cannot hold.
  const std::u8string where = entry.path.u8string();
  std::println("{} ({})", entry.name,
               std::string(where.begin(), where.end()));
}
imager->SetCustomPalette(GetPalette("Furnace"));

For a built-in name this returns the compiled table, so GetPalette("Iron").colors and GetPaletteColors(Palette::kIronBow) are always the same colours. Selecting a built-in through SetPalette() remains the cheaper path and is unaffected by any of this.

Throws ConfigException if the library has no palette by that name. Use FindPalette() to ask without catching.

IsRdcActive

constexpr auto IsRdcActive(RdcStatus status) -> bool

Whether distortion correction is actually reshaping the picture.

Written as a function rather than left to a comparison, for the same reason as IsCalibrated(): the tempting shorthand is rdc != kOff, and that counts kNoCoefficients -- a camera that was asked and cannot -- as corrected.

IsSosActive

constexpr auto IsSosActive(SosStatus status) -> bool

Whether size-of-source correction is actually changing pixels.

Same caution as IsRdcActive(), and it bites harder here: the majority state on a camera that has a table is kZeroStrength, which is an exact identity. Only kActive changes a pixel.

ToString

OTC_SDK_API auto ToString(RdcStatus status) -> const char *

Human-readable name of a distortion-correction status.

ToString

OTC_SDK_API auto ToString(SosStatus status) -> const char *

Human-readable name of a size-of-source correction status.

Explain

OTC_SDK_API auto Explain(RdcStatus status) -> const char *

A sentence explaining a distortion-correction status, for a log line or a support report. ToString() names the state; this says what it means and what, if anything, to do about it.

Explain

OTC_SDK_API auto Explain(SosStatus status) -> const char *

A sentence explaining a size-of-source correction status.

SerializePifChannels

OTC_SDK_API auto SerializePifChannels(const std::vector< pif::PifChannelConfig > &channels) -> std::string

Serialize a channel table. Channels that are Off are written too: "pin 3 is deliberately unused" and "pin 3 was never mentioned" are different statements about a configuration.

ParsePifChannels

OTC_SDK_API auto ParsePifChannels(const std::string &json) -> std::vector< pif::PifChannelConfig >

Parse a channel table. Unknown fields are ignored and missing ones take their defaults, so a table written by a newer SDK still loads.

SerializePifFailSafe

OTC_SDK_API auto SerializePifFailSafe(const pif::PifFailSafeConfig &config) -> std::string

Serialize the fail-safe watchdog's configuration.

ParsePifFailSafe

OTC_SDK_API auto ParsePifFailSafe(const std::string &json) -> pif::PifFailSafeConfig

ToString

OTC_SDK_API auto ToString(PipelineKind kind) -> const char *

Human-readable name of a pipeline kind, for a log line or a UI row.

ToString

OTC_SDK_API auto ToString(PipelineReason reason) -> const char *

Human-readable name of a pipeline reason.

ToString

OTC_SDK_API auto ToString(StreamingBackendSource source) -> const char *

Human-readable name of a streaming-backend source.

GetGpuInfo

OTC_SDK_API auto GetGpuInfo() -> GpuInfo

Ask which GPU the SDK would use, with or without a camera open.

Probes once if nothing has looked yet, then reports what that probe found; the answer is cached for the life of the process, because the shared GPU context is created and destroyed on demand and probing again would cost another context creation for an answer that cannot have changed.

CanApplyReferenceCorrection

constexpr auto CanApplyReferenceCorrection(ReferenceCorrectionSupport support) -> bool

Whether a reference-body correction will actually be applied if you ask for one.

Written as a function rather than left to a comparison, for the same reason as IsCalibrated(): the tempting shorthand here is support != kNotImplemented, and that makes an unopened camera report that it can be corrected. Only a source that has been looked at and found able counts.

ToString

OTC_SDK_API auto ToString(ReferenceCorrectionSupport support) -> const char *

Human-readable name of a reference-correction support value.

Multiply

OTC_SDK_API auto Multiply(const Matrix3 &a, const Matrix3 &b) -> Matrix3

a then b, in the usual matrix order: the result applies b to whatever a produced.

Invert

OTC_SDK_API auto Invert(const Matrix3 &m) -> std::optional< Matrix3 >

The inverse, or nothing when m is singular -- which a scale of zero on either axis produces, so check rather than assume.

Apply

OTC_SDK_API auto Apply(const Matrix3 &m, Vec2 p) -> Vec2

p transformed by m.

MakeTranslation

OTC_SDK_API auto MakeTranslation(Vec2 t) -> Matrix3

A transform that moves by t.

MakeScale

OTC_SDK_API auto MakeScale(Vec2 s) -> Matrix3

A transform that scales about the origin. For a shape placed at a centre, compose with MakeTrs() rather than translating afterwards.

MakeRotation

OTC_SDK_API auto MakeRotation(float radians) -> Matrix3

A transform that rotates about the origin, anticlockwise in region space, in radians.

MakeTrs

OTC_SDK_API auto MakeTrs(Vec2 centre, Vec2 scale, float radians) -> Matrix3

Compose translate * rotate * scale, the form every friendly constructor produces and the form the accessors decompose exactly.

ToPixels

OTC_SDK_API auto ToPixels(Vec2 region, uint32_t width, uint32_t height) -> Vec2

Region space to pixels, for a frame of this size. Region space runs 0..1 across x, so a region keeps its meaning when the frame is resized; pixels do not.

FromPixels

OTC_SDK_API auto FromPixels(Vec2 pixels, uint32_t width, uint32_t height) -> Vec2

Pixels back to region space -- the inverse of ToPixels() for the same frame size.

RegionSpaceHeight

OTC_SDK_API auto RegionSpaceHeight(uint32_t width, uint32_t height) -> float

The y extent of the region space for a frame of this shape: height / width. x always runs 0..1.

MakeShape

OTC_SDK_API auto MakeShape(Primitive primitive, const Matrix3 &transform) -> Composite

A single placed shape: one leaf, no operators.

MakePolygonShape

OTC_SDK_API auto MakePolygonShape(Span< const Vec2 > points, const Matrix3 &transform=kIdentity3) -> Composite

A polygon from explicit vertices in unit space, optionally placed by transform. The outline is closed implicitly; do not repeat the first point.

MakeSplineShape

OTC_SDK_API auto MakeSplineShape(Span< const Vec2 > points, const Matrix3 &transform=kIdentity3) -> Composite

A spline through explicit control points in unit space, optionally placed by transform.

Parameters

Name Description
points The control points. The curve passes through every one of them, so these are the handles an editor drags. At least two, and at most kMaxSplinePoints. Repeat the first point as the last to close the curve -- see below, because that changes what the region measures rather than only how it looks. A closed curve therefore needs at least four entries: three distinct points and the repeat.
transform Places the curve, exactly as it places any other primitive. The control points stay in unit space; see "the curve is defined in unit space" below, which is not a detail for this primitive.

Closure is data, and it changes the measurement: Closure is data, and it changes the measurement There is one spline primitive, and whether it is a path or an area is read off its control points: points.back() == points.front() exactly means closed. The region model already composes areas -- kUnion, kIntersect and kSubtract exist so that a donut is built rather than enumerated -- so a second enumerator for the closed case would put into Primitive something the tree already does, and would be paid for in every switch over it, in both renderers, in three binding enums and in two generated artefacts, forever.

What that costs instead is this paragraph, and it is worth saying bluntly: the same primitive measures two different things depending on its data.

  • Open (back() != front()): no area. Contains() rasterises the curve on the LineTolerance() lattice, exactly as a line is rasterised, so it measures the pixels it runs through. HasPositionAlong() is true and RegionSample::position carries arc length.
  • Closed (back() == front()): an area. Contains() is the even-odd crossing test over the flattened loop, exactly as a polygon's is, so it measures the pixels it encloses. The seam is smooth rather than a corner: the control points wrap, so the curve has the same continuity there as anywhere else. position is NaN, because the samples are interior pixels and an interior pixel has no position on the boundary.

The test is exact equality, not a tolerance, so there is no band in which the answer is unclear -- but there is no band in which it is gradual either. Dragging the last handle onto the first turns a profile into an area, and that is a real edge to be aware of. It is the convention a closed ring is spelled with in SVG paths, GeoJSON and shapefiles, and Region::ClosedSpline() is the constructor that does it for you so that a caller never has to append the repeat by hand.

Which spline, and why: Which spline, and why Centripetal Catmull-Rom, alpha = 1/2.

Catmull-Rom because it interpolates its control points: drag a point and the curve goes there. A B-spline approximates them, so the curve sits beside the handle the operator is holding, and a measuring region that is near where you put it is not a measuring region. A Bezier interpolates its ends only and needs two tangent handles per joint, which there is nowhere to put -- vertices is a flat list of points, and inventing a parallel list of tangents would be a second geometry model for one primitive.

Centripetal rather than uniform because uniform Catmull-Rom forms a cusp or a self-intersecting loop as soon as consecutive control points are unevenly spaced, which is exactly what a hand-dragged point produces. For an open spline that is ugly; for a closed one it is wrong, because a self-intersecting outline has no even-odd inside, so the area a region measures would depend on a loop the operator never drew. The centripetal parameterisation provably has neither (Yuksel, Schaefer and Keyser, 2011), at the cost of two square roots per span.

The curve is defined in unit space: The curve is defined in unit space Like every other primitive, and for a reason specific to this one: the centripetal parameterisation is not affine invariant, because a non-uniform scale changes the chord lengths the knots come from. Defining the curve on the placed control points would mean that stretching a spline region horizontally reshaped it rather than stretching it. So the knots, the tangents and the flattening are all computed on the unit-space control points, and the result is then placed -- which is what makes SetSize() on a spline behave like SetSize() on anything else.

What it costs per pixel: What it costs per pixel A spline is tested the way a polygon is, against kSplineSpanSegments edges per control point rather than one. Each span is rejected first against the exact box of its Bezier control hull, so a pixel that is nowhere near a span pays four comparisons instead of sixteen edge tests, and a large region spends most of its pixels in that reject.

Measured rather than asserted, because a timing assertion on a shared machine is a flake rather than a gate. Scanning a whole 640x480 frame through an 8-control-point curve, a closed spline costs 6.0x the 8-vertex polygon through the same points, and an open one 21.8x the line between its ends -- the line being the cheap end of everything, one segment and no span setup. Most of both is the span construction rather than the piece tests, which is why kSplineSpanSegments moves these numbers so little.

Re-measure with bench_region_contains -- run it deliberately, it is DISABLED_ -- rather than trusting these figures after changing the walk.

IsClosedSpline

OTC_SDK_API auto IsClosedSpline(const Composite &c, uint32_t node_index) -> bool

Whether a spline leaf's control points close the curve -- the one definition of the rule, so a renderer, the measurement and a test cannot each decide it differently.

node_index is an index into c.nodes. False for anything that is not a spline leaf, and for a spline whose last control point differs from its first by any amount at all. See MakeSplineShape().

SplinePolyline

OTC_SDK_API void SplinePolyline(const Composite &c, uint32_t node_index, std::vector< Vec2 > &out)

The placed curve of one spline leaf, as a polyline -- the points to draw.

node_index is an index into c.nodes; anything that is not a spline leaf appends nothing. Appended to out, which is not cleared, so one buffer can collect a whole tree.

This is the same polyline the containment test walks, produced by the same code, so an overlay cannot draw one curve while the measurement measures another. An open spline of n control points yields (n - 1) * kSplineSpanSegments + 1 points, to be drawn unclosed. A closed one -- n entries of which the last repeats the first, so n - 1 distinct -- yields (n - 1) * kSplineSpanSegments points, to be drawn closed, with the first point not repeated at the end; that is the convention MakePolygonShape() already uses, so an overlay that can draw a polygon can draw this with the same call.

Union

OTC_SDK_API auto Union(Composite a, Composite b) -> Composite

Combine two trees. Each appends b's nodes to a's with b's indices rebased, packs both vertex arrays, and pushes one operator node that becomes the new root.

Intersect

OTC_SDK_API auto Intersect(Composite a, Composite b) -> Composite

The area inside both.

Subtract

OTC_SDK_API auto Subtract(Composite a, Composite b) -> Composite

The area inside a but not b -- a ring is a circle with a smaller circle subtracted.

LineTolerance

OTC_SDK_API auto LineTolerance(uint32_t frame_width) -> float

Half the pixel pitch of a frame frame_width pixels across, in region coordinates -- the lattice a line or an open spline region is rasterised on.

A line encloses no area, so "the pixels it crosses" has to be settled some other way. It is settled by rasterising: step along whichever axis the segment covers more of, and at each step take the one pixel the segment passes through. So every column an axis-aligned line spans contributes exactly one pixel, and every step of a diagonal one contributes exactly one pixel, at whatever sub-pixel offset the line was drawn at. The end pixels count: a segment that stops part-way into a pixel did run through it.

Not a distance, despite the name: Not a distance, despite the name This was a distance: a pixel counted if its centre came within this far of the segment. That band is one pixel pitch across and closed at both ends, so a line laid exactly on a pixel boundary was at the tolerance on both sides at once, and float rounding decided whether it took both neighbours or neither. At 160x120 -- the simulator's default -- 34 of 120 rows measured nothing and 14 measured every column twice. A later release replaced the band with the rasteriser, which cannot answer "none" or "two". The name and the value are kept because callers pass them around; what changed is that the value now names a pixel pitch (twice it) rather than a radius, and it is exactly half a pixel at every width rather than floored at a constant that overshot on wide sensors.

An open spline is rasterised by this same rule, piece by piece along its flattened polyline, with one difference: the end-pixel rule above applies only at the two ends of the curve and not at the joints between pieces, because the next piece's own major step already owns the cell the joint sits in. Keeping it there would make a curve two pixels thick wherever a joint fell near a cell boundary -- the same fault at a smaller scale -- and dropping it is what makes a spline through collinear control points rasterise to exactly the same pixels as the line through them.

Pass the result to the Contains() and BoundsOf() overloads that take a tolerance whenever the frame is known -- the measuring code always knows it. The no-tolerance overloads assume a sensor about 312 across, which is all a caller with no frame in hand can honestly assume.

Contains

OTC_SDK_API auto Contains(const Composite &c, Vec2 p) -> bool

Point-in-region, walking the tree from the root.

Uses the default line tolerance. Prefer the overload below when the frame being measured is known.

Contains

OTC_SDK_API auto Contains(const Composite &c, Vec2 p, float line_tolerance) -> bool

Point-in-region with an explicit line lattice, in region coordinates. See LineTolerance(). Ignored by every primitive except Primitive::kLine and an open Primitive::kSpline, the two with no area of their own -- and they are rasterised on the same lattice by the same code, so a spline through collinear control points measures exactly the pixels the equivalent line does. A closed spline is an area and ignores it, as a polygon does.

HasPositionAlong

OTC_SDK_API auto HasPositionAlong(const Composite &c) -> bool

Whether this geometry has an honest distance-along, so that RegionSample::position is a number rather than quiet NaN.

True for exactly two shapes, and both are one-dimensional: a single Primitive::kLine leaf, and a single open Primitive::kSpline leaf. Those are the regions a profile plot can be drawn of, so a caller can ask this before offering one rather than reading a NaN back and guessing why.

False for everything else, and a closed spline is in that list. Its boundary has an arc length, but its samples are the pixels it encloses, and an interior pixel has no position on the outline -- the number would be the distance to the nearest point of a curve it is not on. That is the same reason an ellipse has none, arrived at from the other side. So this is a question about the control points as well as the primitive: see IsClosedSpline().

PositionAlong

OTC_SDK_API auto PositionAlong(const Composite &c, Vec2 p) -> float

How far along a one-dimensional region p lies, in region coordinates -- so PositionAlong() * frame_width` is the distance in pixels.

What fills RegionSample::position, published because the rule should have one definition that a caller can check rather than one the measuring pass keeps to itself.

  • A single Primitive::kLine leaf: the distance from the segment's first endpoint, projected onto the segment. Not clamped, which is what it has always been -- every pixel the rasteriser accepts is within half a pixel of the segment anyway.
  • A single open Primitive::kSpline leaf: arc length from the first control point to the nearest point of the curve, along the flattened polyline SplinePolyline() produces. The polyline rather than the ideal curve, because the polyline is what the containment test accepted the pixel for; a length taken from a curve the measurement does not use would disagree with it in the fourth decimal for no reason anybody could find. Not clamped at the ends either: the rasteriser keeps the pixel a path stops inside, so the last sample or two lie past the final control point, and pinning them to the total length would give two samples the same position -- a vertical step in a plot that is not in the data. A spline through collinear control points therefore reports the same positions as the line through them, to a hundredth of a pixel.
  • Anything else: quiet NaN. See HasPositionAlong().

BoundsOf

OTC_SDK_API auto BoundsOf(const Composite &c) -> Bounds

Bounding box, computed by box algebra over the tree: a union takes the union of its children's boxes, an intersect their intersection, a subtract its left child's box alone. So a subtract never widens the scan and an intersect narrows it.

BoundsOf

OTC_SDK_API auto BoundsOf(const Composite &c, float line_tolerance) -> Bounds

Bounding box with an explicit line lattice. Must be given the same tolerance as the matching Contains() call, or the box clips away rows the containment test would have accepted.

Transformed

OTC_SDK_API auto Transformed(const Composite &c, const Matrix3 &m) -> Composite

A copy of c with m applied on the left of every leaf transform: the same shape, expressed in another coordinate space.

This is how a region crosses a space boundary: a region authored on a Canvas becomes a region in the camera's own frame by one multiply per leaf, and then measures exactly as it always did. It is deliberately the only way that happens; there is no second geometry model on the other side of the boundary.

TransformInto

OTC_SDK_API void TransformInto(const Composite &c, const Matrix3 &m, Composite &out)

Transformed(), writing into out and reusing its storage. The frame thread maps every region into sensor space on every frame, and that must not allocate.

Depth

OTC_SDK_API auto Depth(const Composite &c) -> uint32_t

Longest path from the root to a leaf, for checking against kMaxGeometryDepth.

IsValid

OTC_SDK_API auto IsValid(const Composite &c) -> bool

True when the tree is well-formed and within the caps.

LeafOrder

OTC_SDK_API auto LeafOrder(const Composite &c) -> std::vector< uint32_t >

The shape leaves, in tree order. This order is the contract the per-frame recording format relies on (one matrix per leaf).

NominalApertureCount

OTC_SDK_API auto NominalApertureCount(const Aperture &aperture) -> uint32_t

How many pixels an aperture asks for, before any clipping.

The denominator RegionStats::coverage is computed against, published so that "the aperture is the size it should be" is a claim anyone can check rather than one only the SDK can make: a square of radius 1 is 9, radius 2 is 25, and a circle of radius 2 is the 13 pixel centres within it. Compare it against Region::samples (the window that survived clipping) and RegionStats::pixel_count (how much of that was measurable).

ApertureFootprint

OTC_SDK_API void ApertureFootprint(const Aperture &aperture, Vec2 centre, uint32_t width, uint32_t height, const Composite *clip, std::vector< AperturePixel > &out)

The pixels an aperture actually reaches, after clipping.

The same set the measuring pass samples, produced by the same loop and the same membership and clipping rules, clipped to clip (the owning region's geometry, or null for none) and to a frame of width x height. Appended to out, which is not cleared, so one buffer can collect a whole tree.

This exists because a spot's extent is not in its geometry. Primitive::kPoint has no area and its Contains() is a hard false: "measured through its aperture, never by containment". So anything that rasterises a region from BoundingBox() and Contains() sees a spot as zero pixels however wide its aperture is. That is right for drawing an outline and wrong for anything that has to know which pixels a spot's reading came from: the per-region emissivity both pipelines apply, and the own-scale shading. Those paths call this rather than each inventing a rule, and a test pins the result against Region::samples so the two definitions of "which pixels" cannot drift apart.

centre is where the aperture sits, in region coordinates: a fixed spot's own centre, or a tracked spot's Region::tracked_loc.

EmissivityStateOf

OTC_SDK_API auto EmissivityStateOf(const Region &region, float camera_emissivity, bool emissivity_to_image, bool emissivity_own_scale) -> RegionEmissivityState

Owns regions, assigns ids and generational signal slots, and measures them.

Get() hands back a mutable pointer on purpose: editing a region's geometry live is a write through that pointer, with no remove-and-re-add, no id churn and no invalidation of the rules that refer to it. What a region's own emissivity is doing, given the camera's.

The one definition of the rule, so a display, a label and a test cannot each decide it differently.

Parameters

Name Description
region The region to judge. A disabled one and a RegionKind::kLabel are never measured, so neither has an emissivity that means anything and both report kCameras.
camera_emissivity The value the frame was corrected at, not the one currently configured. NaN means the caller cannot say, and then nothing is marked -- a badge asserted against an unknown reference would be worse than none.
emissivity_to_image RadiationConfig::emissivity_affects_image.
emissivity_own_scale RadiationConfig::emissivity_own_scale.

The threshold that catches people out: The threshold that catches people out Below 0.01 a region's emissivity is the "use the camera's" sentinel and reaches nothing. Between 0.01 and 0.1 it reaches the statistics but not the picture, because the measuring pass and the image paths were given different floors -- so such a region honestly reports kReadingOnly rather than claiming a correction the picture never received. That gap is reported here rather than hidden; whether the two floors should be the same number is a separate question with a measurement change attached to it.

MarkEmissivityStates

OTC_SDK_API void MarkEmissivityStates(std::vector< Region > &regions, float camera_emissivity, bool emissivity_to_image, bool emissivity_own_scale)

Fill in Region::emissivity_state for a region and its children.

What Imager calls after a measuring pass. Separate from EmissivityStateOf() so the rule stays one function and the walk stays one loop.

ApertureCentreOf

OTC_SDK_API auto ApertureCentreOf(const Region &region) -> std::optional< Vec2 >

Where a point region's aperture sits this frame, or nothing.

A RegionKind::kSpot is at its own centre and is there before any frame has been measured. A kHotSpot or kColdSpot is wherever the extreme turned out to be, which is not known until it has been measured once, and painting a tracked spot at the place it was declared would put a patch of foreign emissivity somewhere it may never go. Returns nothing for a region that is not a point kind, is disabled, or is a tracker that has not measured yet.

SerializeRegions

OTC_SDK_API auto SerializeRegions(const std::vector< Region > &regions) -> std::string

ParseRegions

OTC_SDK_API auto ParseRegions(const std::string &json) -> std::vector< Region >

Returns an empty vector when the document is malformed.

SerializeRules

OTC_SDK_API auto SerializeRules(const std::vector< Rule > &rules) -> std::string

ParseRules

OTC_SDK_API auto ParseRules(const std::string &json) -> std::vector< Rule >

BuildFrameState

OTC_SDK_API auto BuildFrameState(const std::vector< Region > &regions, const std::vector< RegionFrameState > &previous) -> std::vector< RegionFrameState >

Build the per-frame records for a region set.

previous is the last frame's records, used to decide whether a region's matrices need repeating. Pass an empty vector on the first frame of a recording, which forces every matrix to be written so a player can seek to the start.

SerializeFrameState

OTC_SDK_API auto SerializeFrameState(const std::vector< RegionFrameState > &states) -> std::string

ParseFrameState

OTC_SDK_API auto ParseFrameState(const std::string &json) -> std::vector< RegionFrameState >

IsNoRegionsFrameState

OTC_SDK_API auto IsNoRegionsFrameState(const std::string &json) -> bool

Whether a per-frame record is the explicit statement above.

ParseFrameState() cannot answer it: an explicitly empty record and an unparseable one both come back as an empty vector, and the two mean opposite things.

ApplyFrameState

OTC_SDK_API void ApplyFrameState(const std::vector< RegionFrameState > &states, std::vector< Region > &regions, std::unordered_set< uint64_t > *recording_owned=nullptr, FrameStateChanges *changes=nullptr)

Apply a frame's records back onto a region set, for playback.

A frame's records are the complete set of THE RECORDING'S regions on that frame -- BuildFrameState() walks the whole tree of the store that was recording -- so this creates the ones that are named and not present, and removes the ones the recording owns that are present and not named. Without the removal an area deleted during a take never went away on playback, and one reshaped during a take, which an editor does by removing it and adding the result under a new id, replayed as two areas: the shape from before the reshape and the shape after it, together.

recording_owned is which ids the recording owns, and that distinction is the whole point. A region the application added on the playback handle is absent from the record because the record was written before it existed, not because it was deleted, and pruning it made AddRegion() on a replay return an id that stopped existing one frame later. Pass the set and only those ids can be pruned; ids born from a record are added to it, because the recording owns those too. Pass nullptr and every unnamed region is pruned, which is the older behaviour and is what a caller with no second id space wants.

An EMPTY record is the exception and changes nothing, because a frame that carried no region metadata -- a file written before this channel existed, or metadata that did not arrive -- is not a statement that there are no regions.

ApplyNoRegions

OTC_SDK_API void ApplyNoRegions(std::vector< Region > &regions, std::unordered_set< uint64_t > *recording_owned=nullptr, FrameStateChanges *changes=nullptr)

Apply the statement that the recording had no regions on a frame.

Everything the recording owns goes; everything the application added on the playback handle stays, which is the same distinction and the reason this takes recording_owned rather than clearing the vector.

Separate from ApplyFrameState() because an empty states reaching that one has to go on meaning "no statement" -- see kNoRegionsFrameState. Same prune, same reporting, one caller.

ToRegion

OTC_SDK_API auto ToRegion(const Roi &roi, uint32_t width, uint32_t height) -> Region

Convert a deprecated Roi to the unified Region model.

This is the only supported bridge between the two, and it exists because the conversion is not a field copy: Roi's y is normalized by the frame height, Region's by the frame width, so every y is scaled by height/width. Hand-porting field by field silently misplaces every region by the aspect ratio.

ToRoi

OTC_SDK_API auto ToRoi(const Region &region, uint32_t width, uint32_t height) -> Roi

Convert a Region back to a Roi, for the View overlay pipeline and for code that has not migrated yet.

Lossy by construction: a Region's boolean composition, aperture, rules and shear have no representation in Roi. A composite region converts to its root shape's bounding form.

NucStatusToString

auto NucStatusToString(NucStatus status) -> const char *

A name for a NUC status, in English, for a log line or a status bar.

Not an identifier: the spacing and capitalisation are for reading ("In Progress", not "in_progress"), so persist or compare the enum value instead. A value outside the enum -- which a cast can produce -- yields "Unknown" rather than reading past the switch.

ShutterStateToString

auto ShutterStateToString(ShutterState state) -> const char *

The state's name, for a log line or a tooltip.

Parameters

Name Description
state the state to name.

Returns: a static, never-null string. "Unknown" for a value from a future SDK that this build does not know.

CalibrationStateToString

auto CalibrationStateToString(CalibrationState state) -> const char *

Likewise for a calibration state: an English label to show, never a token to parse, and "Unknown" for a value outside the enum.

Since Telemetry::calibration_state is not populated, calling this on one read from a live camera says "Not Loaded" every time. It is useful on a state you hold yourself.

SetTemperatureUnit

OTC_SDK_API void SetTemperatureUnit(TemperatureUnit unit)

Choose the temperature unit of the whole SDK, for this process.

Every temperature and temperature difference that crosses the API after this call is in unit (see the top of this header for what that covers and what stays Celsius). The default is TemperatureUnit::kCelsius.

Call it once, at start, before opening a camera. It is safe from any thread, and each value converts with the unit in force at the moment it crosses the API, so a callback that runs while the unit changes may see some values in each. Settings made before a change keep their meaning: the SDK stores them in Celsius, and they read back in the new unit.

The camera's drawn labels follow this unit too, unless Imager::SetDisplayTemperatureUnit() chose another for that camera.

Exceptions

Name Description
InvalidArgumentException for a value other than the two units; the unit then stays what it was.

GetTemperatureUnit

OTC_SDK_API auto GetTemperatureUnit() -> TemperatureUnit

The SDK's temperature unit: what SetTemperatureUnit() last chose, TemperatureUnit::kCelsius until then.

GetApiVersion

OTC_SDK_API auto GetApiVersion() -> std::uint32_t

The API version the loaded library implements.

Compare against OPTRIS_SDK_API_VERSION -- what you compiled against -- to detect a header and a library from different builds. Always equal to optris_sdk_c_abi_version(). Cannot fail.

GetProductVersion

OTC_SDK_API auto GetProductVersion() -> ProductVersion

The loaded library's product version, e.g. 12.0.0. Cannot fail.

GetProductVersionString

OTC_SDK_API auto GetProductVersionString() -> std::string

The loaded library's product version as a display string, e.g. "12.0.0". Cannot fail.

GetBuildInfo

OTC_SDK_API auto GetBuildInfo() -> BuildInfo

What the loaded library was built from. Cannot fail.

Variables

kRegionFieldBase

constexpr uint16_t kRegionFieldBase = 0

Each domain's fields are numbered from a base, so a field maps to a dense array index with a subtraction rather than a hash. That is what keeps per-frame publication and evaluation allocation-free.

The numbers are also on disk. A saved region writes SignalField as its raw integer, so a rule stored today is resolved through these bases when it is loaded back. Append new fields at the end of a block and bump that block's count in the same change; inserting one in the middle, or moving a base, silently repoints every stored rule at a different quantity. The bases are 100 apart, which is also the ceiling on how many fields a domain can have.

kRegionFieldCount

constexpr uint16_t kRegionFieldCount = 17

SignalField::kMin through SignalField::kP99.

The signal bus allocates a fixed array of this many values per region slot, and FieldIndex() rejects anything at or past it. So a field added to the enum without bumping this is unreachable -- rule validation refuses it -- rather than out of bounds. Note that kArea is a pixel count, not an area in any physical unit, and that kBlobCount means two different things by kind: on a RegionKind::kBlobGroup it is the number of blobs detected this frame, and on every other kind it counts all of a region's children, not only blobs.

Six of the seventeen are published only when the region asked for them, and a rule on one the region did not ask for sits in kOrphaned rather than alarming on a zero that means "not computed":

  • kThresholdShare is the fraction 0..1 from RegionThresholdShare, not a percentage, and needs Region::threshold enabled;
  • kMedian and the four percentiles need Region::want_percentiles, because they cost extra work. kMedian used to be published unconditionally out of RegionStats::median_c, which is zero on a region that did not ask -- so every rule on a median was comparing against a valid 0.0 C.

kDeviceFieldBase

constexpr uint16_t kDeviceFieldBase = 100

SignalField::kFlagTemp. Device signals are per-imager, so SignalId::Device() leaves index at 0 and the bus keeps one array of this block for the whole camera rather than one per slot.

kDeviceFieldCount

constexpr uint16_t kDeviceFieldCount = 15

SignalField::kFlagTemp through SignalField::kDeliveryShare.

Four of the fifteen have no producer in this release: nothing publishes kFpaTemp, kFocusPosition, kFrameRate or kDroppedFrames. A rule on one of those is accepted and then sits in kOrphaned forever, which is the safe failure but a quiet one. (kAmbientTemp was on that list and is not any more: it is published whenever the frame carries a valid ambient estimate.)

kDroppedFrames stays on that list on purpose and kDeliveryShare is what answers the question instead. It is kept rather than deleted because 109 is not the last number in this block, and the numbers are on disk: removing it would load a stored rule naming any of the four enumerators above it against its neighbour.

Of the rest, kFlagOpen, kNucInProgress and kConnected carry 0.0 or 1.0 -- compare them with kEqual, not kAbove.

kFlagOpen and kNucInProgress come from the shutter itself, not from frame metadata. That matters because a live camera dispatches no frame at all while its shutter is closed, so a frame-sourced answer could never report a closed shutter: both signals now change on the transition, with no frame behind them, and an inhibit like "silence this alarm while the shutter is closed" holds for the 1-2 s the cycle lasts. kNucInProgress is high for Closing, Closed and Opening alike -- the shutter is in the way for all three -- and every SDK cycle runs a correction inside it. On playback, where there is no shutter to watch, both still come from the recorded frame.

kConnected is still frame-sourced and still only ever published as true, so a rule on it never sees a disconnect.

kProbeTemp is the fourteenth, and the only one produced by the process interface rather than by the frame path: it is published whenever a frame's PIF telemetry carries an external probe reading.

Four of the fifteen are published conditionally, and a rule on one reads kOrphaned rather than comparing against a zero: kAmbientTemp while an ambient estimate is in force, kChipTemp while the frame carries a detector reading, kProbeTemp while a frame's PIF telemetry carries a probe on an interface declared a temperature probe, and kDeliveryShare while the camera's own frame counter has given two readable frames to measure between. Each says so on its own declaration, which is the convention scripts/check_alarm_signal_producers.py enforces for the fields that are never published at all -- a reader meets the declaration, not this paragraph.

kPifFieldBase

constexpr uint16_t kPifFieldBase = 200

SignalField::kDigitalIn. For this domain index is the PIF channel index, the same number the channel's configuration carries, not a position in the list of configured channels.

kPifFieldCount

constexpr uint16_t kPifFieldCount = 6

SignalField::kDigitalIn through SignalField::kFailSafe.

A channel publishes into exactly one of these, chosen by its direction and signal type; a channel configured off publishes nothing and rules on it go kOrphaned. Digital channels arrive as 0.0 or 1.0 and only when the camera actually reported inputs, so a rule cannot read a false "low" off an Xi, which has no digital inputs at all. Analogue channels arrive already decoded into engineering units, not raw counts.

SignalField::kFlag is published while a PIF input owns the flag, and not at all otherwise, so a rule on it reads kOrphaned rather than a confident 0 -- "nothing is holding the flag" cannot be confused with "no input is configured to hold it". It is withdrawn when the input gives the flag back, and a channel switched off or taken out of the table withdraws its own signal the same way: up to 12.0.20 both kept their last value, valid, after the input was Off. It answers a different question from kFlagOpen: that one says the shutter is in the way whoever put it there, this one says the process interface is holding it. Indexed by the channel driving it, there being one flag per camera.

This comment said "SignalField::kFlag has no producer anywhere in this release" for the whole of v12's development, having been written before that producer was wired and never revisited after it. That is the second time a producer list here went stale: the first had kAmbientTemp wired while the device list went on naming it as having none, which is why scripts/check_alarm_signal_producers.py now reads the claim in both directions.

kMotionFieldBase

constexpr uint16_t kMotionFieldBase = 300

SignalField::kMotionBlobCount. For this domain index is the motion zone id.

kMotionFieldCount

constexpr uint16_t kMotionFieldCount = 3

SignalField::kMotionBlobCount through kMotionVelocity. Motion zones are evaluated on their own pass, so a zone update can re-evaluate the motion rules without walking the region rules.

kUserFieldBase

constexpr uint16_t kUserFieldBase = 400

SignalField::kValue. Application signals are told apart by index -- the slot handed out when the name was registered -- and not by field, which is why this domain has exactly one.

kUserFieldCount

constexpr uint16_t kUserFieldCount = 1

One: SignalField::kValue.

A user slot that has never been published reads invalid, so a rule on it reports kOrphaned rather than alarming on an implicit zero. Registering the name is not publishing a value.

kRegionSlotBits

constexpr uint32_t kRegionSlotBits = 20

Number of low bits of SignalId::index used for a region slot.

kRegionSlotMask

constexpr uint32_t kRegionSlotMask = (1U << kRegionSlotBits) - 1U

Masks SignalId::index down to the slot, discarding the generation.

kFirstRegionGeneration

constexpr uint32_t kFirstRegionGeneration = 1

The generation a region slot is first handed out with.

One, not zero, and this matters: at zero the first region on a camera packed to the value 0, which is also what an unfilled SignalId::index carries. "Nobody resolved this" and "the first region" were then the same 32 bits, so an unresolved region signal measured that region instead of reporting kOrphaned -- silently, and identically for a rule input and for an inhibit.

kUnresolvedRegionSlot

constexpr uint32_t kUnresolvedRegionSlot = 0

A region SignalId::index that names no region.

Because generations start at kFirstRegionGeneration, this value is unreachable by PackRegionSlot() for any live slot, so it is safe to test against.

kLegacySigmaExcludedValue

constexpr std::int16_t kLegacySigmaExcludedValue = 550

A second value the legacy ImageBuilder excludes from its sigma statistics, preserved so the two implementations agree pixel for pixel.

It is -45 C in both encodings. Nothing documents why that particular temperature is unmeasurable rather than merely cold, and it looks like a sentinel some sensor generation wrote; it is reproduced here because matching the legacy numbers is the point, not because it is defensible. See CHANGELOG.

kOptrisVendorId

constexpr uint16_t kOptrisVendorId = 0x0403

Optris USB vendor ID.

kDeviceNameKey

OTC_SDK_API const char *const kDeviceNameKey

The metadata key that carries the user's name for a camera.

A camera has a model ("PI 640i") and a serial, and neither is what an operator calls it. This is the key under which "oven inlet" lives.

kMaxDeviceMetadataKeyLength

constexpr std::size_t kMaxDeviceMetadataKeyLength = 63

Longest metadata key the SDK accepts, in bytes, excluding the terminator.

kMaxDeviceMetadataValueLength

constexpr std::size_t kMaxDeviceMetadataValueLength = 63

Longest metadata value the SDK accepts, in bytes, excluding the terminator.

A value is a label, not a document. The limit exists so that optris_sdk_device_info::name in the C ABI can hold any name the C++ API accepted, rather than silently truncating it.

Bytes, not characters, and the difference matters for anything but ASCII: 63 bytes is 63 Latin letters, about 31 in Greek or Cyrillic, and 21 Chinese or Japanese characters. An over-long value is rejected, never truncated -- cutting UTF-8 to a byte count splits multi-byte characters and produces bytes that are not valid UTF-8 at all.

kPaletteMax

constexpr int kPaletteMax = static_cast<int>(Palette::kLava)

The largest valid Palette value.

kPaletteColorCount

constexpr size_t kPaletteColorCount = 240

How many entries a palette table has.

This is 240, not 256, and it is 240 everywhere: the CSV files, the compiled-in tables and the legacy Sdk::getPaletteColors all use it. The renderer resamples to 256 when it builds a lookup table for the GPU, but that is an implementation detail of colorizing and not the shape of a palette. Prefer GetPaletteColors().size() over this constant where you can -- the point of returning a span is that a caller never has to assume a length.

kNoiseFilterMax

constexpr int kNoiseFilterMax = static_cast<int>(NoiseFilter::kWiener)

The highest valid NoiseFilter value. Anything above it is rejected rather than cast -- see ProcessingConfig::filter_mode.

kMaxColorWindows

constexpr std::size_t kMaxColorWindows = 8

How many color windows one imager may carry at once.

A fixed ceiling because both pipeline backends hold the bands in fixed-size GPU and CPU tables. Display::SetColorWindow() refuses the one past the limit rather than accepting it and drawing nothing.

kInvalidPixel

constexpr std::int16_t kInvalidPixel = -32768

The pixel value that means "this pixel could not be measured".

The same bit pattern the legacy path calls INVALIDPIXEL, read as signed here because the v12 internal encoding is int16_t.

It is not a cold pixel and it is not a bad reading: it is the absence of one. Radial distortion correction in Wide mode produces it wherever an output pixel's source falls outside the sensor -- 17380 of 110016 pixels on a G7, 15.8% of the field, by design and on every frame. Anything that averages, ranks or compares pixel values has to exclude it, or one non-measurement drags a whole statistic to -3376.8 C.

This constant used to live in auto_scale.h, which was the only file that tested for it. It is here now because it is not an auto-scale concept.

kMinFilteredPixel

constexpr std::int16_t kMinFilteredPixel = kInvalidPixel + 1

The coldest value a filter may produce, so that saturation cannot manufacture the sentinel.

pipeline/filter.cc clamps its int16 results, and clamping to INT16_MIN would let an ordinary very cold value saturate onto exactly kInvalidPixel -- after which no consumer can tell a saturated measurement from a pixel that was never measured. One unit of range is a cheaper price than an ambiguous sentinel.

kMaxEncodablePixel

constexpr std::int16_t kMaxEncodablePixel = 32767

The hottest sample the internal encoding holds -- 3176.7 C.

Named rather than spelled INT16_MAX at each use, because the number that matters about it is the temperature: anything above 3176.7 C has no spelling in this format at all, and CelsiusToInternal() saturates here rather than narrowing out of range. There is no corresponding cold saturation -- see IsEncodableTemperature().

kInvalidTemperatureC

constexpr float kInvalidTemperatureC = -3376.8F

The Celsius reading kInvalidPixel decodes to, for the buffers that hold temperatures as floats.

Nothing should display this. It exists so that the int16 -> float conversion stays total -- a NaN in a bulk pixel buffer reaches float-to-int casts in the colorizers, which is undefined behaviour rather than a visible defect -- while remaining unmistakable to IsMeasurableTemperature() below.

kAbsoluteZeroC

constexpr float kAbsoluteZeroC = -273.15F

The floor a real reading can never be at or below.

Absolute zero, deliberately, rather than the coldest calibrated range of any camera: it is the one bound that can never collide with a measurement, whatever optic or operating mode arrives later.

kFullTurnDeg

constexpr float kFullTurnDeg = 360.0F

kQuarterTurnDeg

constexpr float kQuarterTurnDeg = 90.0F

kHalfTurnDeg

constexpr float kHalfTurnDeg = 180.0F

kThreeQuarterTurnDeg

constexpr float kThreeQuarterTurnDeg = 270.0F

kIdentity3

constexpr Matrix3 kIdentity3 =
    {1.0F, 0.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F, 0.0F, 1.0F}

The transform that changes nothing; the default for every node.

kNoNode

constexpr uint32_t kNoNode = 0xFFFFFFFFU

"No child here", and the root index of an empty tree. Node links are indices into Composite::nodes rather than pointers, so this stands in for a null.

kMaxGeometryDepth

constexpr uint32_t kMaxGeometryDepth = 16

Depth and size caps. A region is a measuring area, not a CSG modeller, and an unbounded tree is an unbounded per-pixel cost on the frame thread.

kMaxGeometryNodes

constexpr uint32_t kMaxGeometryNodes = 64

Total nodes in one region's tree; see kMaxGeometryDepth.

kSplineSpanSegments

constexpr uint32_t kSplineSpanSegments = 32

How many straight pieces each span of a spline is flattened into.

A spline's containment is the containment of this polyline, not of the ideal curve, and that is the one approximation in the geometry model. It is stated as a number rather than hidden behind a flatness tolerance because the number has to be independent of the frame being measured: a closed spline is an area, and an area that got bigger on a wider sensor would be a measurement that depends on who is looking at it. A tolerance expressed in pixels does exactly that.

Thirty-two is where accuracy stops being worth paying for, measured both ways on a deliberately severe curve -- unevenly spaced control points with near-reversals, four spans across a whole frame. RegionSpline.FlatteningIsWithinAHundredthOfItsSpan reports the error and bench_region_contains the cost:

pieces   error, as a      half a pixel    cost, against a
         fraction of      at a span of    polygon of the
         its span                         same point count
    16        0.686 %            73 px               5.21x
    32        0.197 %           254 px               6.03x
    48        0.091 %           549 px               7.24x

The error falls as 1/n^2 and the cost barely rises, because the per-pixel floor is building the spans -- two square roots and a tangent pair each -- rather than testing their pieces. So the temptation is to raise it further, and the reason not to is that 254 pixels already covers every region anybody draws: a span that long on a 640-wide sensor is three control points across the whole frame, and a curve drawn with points that far apart is not the sharp one measured here. Note also which direction helps -- adding control points shortens the spans and improves the error quadratically, which is what somebody tracing a tighter curve does anyway.

A gentler curve is better than the table says, and the interpolation error of Catmull-Rom itself is a separate and usually larger term: see RegionSpline.AClosedCurveThroughPointsOnACircleSagsByTheAnalyticAmount, where six control points on a circle sit 4.1 pixels inside it however finely the spans are flattened.

kMaxSplinePoints

constexpr uint32_t kMaxSplinePoints = 64

Most control points one spline leaf may carry.

kMaxGeometryNodes exists because "an unbounded tree is an unbounded per-pixel cost on the frame thread". A spline is the same argument one level down: a polygon costs one edge test per vertex per pixel, and a spline costs kSplineSpanSegments of them per control point, so the same number of points is sixteen times the work. A polygon's vertex count is unbounded and gets away with it; a spline's would not, so it is bounded here rather than discovered on a frame thread. Sixty-four control points is a curve nobody draws by hand.

kReplayRegionIdBase

constexpr uint64_t kReplayRegionIdBase = 1ULL << 32

The first id a region added on a replay is given.

A replay has two writers of one id space: the recording, whose ids come out of the file, and the application, which may add regions of its own on the playback handle, which do survive. They must not meet, and they did: a take that drew its fourth region part way through names id 4 only in its per-frame records, so the store had no way to know id 4 was taken when the application asked for an id, handed it over, and then let the take's record rename, move and re-measure the application's region on the frame the take's fourth region appeared.

So the two spaces are separated instead of being reconciled. Every id a recording can name comes from a recorder's own counter, which starts at 1 and steps once for each region created in that session. Anything at or above a floor that counter cannot reach is therefore unnameable by any file, whatever it does: no record to read, no field to add, and it holds for files that already exist as much as for new ones.

2^32 is that floor, and the derivation is the whole justification for the number: reaching it needs four billion regions created in one recording session. At one new region on every frame of a 32 Hz take that is over four years of continuous recording, and a region per frame is already a thousand times what an application does. Ids are uint64_t, so the space above the floor is as large as the space below it and nothing is given up by starting there.

It is a partition of a number line, not a measurement: there is nothing here to re-derive from a tree, and the reasoning it rests on is written above rather than left as a magic number.

kNoRegionsFrameState

OTC_SDK_API const char *const kNoRegionsFrameState

A per-frame record that says, explicitly, that there were no regions on that frame.

The format had no way to say it. A frame the camera had no regions on carries no regions key at all -- BuildFrameState() is never called for an empty store -- and ApplyFrameState() reads an absent record as "no statement", which is the only thing it can do: a file written before the region track existed, and a frame whose metadata packet did not arrive, are absent in exactly the same way, and reading either as "there are no regions" would erase every region on the first frame of an old file.

So the statement has to come from somewhere that still knows the difference, which is the player: it has the metadata packet in hand and can tell a record with no regions in it from no record. It hands this document on in place of the one the frame did not carry, and from there it is an ordinary record travelling the ordinary path -- which is the point. The alternative was a second channel beside the record channel meaning "and now remove everything", and two channels that have to agree about the same thing are how a seek and a play-through end up disagreeing in silence.

Never written to a file by this SDK. A recorder that one day writes a region keyframe would write exactly this for "no regions", and readers already understand it.

kFrameCycleMinSteps

constexpr uint32_t kFrameCycleMinSteps = 2

The fewest steps TestPattern::kFrameCycle can cycle through. One step is a uniform field that never changes, which shows nothing.

kFrameCycleMaxSteps

constexpr uint32_t kFrameCycleMaxSteps = 8

The most steps TestPattern::kFrameCycle can cycle through. The pattern is read by eye as often as by code, and past eight steps the colours of two neighbouring steps move close enough in a palette to be mistaken for each other, which is the one thing the pattern must not allow.

kSimulatedSerialBase

constexpr unsigned long kSimulatedSerialBase = 9990000UL

Serial numbers from here up belong to simulated cameras.

Registered simulated devices are numbered kSimulatedSerialBase + n starting at 1, so the first one is 9990001 -- the serial the built-in simulated device has always reported, which is why allocation starts there rather than at a fresh block.

This is a convention, not a guarantee wrung out of the serial registry: it is a plausible-looking seven-digit number and no firmware refuses to carry it. It is documented and given a name so that the choice is visible and collisions are a decision rather than an accident. Contrast the test-only optris::testing::kFictionalSerialBase (4290000000), which is safely above anything a real camera carries but would look absurd in a device list an operator reads.

kSimulatedSerialLimit

constexpr unsigned long kSimulatedSerialLimit = 9991000UL

One past the last serial RegisterSimulatedDevice() will hand out. 999 simulated cameras is far past any use for them, and stopping rather than running on keeps the block a fixed, documented range.