ThermalCamera
public sealed class ThermalCamera : IAsyncDisposable, IDisposable
An Optris thermal camera: open it, stream frames from it, measure regions on it, and shut it down.
Lifetime. Open with one of the static factory methods and dispose when finished. Prefer await using: disposal stops the camera and waits for its threads, and doing that asynchronously keeps it off the caller's thread.
Two ways to get frames, both live at once. ThermalCamera.FramesAsync(…) pushes them at you through an IAsyncEnumerable; ThermalCamera.AcquireFrameAsync(…) lets you ask for one. Neither excludes the other, and the camera has to be started before either produces anything.
No user code runs on an SDK thread. Frames arrive on the SDK's own streaming thread; the marshalling layer copies each one into a bounded channel and returns immediately. Your await foreach body runs on a thread pool thread, so however slow it is, it is never what unblocks the camera's frame pump.
What a handler that does run on an SDK thread may call. ThermalCamera.OnRawImage(…), ThermalCamera.OnEnergyImage(…) and the shutter, motion and alarm handlers are invoked on the SDK's own threads. From inside one, every property and every measurement call on this camera is safe -- width, height, serial, radiometry, temperature range, regions and their readings, and the region, rule, palette and colour-range calls that change them. None of them can deadlock. Until v12 the first of those could hang the camera for good (now fixed), so advice from an older release to avoid the API inside a handler no longer applies.
The exceptions are the calls that stop or drain the stream, which would wait for the handler that is asking: ThermalCamera.Stop, ThermalCamera.Reconnect, ThermalCamera.ActiveOperationMode and the network-configuration write. They are refused rather than hung -- each throws, or logs and returns, naming the handler it came from. Disposing the camera from inside its own handler is the one case that cannot report itself; do it on a thread of your own.
Threading. This type is safe to use from several threads: the properties and measurement calls take the SDK's own locks. The one exception is that ThermalCamera.FramesAsync(…) is intended for a single consumer -- several enumerators over one camera compete for the same frames rather than each receiving all of them.
Example The whole shape of a program, on a camera that needs no hardware:
await using var camera = ThermalCamera.OpenSimulated( new SimulatedCameraOptions { Pattern = TestPattern.HotSpot }); using var region = Region.Rect(new Vector2(0.5f, 0.375f), new Vector2(0.4f, 0.3f)); region.Name = "middle"; ulong id = camera.AddRegion(region); // Subscribe before starting: the stream carries what is delivered // after it is subscribed, and a simulated camera renders its first // frame inside Start(). using var stopping = new CancellationTokenSource(TimeSpan.FromSeconds(5)); IAsyncEnumerable<ThermalFrame> frames = camera.FramesAsync(stopping.Token); camera.Start(); await foreach (ThermalFrame frame in frames) { using (frame) { Console.WriteLine($"{frame.MinTemperature:F1} to " + $"{frame.MaxTemperature:F1} C"); } } RegionStats stats = camera.GetRegionStats(id); Console.WriteLine($"region mean {stats.Mean:F1} C");
ThermalCamera: constants
public const int DefaultFrameBufferCapacity = 16
How many frames the push path buffers before it starts dropping.
Half a second at 32 hertz. Deep enough to ride out a garbage collection, shallow enough that a consumer which falls behind is looking at recent data rather than at a growing backlog.
public const int MaxColorWindows = 8
How many colour windows one camera may carry at once.
A fixed ceiling because both pipeline backends hold the bands in fixed-size tables. ThermalCamera.SetColorWindow(…) refuses the one past the limit rather than accepting a band it will not draw.
ThermalCamera: properties
public OperationMode ActiveOperationMode { get; set; }
The configuration the camera is in.
- Throws
SdkConfigurationException: On assignment: this camera has no such mode. Pass one fromThermalCamera.OperationModesrather than assembling one. - Throws
FeatureNotSupportedException: On assignment to a replay. A recording's operating point is a property of the file. - Throws
SdkObjectNotFoundException: On reading a replay that does not name its optic: a recording written before the SDK recorded one, one from another writer, or one made on a camera whose calibration names no optics unit. Refused rather than answered with zeroes, which would be indistinguishable from a real mode. - Throws
ObjectDisposedException: The camera has been disposed.
A replay answers the mode it was recorded at, which is how an application learns which lens a recording was made with: read OperationMode.FieldOfView together with OperationMode.FieldOfViewUnit, and OperationMode.Optics for the camera's own label. Reading this threw on every replay until the recorder started writing the optic into the file.
Set this before ThermalCamera.Start. Doing so is correct and repeatable: an Xi 400 opened on -20..100 and on 0..250 reads the same room within 0.7 K, each through its own calibration.
Changing it on a running camera costs you about thirty seconds of measurements, and the frames say so. A switch restarts the dark image and the auto-skim, which is the same start-up calibration a connect runs, and FrameMetadata.IsThermalDataReliable is false for the whole of it: measured on an Xi 410, 556 of the 557 frames after the write, over 29.9 seconds. Show the same overlay you show while a camera is connecting, from the assignment until the first frame that reports the flag set. That flag is the whole of the signal: there is no timer to run and nothing else to read.
No frame of the old mode is handed out after the assignment returns. Frames still buffered for ThermalCamera.FramesAsync(…), or still queued for ThermalCamera.AcquireFrameAsync(…) and ThermalCamera.TryAcquireFrame(…), were taken in the mode just left, the newest of them still marked reliable, and they are discarded. So the first frame after the assignment that reports the flag set is the new mode's. Assigning the mode already in force discards nothing. The same holds for ThermalCamera.TemperatureRangeExtension, ThermalCamera.HighPrecision, ThermalCamera.TemperatureRange and ThermalCamera.SetClippedWindow(…).
The readings afterwards land where opening the camera in that range lands them: about 0.7 K, re-measured at 0.16 to 0.51 K. An earlier version of this binding carried a MeasurementTrust mark here that never cleared and told the operator to close and reopen the camera. It is gone, and so is the reason for it.
A mode assembled by hand is rejected rather than approximated: a combination the calibration does not support is not a mode. Assigning one you were given cannot miss.
Changing mode restarts the video format, so ThermalCamera.Width, ThermalCamera.Height and ThermalCamera.FrameRate may change with it.
public bool AreColorWindowsSupported { get; }
Whether this source can draw colour windows at all.
- Throws
ObjectDisposedException: The camera has been disposed.
true on a camera and on an ordinary recording, which carries temperatures and is coloured by this SDK. false on a picture recording: a take written as colorized video, whose palette went into the pixels before the file was written and whose temperatures are gone. There is no temperature there for a band to select, and ThermalCamera.SetColorWindow(…) raises FeatureNotSupportedException for it.
Ask the handle; do not switch on ThermalCamera.IsPlayback. That is a different question, and answering it instead hides a feature that works. Until this was fixed every colour-window call including this one threw on a playback handle, so the only way to discover the answer was to set a band and catch, which is what having a question to ask exists to spare a caller.
public IReadOnlyList<AttachmentInfo> Attachments { get; }
Every file carried inside the recording being replayed.
- Throws
FeatureNotSupportedException: This is a live camera, which carries no file to read from. - Throws
ObjectDisposedException: The camera has been disposed.
The read side of ThermalCamera.SetAttachmentProvider(…): what your application attached as the file was written, it reads back here. The SDK's own otc-meta.json, device.json and config.json are in the list too, so telling your files from ours is a comparison on AttachmentInfo.Name.
The index only: reading a payload is ThermalCamera.ReadAttachment(…), so listing what a recording carries never copies megabytes nobody asked for.
To read a recording's attachments without replaying it (no decoder, no playback thread, no camera handle), use RecordingFile.Open(…) instead. It is the cheaper call and is what a folder listing wants.
AttachmentInfo.Sha256 is the digest the file's own index recorded, and unlike a snapshot's it is not re-verified on read: an MKV attachment is stored verbatim, so there is no decode step that could go wrong unnoticed. A file this SDK did not write carries no index and reports an empty string, which means "the file does not say".
Example
using ThermalCamera playback = ThermalCamera.OpenRecording("run.mkv"); foreach (AttachmentInfo file in playback.Attachments) { Console.WriteLine($"{file.Name} ({file.Mime}, {file.Size} B)"); }
public bool AutoShutter { get; set; }
Whether the camera closes its shutter on its own schedule.
- Throws
ObjectDisposedException: The camera has been disposed.
Switching this off is how a process that must not be interrupted avoids a shutter cycle mid-measurement, at the cost of drift, which is what the cycle exists to remove. Turn it back on, or call ThermalCamera.TriggerShutter yourself at a moment that suits.
public ulong BufferedFrameDropCount { get; }
How many frames this package dropped from its own buffer because the consumer of ThermalCamera.FramesAsync(…) fell behind.
See ThermalCamera.FramesAsync(…) for what happens when the buffer is full. This counter is never reset by ThermalCamera.ResetStatistics, which resets the SDK's counters rather than this package's.
public string CalibrationDiagnosis { get; }
Why the calibration is missing, in words, when it is. Empty otherwise.
- Throws
ObjectDisposedException: The camera has been disposed.
Names which source let this machine down -- the directory you pointed at, the camera itself, or a download that was switched off -- because on a factory PC behind a firewall that distinction is the whole of the problem.
public CalibrationStatus CalibrationStatus { get; }
Whether this camera's temperatures can be believed.
- Throws
ObjectDisposedException: The camera has been disposed.
A camera whose calibration files could not be found opens anyway, streams anyway, and reports temperatures anyway -- and they are wrong. ThermalCamera.ConnectionStatus will not tell you: the link is fine, and the link is all it reports.
Latched during the open and readable for as long as this object lives, including after the stream has stopped.
Reports CalibrationStatus.Unknown for a simulated camera, for playback and for a still, none of which has a calibration to find. It answers for all three; it does not throw.
public bool CanFocus { get; }
Whether this camera will accept a focus command right now.
- Throws
ObjectDisposedException: The camera has been disposed.
The one question most applications have, and a property rather than a comparison you write yourself because the comparison that reads naturally -- "anything but FocusCapability.Fixed" -- is wrong. It makes an unopened camera, and any model this SDK has never heard of, report that it can be focused.
public ValueTuple<Nullable<float>, Nullable<float>> ColorRange { get; }
The fixed range in force, or two nulls when the scale is automatic.
- Throws
ObjectDisposedException: The camera has been disposed.
The counterpart ThermalCamera.SetColorRange(…) did not have. It answers for whatever set the range, not only for a call to the setter: a recording made on a fixed range carries it in the file and a replay adopts it at open, so this reports it before a single frame has been drawn, which is when an application decides what to label the scale. That is the difference to watch for.
A live camera reports both ends or neither. A replay and a reopened still can report one end alone, because they hold the two separately.
Not ThermalCamera.EffectiveColorRange, which is what the last frame was actually drawn with: null before anything is drawn, and moving frame to frame under an automatic mode. This is the setting.
Example
(float? low, float? high) = playback.ColorRange; if (low is not null && high is not null) { ShowLabel($"Fixed {low:0.0}..{high:0.0} °C"); }
public ColorScaleDynamics ColorScaleDynamics { get; set; }
How fast the auto-scaled colour range is allowed to move.
- Throws
ObjectDisposedException: The camera has been disposed.
Applies in every auto scaling mode, including ColorScaling.MinMax. Has no effect while a fixed range is in force: a range you set is not an estimate to be smoothed.
This echoes what was set. What the damping did to the last frame is ThermalCamera.EffectiveColorRange.
Example
// Steadier than the default, and let it settle rather than // creep. camera.ColorScaleDynamics = ColorScaleDynamics.Default with { CloseTime = TimeSpan.FromSeconds(3), }; // Or off entirely, for a picture that must be reproducible // frame by frame. camera.ColorScaleDynamics = ColorScaleDynamics.Off;
public ColorScaling ColorScaling { get; }
How the palette's temperature range is chosen.
- Throws
ObjectDisposedException: The camera has been disposed.
Including a range that came out of a recording. This used to answer Manual only after this object's own ThermalCamera.SetColorRange(…), from a flag it kept itself, so a replay of a recording made on a fixed range, which adopts that range at open and is drawn on it, reported ColorScaling.Percentile: the default of a mode nothing had chosen. An application labelling the scale labelled it wrongly. The flag is gone and this asks the SDK.
On a replay this is the handle's scale, not the file's. Clear the range and it falls back to the automatic mode; ThermalCamera.RecordedRender still reports what the recording was made with.
public IReadOnlyList<ValueTuple<uint, ColorWindow>> ColorWindows { get; }
The colour windows in force, with the id each was set under, in ascending id, which is also the order they composite in.
- Throws
ObjectDisposedException: The camera has been disposed.
There was no reader at all before version 12, so an application could neither show the bands it had set nor confirm a write. Since the write also did nothing on a real camera, nothing could have told it so.
public string ConnectionInterface { get; }
How the camera is attached, e.g. USB, for display.
- Throws
ObjectDisposedException: The camera has been disposed.
public ConnectionStatus ConnectionStatus { get; }
What the link to the camera is doing, right now.
- Throws
ObjectDisposedException: The camera has been disposed.
Readable at any time, including before ThermalCamera.Start and after a drop. Reports ConnectionStatus.Stalled while the camera is open but no frame has arrived within the connection timeout.
Prefer ThermalCamera.OnConnectionStatus(…) if you can: polling this from a timer works, but the callback tells you the moment it happens, and a stale image on screen is a problem that gets worse with every second nobody notices it.
public TimeSpan ConnectionTimeout { get; set; }
How long without a frame before ThermalCamera.ConnectionStatus reports ConnectionStatus.Stalled.
- Throws
ArgumentOutOfRangeException: The value is zero or negative. That is not a short wait; it is a stream that is stalled before it starts. - Throws
ObjectDisposedException: The camera has been disposed.
Worth reading rather than assuming. The default is not the SDK's: it comes from this camera's saved configuration on this machine, so the same program watching the same camera model reports a stall after a different wait on a different PC. An application that wants to tell its user how long the picture has been stale has to ask.
Setting it writes nothing to disk. The saved configuration is the machine's; this is the application's, and it lasts as long as this ThermalCamera does. It is also the only lever over a camera that opens cleanly and then never delivers a frame: with the stock ten seconds, a program that re-opens on a stall waits ten seconds to find out it has to.
A simulated camera never stops delivering frames while it is open, so the value round-trips there but nothing consumes it.
public ContinuousStatistics ContinuousStatistics { get; }
Read what the rolling history has done.
public CustomPalette? CustomPalette { get; }
The custom palette in force, or null when a built-in one is.
- Throws
ObjectDisposedException: The camera has been disposed.
Reads the colours back so a legend can be drawn the same way Palettes.GetColors(…) serves the built-in palettes.
public ValueTuple<bool, float, float> DetailEnhancement { get; }
Detail enhancement as it stands: whether it is running, and the two gains.
- Throws
ObjectDisposedException: The camera has been disposed.
Reports what was accepted, not what was last written; a refused ThermalCamera.SetDetailEnhancement(…) leaves the previous setting in force and this keeps reporting that. So a settings page can show what the camera is doing instead of what the page last sent it.
On a replay or a still this answers (Enabled: false, 0, 0) rather than throwing, and that is the whole truth rather than a default standing in for something unknown: enhancement is display-only and nothing behind a file runs it, so the picture has had none applied. Contrast ThermalCamera.NoiseFilter, which still throws there, because a file does not record which filter it was made with.
public DeviceType DeviceType { get; }
The camera's model, as an enumeration.
- Throws
ObjectDisposedException: The camera has been disposed.
public TemperatureUnit DisplayTemperatureUnit { get; set; }
The unit this camera shows temperatures in, wherever the SDK itself turns a temperature into text for a person to read.
- Throws
SdkConfigurationException: The value is neitherTemperatureUnit.CelsiusnorTemperatureUnit.Fahrenheit. Nothing changes then. - Throws
ObjectDisposedException: The camera has been disposed.
That is the reading in a region's label drawn into the picture (RegionStyle.ShowLabel), on the colour image, on the GPU surface and in a snapshot's picture, and the "The scene measured... to..." line a JPEG snapshot opens with. Each is converted and rounded by Temperatures.Format(…), so a label and your own Temperatures text of the same reading agree to the last digit. In Fahrenheit a label reads "INLET 70.3F" where it read "INLET 21.3C".
Display only. It chooses the unit of this camera's own text and nothing else. The unit of every number this API takes and returns (frames, regions, alarm limits, process interface mappings, the colour range, radiation parameters, values read back from recordings) is Sdk.TemperatureUnit's, for the whole SDK, whatever this is set to. Everything written for a program to read stays in Celsius: the radiometric PNG and TIFF, the metadata in every snapshot, and log lines. A CSV snapshot keeps its own CsvOptions.TemperatureUnit.
Works on a camera, a recording and a still (a still draws no region labels, so there it is the JPEG line alone). Takes effect on the next frame drawn and the next snapshot written.
public DistortionCorrection DistortionCorrection { get; set; }
Radial distortion correction.
- Throws
ObjectDisposedException: The camera has been disposed.
Reading this is authoritative: distortion correction is a stage of the SDK's own image pipeline, not a setting held in the camera, so the mode reported is the mode being applied. Nothing outside this process can change it.
public ulong DroppedFrameCount { get; }
How many frames this source's pull queue discarded because a consumer could not keep up.
- Throws
ObjectDisposedException: The camera has been disposed.
This is the number to watch in any integration that pulls with ThermalCamera.TryAcquireFrame(…) or ThermalCamera.AcquireFrameAsync(…). It growing means frames are arriving faster than they are being taken, and the fix is on the consumer's side.
A recording and a still answer too, about their own queues. All three sources hand frames over through a fixed-depth queue that discards on overflow rather than blocking, so all three lose frames to a slow consumer. Reading this threw FeatureNotSupportedException on a recording in earlier releases, not by decision, but because it resolved its handle through the camera-only path while ThermalCamera.FrameCount beside it did not. Measured on a replay: a 240-frame recording pulled by a consumer spending 200 µs a frame, less than writing a PNG costs, delivered 50 frames and dropped 190, and no API could say so. Anything exporting a frame series from a replay should read this and refuse to claim success when it is non-zero.
It counts exactly the frames that source's own queue threw away, and nothing else, not frames the camera never sent, and not frames lost in the transport. Frames this package dropped from the buffer behind ThermalCamera.FramesAsync(…) are a different loss on a different path, counted by ThermalCamera.BufferedFrameDropCount. Two buffers, two numbers; adding them together is meaningless because a given frame can only ever be on one of the paths.
Do not read this as a health figure unless you are actually pulling frames. That queue is four frames deep and is filled on every frame whether or not anything is taking frames out of it; gating it on a first acquisition was considered and deliberately not done, so that a consumer which attaches late gets a recent frame rather than the first four of the run. The consequence is that an application taking frames through the events or the callbacks, and never calling ThermalCamera.TryAcquireFrame(…), will see this number rise by roughly one per frame for the whole session. That is the queue working as intended and is not a sign of anything wrong. It is also why there is no alarm signal for dropped frames: a rule on such a figure would fire on nearly every application.
Which frame is lost is ThermalCamera.FrameQueuePolicy, on a camera. Cumulative, and not reset by starting or stopping; ThermalCamera.ResetStatistics zeroes a camera's and is the only thing that does.
Example
Console.WriteLine($"{camera.DroppedFrameCount} dropped by the SDK, " + $"{camera.BufferedFrameDropCount} by the buffer");
public Nullable<float> EffectiveAmbientTemperature { get; }
The ambient temperature the measurement is actually using, in the SDK's temperature unit (Celsius unless Sdk.TemperatureUnit chose Fahrenheit), or null if there is not one yet.
- Throws
ObjectDisposedException: The camera has been disposed.
RadiationParameters.AmbientTemperature reports what was configured, in both modes. While RadiationParameters.EstimateAmbient is set the camera works the ambient out from its own housing probe instead, and that estimate, not the configured value, is what the measurement is based on. This property reports whichever one is in force.
Do not reproduce the estimate yourself. It is derived from the offset-corrected housing probe with a 0.1 K hysteresis, so it steps rather than drifts, and a copy of the rule will disagree with the SDK on every frame the hysteresis suppresses.
null before the first frame (the estimate comes from the housing probe, so no frame means no reading) and while estimation is off with no ambient ever configured. Show nothing rather than a default no measurement used.
Equal to the SignalField.AmbientTemperature device signal by construction: both report what arrived on the most recent frame. Read the signal to have an alarm rule watch it; read this when you just want the number.
A replay answers too. It reports the ambient the frame now standing was measured against, out of the recording's own per-frame record, so an estimate that moved while the recording ran replays as it moved. A recording written before the SDK stored that answers the file's one value instead: the ambient in force when the recording started, which is the right answer for such a file because nothing in it contradicts it. This threw FeatureNotSupportedException on every replay until the recorder started storing the ambient per frame.
Example
string shown = camera.EffectiveAmbientTemperature is float ambient ? $"{ambient:F1} °C" : "estimating…";
public Nullable<ValueTuple<float, float>> EffectiveColorRange { get; }
The temperatures the palette actually spanned on the most recent frame, or null if it has not drawn one yet.
- Throws
ObjectDisposedException: The camera has been disposed.
This is what a temperature slider displays while auto-scaling, and it is not something an application can work out for itself: under the sigma modes the range is damped across frames, so it is neither what this frame's pixels imply nor what was last requested.
null before the first frame and immediately after ThermalCamera.SetColorScaling(…), because in both states no frame has been drawn with any range. A slider should keep showing whatever it last showed rather than fall back to zero, which is why this is nullable rather than a pair that would quietly read 0–0.
public EmissivityConversionSupport EmissivityConversionSupport { get; }
Whether a reading can be re-evaluated at another emissivity on this source.
- Throws
ObjectDisposedException: The camera has been disposed.
Reports EmissivityConversionSupport.Unknown for a camera that is not open. Treat only EmissivityConversionSupport.Supported as support; anything else means ThermalCamera.TemperatureAtEmissivity(…) will refuse and the control should be hidden.
public uint FirmwareRevision { get; }
The camera's firmware revision, or zero if it does not report one.
- Throws
ObjectDisposedException: The camera has been disposed.
public float FlagRecordingOverrideDrift { get; }
The drift that overrides FlagWhileRecording.AvoidUnlessDrift, a difference in degrees of the SDK's temperature unit (kelvin-sized in Celsius, Fahrenheit-sized in Fahrenheit).
- Throws
ObjectDisposedException: The camera has been disposed.
Zero unless that policy was selected, and meaningless to the other two.
public FlagWhileRecording FlagWhileRecording { get; }
The while-recording shutter policy in force.
- Throws
ObjectDisposedException: The camera has been disposed.
Read back from what was applied. Set it with ThermalCamera.SetFlagWhileRecording(…), which needs the drift override alongside it for FlagWhileRecording.AvoidUnlessDrift and so is a method rather than a setter.
public FocusCapability FocusCapability { get; }
Whether this camera's lens can be driven at all.
- Throws
ObjectDisposedException: The camera has been disposed.
Ask this before offering a focus control. It is the only focus member that answers on every camera: ThermalCamera.SetFocus(…), ThermalCamera.FocusPosition and ThermalCamera.GetFocusRange all throw FeatureNotSupportedException on a camera with no motor. This one reports FocusCapability.Unknown on a camera that is not open rather than throwing.
Latched when the camera opens, from the same capability the refusal is decided on, so this and the calls above cannot disagree.
public string FocusDiagnosis { get; }
Why, in words: for the tooltip on a disabled focus control and for a support report. Never empty.
- Throws
ObjectDisposedException: The camera has been disposed.
public ushort FocusPosition { get; set; }
The lens position in its own step units, for repeating an exact setting.
- Throws
FeatureNotSupportedException: The camera has no motorized lens, or is not open. AskThermalCamera.CanFocusfirst and the exception never arises. - Throws
ObjectDisposedException: The camera has been disposed.
ThermalCamera.SetFocus(…) is the portable way to ask for a focus; this is for saving and restoring one exactly. The travel is ThermalCamera.GetFocusRange.
Really the motor's own steps. Before this it was whole percent under another name, so a position saved and restored did not put the lens back where it had been.
public ushort FocusTarget { get; }
The position last asked for: where the lens is heading.
- Throws
FeatureNotSupportedException: The camera has no motorized lens, or is not open. - Throws
ObjectDisposedException: The camera has been disposed.
A focus command does not wait for the lens. ThermalCamera.SetFocus(…) and the ThermalCamera.FocusPosition setter return as soon as the command is on the wire, and the motor takes seconds to cross its travel -- 1.9 s for a two-thirds traverse, measured on an Xi 400. Reading ThermalCamera.FocusPosition straight afterwards reports where the lens was, which looks exactly like the command having been ignored and makes a slider bound to it snap back under the user's hand.
Bind your control to this and it stays where the user put it; poll ThermalCamera.FocusPosition beside it and watch the lens walk there.
Do not poll for the position to equal the target. How close the lens ends up is a property of the motor, and on one of the two families measured it never reaches the number at all. An Xi 400 (serial 21074191, travel 912..3184) settles within 4 steps and jitters there, reaching equality on 4 of 4 traverses. An Xi 410 (serial 26074397, travel 1194..2903) settles within 3 steps at the near end stop but 4 to 8 steps short of the far one, never equal to it -- so a loop waiting for equality runs to its own timeout on a lens that arrived seconds earlier.
The lens has arrived when the position stops changing, not when it reaches a particular number. Read it twice a settle interval apart and compare the two readings against a small tolerance -- about 10 steps covers both families above.
The interval matters as much as the tolerance. A focus command does not take effect instantly; the lens takes a moment to start, and two reads close together both catch it stationary, which is indistinguishable from a lens that has finished. Polling every 37 ms declared arrival with the motor still running on 3 of 4 traverses on the Xi 410 and 2 of 4 on the Xi 400, as far as 2199 steps from the target. Polling every 400 ms was correct on 8 of 8 traverses across both cameras.
There is deliberately nothing that blocks until arrival and nothing that reports "moving". Blocking would freeze the caller for seconds. As for "moving": the camera reports a motion byte and on the camera measured it reads set permanently -- lens stationary, in flight, and long after arrival alike -- so exposing it would be a property that reports something it cannot determine.
Zero when nothing has been commanded since the camera opened.
public ulong FrameCount { get; }
How many frames the camera has delivered since the last reset.
- Throws
ObjectDisposedException: The camera has been disposed.
public FrameQueuePolicy FrameQueuePolicy { get; set; }
Which frame the SDK's four-deep acquisition queue loses when a pull consumer falls behind.
- Throws
FeatureNotSupportedException: This is a recording or a still. - Throws
ObjectDisposedException: The camera has been disposed.
Settable while streaming; it takes effect on the next frame and leaves what is already queued alone.
Before this existed the queue kept its first four frames for the life of the stream and refused every frame after them, so a consumer that started pulling a minute in was handed the first second of the stream and had no way to tell.
How many frames it cost you is ThermalCamera.DroppedFrameCount, which a recording and a still answer as well as a camera. This does not affect ThermalCamera.FramesAsync(…), which has a buffer of its own.
Camera only, and the asymmetry is worth knowing. A recording and a still have a pull queue of the same shape and the same overflow, but no policy: they always keep what is queued and lose the arriving frame, which is FrameQueuePolicy.DropNewest behaviour and not the FrameQueuePolicy.DropOldest a camera defaults to. So a slow consumer pulling from a running replay receives an older subset than the same consumer would get from a camera. ThermalCamera.DroppedFrameCount says how large the loss is on either. Branch on ThermalCamera.IsPlayback rather than on the exception.
Example
// A live view wants the present, and nothing else. camera.FrameQueuePolicy = FrameQueuePolicy.DropOldest;
public int FrameRate { get; }
The camera's nominal frame rate, in hertz.
- Throws
ObjectDisposedException: The camera has been disposed.
public FrameRateInfo FrameRateInfo { get; }
What rate frames arrive at, what was asked for, and why they differ.
- Throws
ObjectDisposedException: The camera has been disposed.
ThermalCamera.SubsampledFramerate answers what was asked for. This answers what is happening: "requested 15, running at 12.7 because the operation mode's sensor rate is 27 and the request was re-derived against it" is more use than either number alone.
It also answers a question FrameRateInfo.Reason cannot, in FrameRateInfo.IsExportRestricted: whether the unit is export-restricted, which holds whatever is currently limiting the rate.
The example this remark used to give, "running at 9 because this camera's CPU pipeline cannot go above that", described the 9 fps ceiling as a pipeline limitation. It is not one and never was: it is an export-law requirement that applies on every pipeline, which is the reading that was retired, together with the ClampedToPipelineLimit reason that carried it, removed at API version 30.
public uint HardwareRevision { get; }
The camera's hardware revision, or zero if it does not report one.
- Throws
ObjectDisposedException: The camera has been disposed.
public bool HasRadiation { get; }
Whether this source states the values ThermalCamera.Radiation reports, or whether they are defaults standing in for an answer.
- Throws
ObjectDisposedException: The camera has been disposed.
ThermalCamera.Radiation hands back plain numbers, so "this recording was made at an emissivity of 1.0" and "the file never said, so you are looking at the default" are indistinguishable, and 1.0 / 1.0 / 20 °C are perfectly plausible values, which is what makes guessing dangerous rather than merely untidy. Read this before you label a replay:
using var replay = ThermalCamera.OpenRecording("run.mkv"); label.Text = replay.HasRadiation ? $"ε {replay.Radiation.Emissivity:0.00}" : "emissivity not recorded";
false for a recording written by v11, for one from another writer, and for any file whose metadata is silent about the three. Every recording this SDK makes states them.
All three or nothing, deliberately: ThermalCamera.Radiation hands them back as one record and there is nothing a caller can do with a partial yes, so a file stating two of the three answers false rather than inviting the third to be believed. No writer in this SDK produces such a file.
A fact about the file, not about what is in force. Setting ThermalCamera.Radiation on a recording changes what the frames are re-derived at and does not move this; the recording still says what it says.
public bool HasSimulatedProcessInterface { get; }
Whether a simulated process interface is plugged in right now.
- Throws
ObjectDisposedException: The camera has been disposed.
public bool HasSurface { get; }
Whether a GPU surface is configured.
- Throws
ObjectDisposedException: The camera has been disposed.
public bool HasTemperatureRange { get; }
Whether this source states the range ThermalCamera.TemperatureRange reports, or whether it is a default standing in for an answer.
- Throws
ObjectDisposedException: The camera has been disposed.
ThermalCamera.TemperatureRange hands back two plain integers, so "this recording was made in −20..100 °C" and "the file never said and the default stands" are the same two numbers and different facts. This is what tells them apart, and it is the same pairing ThermalCamera.HasRadiation provides for the radiometry.
false for a v11 recording, for one from another writer, and for any file whose documents are silent about the range, and then the −20..100 °C reported is this SDK's own default and describes nothing that was recorded. Show nothing rather than a range nobody chose, and draw no scale bar against it.
A fact about the file, not about what is in force, and not moved by applying a configuration to a replay.
Example
using var replay = ThermalCamera.OpenRecording("run.mkv"); footer.Text = replay.HasTemperatureRange ? $"{replay.TemperatureRange}" : "measurement range not recorded";
public int Height { get; }
Frame height in pixels.
- Throws
ObjectDisposedException: The camera has been disposed.
public bool HighPrecision { get; set; }
Select the high-precision temperature table, where the active mode offers one. On by default, as in SDK 11.
- Throws
ObjectDisposedException: The camera has been disposed.
What it trades, precisely, because this property used to say "frame rate" and that was never true of either SDK: it trades the span of temperatures the 16-bit internal value can represent. The ordinary table encodes (T + 100) * 10 and spans -100 to +6453 C in steps of 0.1 C; the high-precision one encodes (T + 100) * 100, which is 0.01 C steps but only reaches +300 C before the table builder clamps it. That is why it is a per-range property of the calibration and not something every mode can offer -- OperationMode.SupportsHighPrecision is the camera's own answer, and of the 82 calibrated ranges across the cameras Optris tests with, four say yes. The frame rate is identical either way.
What it does not change today: the step size of the temperatures this SDK reports. The pipeline carries every thermal pixel as T*10 + 1000 in a 16-bit integer, so the finer table is built and then rounded to 0.1 C on its way in. Switching this on selects the finer table, which moves where that rounding falls and nothing else. SDK 11 reported in 0.01 C steps; reproducing that needs the pipeline's representation changed, which is tracked as its own issue.
This property cannot tell you any of that, which is why ThermalCamera.HighPrecisionState exists. Writing true succeeds and reads back true on every camera, including one whose calibration offers no finer table, so "not supported" and "supported and rounded away" are the same observation here.
And 0.01 C is the step of the encoding, not of the measurement. The SDK's per-pixel temperature is a lookup on an integer corrected detector count, so the finest difference it can distinguish between two pixels is the gap between two adjacent entries of that table. Measured over the 76 real characteristic curves on the cameras Optris tests with, each restricted to the range it belongs to and joined to the Decimal flag that decides whether a range gets the finer table at all:
- Only 4 of the 76 can use it, all -20..100 C, on 4 of 28 cameras. A figure averaged over all 76 answers a different question, because the other 72 never receive it.
- On the best of the four, one adjacent count is 0.0093 K at 100 C and 0.0274 K at -20 C, so 0.01 C exists at the top of that range and nowhere else, and a step guaranteed across the range is 0.0274 K, or 0.0772 K on the worst of the four.
- The single figure 0.0140 K is that range's mean, neither its best nor a guarantee.
So quote a statistic, never a bare number: about 0.0093 K at best, 0.0125 K typically and 0.027 K guaranteed on the best range of the best camera.
SDK 11 genuinely resolved this rather than merely printing it. Its delivered pixel carried centidegrees and its table builder stretched the energy axis to ~200 index steps per kelvin where this one uses 20, so it is a capability SDK 12 lost rather than a number SDK 11 displayed over coarser data.
Camera-wide, not per mode, for the same reason as ThermalCamera.TemperatureRangeExtension.
Changing it on a running camera restarts the startup calibration, as changing ThermalCamera.ActiveOperationMode does: wait for the first frame that reports the readings reliable, and no frame from before the change is handed out after it.
Implemented since version 12. In earlier releases, setting it to true threw.
public HighPrecisionState HighPrecisionState { get; }
Whether the finer step is actually reaching the temperatures you read, and when it is not, why not.
- Throws
ObjectDisposedException: This camera has been disposed.
Read this rather than inferring an answer from ThermalCamera.HighPrecision, which reports the request and reads back true on every camera, including those whose calibration offers no finer table and those where the pipeline rounds it away. Pairing it with OperationMode.SupportsHighPrecision gets closer and still cannot see the rounding, which is the part a caller has no other way to learn.
Answers HighPrecisionState.Unknown on a camera that is not open rather than throwing, so a status panel can show it without a connection. It still throws ObjectDisposedException once this camera has been disposed.
public bool HonoursRegionEmissivity { get; }
Whether a region's own emissivity reaches the numbers on this still.
- Throws
ObjectDisposedException: The source has been disposed. - Throws
FeatureNotSupportedException: This is a camera or a recording.
A property of the file, asked of the file that was opened. Honouring a region's own emissivity means undoing the radiometric correction already made and redoing it at a different emissivity, and both directions go through the camera's own characteristic curve. The SDK writes that curve into every still it saves from a camera that has one.
true when this still carried its curve. The region is then resolved by the same object a live camera resolves it with, so it reports what the camera that took the picture would have reported. The picture itself is never corrected (there is no pipeline here), so such a region's state is RegionEmissivityState.ReadingOnly, which is the badge to draw.
false for a still written before the curve was carried, one saved by a source that has no curve, and one whose curve cannot be inverted. The region then reads at the camera's own emissivity and RegionEmissivityState.Cameras says so. That is reported rather than absorbed because the alternative is a region that reads exactly as if it had no emissivity of its own while claiming to have one: a measurement error that looks like a working feature.
The camera's emissivity, the one every pixel in the file was computed at, is recorded either way and is what ThermalCamera.Radiation returns.
The global knob and a region's own emissivity are different arithmetic, on a still as on a camera. A region's own value is applied algebraically at measure time; the global value goes through the energy-to-temperature table. Measured on a real PI 640i from emissivity 0.95, the two agree to within 3–10% of the response: 0.40 K at 0.90, but 6.9 K at 0.50, on a correction of +40.7 K. That is the camera's behaviour reproduced, not a defect of measuring from a file, but an interface offering both should not present them as interchangeable at low emissivity.
public ulong IntervalCaptureCount { get; }
How many images the running time-lapse has written so far.
- Throws
ObjectDisposedException: The camera has been disposed.
public TimeSpan IntervalCaptureInterval { get; }
The interval actually in force, after any raise to the camera's frame period.
- Throws
ObjectDisposedException: The camera has been disposed.
TimeSpan.Zero when no time-lapse is running.
public bool IsAutoReconnectEnabled { get; }
Whether automatic reconnection is in force for this camera.
This reports the state, not the request. It reads false once the SDK has given up: after ReconnectPhase.GaveUp nothing is watching the camera, and a flag still reading "in force" was describing a request nobody was acting on, which is how an application came to show "reconnecting" forever against a camera the SDK had stopped trying to reach.
The budget running out and a handler refusing an attempt both end that way, and both are switched back on the same way, with ThermalCamera.EnableAutoReconnect(…).
public bool IsConnected { get; }
Whether a camera is open.
- Throws
ObjectDisposedException: The camera has been disposed.
This does not mean frames are arriving. A camera whose stream has stopped (because the host slept, or the link went quiet) is still open, and this still answers true. Ask ThermalCamera.ConnectionStatus whether the picture can be trusted.
public bool IsContinuous { get; }
Whether a rolling history is being written.
Independent of ThermalCamera.IsRecording, which is about a take. Both can be true at once.
public bool IsCorrectionRunning { get; }
Whether a non-uniformity correction is running right now.
- Throws
ObjectDisposedException: The camera has been disposed.
Frames produced while this is true are not reliable measurements.
public bool IsDetailEnhancementSupported { get; }
Whether this source can run detail enhancement at all.
- Throws
ObjectDisposedException: The camera has been disposed.
true whenever a pipeline backend is running, which covers a live camera on either backend and a simulated camera; false for playback, and for any other source running no backend, where ThermalCamera.SetDetailEnhancement(…) refuses a non-zero gain.
It answers rather than throwing, on every kind of handle. It threw FeatureNotSupportedException on a replay or a still in earlier releases, which contradicted the paragraph above and left applications hardcoding false rather than asking. Ask it; a false from here is a real answer.
true where the enhancement changes the picture, including on a simulated camera. That took two corrections to arrive at. It answered false for a simulated camera, which became wrong when one started running the real pipeline; it then answered true where the enhancement still reached no pixel, because enhancement is display-only and a simulated camera's picture is colorized outside the pipeline, downstream of the display buffer the enhancement writes. An earlier release carried that display buffer out to the colorizer, so the answer and the behaviour agree: a simulated camera is a fair place to check that enhancement works.
public bool IsIntervalCapturing { get; }
Whether a time-lapse is running.
- Throws
ObjectDisposedException: The camera has been disposed.
public bool IsLooping { get; set; }
Start again from the beginning when the recording ends.
- Throws
FeatureNotSupportedException: This is a live camera, which has no transport. - Throws
ObjectDisposedException: The camera has been disposed. - Throws
FeatureNotSupportedException: This is a live camera, which has no transport.
public bool IsPlayback { get; }
Whether this is a recording being replayed rather than hardware.
- Throws
ObjectDisposedException: The camera has been disposed.
Check this before showing a transport bar: every seek and speed member below throws FeatureNotSupportedException on a live camera.
Example
if (camera.IsPlayback) { ShowTransportControls(camera.PlaybackDuration); }
public bool IsPlaybackAtEnd { get; }
Whether a non-looping replay has read the recording to its end.
- Throws
FeatureNotSupportedException: This is a live camera, which has no transport. - Throws
ObjectDisposedException: The camera has been disposed.
The end of a replay, asked rather than inferred. Before this the only way to see it was to poll ThermalCamera.PlaybackPosition against ThermalCamera.PlaybackDuration, and those two never meet -- so every caller had to invent a tolerance, and a caller that waited for equality waited forever. Observed in the field: Optris Connect allowed 250 ms plus a frame period and still never saw the end of a recording shorter than three minutes.
false before playback starts, and false again after ThermalCamera.Start or any ThermalCamera.SeekTo(…): both of those are somewhere to play from. A replay with ThermalCamera.IsLooping on never turns this true, because it never ends.
ThermalCamera.Stop leaves it true, which is not an oversight: stopping halts the decode thread and leaves the recording where it is rather than rewinding, so a replay that has played out has still played out. Starting does not rewind either -- to play the recording again, ThermalCamera.SeekTo(…) TimeSpan.Zero first.
This says the file has been read out, not that nothing is left to collect. AcquireFrameAsync may still have queued frames to hand over after this turns true; drain them rather than stopping on it. A caller reading FramesAsync to completion has already had every frame by then.
Example
while (!playback.IsPlaybackAtEnd) { ShowProgress(playback.PlaybackPosition, playback.PlaybackDuration); await Task.Delay(100); } ShowFinished();
public bool IsPlaybackPaused { get; }
Whether the replay is paused.
- Throws
ObjectDisposedException: The camera has been disposed. - Throws
FeatureNotSupportedException: This is a live camera, which has no transport.
Distinct from "not running": a stopped replay is not paused, and both answer false here. Pair it with ThermalCamera.IsRunning.
public bool IsRecording { get; }
Whether a recording is running.
- Throws
ObjectDisposedException: The camera has been disposed.
public bool IsRecordingBounded { get; }
Whether the running recording has a deadline at all.
- Throws
ObjectDisposedException: The camera has been disposed.
ThermalCamera.RemainingRecordingTime is TimeSpan.Zero both for a recording that will run until it is stopped and for one whose deadline has just passed, and those are different things.
public bool IsRunning { get; }
Whether the camera is acquiring frames.
- Throws
ObjectDisposedException: The camera has been disposed.
public bool IsShutterExternallyControlled { get; }
Whether the shutter flag belongs to a process-interface input rather than to the SDK.
- Throws
ObjectDisposedException: The camera has been disposed.
true while any PIF input is configured as PifChannelKind.FlagControl (Shutter Control). The camera firmware then drives the flag from that pin, and for as long as it does:
- the SDK runs no shutter cycle of its own: no automatic cycle, whatever
ThermalCamera.AutoShuttersays, and no startup calibration cycle; ThermalCamera.TriggerShutterthrowsFeatureNotSupportedException;- every closure the interface makes is still reported through
ThermalCamera.OnShutterState(…), and still produces a correction.
So this is not "the shutter is disabled". It is "somebody else decides when", which is the point of the feature: a closure interrupts the measurement, and only the process knows when that is safe. Some customers measure a process where the video must not stop, and they shut the flag themselves in the break between two parts.
An application offering shutter controls should read this and say why they are unavailable, rather than offering a control that throws. Read it rather than inferring it from the channel table your own code sent: this answers from what was actually applied to the camera, so it cannot disagree with the behaviour, and it survives a reconnect.
false for a simulated camera: it has no interface to hand the flag to.
public bool IsShutterOpen { get; }
Whether the shutter is open right now.
- Throws
ObjectDisposedException: The camera has been disposed.
On a live camera this is constantly true and tells you nothing about the shutter. The SDK updates the value only while dispatching a frame, and it dispatches no frames during a shutter cycle, so there is no moment at which anything writes "closed".
It is kept because a recording and a simulated camera do report it, and because the answer is meaningful the instant it is asked outside a cycle. To watch the shutter use ThermalCamera.OnShutterState(…), and to ask whether the camera is mid-correction right now use ThermalCamera.IsCorrectionRunning.
public bool IsSimulated { get; }
Whether this is a simulated camera rather than a real one.
- Throws
ObjectDisposedException: The camera has been disposed.
The question ThermalCamera.SimulatedOptions and ThermalCamera.UpdateSimulatedScene(…) answer by throwing, offered on its own so a user interface can decide whether to show a scene panel without provoking an exception to find out.
public bool IsStill { get; }
Whether this is a saved still opened as a measurable source rather than a camera or a recording.
- Throws
ObjectDisposedException: The source has been disposed.
Answered by all three kinds, so it is safe to branch on without provoking an exception to find out.
public NucCycleReport LastNucCycle { get; }
What the SDK's most recent own shutter cycle measured.
- Throws
ObjectDisposedException: The camera has been disposed.
The same value the handler given to ThermalCamera.OnNucCycle(…) was passed, kept so a handler installed afterwards does not have to wait out an auto interval, three minutes on a camera running normally, to learn anything.
NucCycleReport.HasReport is false when nothing has been reported on this camera yet, which is also the answer for a simulated camera, for a recording, and for a camera whose every cycle so far was abandoned rather than decided. Reading it is not an error in any of those cases.
Survives a reconnect: the last report belongs to the camera, not to the device session. The sequence restarts at 1, because the pipeline that counts cycles is rebuilt by the reopen.
public ulong LastSeekReplayedRecords { get; }
How many region records the last seek replayed without decoding anything.
- Throws
ObjectDisposedException: The camera has been disposed. - Throws
FeatureNotSupportedException: This is a live camera or a still, as forThermalCamera.LastSeekWalkedFrames.
A seek's second cost, bounded by a different distance from ThermalCamera.LastSeekWalkedFrames, which is why there are two numbers rather than one.
The picture reaches back to the video anchor, because nothing after an anchor decodes without the frames between. The region state reaches back to wherever it was last known, which can be much further: a region's definition is written on the frame it first appeared on, so walking forward from an anchor need not contain that definition at all. The records are replayed off the metadata track to close the gap, with the video stream handed to the demuxer to skip, so the cost is the record track's and not the picture's.
A seek forward replays only the records between where the state was last known and the target, so a scrub forward costs the same per frame crossed however long the file is. A seek backward starts from the beginning of the file: a record is a delta and nothing un-applies one, so the only honest way back is forward from a known state. That makes a backward seek's cost proportional to where it lands, and it is the figure to plan a scrub against on a long recording.
public ulong LastSeekWalkedFrames { get; }
How many frames the last seek decoded without delivering them.
- Throws
ObjectDisposedException: The camera has been disposed. - Throws
FeatureNotSupportedException: This is a live camera or a still. There is no seek on either, so zero would be a number standing in for "the question does not apply".
A recording this SDK writes is not all-intra, so a seek can only start the decoder at the anchor at or before its target; the frames between are decoded and discarded, which is what makes a seek frame-accurate. This is what that cost. Zero after a seek that landed on an anchor, and zero before the first seek.
Counted, not estimated. The alternative is to assume the encoder's GOP and divide by the declared frame rate, and both of those are wrong on a file whose camera did not deliver at the rate its header claims.
For what a seek will cost, before paying for it, open a FrameIndex over the file: FrameIndex.AnchorFor(…) answers it without decoding anything. This one is how an application finds out that its prediction was wrong.
public ShutterCorrection LastShutterCorrection { get; }
What came of the most recent closure the process interface made.
- Throws
ObjectDisposedException: The camera has been disposed.
The same value the handler given to ThermalCamera.OnShutterCorrection(…) was passed, kept so a handler installed afterwards does not have to wait for the next break in the production line to learn anything.
ShutterCorrection.HasReport is false when nothing has been reported on this camera yet, which is also the answer for a camera whose flag no interface has taken, for a simulated camera and for a recording. Reading it is not an error in any of those cases.
Survives a reconnect: the count and the last report belong to the camera, not to the device session.
public LiveFrameRate LiveFrameRate { get; }
Real frames per second over the time the scene was being measured: the frame rate to show a user.
- Throws
ObjectDisposedException: The camera has been disposed.
The count ThermalCamera.MeasuredFrameRate makes, over the same window, with the shutter closures and a replay's pauses left out, so neither reads as 0 fps. A camera that stops delivering still reads 0. Answers for a live camera, the simulated camera and a recording. See LiveFrameRate.
public MeasuredFrameRate MeasuredFrameRate { get; }
The rate of frames that are actually new, measured by counting them.
- Throws
ObjectDisposedException: The camera has been disposed.
ThermalCamera.FrameRateInfo answers what the SDK intends to deliver, from configuration. This answers what happened: how many frames carrying new pixels were delivered over a recent window, how long that window was, and how many of the frames in it were repeats. A frame with FrameMetadata.IsRepeatedFrame set does not count.
Use it where FrameRateInfo.Effective describes itself as the number to divide by when budgeting work per frame. That is exactly the use a configured number is wrong for.
Answers for every source: a live camera, the simulated camera and playback are all counted in the same place. See ThermalCamera.MeasuredFrameRate for the algorithm, the window, and what each case reports.
public string Model { get; }
The camera's model name, for display.
- Throws
ObjectDisposedException: The camera has been disposed.
public Nullable<NetworkConfiguration> NetworkConfiguration { get; }
How this camera is addressed on the network, or null if it has no Ethernet interface.
- Throws
ThermalDeviceException: The camera has an Ethernet interface and its configuration could not be read. - Throws
ObjectDisposedException: The camera has been disposed.
Example
if (camera.NetworkConfiguration is { } net) { Console.WriteLine($"{net.Address}/{net.SubnetMask} " + $"streaming to {net.StreamDestination}:{net.Port}"); } else { // A USB camera. Hide the network dialog. }
public ValueTuple<NoiseFilterMode, float> NoiseFilter { get; }
The spatial noise filter in force, and its strength.
- Throws
FeatureNotSupportedException: The handle is a replay or a still. Refused deliberately rather than answered: the only value available isNoiseFilterMode.None, because that is what the player runs, and an application would read that as "this recording is unfiltered". A recording's temperatures carry whichever filter was in force when it was written and the file records no filter settings at all, soNoneover numbers that went through a 5x5 median would be a wrong answer presented as a measurement. UseThermalCamera.IsNoiseFilterSupported(…)to decide whether to offer the control; it answersfalsewithout throwing. - Throws
ObjectDisposedException: The camera has been disposed.
Authoritative: it reports what was last accepted, and a rejected selection is never accepted, so this cannot name a filter the camera is not running. There was no reader at all before version 12; an application could not discover which filter it had selected, which is what made the two meanings of the old int undiscoverable.
public IReadOnlyList<OperationMode> OperationModes { get; }
Every configuration this camera supports.
Returns: The modes, in the order the camera reports them.
- Throws
ObjectDisposedException: The camera has been disposed.
A mode is a whole operating point (optics, temperature range, resolution and frame rate together), and they cannot be mixed freely. This is what a settings dialogue populates itself from.
A replay reports the one mode it was recorded at, not the list the camera offered; no file carries that, and a recording cannot be replayed at another operating point. It reports an empty list for a recording that does not name its optic: one written before the SDK recorded it, one from another writer, or one made on a camera whose calibration names no optics unit. So an empty list is not a failure, and code that treats it as one will be wrong about a recording.
Example
foreach (OperationMode mode in camera.OperationModes) { Console.WriteLine(mode); } // Pick one you were given. camera.ActiveOperationMode = camera.OperationModes[2];
public string OutputDirectory { get; set; }
Where snapshots and recordings go when whatever started them did not name a directory.
- Throws
ArgumentException: On set: the value is null or empty. - Throws
ObjectDisposedException: The camera has been disposed.
An alarm rule carrying a snapshot or recording action is the usual case: it fires on the camera's own thread and has no caller to ask where to put the file.
public bool OverlayCompositing { get; set; }
Whether the SDK draws the region outlines into the colour image it delivers.
- Throws
ObjectDisposedException: The camera has been disposed.
Where the picture is made decides whether outlines are drawn:
- A camera whose picture is made on the graphics card (a GPU backend) draws them unless this is set to
false, and leaves them out while an orientation is set. - A camera on the CPU pipeline, the simulated camera and a recording draw them only once this has been set to
true. Until then the getter readstrueand no outlines are drawn.
To draw them yourself at display resolution, set it to false and call ThermalCamera.CompositeOverlays(…), which does not scale up from the thermal frame's size. Whether a saved picture has outlines in it is SnapshotRender.Overlays. Before v12 there was no getter at all and an application had to cache what it wrote.
public Palette Palette { get; set; }
The colour map applied to the picture.
- Throws
ObjectDisposedException: The camera has been disposed.
Display only. No palette has ever changed a measured temperature, on any backend.
public PipelineInfo PipelineInfo { get; }
What the SDK chose for this camera, and why: the processing pipeline, the GPU adapter it computes on, and the streaming backend carrying its frames.
- Throws
ObjectDisposedException: The camera has been disposed.
Read it after the camera is open. See PipelineInfo for what is in it and when each field is filled in.
public bool PlaybackCanChangeRadiation { get; }
Whether this recording's global radiation can be changed and have it reach the delivered pixels.
- Throws
ObjectDisposedException: The camera has been disposed. - Throws
FeatureNotSupportedException: This is a live camera.
Ask this rather than writing the emissivity to find out: a user interface wants to grey the slider out, and an exception is a poor way to discover that. The answer is fixed when the file is opened.
True when the recording carries a radiometry bundle that reproduces the characteristic curve the file also carries. The energy each stored temperature came from is then recovered through that curve and read back out of a table rebuilt at the new value -- the table the camera itself would have built -- so the global knob on a replay is the same knob as on a camera. It costs the stored tenth of a kelvin and nothing else: measured, 0.20 K at emissivity 0.90 and 0.30 K at 0.50.
False for a recording written before the bundle was carried, for one from a camera with no characteristic curve, and for one whose bundle does not reproduce its own curve. Writing the emissivity then throws FeatureNotSupportedException.
Says nothing about a region's own emissivity, which goes through the curve alone and needs no bundle -- ThermalCamera.PlaybackHonoursRegionEmissivity is that question.
public TimeSpan PlaybackDuration { get; }
How long the recording is.
- Throws
FeatureNotSupportedException: This is a live camera, which has no transport. - Throws
ObjectDisposedException: The camera has been disposed.
public bool PlaybackHonoursRegionEmissivity { get; }
Whether a per-region emissivity reaches that region's numbers on this recording.
- Throws
ObjectDisposedException: The camera has been disposed. - Throws
FeatureNotSupportedException: This is a live camera.
Honouring a region's own emissivity means undoing the correction at the camera's value and redoing it at the region's, and both directions go through the camera's characteristic curve. A recording holds finished temperatures, so that curve is the one thing needed to invert them.
The picture is never corrected either way. A replay runs no pipeline backend, so there is nothing to apply a per-region emissivity map in; such a region reports RegionEmissivityState.ReadingOnly to say exactly that, and a refresh after changing it moves the region's statistics and not one pixel. Read the state rather than assuming the image agrees with the number beside it.
False for a recording written before the curve was carried and for one from a camera that has none. The region then reads at the camera's own emissivity and RegionEmissivityState.Cameras says so.
public uint PlaybackPart { get; }
Which part of a multipart recording is playing, counting from 0 -- the number in the file's _partNNN suffix. Added in 12.0.10.
- Throws
FeatureNotSupportedException: This is a live camera, which has no transport. - Throws
ObjectDisposedException: The camera has been disposed.
For a recording opened with ThermalCamera.OpenRecordingSeries(…). 0 for one opened with ThermalCamera.OpenRecording(…), which holds a single file.
public uint PlaybackPartCount { get; }
How many parts this replay holds: 1 for a single file. Added in 12.0.10.
- Throws
FeatureNotSupportedException: This is a live camera, which has no transport. - Throws
ObjectDisposedException: The camera has been disposed.
public TimeSpan PlaybackPosition { get; }
How far into the recording we are, measured from its first frame.
- Throws
FeatureNotSupportedException: This is a live camera, which has no transport. - Throws
ObjectDisposedException: The camera has been disposed.
An offset into the file -- the same thing ThermalCamera.SeekTo(…) takes -- so it is always between TimeSpan.Zero and ThermalCamera.PlaybackDuration, for every seek target this API accepts. It is not how to see that a recording has played out, which this said until This is the last frame's start and ThermalCamera.PlaybackDuration counts that frame's own length as well, so the two stand one frame period apart on a correct file and never meet. ThermalCamera.IsPlaybackAtEnd is that question. It is not the replayed frame's capture stamp (ThermalFrame.Timestamp), which counts from an epoch belonging to the transport the recording was made on. Reporting that instead was a defect: a four second file answered with days.
Example
double fraction = playback.PlaybackDuration > TimeSpan.Zero ? playback.PlaybackPosition / playback.PlaybackDuration : 0.0;
public float PlaybackSpeed { get; set; }
How fast the recording is replayed.
- Throws
ArgumentOutOfRangeException: On set: the value is not positive. - Throws
ObjectDisposedException: The camera has been disposed. - Throws
FeatureNotSupportedException: This is a live camera, which has no transport.
public Nullable<DateTimeOffset> PlaybackStartedAt { get; }
When the recording started, as a date.
- Throws
FeatureNotSupportedException: This is a live camera, which has no transport. - Throws
ObjectDisposedException: The camera has been disposed.
For a recording made from a camera, when the recording began, to the second. For one converted from a PIX Connect .ravi with Ravi.ImportAsync(…), when the original was recorded, not when it was converted. For a multipart recording, when its first part began.
Add ThermalCamera.PlaybackPosition for the wall-clock time of the frame on screen.
public RecordingTimeZone? PlaybackTimeZone { get; }
The time zone the recording was made in, beside the UTC start ThermalCamera.PlaybackStartedAt gives, or null when the recording does not say.
- Throws
FeatureNotSupportedException: This is a live camera. - Throws
ObjectDisposedException: The camera has been disposed.
The recording computer's zone for a recording of a camera; the one given (or, marked RecordingTimeZone.Assumed, the one taken) at conversion for one converted from a PIX Connect .ravi. null for a recording made by an SDK release before this existed, or by another program. PlaybackStartedAt?.ToOffset(zone.UtcOffset) is the start as the clock in the room read it.
public PreRollState PreRoll { get; }
What the pre-roll buffer is actually doing: whether it is on, the duration in force, and how deep the ring really is.
- Throws
ObjectDisposedException: The camera has been disposed.
Worth reading rather than assuming. A duration below the camera's frame period is raised to one frame, and a depth past ThermalCamera.PreRollMemoryBudget is cut to fit, so what is in force is not always what was asked for.
To decide whether the buffer is full, read PreRollState.HoldsDuration rather than comparing PreRollState.Buffered with PreRollState.Frames: on a camera that delivers fewer frames than its sensor's rate that comparison is never true, however long the buffer is armed.
public ulong PreRollMemoryBudget { get; set; }
How much memory the pre-roll buffer may use. 512 MiB by default.
- Throws
ObjectDisposedException: The camera has been disposed.
Every buffered frame is a full copy of the pixel data, so a long pre-roll on a large sensor is measured in gigabytes: sixty seconds of a 640x480 sensor at 32 Hz is about 1.2 GB. The depth is cut to the budget rather than the request refused; ThermalCamera.PreRoll reports what survived. Setting it takes effect on the next ThermalCamera.EnablePreRoll(…). Zero means no cap.
public TimeSpan ProcessingLatency { get; }
How long the most recent frame took from capture to delivery.
- Throws
FeatureNotSupportedException: Always. The SDK does not measure processing latency. - Throws
ObjectDisposedException: The camera has been disposed.
Always throws FeatureNotSupportedException in this release, and never returns a value. The SDK does not measure processing latency. The measurement was withdrawn rather than never written: v11 had this call, and it returned a hardcoded zero on every camera, live or simulated.
It throws instead of returning TimeSpan.Zero on purpose. A caller who measures latency and is handed a zero concludes that latency is zero, which is wrong in the direction that looks like good news and cannot be detected from the outside. An exception says "we do not measure this", which a caller can act on. The property stays declared, so code written against it still compiles; it just cannot succeed, and any caller must either guard it or not read it.
To measure delivery latency now, compare a frame's FrameMetadata.Timestamp against your own clock when the frame arrives.
public RadiationParameters Radiation { get; set; }
The parameters that turn what the sensor measures into a temperature.
- Throws
ObjectDisposedException: The camera has been disposed.
Setting this applies every field, so change what you mean to change from the current value rather than building one from scratch; a with expression is the natural way. Takes effect on the next frame.
Example
camera.Radiation = camera.Radiation with { Emissivity = 0.95f };
public RadiationSources RadiationSources { get; }
Which of the radiation parameters in force this application owns, and which a process-interface input is driving.
- Throws
ObjectDisposedException: The camera has been disposed. - Throws
FeatureNotSupportedException: This is a replay or a still. Neither has a process interface, so there is no question to answer about them, and reportingRadiationParameterSource.Sdkwould be a value standing in for "does not apply".
See ThermalCamera.RadiationSources for when the answer changes, with the channel table, not with each sample, so reading it once after configuring the process interface is enough.
Example
RadiationSources sources = camera.RadiationSources; emissivityBox.IsReadOnly = sources.Emissivity == RadiationParameterSource.Pif;
public RecordedFlagPolicy? RecordedFlagPolicy { get; }
What a recording says its shutter was told to do while it was written.
- Throws
ObjectDisposedException: The camera has been disposed.
The property to read before trusting a recording's numbers. For a playback handle; ThermalCamera.ShutterDeferral is the live camera's equivalent.
null when the recording declares no policy, which for this metadata means the shutter was not held back: the block is omitted entirely at the default policy. Every recording written before the setting existed is in that position, and for those files it is also the truth.
public RecordedRender? RecordedRender { get; }
How this recording's picture was drawn, as the file records it, or null when the file does not say.
- Throws
FeatureNotSupportedException: This is a live camera, which was not recorded. - Throws
ObjectDisposedException: The camera has been disposed.
The palette and the two ends of the colour scale, which are not recoverable from the pixels. Under the automatic modes the range is filtered over time, so it is not even what the frame's own pixels imply: the file is the only place it can be read from.
This is what the recording was made with. What the replay is drawing with now is ThermalCamera.Palette, ThermalCamera.ColorRange and ThermalCamera.ColorScaling. They agree when the recording opens (a replay adopts the file's palette and scale), and stop agreeing the moment the application changes either. An interface showing "recorded on 15..130 °C" beside what is on screen needs both.
null means the file carries no render metadata at all, which is every recording written before it existed. That is distinguishable from a file that says something unhelpful, and both are distinguishable from the SDK's own defaults, which is the point of the call.
Example
RecordedRender? made = playback.RecordedRender; if (made?.IsFixedRange == true) { ShowLabel($"Recorded on {made.RangeMinimum:0.0}" + $"..{made.RangeMaximum:0.0} °C"); }
public RecordingStatistics RecordingStatistics { get; }
What the current, or last, recording did with its frames.
- Throws
ObjectDisposedException: The camera has been disposed.
Reset when a recording starts and kept after it stops. Without it a recording that has silently stopped growing looks exactly like a healthy one: ThermalCamera.IsRecording stays true while every frame is refused.
Example
camera.StopRecording(); RecordingStatistics stats = camera.RecordingStatistics; Console.WriteLine( $"{stats.FramesWritten} frames written, {stats.FramesLost} lost");
public string ReferenceCorrectionDiagnosis { get; }
Why this source cannot be corrected, in words, when it cannot.
- Throws
ObjectDisposedException: The camera has been disposed.
public ReferenceCorrectionSupport ReferenceCorrectionSupport { get; }
Whether this source can be corrected against a reference body.
- Throws
ObjectDisposedException: The camera has been disposed.
Reports ReferenceCorrectionSupport.Unknown for a camera that is not open. Treat only ReferenceCorrectionSupport.Supported as support; anything else means the control should be hidden.
public int RegionCount { get; }
How many regions the camera holds.
- Throws
ObjectDisposedException: The camera has been disposed.
public bool RegionEmissivityInFrames { get; }
Whether the temperatures the SDK is handing out already carry each region's own emissivity.
- Throws
ObjectDisposedException: The camera has been disposed.
This is not RadiationParameters.EmissivityAffectsImage read back. That property is what was asked for and reads back as it was set; this is what happened. The two differ because the answer also depends on whether any region actually carries an emissivity of its own and on whether the pipeline behind this source has an image-side path at all: three things an application cannot see between them.
Use it to decide whether to call ThermalCamera.TemperatureAtEmissivity(…) on a value you sampled yourself. Region statistics never need it: those are corrected either way. Both mistakes are silent: correcting again moves a temperature that was already right, and not correcting reports the scene's number where the region reports its own, in the same picture.
public TimeSpan RemainingRecordingTime { get; }
How much of a time-limited recording is left to run.
- Throws
ObjectDisposedException: The camera has been disposed.
TimeSpan.Zero when nothing is recording, or the recording has no time limit.
public SegmentLimitAction SegmentLimitAction { get; set; }
What a recording does when it reaches its segment limit, RecordingOptions.MaxSegmentBytes or RecordingOptions.MaxSegmentDuration. Added in 12.0.10.
- Throws
FeatureNotSupportedException: This is a recording or a still, which records nothing. - Throws
ObjectDisposedException: The camera has been disposed.
SegmentLimitAction.ContinueSeries, the default, carries on in the next part of the same recording, which ThermalCamera.OpenRecordingSeries(…) replays as one. SegmentLimitAction.StartNewRecording ends the recording and starts a new one, named with its own start time. SegmentLimitAction.StopRecording (12.0.28) ends the recording at the limit, with RecordingStopReason.SegmentLimit.
Applies to every recording started after it is set, by the application or by an alarm rule, and has no effect on a recording with no segment limit.
Example
camera.SegmentLimitAction = SegmentLimitAction.StartNewRecording; camera.StartRecording("run.mkv", new RecordingOptions { MaxSegmentBytes = 2_000_000_000, });
public int SensorHeight { get; }
The detector's own height, before any orientation.
- Throws
ObjectDisposedException: The source has been disposed.
See ThermalCamera.SensorWidth.
public int SensorWidth { get; }
The detector's own width, before any orientation.
- Throws
ObjectDisposedException: The source has been disposed.
ThermalCamera.Width reports what is delivered, which a quarter turn swaps. This reports what the hardware (or, on a file, the stored frame) actually is.
public string Serial { get; }
The camera's serial number.
- Throws
ObjectDisposedException: The camera has been disposed.
public ShutterDeferral ShutterDeferral { get; }
What the while-recording shutter policy is doing, and what it has cost so far.
- Throws
ObjectDisposedException: The camera has been disposed.
The honest half of ThermalCamera.FlagWhileRecording. A suppressed shutter cycle changes nothing else an application can see (the stream has no gap and the temperatures still look like temperatures), so without this a degraded recording is indistinguishable from a good one from inside the process making it.
Read ShutterDeferral.PolicyInForce first: it is false whenever the setting cannot act, including while ThermalCamera.IsShutterExternallyControlled is true, where the policy is moot rather than working.
Example
ShutterDeferral held = camera.ShutterDeferral; if (held.IsDeferring) { ShowWarning($"flag suppressed, drift " + $"{held.DriftCelsius:0.00} °C"); }
public float ShutterDriftThreshold { get; }
How far an internal temperature probe may drift before a correction is due, a difference in degrees of the SDK's temperature unit (kelvin-sized in Celsius, Fahrenheit-sized when Sdk.TemperatureUnit chose Fahrenheit).
- Throws
ThermalDeviceException: No camera is open. The engine reports a zero threshold then, and zero is not a threshold a camera can run, so it is refused as an answer rather than passed on. - Throws
ObjectDisposedException: The camera has been disposed.
Authoritative rather than remembered, for the reason ThermalCamera.ShutterInterval gives: the schedule is the SDK's own and never leaves this process, so what the SDK holds is what is being applied.
Set it with ThermalCamera.SetAutoCorrection(…), which is the only way to write it. Until this property existed the threshold could be set and never read, so a settings page could show only the last value it had written and could not tell when that stopped being true.
It starts at 0.1 K on every open: the per-serial configuration archive stores no threshold, so nothing carries it over from the last session. Compared as strictly greater than, against whichever of the camera's box, chip and flag probes has moved furthest since the last correction, and only once the minimum of ThermalCamera.ShutterInterval has elapsed.
public Nullable<bool> ShutterForecast { get; set; }
Compensate for the dark offsets drifting between shutter cycles. On by default.
- Throws
ObjectDisposedException: The camera has been disposed.
A dark reference describes the detector at the instant it was taken. Between corrections the detector keeps moving, so the reference goes stale and the temperatures drift with it, by 2.4 to 2.6 K on a PI 400 measured between two cycles, and more the longer the interval is. With this on, the SDK measures how fast each pixel's offset is moving and walks the applied offset towards where the next reference is predicted to be, so a frame taken halfway between two corrections is corrected for roughly half the drift instead of none of it.
It learns only from shutter cycles taken once the detector has settled, starts at the third of those, ignores pixels whose predicted drift is under three sensor counts, and resets when the converter working point or the calibration changes.
This is not a warning that a cycle is about to happen. This property was documented as letting "an application pause rather than record frames it will have to discard", which described a feature the SDK does not have. It does not change when a correction happens; it changes what the offsets do in between. To be told about a cycle, use ThermalCamera.OnShutterState(…).
Reading this used to return null always, because the setter was an empty stub and there was no state to report. The property stays nullable so that it can still say "not known" if a future camera cannot answer, but on every camera today it answers.
public ValueTuple<TimeSpan, TimeSpan> ShutterInterval { get; set; }
How long the camera waits between automatic shutter cycles.
- Throws
ArgumentException: The minimum is longer than the maximum and the maximum is aboveTimeSpan.Zero. - Throws
ObjectDisposedException: The camera has been disposed.
A maximum of TimeSpan.Zero is "no ceiling", and it is the default. It is what a camera nobody configures reports: every real-camera open reads back (00:00:12, 00:00:00). So what this property returns can always be assigned straight back to it. Nothing then forces a correction on time alone: a detector drifting more slowly than the drift threshold is never re-referenced, which is inherited behaviour rather than a choice, and a process that needs a guaranteed interval has to set one.
A minimum of TimeSpan.Zero switches the drift arm off, so only the ceiling starts a cycle. Both at zero means no automatic cycle at all, although ThermalCamera.AutoShutter still reads true: the schedule is on and neither arm can fire.
An inverted pair with a real ceiling, such as 90 s against 9 s, is refused. It runs a fixed 9-second timer and never consults drift, because the smaller of the two wins.
Reading this is authoritative rather than remembered. The automatic shutter is scheduled by the SDK against its own clock, not by the camera, so the interval reported here is the interval being applied; it cannot be made stale by a camera restart or by another client, because the schedule never leaves this process.
The camera's own autonomous shutter schedule, which lives in the camera and survives a power cycle, is a different setting on a different set of devices and is not exposed here.
public SimulatedCameraOptions SimulatedOptions { get; }
What this simulated camera is currently drawing.
- Throws
FeatureNotSupportedException: This is a real camera. - Throws
ObjectDisposedException: The camera has been disposed.
Every property comes back resolved to what the camera is actually doing, so read-modify-write works: take this, change a scene property, pass it to ThermalCamera.UpdateSimulatedScene(…).
Example Move a running virtual camera onto a hot spot:
var scene = camera.SimulatedOptions; scene.Pattern = TestPattern.HotSpot; scene.HotSpotRadius = 15; camera.UpdateSimulatedScene(scene);
public bool SizeOfSourceCorrection { get; set; }
Size-of-source correction: whether the halo of stray flux around a hot target is subtracted back out of the signal.
- Throws
ObjectDisposedException: The camera has been disposed.
On by default, matching version 11.
This is the switch, not the outcome. Switching it on is not enough to change a pixel: the gate and the magnitude are separate, and ThermalCamera.SizeOfSourceStrength defaults to zero, which is an exact identity. ThermalCamera.GetPictureCorrection reports which of those is the case.
public float SizeOfSourceStrength { get; set; }
How much of the received signal arrives via the size-of-source halo, as a fraction.
- Throws
ObjectDisposedException: The camera has been disposed.
0 subtracts nothing; 0.95 is the most the pipeline will attempt. Values outside that range are clamped, not refused, so reading this back gives what the pipeline is using and not necessarily what was assigned.
Zero by default, and that is the only honest default: the correction table ships normalized to unit sum, so it describes the shape of the halo and carries no magnitude at all, and no calibration document the SDK has shipped supplies one. It has to be measured for a camera and its optics. Until it is, the correction is an exact identity however ThermalCamera.SizeOfSourceCorrection is set.
public string StillMetadataJson { get; }
The whole metadata document the file carries, as JSON.
- Throws
ObjectDisposedException: The source has been disposed. - Throws
FeatureNotSupportedException: This is a camera or a recording.
The pixel scale, the scene statistics, the capture telemetry, the regions the writer recorded and anything it merged in: the same document Snapshot.MetadataJson hands back for a file that is not open as a source. It is the way to reach the parts of the metadata this binding does not model as properties, including the recorded region list.
It is also where the recorded render lives on a still: what the colours meant when the picture was taken, in the document's render block. ThermalCamera.RecordedRender answers for a recording only.
public string StillPath { get; }
The file this still was opened from.
- Throws
ObjectDisposedException: The source has been disposed. - Throws
FeatureNotSupportedException: This is a camera or a recording.
public float StillRedeliveryRate { get; set; }
How often a running still re-delivers its one frame, in hertz.
- Throws
ObjectDisposedException: The source has been disposed. - Throws
FeatureNotSupportedException: This is a camera or a recording. - Throws
SdkConfigurationException: The rate is outside 0.1 to 120. The rate in force is unchanged: a zero would be a thread that never delivers, which from outside is indistinguishable from a wedged source.
A still has exactly one frame and that frame never changes, but a running source re-delivers it as a camera pointed at an unchanging scene would. That is what lets code written against a camera run unchanged, and what lets a region moved after ThermalCamera.Start be measured without anything being restarted.
This is not ThermalCamera.FrameRate, which reports what the device recorded.
public float SubsampledFramerate { get; set; }
Deliver fewer frames than the camera sends.
- Throws
ArgumentOutOfRangeException: The value assigned is negative. - Throws
ObjectDisposedException: The camera has been disposed.
Reports the request, which is the setting as a settings page should show it. It is clamped to the sensor's rate before it is reported, so it never names a rate no frame will arrive at; it used to survive an operation-mode change unchanged and could sit above the new mode's rate indefinitely.
This is still not a measurement of what is delivered. Subsampling is done by the SDK dropping frames on the host and the camera keeps streaming at its native rate. On an export-restricted camera the delivered rate never exceeds 9 fps, on any pipeline, whatever is set here: that ceiling is a legal requirement and cannot be raised. For what is actually arriving, and why, read ThermalCamera.FrameRateInfo.
public TemperatureRange TemperatureRange { get; set; }
The temperature range this source is measuring in.
- Throws
SdkConfigurationException: On set: the camera does not support that range. CheckThermalCamera.GetAvailableTemperatureRangesfirst. - Throws
FeatureNotSupportedException: On set: this is a recording or a still. A different range is a different calibration, and the file carries only the one it was made in. - Throws
ObjectDisposedException: The camera has been disposed.
Setting this restarts the camera's calibration, so frames stop for a moment and the first ones afterwards may arrive with FrameMetadata.IsFlagOpen false.
A recording and a still answer too, with the calibrated range the file was made in: the range every temperature in it belongs to, and the one a scale bar over a replay has to be drawn against. Reading this threw FeatureNotSupportedException on a replay until an earlier defect, which left a client with the range as 0..0 and a tile falling back to its slider's default: a recording made in a 150..900 °C range drawn on a −20..100 °C scale that none of its own temperatures fit.
A file that states no range at all (a v11 recording, or one from another writer) reports −20..100 °C, the SDK's own default. Every recording this SDK makes states it. ThermalCamera.HasTemperatureRange is what tells the two apart; test it before you draw a scale bar or label a replay.
Example
TemperatureRange wanted = camera.GetAvailableTemperatureRanges() .First(r => r.Maximum >= 250); camera.TemperatureRange = wanted;
public bool TemperatureRangeExtension { get; set; }
Show a scene past the active temperature range. Not a measuring range -- the extended part is outside the calibration and reads with poor precision.
- Throws
ObjectDisposedException: The camera has been disposed.
It exists so the field of view can be aimed, and so a visual check is possible, on a camera whose range has a high lower limit: a 150..900 C range typically extends down to 20 C, which is what lets a room-temperature scene be seen while in it. Use it to point the camera, not to measure.
Camera-wide, not per mode. The request is recorded whether or not the mode you are in can act on it, so switching it on and then selecting an extendable mode works. Whether it is in force right now is this property together with OperationMode.IsExtendable, and how far it reaches is OperationMode.ExtendedMinimumTemperature and OperationMode.ExtendedMaximumTemperature.
This switch does not change what a mode calls itself. OperationMode.MinimumTemperature and OperationMode.MaximumTemperature are the calibrated limits whatever this is set to, so every record the SDK hands out stays assignable. They used to report the limits in force, which gave an extendable mode a second identity that no lookup accepted, and OperationMode.MinimumTemperature for the composition that gives you the limits in force.
A mode that cannot be extended is left exactly as it was, including the 25 K accommodation band above and below its calibrated range. Switching the extension on used to delete that band at any end that could not extend.
Nothing marks a pixel, a frame or a region statistic as being outside the calibrated range. The SDK does not report that; an application that wants to show it has to compare against the mode's own limits.
Changing it on a running camera restarts the startup calibration, as changing ThermalCamera.ActiveOperationMode does: wait for the first frame that reports the readings reliable, and no frame from before the change is handed out after it.
Implemented since version 12. In earlier releases, setting it to true threw, because the switch reached an empty stub; earlier still it succeeded and changed nothing.
public float TemporalSmoothing { get; set; }
Temporal smoothing, from 0 to 1. Lower is smoother and slower to respond; 1 disables it.
- Throws
ObjectDisposedException: The camera has been disposed.
Averages each pixel with its own recent history, so it also changes reported temperatures.
Reading this is authoritative and answers before anything has been written: temporal smoothing is a stage of the SDK's own pipeline rather than a setting held in the camera, and the value reported on a camera nobody has configured is the one both pipelines start from. Nothing outside this process can change it.
The value survives a change of filter. Every mode other than NoiseFilterMode.Temporal ignores it rather than clearing it, so this reports what temporal smoothing would resume at.
There was no getter in earlier releases, so a settings page could show only what it had itself last written, wrong after any path that reopens the device without going through it.
public int Width { get; }
Frame width in pixels.
- Throws
ObjectDisposedException: The camera has been disposed.
public AlarmState WorstAlarmState { get; }
The worst alarm state across every rule on this camera.
- Throws
ObjectDisposedException: The camera has been disposed.
One value for a status light: if anything is alarming, this says so, without the caller walking every region.
Example
if (camera.WorstAlarmState == AlarmState.Active) { SoundTheAlarm(); }
ThermalCamera: methods
public void AcknowledgeAlarm(ulong ruleId)
Release a rule's latch.
-
ruleId: Which rule. -
Throws
ObjectDisposedException: The camera has been disposed.
If the condition still holds the alarm stays active and the latch re-arms. Acknowledging a ringing alarm never silences it.
public void AcknowledgeAllAlarms()
Release every latch, with the same rule as above.
- Throws
ObjectDisposedException: The camera has been disposed.
public Task<ThermalFrame> AcquireFrameAsync(CancellationToken cancellationToken = default)
Wait for the next frame.
cancellationToken: Stops waiting.
Returns: The next frame. Dispose it -- it holds native memory.
- Throws
OperationCanceledException:cancellationTokenwas cancelled. This is not an error; it is what you asked for. - Throws
InvalidOperationException: The camera is not streaming. CallThermalCamera.Startfirst. - Throws
ObjectDisposedException: The camera has been disposed.
This is the path to use when you want to control the pace -- process a frame, then ask for the next -- rather than being pushed frames and dropping the ones you cannot keep up with.
The wait happens on a thread pool thread, in short slices, so cancellation takes effect promptly rather than only when the next frame arrives.
Example
camera.Start(); using var stopping = new CancellationTokenSource(TimeSpan.FromSeconds(5)); while (!stopping.IsCancellationRequested) { using ThermalFrame frame = await camera.AcquireFrameAsync(stopping.Token); Process(frame); // as slowly as we like: nothing is dropped }
public Task<ThermalFrame> AcquireFrameAsync(TimeSpan timeout, CancellationToken cancellationToken = default)
Wait for the next frame, giving up after a while.
timeout: How long to wait before deciding the camera has stopped producing.cancellationToken: Stops waiting.
Returns: The next frame. Dispose it.
- Throws
ArgumentOutOfRangeException:timeoutis negative. - Throws
OperationCanceledException:cancellationTokenwas cancelled. - Throws
FrameTimeoutException:timeoutelapsed with no frame. - Throws
InvalidOperationException: The camera is not streaming. CallThermalCamera.Startfirst. - Throws
ObjectDisposedException: The camera has been disposed.
A timeout and a cancellation are different things and are reported differently. Cancellation is what you asked for; a timeout means the camera stopped producing, which is a fault.
Example
try { using ThermalFrame frame = await camera.AcquireFrameAsync(TimeSpan.FromSeconds(2), token); } catch (FrameTimeoutException) { Console.Error.WriteLine("the camera has stopped"); }
public IAsyncEnumerable<ActionCompleted> ActionCompletedAsync(CancellationToken cancellationToken = default)
Every alarm action that did not fail, and what it did.
cancellationToken: Stops the enumeration.
Returns: The outcomes.
- Throws
ObjectDisposedException: The camera has been disposed.
The counterpart to ThermalCamera.ActionFailed(…), on the same thread and under the same rule: an action's fate never changes an alarm's state. This is the only way to learn that an alarm's snapshot reached the disk, or that one was deliberately skipped rather than lost.
A separate subscription from ThermalCamera.ActionFailed(…), so an application that wants only failures keeps what it had and one that wants confirmations does not have to filter them out of an error channel.
Named with the Async suffix where ThermalCamera.ActionFailed(…) has none, because the record it yields is ActionCompleted and a method of that name beside a type of that name reads badly. ThermalCamera.ActionFailed(…) has no such clash: its record is ActionError.
public IAsyncEnumerable<ActionError> ActionFailed(CancellationToken cancellationToken = default)
Every alarm action that could not be carried out.
cancellationToken: Stops the enumeration.
Returns: The failures.
- Throws
ObjectDisposedException: The camera has been disposed.
An action failing never changes an alarm's state and never interrupts frame processing, which is why it is reported here rather than through ThermalCamera.AlarmEventsAsync(…): a snapshot that could not be written does not mean the temperature came back down.
public ulong AddRegion(Region region)
Put a measuring region on the camera.
region: The region to add. It is copied: the one you pass stays yours to dispose or to add again.
Returns: The region's identifier, for reading it back and removing it.
- Throws
ArgumentNullException:regionisnull. - Throws
SdkConfigurationException: The geometry is degenerate, or exceeds the depth and node caps. - Throws
ObjectDisposedException: The camera or the region has been disposed.
Once added, the region is measured on every frame while the camera is streaming. Read the results with ThermalCamera.GetRegionStats(…) for one region, or ThermalCamera.ReadRegionStates(…) for all of them at once.
Example
using var shape = Region.Circle(new Vector2(0.5f, 0.375f), 0.1f); shape.Name = "inlet"; ulong inlet = camera.AddRegion(shape); // The same builder, moved and added again. shape.Name = "outlet"; shape.Centre = new Vector2(0.8f, 0.375f); ulong outlet = camera.AddRegion(shape);
public ulong AddRegion(Region region, ulong parentId)
Add a region as a child of an existing one, so it measures through its parent.
region: The region to nest. It is copied.parentId: Any existing region, top-level or itself a child.
Returns: The child's identifier.
- Throws
SdkObjectNotFoundException: No region has that identifier. - Throws
ArgumentNullException:regionisnull. - Throws
ObjectDisposedException: The camera has been disposed.
A child is measured through its parent's geometry: a RegionKind.HotSpot child follows the warmest pixel inside the parent rather than across the whole frame, and a spot's aperture is clipped to it. Without this a hot-spot region could only track the whole scene.
The child is a region in every other respect (its own identifier, its own statistics, its own alarm rules, its own name), and every per-identifier call takes it.
A child is not a blob. Blobs are per-frame detection results whose identifiers churn on every frame, which is why they are deliberately not children. A child region is declared once and keeps its identifier until it is removed, so a rule naming one is never orphaned.
Children do not appear in ThermalCamera.ReadRegionStates: a child's alarm already rolls up into its parent's state, so listing it separately would count it twice. Enumerate them with ThermalCamera.GetRegionChildren(…).
Example A spot that follows the hottest point inside an area:
ulong area = camera.AddRegion(Region.Rectangle( new Vector2(0.25f, 0.25f), new Vector2(0.5f, 0.5f))); var tracker = Region.Spot(new Vector2(0.5f, 0.5f)); tracker.Kind = RegionKind.HotSpot; tracker.Name = "inlet peak"; ulong peak = camera.AddRegion(tracker, area);
public ulong AddRule(ulong regionId, AlarmRule rule)
Attach an alarm rule to a measuring region.
regionId: The region to watch, fromThermalCamera.AddRegion(…).rule: The rule. It is copied: the object you pass stays yours, and changing it afterwards does not change the installed rule. UseThermalCamera.UpdateRule(…)for that.
Returns: The rule's identifier.
- Throws
ArgumentNullException:ruleisnull. - Throws
SdkConfigurationException: The region does not exist, or the rule does not describe something that can be evaluated. - Throws
ObjectDisposedException: The camera has been disposed.
When the rule's AlarmRule.Input names a region signal, the camera fills in which region from regionId, so the common case never has to look a slot up.
Example
ulong bearing = camera.AddRegion(shape); ulong ruleId = camera.AddRule(bearing, new AlarmRule { Name = "bearing too hot", Input = SignalId.Region(SignalField.Max), Condition = AlarmCondition.Above(80.0f, hysteresis: 2.0f), });
public ulong AddRule(AlarmRule rule)
Add a rule that is not attached to any region.
rule: The rule. Copied, as above.
Returns: The rule's identifier.
- Throws
ArgumentNullException:ruleisnull. - Throws
SdkConfigurationException: The rule does not describe something that can be evaluated. - Throws
ObjectDisposedException: The camera has been disposed.
For an alarm on a process-interface input, on camera telemetry, or on a value the application publishes.
public IAsyncEnumerable<AlarmEvent> AlarmEventsAsync(CancellationToken cancellationToken = default)
Every alarm transition, as it happens.
cancellationToken: Stops the enumeration.
Returns: The transitions.
- Throws
ObjectDisposedException: The camera has been disposed.
The same shape as ThermalCamera.FramesAsync(…), and for the same reason: your loop body runs on a thread pool thread, never on the SDK's alarm thread, so a slow handler never delays the camera or the other actions.
Buffered, and unlike frames the buffer is unbounded: alarms are rare and each one matters, so dropping the oldest would be the wrong trade. A consumer that never reads will grow the buffer, which is the honest failure for something you asked to be told about.
Intended for a single consumer. Several enumerators compete for the same events rather than each receiving all of them.
Example
await foreach (AlarmEvent e in camera.AlarmEventsAsync(token)) { if (e.Current == AlarmState.Active) { Console.WriteLine($"{e.RuleName} at {e.Value:F1}"); } }
public ConfigurationLoadReport ApplyConfiguration(CameraConfiguration configuration, bool requireMatchingSerial = false)
Put a whole configuration record back, and find out what it changed.
configuration: A record fromThermalCamera.GetConfiguration. It may have come from a different camera.requireMatchingSerial: Refuse a record whoseCameraConfiguration.Serialis not this camera's.falseby default, because a configuration is routinely taken from one camera and rolled out to a line of identical ones.
Returns: What the apply did: which sections are now in effect, which are not, and a sentence for a person. See ConfigurationLoadReport.
- Throws
ArgumentNullException:configurationis null. - Throws
ObjectDisposedException: The camera or the record has been disposed. - Throws
ConfigurationLoadException: The record was refused for this camera, or applying it stopped part-way. ReadConfigurationLoadException.Reportbefore deciding whether to re-read your settings. - Throws
FeatureNotSupportedException: This is a recording rather than a live camera.
The in-memory half of ThermalCamera.LoadConfiguration(…), through the same staged applier and reporting in the same ConfigurationLoadReport: what cannot work on this camera is decided while nothing has moved, and only then is anything applied. So a record carrying a temperature range this model has not got comes back ConfigurationLoadOutcome.AppliedWithOmissions with the range named, rather than leaving the camera holding another model's emissivity.
ConfigurationLoadReport.Present is always every section. A record always carries every one of them (no regions means "no regions", not "absent"), which is the one way it differs from a file.
This replaces the measuring regions, the alarm rules, the motion zones, the colour windows and the canvas placement, exactly as an import does. Anything added since the record was taken is discarded, and every region gets a new id, so look regions up by name afterwards with ThermalCamera.TryGetRegionId(…) rather than holding an id across an apply.
public NetworkConfigurationOutcome ApplyNetworkConfiguration(NetworkConfiguration configuration)
Write a new network configuration to the camera.
configuration: The settings to write. ReadThermalCamera.NetworkConfigurationfirst and change what you mean to change: every field is written, so a default-constructed value moves the camera to0.0.0.0as surely as a typed one moves it anywhere else.
Returns: Which of the four things happened. Check it, and read NetworkConfigurationOutcome before deciding what to do with this instance: a new NetworkConfiguration.StreamDestination or NetworkConfiguration.SubnetMask ends the connection, but a new NetworkConfiguration.Address or NetworkConfiguration.Port does not: the SDK follows the camera to its new address and returns NetworkConfigurationOutcome.AppliedConnectionKept on an instance that still works, with any address you cached now stale. An identical configuration writes nothing and returns NetworkConfigurationOutcome.Unchanged. Over USB nothing takes effect until the camera is next on Ethernet, which is NetworkConfigurationOutcome.AppliedPendingEthernet.
- Throws
FeatureNotSupportedException: This camera has no Ethernet interface. - Throws
ThermalDeviceException: The configuration was refused. Nothing was written; the message says why. The commonest reason is aNetworkConfiguration.StreamDestinationequal to theNetworkConfiguration.Address, and that one is the SDK's own check, thrown before anything is written, so the camera never sees those settings. Do not report it to an operator as the camera refusing them. - Throws
ObjectDisposedException: The camera has been disposed.
This changes where the camera is for every program on the network, not just yours, and it persists across a power cycle. A camera given an address on a subnet nobody can reach has to be physically fetched and put on a USB cable.
Example
if (camera.NetworkConfiguration is { } current) { var wanted = current with { Address = "10.0.0.42" }; switch (camera.ApplyNetworkConfiguration(wanted)) { case NetworkConfigurationOutcome.AppliedConnectionKept: // An address-only change is recovered in place. // Keep the instance; it is talking to 10.0.0.42 // now, so re-read the address if you show it. break; case NetworkConfigurationOutcome.AppliedConnectionLost: // Only a SubnetMask or StreamDestination change // gets here. Reopen at the new address. await camera.DisposeAsync(); break; case NetworkConfigurationOutcome.Unchanged: // It already had these settings. Nothing moved. break; case NetworkConfigurationOutcome.AppliedPendingEthernet: // Written over USB. The camera is still on its old // address until it is next used over Ethernet. break; } }
public void ApplyStillConfiguration(CameraConfiguration configuration)
Apply a whole configuration record to this still.
-
configuration: A record fromThermalCamera.GetConfiguration, which works on a still. -
Throws
ObjectDisposedException: The source has been disposed. -
Throws
ArgumentNullException:configurationisnull. -
Throws
FeatureNotSupportedException: This is a camera or a recording, or the still carries no radiometry bundle: one saved before 12.0, or from a camera with no characteristic curve. The temperature range is refused always: a different range is a different calibration, and the file holds only the one it was saved in.
For restoring a record captured earlier. To change the emissivity, assign ThermalCamera.Radiation instead: a CameraConfiguration is an opaque record with no setters, so one copied from this still carries the values it was copied with and applying it back changes nothing. The ThermalCamera.Radiation setter routes to the still's own knob and re-derives every pixel through a table rebuilt from the calibration the file carries.
public SimulatedProcessInterface AttachSimulatedProcessInterface(PifDeviceKind kind = 1, SimulatedPifLayout? layout = null)
Plug an in-memory process interface into this simulated camera.
kind: What the interface presents itself as. Every kind is accepted, andProcessInterface.GetSupportedDeviceKindslists them all, soProcessInterface.DeclareIdentity(…)can be exercised.layout: How many channels of each sort it has and what it claims to be capable of, ornullfor a standard shape: two of each, with a fail-safe line.
Returns: The wire side of the interface: the input pins, which are yours to drive.
- Throws
FeatureNotSupportedException: This is a real camera or a recording. - Throws
ObjectDisposedException: The camera has been disposed.
A simulated camera has no PIF socket, so ThermalCamera.TryOpenProcessInterface(…) answered false on one and no PIF behaviour could be tested without hardware at all. After this call it answers true and hands back a real interface over a memory-backed port: the same channel table, the same transforms, the same output reconciliation and the same signals into the alarm engine. Only the wire is fake.
Calling it again replaces the interface, as swapping the box on the connector would. Any ProcessInterface opened before then goes stale and reports that, exactly as it does across a reconnect.
Example
await using var camera = ThermalCamera.OpenSimulated(); SimulatedProcessInterface wire = camera.AttachSimulatedProcessInterface(); using ProcessInterface pif = camera.OpenProcessInterface(); wire.SetDigitalInput(0, high: true); Console.WriteLine(pif.ReadDigitalInput(0)); // High
public void ClearColorWindows()
Remove all colour windows.
- Throws
ObjectDisposedException: The camera has been disposed.
public void ClearCustomPalette()
Go back to the built-in palette ThermalCamera.Palette reports.
- Throws
ObjectDisposedException: The camera has been disposed.
Does nothing when no custom palette is in force.
public void ClearExternalBuffers()
Stop writing into every registered buffer.
- Throws
ObjectDisposedException: The camera has been disposed.
public void ClearMotionZones()
Stop watching all of them.
- Throws
ObjectDisposedException: The camera has been disposed.
public void ClearRegions()
Remove every region from the camera.
- Throws
ObjectDisposedException: The camera has been disposed.
public void ClearSubsampling()
Return the camera to the sensor's own frame rate.
- Throws
ObjectDisposedException: The camera has been disposed.
The same as assigning 0 to ThermalCamera.SubsampledFramerate, spelled so a settings page has an "Off" to call. In earlier releases there was no way back at all: the setter refused zero, and writing the sensor's own rate in (the nearest thing) then read back as a request for that rate.
public bool CompositeOverlays(Span<byte> rgba, int width, int height)
Draw the region overlays onto a buffer of your own, at any size.
rgba: Where to draw,widthtimesheighttimes four bytes, in BGRA.width: Its width in pixels.height: Its height in pixels.
Returns: true if anything was drawn. false means there are no overlays to draw, which is routine and not an error. A still opened with ThermalCamera.OpenStill(…) also answers false: it draws no overlays.
- Throws
ArgumentException:rgbais too small. - Throws
ObjectDisposedException: The camera has been disposed.
The overlays are built for the size you ask for, so they stay crisp instead of being scaled up from the sensor's resolution.
Works on a camera and on a recording. Without a GPU backend, which a recording never has, the overlays are drawn on the CPU instead, so a missing GPU is not a reason for false.
public bool ConfigureSurface(IntPtr surface, int width, int height)
Render every frame straight to a surface, at display resolution.
surface: AWGPUSurface, created againstThermalCamera.GetGpuInstance. Borrowed: you keep ownership and must not destroy it while it is configured. This pointer is not validated and cannot be. It belongs to another library, so there is nothing here that could check it. Anything that is not a liveWGPUSurfacefrom that same instance crashes the process inside the graphics driver rather than returning an error, and because a camera with no GPU backend returnsfalsebefore ever looking at it, a bad handle can appear harmless on a simulated camera and be fatal on a real one.width: Display width in pixels.height: Display height in pixels.
Returns: true if it was configured, false if this camera has no GPU backend.
- Throws
ObjectDisposedException: The camera has been disposed.
This is the whole-GPU path: the colorized output and the region overlays are drawn to the surface rather than read back, so a frame reaches the screen without a round trip through the CPU. The overlays are built for the surface's size and stay crisp instead of being scaled up from the sensor's.
The SDK's own pipeline runs through wgpu on D3D12 on Windows and Vulkan elsewhere -- Sdk.GpuInfo says which, on this machine, without opening a camera. A UI toolkit compositing in OpenGL cannot share a texture with either of them directly, so the usual arrangement is a child window the SDK owns outright.
public void DetachSimulatedProcessInterface()
Unplug the simulated process interface again.
- Throws
FeatureNotSupportedException: This is a real camera or a recording. - Throws
ObjectDisposedException: The camera has been disposed.
public void DisableAutoReconnect()
Stop reconnecting this camera automatically.
Harmless when nothing is enabled, so tidy-up code need not check. No further attempt is made, and this returns after the watcher has stopped, so anything an ThermalCamera.OnReconnect(…) handler captured is safe to release afterwards.
An attempt already in flight is abandoned, not waited out. This used to say the opposite, and the cost was a call that blocked for a teardown, a whole re-open and up to eight more seconds of waiting for a first frame: tens of seconds, on the path an application takes while it is shutting down. An attempt is now given up between the teardown and the re-open, and while waiting for that first frame, and the camera is left closed: ThermalCamera.ConnectionStatus comes to rest at ConnectionStatus.Disconnected, and no ReconnectPhase.AttemptFailed is raised, because nothing failed; you asked the SDK to stop.
A failed attempt rests at ConnectionStatus.Failed instead, and the difference is deliberate: your application may branch on the two, and switching recovery off does not read, in a log, like a recovery that did not work.
What is still waited for is the re-open itself, if it had already begun: that call cannot be interrupted, so the worst case is one connection timeout (ten seconds by default) rather than one timeout plus the frame grace.
public void DisablePreRoll()
Stop keeping a pre-roll buffer and release its memory.
- Throws
ObjectDisposedException: The camera has been disposed.
public void Dispose()
Stop the camera and release it.
Blocks while the camera's threads are stopped and joined. Prefer ThermalCamera.DisposeAsync, which does the same work without holding the calling thread.
How long that is, when a reconnect is in flight. With ThermalCamera.EnableAutoReconnect(…) in force this joins the SDK's reconnect watcher, and an attempt it is part way through is abandoned rather than finished: between the teardown and the re-open, and while waiting for a re-opened camera's first frame. So the bound is one re-open: up to the connection timeout, ten seconds by default. It used to be that plus a further eight seconds of frame grace, and both of those on top of each other was the worst case an application saw while closing.
public ValueTask DisposeAsync()
Stop the camera and release it, without blocking the caller.
Returns: A task that completes once the camera has stopped, its threads have been joined, and every buffered frame has been released.
await using really does stop the camera: this waits for the SDK's streaming threads, so when it completes nothing is still running and no callback can fire again.
Any frames still sitting in the buffer are disposed here rather than left to the finalizer. A frame the consumer never took is still native memory.
Example
await using (var camera = ThermalCamera.OpenSimulated()) { camera.Start(); //... } // stopped and joined here
public void EnableAutoReconnect(ReconnectConfig? config = null)
Have the SDK re-open this camera by itself whenever it drops.
-
config: The backoff policy, ornullfor the defaults: ten attempts, 500 ms doubling to a 30 s ceiling. -
Throws
ObjectDisposedException: The camera has been disposed. -
Throws
SdkConfigurationException: The configuration is not a backoff: aReconnectConfig.BackoffMultiplierbelow 1 shortens the wait after every failure, and a zeroReconnectConfig.InitialDelayis a retry loop with no wait in it. Both hammer a camera that is not there.
This is the answer to "who reconnects": the SDK does. A background thread watches the connection status and, on a transition to ConnectionStatus.Lost, ConnectionStatus.Stalled, ConnectionStatus.Disconnected or, after a session that worked, ConnectionStatus.Failed, performs ThermalCamera.Reconnect on the backoff schedule in config. Frame handlers stop when the camera stops and resume when it comes back, with the same settings, and your program writes no recovery loop.
A ConnectionStatus.Failed raised by the very first open is not recovered. The application asked for that open and is holding the exception it threw; retrying it behind the application's back is not recovery, it is a second opinion nobody asked for, and it would have the SDK reopening a camera the caller has already decided it could not have.
A camera that is being asked for frames and has never delivered one is not recovered. The question this answers is "did this session ever work", and an open on its own does not answer it: ConnectionStatus.Connected is published at the end of the open, before any frame, so a camera whose stream never started looks identical to one that ran for an hour.
The case it is for is a network camera whose first frame is held back by a firewall prompt. Before this rule such a camera stalled, was recovered, stalled again, and spent the whole attempt budget on a reopen that cannot help it: the frames are not blocked by anything a reopen changes.
Two things it deliberately does not withhold. A camera you opened and never started is recovered as before: there is no frame to wait for on one of those. And a camera that delivered frames and has since gone quiet or been stopped is recovered on the strength of what it already delivered: one frame is enough, for the whole life of the camera, because the rule asks whether it ever delivered and not whether it is delivering now.
An attempt is made only when the camera is actually on the bus. A USB camera that is not enumerated is waited for (ReconnectPhase.WaitingForDevice, on the same backoff schedule), and that wait spends no attempt, so a camera left unplugged over a weekend is still being looked for on Monday rather than having burned its ten attempts against an empty bus in the first minute. A network camera that answers discovery nowhere is waited for the same way, and one that answers at another address is re-opened there. Refuse an individual attempt with ThermalCamera.OnReconnectAttempt(…).
That holds for a lone camera too, which it did not before. The wait used to need another Optris USB camera to stay enumerated: the USB layer reports a bus with nothing on it and a backend that could not look in the same way, so an empty sweep counted as "present" and the commonest rig of all, one camera on one PC, spent every attempt. The sweep now establishes separately whether it could read the bus, on Windows and on Linux alike, and an empty result from a bus it could read means the camera is absent. Where that cannot be established the SDK concludes nothing and makes the attempt, exactly as before, because never re-opening a camera that is present would be the worse mistake.
Watch ThermalCamera.OnConnectionStatus(…) as well: Connected to Lost, then Connecting, then Connected is a recovery that worked, and showing "reconnecting" rather than a frozen frame is what makes the gap honest to an operator. ThermalCamera.OnReconnect(…) reports the attempts themselves.
One drop and one failed attempt reads Lost or Stalled, then Connecting, then Disconnected, then Connecting, and finally Connected or Failed. Failed is the last word of a failed attempt, never Disconnected: the teardown's own notification is delivered before it, so a subscriber keyed on Failed cannot miss the outcome, and one keyed on Disconnected cannot mistake a failed attempt for the user closing the camera.
A recording in progress is stopped and finalized before the re-open, and is not started again, see ThermalCamera.Reconnect for what that means for the file, for ThermalCamera.OnRecording(…) and for a running time-lapse.
Calling this again replaces the configuration. Stopped by ThermalCamera.DisableAutoReconnect, by disposing the camera, and by the SDK itself once it gives up, after which this is what starts it again.
public void EnablePreRoll(TimeSpan duration)
Keep the last duration of frames in memory, so a recording started later can begin before the moment that triggered it.
-
duration: How much history to keep. -
Throws
ArgumentOutOfRangeException:durationis negative. -
Throws
ObjectDisposedException: The camera has been disposed.
This is the whole point of pre-roll: the interesting event is usually what makes you start recording, and without it the recording begins just after the thing you wanted to see.
It costs memory. A second of 640x480 frames at 32 Hz is about 39 MB, so a ten-second buffer on a big sensor is not free.
Example
camera.EnablePreRoll(TimeSpan.FromSeconds(5)); camera.Start(); //... something happens... // The file begins five seconds before this line. camera.StartRecording("event.mkv");
public IAsyncEnumerable<ThermalFrame> FramesAsync(CancellationToken cancellationToken = default)
Every frame the camera produces, as they arrive.
cancellationToken: Stops the enumeration. This is the supported way to end it.
Returns: An async sequence of frames. Dispose every frame -- each holds native memory, and at camera frame rates the collector will not keep up if you do not.
- Throws
ObjectDisposedException: The camera has been disposed.
The stream carries the frames delivered after it is subscribed, and it subscribes when this method is called. Not when you first read it; that is the one thing worth knowing about the order of these two calls. So a caller who wants the first frame of a run calls this before ThermalCamera.Start, as the examples here do and as examples/c/02_stream.c does for the C callback. Calling it afterwards is allowed and loses whatever arrived meanwhile, which on a simulated camera or a replay is the first frame, because both deliver one inside ThermalCamera.Start.
The camera must be started. Frames begin arriving once it is running; enumerating a stopped camera simply waits.
When the buffer is full, the oldest frame is dropped. That is almost always right for a live camera: a consumer which falls behind should see the most recent view of the world, not work through a backlog that grows without limit. The dropped frames are released immediately, and counted by ThermalCamera.BufferedFrameDropCount so the loss is visible rather than silent. If dropping is not acceptable, take frames with ThermalCamera.AcquireFrameAsync(…) instead and control the pace yourself.
Your loop body never runs on an SDK thread. The native callback copies the frame into the buffer and returns immediately; the body of your await foreach runs on a thread pool thread. However slow it is, it is not what unblocks the camera.
One consumer. Several enumerators over the same camera share one buffer and compete for frames rather than each seeing all of them.
Example Stream for five seconds, then stop. Subscribe first, so the first frame of the run is yours:
using var stopping = new CancellationTokenSource(TimeSpan.FromSeconds(5)); IAsyncEnumerable<ThermalFrame> frames = camera.FramesAsync(stopping.Token); camera.Start(); await foreach (ThermalFrame frame in frames) { using (frame) { Console.WriteLine($"frame {frame.Metadata.Sequence}: " + $"max {frame.MaxTemperature:F1} C"); } } Console.WriteLine($"{camera.BufferedFrameDropCount} frames dropped");
public IAsyncEnumerable<ThermalFrame> FramesAsync(int bufferCapacity, CancellationToken cancellationToken)
Every frame the camera produces, with a buffer size of your choosing.
bufferCapacity: How many frames to buffer before dropping the oldest.cancellationToken: Stops the enumeration.
Returns: An async sequence of frames. Dispose every frame.
- Throws
ArgumentOutOfRangeException:bufferCapacityis not positive. - Throws
ObjectDisposedException: The camera has been disposed.
See ThermalCamera.FramesAsync(…) for the full contract. A deeper buffer tolerates a burstier consumer at the cost of more native memory held and staler frames when it falls behind; the capacity is fixed for the life of the camera, so the first call decides it.
Example
// A consumer that occasionally stalls for a quarter second. await foreach (ThermalFrame frame in camera.FramesAsync(32, token)) { using (frame) { Process(frame); } }
public ActionDropCounts GetActionDropCounts()
How many alarm actions, and how many action reports, this camera has lost.
Returns: Both totals.
Exact totals over the life of the camera, recording or still, across reconnects. ThermalCamera.ActionFailed(…) and ThermalCamera.ActionCompletedAsync(…) are best effort; this is how an application learns that some of their reports never arrived. See ActionDropCounts.
public AlarmRuntime GetAlarmRuntime(ulong ruleId)
The state of one rule, and whether its latch is the only thing holding it active.
ruleId: Which rule.
Returns: Its state and latch fact. An unknown rule reports AlarmState.Unknown and false.
- Throws
ObjectDisposedException: The camera has been disposed.
Use this to decide what ThermalCamera.AcknowledgeAlarm(…) will do. The two situations are indistinguishable through ThermalCamera.GetAlarmState(…), and they want different user interfaces:
AlarmRuntime.IsHeldByLatchtrue: the value is back inside the limits and only the latch keeps the ruleAlarmState.Active. Acknowledging releases it.- false, with
AlarmRuntime.StateAlarmState.Active: the condition still holds. Acknowledging re-arms the latch and changes nothing.
Always false for a non-latching rule and for any state other than AlarmState.Active.
public AlarmState GetAlarmState(ulong ruleId)
The state of one rule.
ruleId: Which rule.
Returns: Its state, or AlarmState.Unknown if there is no such rule or it has seen no input yet.
- Throws
ObjectDisposedException: The camera has been disposed.
public IReadOnlyList<TemperatureRange> GetAvailableTemperatureRanges()
Every temperature range this camera offers.
Returns: The ranges, in the order the camera reports them.
- Throws
ObjectDisposedException: The camera has been disposed.
Offer these rather than a fixed list: a range this camera does not have is refused, and a user interface that offers one is offering something that cannot be applied.
Example
foreach (TemperatureRange range in camera.GetAvailableTemperatureRanges()) { Console.WriteLine(range); }
public Canvas GetCanvas()
A copy of the canvas in force. You own it; dispose it.
- Throws
FeatureNotSupportedException: On a player or a snapshot source.
public ValueTuple<ChipHeating, float> GetChipHeating()
How the chip's temperature is being held, and at what.
Returns: The mode and its target in the SDK's temperature unit (Celsius unless Sdk.TemperatureUnit chose Fahrenheit).
- Throws
ObjectDisposedException: The camera has been disposed.
public ClippedWindow GetClippedWindow()
Where a clipped video format's window sits on the detector.
Returns: The window, or a ClippedWindow whose ClippedWindow.Clipped is false when the active mode reads the whole detector.
- Throws
ObjectDisposedException: The camera has been disposed.
The fastest formats are not the whole detector. A PI 640's 640x120 @ 125 Hz reads 120 of its 480 rows, and that strip can be moved.
This succeeds whether or not a camera is open and whatever mode it is in, so it is what a settings dialogue asks before offering the control. It is ThermalCamera.SetClippedWindow(…) that refuses.
public CameraConfiguration GetConfiguration()
Take this camera's whole configuration as one record, without writing a file.
Returns: Everything ThermalCamera.SaveConfiguration(…) writes: the measurement parameters, the temperature range, the palette and any custom colour table, the output directory, the motion zones, the colour windows, the canvas placement, the measuring regions and the alarm rules. Dispose it.
- Throws
ObjectDisposedException: The camera has been disposed.
A recording answers as well as a live camera; the record then holds the serial, the measurement parameters and the temperature range the file was made with. This used to raise FeatureNotSupportedException, and that exception was still documented here after a change had made it untrue.
The in-memory half of ThermalCamera.SaveConfiguration(…), for the application that wants to put a camera back the way it was at the end of a run, or try something and undo it, and has no business writing to a disk to do it.
The record is a snapshot. Nothing about it tracks the camera afterwards, so one taken before a change is what puts the camera back after it, and it may outlive the camera it was read from.
Example
using CameraConfiguration saved = camera.GetConfiguration(); camera.Radiation = camera.Radiation with { Emissivity = 0.5f }; camera.ApplyConfiguration(saved);
public IReadOnlyList<TimelineSpan> GetContinuousTimeline()
The spans of history on disk, oldest first.
The open segment is included, with its TimelineSpan.To at the last frame written, so a timeline widget can draw up to the present rather than stopping a segment short. It cannot be cut from until it closes.
public float GetFocus()
Where the lens is now, from 0.0 near to 1.0 far.
Returns: The position as a fraction of the lens's travel: 0.0 at the near end of ThermalCamera.GetFocusRange, 1.0 at the far end.
- Throws
FeatureNotSupportedException: The camera has no motorized lens, or is not open. AskThermalCamera.CanFocusfirst and the exception never arises. - Throws
ObjectDisposedException: The camera has been disposed.
The counterpart of ThermalCamera.SetFocus(…), for showing a person where the focus is without the motor's own units. Read from the motor, so while the lens is still travelling it reports where the lens is, not where it is going; see ThermalCamera.FocusTarget.
public ValueTuple<ushort, ushort> GetFocusRange()
The lens's travel, in its own step units.
Returns: The nearest and furthest positions.
- Throws
FeatureNotSupportedException: The camera has no motorized lens, or is not open. AskThermalCamera.CanFocusfirst and the exception never arises. - Throws
ObjectDisposedException: The camera has been disposed.
Read from the camera. Before this it was a fixed (0, 100) on every model, motorized or not, which made it a percentage under another name.
public IntPtr GetGpuInstance()
The SDK's WebGPU instance, for creating a surface against it.
Returns: A WGPUInstance, or IntPtr.Zero when there is no GPU backend. Owned by the SDK: do not release it.
- Throws
ObjectDisposedException: The camera has been disposed.
public ValueTuple<float, Mirror> GetOrientation()
The orientation in force.
Returns: The rotation in degrees and the mirror.
- Throws
ObjectDisposedException: The source has been disposed.
public PictureCorrection GetPictureCorrection()
What the two optical corrections are actually doing, as opposed to what was asked for.
Returns: A snapshot. See PictureCorrection for what is in it and when each field means anything.
- Throws
ObjectDisposedException: The camera has been disposed.
Both corrections default to on and both depend on calibration data a given camera and optics may not carry, so the request and the outcome genuinely differ on ordinary hardware. Setting a correction the camera cannot do does not throw -- that would make every such camera fail on the default configuration -- so this is where the reason goes instead.
A source with no processing adapter to read this through, such as a simulated camera or a recording being replayed, reports PictureCorrection.IsValid as false with both statuses Unknown. That is not a failure, and it must never be read as active.
public ProcessingOutputs GetProcessingOutputs()
Which frame types this camera's pipeline is producing.
Returns: What is in force, including the two flags a handler registration manages on your behalf, so registering a raw handler and reading this back shows ProcessingOutputs.RawFrames set.
- Throws
ObjectDisposedException: The camera has been disposed.
This is the read half of the read-modify-write that ThermalCamera.SetProcessingOutputs(…) requires: the setter writes all five flags, so what you did not mean to change has to come from here. Nothing over this binding could reach the setting at all before version 12.
public ReconnectConfig GetReconnectConfig()
The configuration ThermalCamera.EnableAutoReconnect(…) was given, or the defaults when it has not been called.
public RecordedGap? GetRecordedGap()
Whether the frame most recently delivered by this recording is on the far side of a hole in it.
Returns: null when this frame carries no marker, which is the complete answer and not an absence: the join at this frame is sound. Every frame of a recording that ran without an outage is in that position, as is every frame of every recording written before this metadata existed.
That you get a record at all is the fact: the frames either side of this one are not contiguous, because the camera stopped delivering in between. Two things put such a hole into a file: a recording held open across a reconnect (RecordingOptions.HoldOpenAcrossReconnect), and an armed pre-roll that spanned an outage.
Per frame, like ThermalCamera.RecordedRender, so a replay has to be at the frame to see it. There is no file-level half to fall back to: a recording's metadata document is written before its first frame and cannot describe anything that happens afterwards.
Only a recording opened as a camera can answer. A live camera throws FeatureNotSupportedException, because there is no file to ask about, and what a camera offers instead is ReconnectPhase.Recovered on ThermalCamera.OnReconnect(…).
public RecordedLossy? GetRecordedLossy()
What was done to this recording's samples that a lossless recording would not have done.
Returns: null when the recording declares nothing, which means it is lossless. The block is omitted entirely for an exact recording, and every recording written before the setting existed is exact. Null means lossless; it is not "unknown".
Only a recording opened as a camera can answer. A live camera throws FeatureNotSupportedException, because there is no file to ask about, which is a different answer from the null below, and deliberately so.
public ReferenceCorrection GetReferenceTemperature()
The reference-body correction currently in force, if any.
- Throws
ObjectDisposedException: The camera has been disposed.
The reader that version 12.0 did not have. A measurement correction whose effect nothing can observe is the shape the original defect had: the SDK said the correction had been applied and nothing anywhere could contradict it.
public Region? GetRegion(ulong id)
Read an installed region back.
id: Which region.
Returns: A copy of it, which you own and should dispose, or null if there is no such region.
- Throws
ObjectDisposedException: The camera has been disposed.
Pair with ThermalCamera.UpdateRegion(…) to change one: read it, move it, write it back.
public AlarmState GetRegionAlarmState(ulong regionId)
The worst state across every rule attached to one region.
regionId: Which region.
Returns: The worst state, or AlarmState.Unknown.
- Throws
ObjectDisposedException: The camera has been disposed.
public IReadOnlyList<ulong> GetRegionChildren(ulong parentId)
The identifiers of one region's direct children, in the order they were added.
parentId: The region to look under.
Returns: Its children's identifiers. Empty for a region with none, and for an unknown identifier.
- Throws
ObjectDisposedException: The camera has been disposed.
public RegionEmissivityState GetRegionEmissivityState(ulong id)
Whether a region is being measured at an emissivity of its own, and what that does to the picture.
-
id: The identifierThermalCamera.AddRegion(…)returned. -
Throws
SdkObjectNotFoundException: No region has that identifier. -
Throws
ObjectDisposedException: The camera has been disposed.
See RegionEmissivityState. Recomputed on every measured frame against the emissivity that frame was corrected at, not the one currently configured -- the two differ on a replayed recording and for a frame or two after a settings change. This is what a label draws to say an area is not on the same emissivity as everything around it.
public ulong GetRegionId(string name)
Find a region by the name it was given.
name: The region'sRegion.Name.
Returns: Its identifier.
- Throws
ArgumentException:nameis null or empty. - Throws
SdkObjectNotFoundException: No region has that name. - Throws
ObjectDisposedException: The camera has been disposed.
Names need not be unique; this returns the first match. Use ThermalCamera.TryGetRegionId(…) where the region may legitimately be absent.
Example
ulong id = camera.GetRegionId("middle");
public IReadOnlyList<ulong> GetRegionIds()
The identifiers of every region the camera holds, top level only.
Returns: The ids, in the order the camera holds them.
- Throws
ObjectDisposedException: The camera has been disposed.
Children -- hot and cold spots, nested areas -- are not listed; they are reached through their parent. In earlier releases the only ways to find a region were to remember the id ThermalCamera.AddRegion(…) returned and to look one up by name, neither of which helps after LoadConfiguration, which assigns new ids to regions the caller never added.
public RegionPercentiles GetRegionPercentiles(ulong id)
Read one region's distribution for the most recent frame.
id: The identifierThermalCamera.AddRegion(…)returned.
Returns: Its percentiles for the most recent frame.
- Throws
SdkObjectNotFoundException: No region has that identifier. - Throws
ObjectDisposedException: The camera has been disposed.
Check RegionPercentiles.IsValid. It is false unless the region was added with Region.ComputePercentiles set, because computing them costs extra work on every frame.
Example
using var region = Region.Rect(new Vector2(0.5f, 0.375f), new Vector2(0.4f, 0.3f)); region.ComputePercentiles = true; ulong id = camera.AddRegion(region); RegionPercentiles p = camera.GetRegionPercentiles(id); if (p.IsValid) { Console.WriteLine($"95th percentile {p.NinetyFifthPercentile:F1} C"); }
public uint GetRegionSignalSlot(ulong regionId)
A region's packed signal slot, for naming it in a SignalId.
regionId: The identifierThermalCamera.AddRegion(…)returned.
Returns: Its slot. Never zero.
- Throws
SdkObjectNotFoundException: No region has that identifier. - Throws
ObjectDisposedException: The camera has been disposed.
You need this only to point a rule at a region other than the one it is attached to. A rule's own input is resolved by the camera on ThermalCamera.AddRule(…) and again on ThermalCamera.UpdateRule(…), so leave that as SignalId.Region(…).
The slot is a runtime handle, not an identity: it changes when the region is removed and re-added, and means nothing on another camera. Resolve it where you use it rather than storing it alongside the rule.
Example Silence the bearing alarm while the furnace door is open:
uint door = camera.GetRegionSignalSlot(furnaceDoorId); var rule = new AlarmRule { Input = SignalId.Region(SignalField.Max), Condition = AlarmCondition.Above(90.0f), }; rule.Inhibits.Add(new AlarmInhibit( SignalId.Region(door, SignalField.Max), AlarmCondition.Above(200.0f))); camera.AddRule(bearingId, rule);
public RegionStats GetRegionStats(ulong id)
Read one region's most recent measurement.
id: The identifierThermalCamera.AddRegion(…)returned.
Returns: Its statistics for the most recent frame.
- Throws
SdkObjectNotFoundException: No region has that identifier. - Throws
ObjectDisposedException: The camera has been disposed.
Check RegionStats.IsValid before using the numbers. A region reports invalid rather than zero temperatures when it has not been measured yet -- because the camera is not streaming, or the region is disabled.
Example
RegionStats stats = camera.GetRegionStats(id); if (stats.IsValid) { Console.WriteLine($"{stats.Minimum:F1} to {stats.Maximum:F1} C, " + $"mean {stats.Mean:F1}, over {stats.PixelCount} px"); }
public RegionThresholdShare GetRegionThresholdShare(ulong id)
Read how much of one region was past its threshold on the most recent frame.
id: The identifierThermalCamera.AddRegion(…)returned.
Returns: Its threshold share for the most recent frame.
- Throws
SdkObjectNotFoundException: No region has that identifier. - Throws
ObjectDisposedException: The camera has been disposed.
Check RegionThresholdShare.IsValid. It is false unless the region was added with Region.Threshold enabled and produced a measurement this frame.
Example
using var region = Region.Rect(new Vector2(0.5f, 0.375f), new Vector2(0.4f, 0.3f)); region.Threshold = RegionThreshold.Above(200.0f); ulong id = camera.AddRegion(region); RegionThresholdShare s = camera.GetRegionThresholdShare(id); if (s.IsValid) { Console.WriteLine($"{s.Share * 100:F1}% of it is over 200 C"); }
public AlarmRule? GetRule(ulong ruleId)
Read an installed rule back.
ruleId: Which rule.
Returns: A copy of it, or null if there is no such rule.
- Throws
ObjectDisposedException: The camera has been disposed.
Pair with ThermalCamera.UpdateRule(…) to change one: read it, change what you want, write it back.
The rule's actions are read back in full, kind, trigger, format, directory, name pattern, interval, duration and write options, through optris_sdk_rule_get_action() and its two options companions. This paragraph used to say they were "reported only as counts by the native layer, so the copy carries their number but not their contents", which stopped being true when those entry points were added and is why AlarmTests.GetRule_CarriesItsRegionAndItsActions asserts every field of all three kinds. Only the inhibit sources are still a count without contents: AlarmRule.Inhibits comes back empty and AlarmRule.InhibitCount says how many the installed rule has. Keep the original if you need to reconstruct those, because writing the copy back unchanged would drop them.
public IReadOnlyList<ulong> GetRuleIds()
The identifiers of every installed rule.
Returns: The ids, in no particular order.
- Throws
ObjectDisposedException: The camera has been disposed.
public void InterruptFailSafe(bool active, string reason = "")
Stops, or restarts, the fail-safe heartbeat from your own application.
-
active: True to interrupt the heartbeat, false to release the interrupt. -
reason: Free text recorded in the SDK log, so the reason a line stopped can be recovered afterwards. -
Throws
ObjectDisposedException: The camera has been disposed.
The fail-safe watchdog already watches the camera and the SDK's own processing: it checks on every frame that frames are still arriving, that the pipeline still finishes them and that the shutter still cycles, and it stops the heartbeat when one of those fails. What it cannot watch is your application. This is how you report your own trouble to the same output -- a stuck worker thread, a queue that stopped draining, a control loop that missed its deadline.
With active true the heartbeat stops, so a PIF fail-safe output stops changing and whatever reads it sees a fault. With active false the interrupt is lifted, which does not by itself restart the heartbeat: the watchdog's own conditions still have to pass.
public bool IsNoiseFilterSupported(NoiseFilterMode mode)
Whether this camera's pipeline implements a filter.
-
mode: The filter to ask about. -
Throws
ObjectDisposedException: The camera has been disposed.
Which pipeline a camera runs follows from its resolution rather than from anything the application chose, so this is how to decide what to put in front of a user. ThermalCamera.SetNoiseFilter(…) refuses an unsupported filter rather than substituting another one. A value that is not a NoiseFilterMode is reported as unsupported rather than throwing.
A replay and a still answer false for every mode rather than throwing. There is no filter stage behind a file. This threw FeatureNotSupportedException in earlier releases, and an application that asks once per mode, as Optris Connect does, caught the first one, read it as an empty list and told the operator to connect a camera on a screen that was replaying a file.
false here does not mean the recording is unfiltered. It means no filter can be chosen here. A recording's temperatures carry whichever filter was in force when it was written, and the file records no filter settings at all, which is why ThermalCamera.NoiseFilter still throws rather than answering NoiseFilterMode.None.
public bool IsRegionFromRecording(ulong id)
Whether a region belongs to the recording being replayed, as against having been added on the playback handle afterwards.
-
id: The identifierThermalCamera.AddRegion(…)returned, or one read back fromThermalCamera.GetRegionIds. -
Throws
ObjectDisposedException: The camera has been disposed.
The question an application reviewing footage has to answer about every region it shows: a recorded region is the file's statement about what was measured, and one the operator drew during the review is the operator's. They are indistinguishable through ThermalCamera.GetRegion(…).
Ask this rather than comparing the identifier against 232. Regions added on a replay are numbered from that floor, so "a low identifier is the recording's" happens to hold today, as a numbering convention, which nothing promises to keep. It is also not the whole answer even now: a region born mid-replay from a per-frame record is the recording's, carries a recorded identifier, and did not exist when the file was opened; and one the take deleted stops being the recording's on the frame it goes. A comparison sees neither.
False on a live camera, on a still, and for an unknown identifier, in every case because nothing there is a recording's, rather than as a refusal. So this is safe to call from code holding a camera whose kind it does not know, and an identifier whose region was removed a frame ago answers false instead of throwing.
It says nothing about whether the region can be edited. A replay accepts an edit to a recorded region. The next per-frame record naming it sets again what the recording states (where it is, its shape, name, style and emissivity, and its minimum, maximum, mean, coverage and alarm state), so an edit to any of those lasts one frame. Which optional statistics it computes (Region.ComputePercentiles for the median and percentiles, the threshold, the samples) is yours once you change it: the replay computes them from the recorded temperatures, and no record changes the choice after that, including when a seek removes the region and a later record brings it back. A computed statistic is withheld (NaN, not valid) on a frame the record says the region was not measured, and for a region with an emissivity of its own whose recorded pixels do not carry it.
Example
foreach (var id in replay.GetRegionIds()) { var region = replay.GetRegion(id); Draw(region, dashed: !replay.IsRegionFromRecording(id)); }
public ConfigurationLoadReport LoadConfiguration(string path)
Import a configuration written by ThermalCamera.SaveConfiguration(…), and find out what it changed.
path: The file to read.
Returns: What the import did: which sections the file carried, which are now in effect, and a sentence for a person. See ConfigurationLoadReport. Code that ignores the return value gets the behaviour it always had.
- Throws
ArgumentException:pathis null or empty. - Throws
SdkIOException: The file could not be read, or is not JSON. Nothing was changed. - Throws
ConfigurationLoadException: The file was refused for this camera, or applying it stopped part-way. ReadConfigurationLoadException.Reportbefore deciding whether to re-read your settings. - Throws
ObjectDisposedException: The camera has been disposed.
This replaces the measuring regions, the alarm rules, the motion zones, the colour windows and the canvas placement. Anything added since the file was written is discarded.
Everything that can be checked before the camera is touched is checked before the camera is touched -- a temperature range this model does not offer is the usual one -- so a file that cannot work here is refused with nothing changed rather than applied half-way.
Region ids are not preserved. They are assigned on add, so every region gets a new one. Look regions up by name afterwards with ThermalCamera.TryGetRegionId(…) rather than holding an id across a load.
Whole-file save and restore is the only shape this comes in. The configuration carries the regions and rules as well as the scalar settings, so a partial apply would silently delete them. To change one setting, use the property for it.
Example
ConfigurationLoadReport report = camera.LoadConfiguration("line-3.json"); if (report.Omitted != ConfigurationSections.None) { Console.WriteLine(report.Diagnosis); } // The ids changed, so look the region up again by name. if (camera.TryGetRegionId("inlet", out ulong inlet)) { Console.WriteLine(camera.GetRegionStats(inlet).Mean); }
public ConfigurationLoadReport LoadConfiguration(string path, ConfigurationLoadOptions options)
Import a configuration file, with a say in what is refused.
path: The file to read.options: What to refuse. SetConfigurationLoadOptions.RequireMatchingSerialwhen the file is a backup of this camera rather than a template for a line of them.
Returns: What the import did. See ThermalCamera.LoadConfiguration(…).
- Throws
ArgumentException:pathis null or empty. - Throws
ArgumentNullException:optionsis null. - Throws
SdkIOException: The file could not be read, or is not JSON. Nothing was changed. - Throws
ConfigurationLoadException: The file was refused for this camera, or applying it stopped part-way. - Throws
ObjectDisposedException: The camera has been disposed.
Example
try { camera.LoadConfiguration(path, new ConfigurationLoadOptions { RequireMatchingSerial = true, }); } catch (ConfigurationLoadException error) { // Refused -- the camera is exactly as it was. Console.Error.WriteLine(error.Report.Diagnosis); }
public IAsyncEnumerable<MotionEvent> MotionEventsAsync(CancellationToken cancellationToken = default)
What the motion zones see, as they see it.
cancellationToken: Stops the enumeration.
Returns: The observations.
- Throws
ObjectDisposedException: The camera has been disposed.
This is the data path, and it reports on every frame a zone sees something. Anything that should act on movement wants an AlarmRule instead, see ThermalCamera.SetMotionZone(…).
Buffered with a bounded channel that drops the oldest when full, like ThermalCamera.FramesAsync(…): these arrive at the frame rate, and a stale observation is worth less than a current one.
public void OnColorImage(ImageFrameHandler? handler)
Receive the colorized picture, as BGRA.
-
handler: What to call, ornullto stop. Replaces any previous handler. -
Throws
ObjectDisposedException: The camera has been disposed.
This is the SDK's own rendering: the active ThermalCamera.Palette, the colour range, any ThermalCamera.SetColorWindow(…), and, unless switched off with ThermalCamera.OverlayCompositing, the region outlines.
Unlike ThermalCamera.FramesAsync(…) this is a callback rather than a stream, and it runs on the SDK's own thread. That is deliberate: the pixels are borrowed, so buffering them would mean copying every frame, which is exactly what a picture path should not do. Do the least possible here (upload to a texture, or copy into a buffer you own), and get out.
Example
byte[] latest = new byte[camera.Width * camera.Height * 4]; camera.OnColorImage(frame => frame.CopyTo(latest));
public void OnConnectionStatus(Action<ConnectionStatusChange>? handler)
Report every change of connection status. Pass null to stop.
-
handler: What to run on a change, ornullto stop delivery. Replaces any previous handler. -
Throws
ObjectDisposedException: The camera has been disposed.
Fires on transitions only, so it is safe to drive UI state directly from it: a link that is dead and stays dead reports ConnectionStatus.Stalled once, not once per timeout period.
Registering does not replay the status already in effect. Read ThermalCamera.ConnectionStatus once after registering if you need to seed a display.
Which SDK thread this runs on depends on what changed, and it is not always the event dispatch thread. A transition coming out of the legacy device layer is queued and delivered on the dispatch thread. Connecting and Failed raised by a reconnect are published synchronously: on the SDK's reconnect watcher thread for an automatic attempt, and on your own calling thread for a manual ThermalCamera.Reconnect. So the handler can run underneath a call you made yourself.
This is why the rule below is absolute rather than a nicety: disposing from a handler that is running on the watcher thread asks that thread to shut itself down, and it cannot. Marshal to your UI thread and act there.
And it can run on two of those threads at the same time, so your handler must be thread-safe. A queued device transition and a reconnect's synchronous publish are two independent deliveries and nothing serializes them; this is measured, not theoretical, with two threads observed inside one handler together. Do not assume one call has returned before the next begins, and keep the handler to recording what changed.
Do not dispose the camera from the handler, and do not call ThermalCamera.OnConnectionStatus(…) from it either. Both need state the notification is holding, so neither can complete while the handler runs. Registering a handler from inside one is refused and logged, and a refused call is a call that did nothing. Disposing is survivable but not free: the close is logged and moved to a thread of the SDK's own, so ThermalCamera.Dispose returns before the device has been released and a camera opened right afterwards may find it still claimed.
This is worth spelling out because recovering from ConnectionStatus.Stalled or ConnectionStatus.Lost by hand means disposing the camera and opening a new one, and the handler is the obvious place to do it. Record the transition here and act on it from your own code; the example below shows the shape.
Or do not recover by hand at all. ThermalCamera.EnableAutoReconnect(…) does this for you, with a backoff, a presence gate that waits rather than burning attempts against a camera that is not there, and a progress handler of its own in ThermalCamera.OnReconnect(…). Pick one owner for the recovery: an application that follows the example below and enables automatic recovery disposes the camera while the SDK's own attempt is in flight, which is the one combination to avoid.
Clearing the handler is a fence: once OnConnectionStatus (null) returns, no handler is still running.
Example
camera.OnConnectionStatus(change => { if (change.Current == ConnectionStatus.Stalled) { Warn("the camera stopped sending frames"); } });
Recovery, which does not happen in the handler:
var lost = new TaskCompletionSource(); camera.OnConnectionStatus(change => { if (change.Current is ConnectionStatus.Lost or ConnectionStatus.Stalled) { lost.TrySetResult(); // and nothing else from here } }); await lost.Task; camera.Dispose(); // safe here: your thread, not the SDK's camera = await ThermalCamera.OpenAsync(options);
public void OnEnergyImage(ImageFrameHandler? handler)
Receive radiometric energy, one signed 32-bit sample per pixel.
-
handler: What to call, ornullto stop. -
Throws
ObjectDisposedException: The camera has been disposed. -
Throws
FeatureNotSupportedException: This is a recording rather than a camera. A recording stores the corrected frame, so the energy behind it is not in the file.
The stage before energy becomes temperature. Useful when integrating radiance over an area, which cannot be done correctly by averaging temperatures. One call per thermal frame, on the SDK's own thread.
Registering is all that is needed. Before v12.0 this method discarded its argument outright and returned success.
Sensor coordinates, and simulated rather than measured on a simulated camera, see ThermalCamera.OnRawImage(…), which has the same two properties for the same reasons.
public void OnError(Action<string>? handler)
Be told when the SDK fails on one of its own threads, where there is no call of yours to throw out of.
-
handler: What to run on an asynchronous failure, taking the SDK's message, ornullto stop delivery. -
Throws
ObjectDisposedException: The camera has been disposed. -
Throws
OptrisSdkException: The handler could not be registered.
Everything a call can report, it reports by throwing. This is for what goes wrong in between: an acquisition thread that died, a stream that could not be started, a write that failed. Without a handler those are visible only as an absence, which is a bounded ThermalCamera.AcquireFrameAsync(…) timing out, with no way to tell "nothing to see" from "nothing is coming".
Not the same channel as ThermalCamera.OnConnectionStatus(…). That one reports what the link is doing and says nothing about why; this one carries the SDK's own account of the failure, as text meant to be logged and shown. The two overlap rather than divide: an error the SDK reports here also moves the status to ConnectionStatus.Failed, while a link that merely stalls moves the status and says nothing here.
The handler runs on an SDK thread, not on the thread that registered it and not on any synchronization context. Keep it short, marshal to your UI yourself, and do not call back into this camera from it: disposing a camera from inside its own callback deadlocks against the join that disposal performs. Record the message and act on it from your own code, as the example below does.
An exception thrown by the handler is swallowed. It cannot be allowed to unwind into C++, which is undefined behaviour, and there is nothing on an SDK thread to report it to. A handler that may throw has to catch for itself, or the failure it was installed to report is the one that disappears.
Registering replaces any previous handler, and OnError(null) stops delivery. Disposal clears it as well, so a handler cannot run against a camera that is gone.
Example
camera.OnError(message => Log.Error("SDK: {0}", message));
Acting on it, which does not happen in the handler:
var failed = new TaskCompletionSource<string>(); camera.OnError(message => failed.TrySetResult(message)); string reason = await failed.Task; camera.Dispose(); // safe here: your thread, not the SDK's
public void OnNucCycle(Action<NucCycleReport>? handler)
Be told what each of the SDK's own shutter cycles measured.
-
handler: The handler, ornullto stop. Replaces any previous one. -
Throws
ObjectDisposedException: The camera has been disposed.
The counterpart of ThermalCamera.OnShutterCorrection(…) for the SDK's own periodic correction, which does not report through that one. Until this existed every number in the record went only to the SDK's log, so no application could tell a cycle that averaged dark frames from one that averaged the scene.
Once per cycle that reached a decision. A cycle taken over by a process interface, or cut short by a mode switch, a reconnect or shutdown, reports nothing, and NucCycleReport.Sequence is how a consumer tells that from a delivery it missed.
Registering late loses nothing permanently: ThermalCamera.LastNucCycle answers for the cycle before this handler existed, which matters here because an auto interval is three minutes on a camera running normally.
The handler runs on the SDK's flag cycle thread, before the shutter's reopen is waited out, so a slow handler here holds the picture back. Marshal to your UI thread before touching anything, and do not call back into the camera from it.
public void OnPipelineChanged(Action<PipelineChange>? handler)
Be told when this camera's pipeline changes while it is open. Pass null to stop.
-
handler: Receives the pipeline before, the one after, and why. -
Throws
ObjectDisposedException: The camera has been disposed.
ThermalCamera.PipelineInfo answers which pipeline the camera is on at any moment; this says when that answer moves. The choice made while the camera opens is not a change and is not reported.
The handler runs on the SDK's frame thread, once per change, before the first frame the new pipeline computed. Marshal to your UI thread before touching anything.
public void OnRawImage(ImageFrameHandler? handler)
Receive the sensor's own samples, before any correction.
-
handler: What to call, ornullto stop. -
Throws
ObjectDisposedException: The camera has been disposed. -
Throws
FeatureNotSupportedException: This is a recording rather than a camera. A recording stores the corrected frame, so the detector's own samples are not in it.
For diagnostics and for building a different pipeline. One call per thermal frame, on the SDK's own thread. These are not temperatures, and there is no scale that turns them into one without the calibration the SDK applies.
Registering is all that is needed: the pipeline starts producing raw frames because you asked, and stops when you pass null. Before v12.0 the handler was stored and never called, with no error at any layer.
The frame arrives in sensor coordinates: unlike the thermal frame, it is never rotated or mirrored to match the picture, because the calibration data it would be compared against is in sensor coordinates too.
On a simulated camera these are computed from the drawn scene rather than measured; there is no detector to measure. Exact and repeatable, but not a calibration reference.
public void OnReconnect(Action<ReconnectEvent>? handler)
Report every step of an automatic reconnect: the attempts, their failures and the outcome.
Worth having as well as ThermalCamera.OnConnectionStatus(…), which on its own cannot distinguish a recovery in progress from a camera that is simply gone.
Every event names its camera: ReconnectEvent.Serial and ReconnectEvent.Model are captured before the first attempt, so a process recovering several cameras can label each banner, and so the identity is still right on ReconnectPhase.GaveUp; by then the camera is closed and has no serial of its own to ask for.
ReconnectPhase.WaitingForDevice is not a failure and costs no attempt: the camera is not on the bus, so nothing was tried. Show it as waiting rather than as a failed attempt, or the count on screen will disagree with ReconnectEvent.MaxAttempts.
Pass null to stop delivery; registering replaces any previous handler. Clearing is a fence: once this returns after being passed null, no handler is still running.
The handler runs on the SDK's reconnect thread. It must not call ThermalCamera.Reconnect, ThermalCamera.EnableAutoReconnect(…), ThermalCamera.DisableAutoReconnect or this method; all of them need state the call is holding, or would have to stop the thread they are running on. The SDK refuses them and writes a line naming what happened rather than hanging.
Disposing the camera from the handler is survivable but is still not the thing to do. The close cannot finish on this thread, so the SDK logs and completes it on a thread of its own: ThermalCamera.Dispose returns before the device has been released, and a camera opened immediately afterwards may find it still claimed. Record what you decided here and tear the camera down on a thread of your own.
Example
camera.EnableAutoReconnect(); camera.OnReconnect(e => { switch (e.Phase) { case ReconnectPhase.Attempting: ui.ShowReconnecting(e.Model, e.Attempt, e.MaxAttempts); break; case ReconnectPhase.WaitingForDevice: ui.ShowWaitingForCamera(e.Serial); break; case ReconnectPhase.Recovered: ui.ShowLiveImage(); break; case ReconnectPhase.GaveUp: ui.ShowGaveUp(e.Message); break; } });
public void OnReconnectAttempt(Func<ReconnectAttempt, bool>? handler)
Be asked before each reconnect attempt, and be able to refuse it. Pass null to remove the handler.
-
handler: What to ask before each attempt, ornullto remove the handler and let every attempt proceed. -
Throws
ObjectDisposedException: The camera has been disposed.
Called just before each attempt: after the wait, and after the SDK has satisfied itself that the camera is on the bus at all. Return true to let the attempt proceed. Return false and the SDK stops recovering this camera altogether: it publishes ReconnectPhase.GaveUp, ThermalCamera.IsAutoReconnectEnabled reads false from then on, and ThermalCamera.EnableAutoReconnect(…) is what starts it again. It is not a way to skip one attempt and keep the rest.
There is deliberately no third answer. A handler that refuses an attempt because the camera is briefly unreachable has stopped the recovery rather than postponed it; return true in that case. The deferral is already in the SDK and sits lower than a handler can: the presence gate withholds an attempt for an absent or foreign-held camera without spending one, publishes ReconnectPhase.WaitingForDevice, and re-asks on every wait. Keep this handler for what only your application knows and leave the bus to the gate.
This is the hook for an application that knows something the SDK cannot: that the device is deliberately powered down, that the operator closed the camera's tile, that a camera has been re-addressed. Without it the only way to stop a recovery was to call ThermalCamera.DisableAutoReconnect from another thread, racing the very attempt it was trying to stop.
Independent of ThermalCamera.EnableAutoReconnect(…) and registered in either order: the handler survives enabling automatic reconnection again, and with no handler installed every attempt proceeds. Registering replaces any previous handler.
The handler runs on the SDK's reconnect thread, under the same rules as ThermalCamera.OnReconnect(…): it must not dispose the camera and must not call ThermalCamera.Reconnect, ThermalCamera.EnableAutoReconnect(…) or ThermalCamera.DisableAutoReconnect, all of which need state the call is holding. Decide and return; do anything else from a thread of your own.
An exception thrown out of the handler is swallowed and read as true, so a handler that breaks leaves the SDK trying rather than quietly abandoning a camera nobody was told about. Failing safe here means continuing to recover, not giving up.
Example
camera.OnReconnectAttempt(a => { // The operator closed this camera's tile: stop recovering // it rather than reopening a window nobody is watching. return tiles.IsOpen(a.Serial); });
public void OnRecording(Action<RecordingEvent>? handler)
Be told that a recording started, stopped, rolled over into the next segment, or failed.
-
handler: What to run, ornullto stop delivery. Registering replaces any previous handler. -
Throws
ObjectDisposedException: The camera has been disposed.
The event an application otherwise cannot get. Polling ThermalCamera.IsRecording can see that a recording ended but never whether it reached its duration, was stopped by an alarm rule, or died on a write error, and an alarm rule can start one without the application asking at all.
The handler runs on an SDK thread: the calling thread for a start you asked for, the SDK's own timer thread for a recording that reached its duration, the frame delivery thread for a failure. Do not call back into the camera from it. Set a flag, or marshal to your UI thread, and act there.
Register it before starting a recording: a segment rollover reports to the handler that was installed when the recording opened.
A handler that queues the event and acts on it later reads RecordingEvent.Statistics, not ThermalCamera.RecordingStatistics. The property describes the recording that is current when it is read, and if an alarm rule or your own code has started the next recording in the meantime, that start has reset it. The event's own figures were taken when the recording ended. RecordingEvent.RecordingId says which Started a Stopped belongs to. Both were added in 12.0.15.
Example
camera.OnRecording(e => { switch (e.Phase) { case RecordingPhase.Started: ui.ShowRecordingChip(e.Path); break; case RecordingPhase.Stopped: ui.Toast($"Saved {e.Statistics?.FramesWritten} frames " + $"to {e.Path}"); break; case RecordingPhase.Failed: ui.Error($"Recording failed: {e.Message}"); break; } });
public void OnRgbImage(ImageFrameHandler? handler)
Receive the same picture as 24-bit RGB, for consumers that cannot take an alpha channel.
-
handler: What to call, ornullto stop. -
Throws
ObjectDisposedException: The camera has been disposed.
The same threading and lifetime rules as ThermalCamera.OnColorImage(…).
public void OnShutterCorrection(Action<ShutterCorrection>? handler)
Be told what came of each closure the process interface makes.
-
handler: The handler, ornullto stop. Replaces any previous one. -
Throws
ObjectDisposedException: The camera has been disposed.
Fires only while a PIF input is in Shutter Control (see ThermalCamera.IsShutterExternallyControlled); a cycle the SDK drove does not report through this. Once per closure, when the flag reopens.
"The flag shut" and "a correction was taken from it" are different facts. The first is on ThermalCamera.OnShutterState(…); this is the second. They were deliberately not merged: ShutterState.Error already means the shutter did not move, which a closure too short to average is not.
Registering late loses nothing permanently: ThermalCamera.LastShutterCorrection answers for the closure before this handler existed.
The handler runs on the SDK's frame thread, from inside the frame that reported the reopen, so a slow handler here costs frames. Marshal to your UI thread before touching anything, and do not call back into the camera from it.
public void OnShutterState(Action<ShutterStateChange>? handler)
Be told when the shutter opens or closes.
-
handler: What to call, ornullto stop being told. Replaces any previous handler. -
Throws
OptrisSdkException: The registration failed. -
Throws
ObjectDisposedException: The camera has been disposed.
This is the only way to track the shutter. FrameMetadata.IsFlagOpen never reads false on a live camera, and that is correct rather than broken: frames captured while the shutter is closed are not measurements (the sensor is looking at the shutter), so they are never delivered. A cycle appears in the frame stream as a gap of roughly one to two seconds, not as a run of frames flagged closed.
Polling ThermalCamera.IsShutterOpen does not work either, and it fails harder: on a live camera it is true constantly. The SDK only updates the value while dispatching a frame, and no frame is dispatched during a cycle, so nothing ever writes "closed". A IsShutterOpen && !IsCorrectionRunning poll works only because ThermalCamera.IsCorrectionRunning does all of the work.
Register before ThermalCamera.Start to also see ShutterState.Initializing, the startup calibration.
The handler runs on the SDK's shutter-cycle thread, not the streaming thread and not yours. A slow handler delays the next transition report and nothing else, but marshal to your UI thread before touching anything. Do not call back into the camera from it.
Example
camera.OnShutterState(change => iris.Dispatcher.Post(() => iris.Shut = change.IsShut));
public void OnVideoFormatChange(Action<VideoFormatChange>? handler)
Be told when the camera changes resolution or frame rate.
-
handler: What to call, ornullto stop being told. Replaces any previous handler. -
Throws
OptrisSdkException: The registration failed. -
Throws
ObjectDisposedException: The camera has been disposed.
A camera renegotiates its video format on an operation-mode change and on a reconnect. Anything sized against the old picture (a bitmap, a buffer, a layout) has to be rebuilt for the new one, and this says when, with the new size and rate.
A simulated camera, a recording and a still never change format, so on those the handler is accepted and never called.
The handler runs on an SDK thread, not on the thread that registered it and not on any synchronization context. Marshal to your UI thread before touching anything, and do not dispose this camera from inside it. An exception it throws is swallowed, because it cannot be allowed to unwind into the SDK.
Disposal clears the handler, so it cannot run against a camera that is gone.
Example
camera.OnVideoFormatChange(change => view.Dispatcher.Post( () => view.Resize(change.Width, change.Height)));
public static ThermalCamera Open()
Open the first camera the SDK can find.
Returns: The camera. Dispose it when finished.
- Throws
ThermalDeviceException: No camera is attached, or it could not be opened. - Throws
CalibrationException: The open failed and calibration was found missing along the way. Missing calibration on its own is not a failure: the camera opens and streams, andThermalCamera.CalibrationStatusrather than a catch block is what reports it.
Example
await using var camera = ThermalCamera.Open(); Console.WriteLine($"{camera.Model} ({camera.Serial})");
public static ThermalCamera Open(DeviceInfo device)
Open one specific camera.
device: An entry fromSdk.EnumerateDevices.
Returns: The camera. Dispose it when finished.
- Throws
ArgumentNullException:deviceisnull. - Throws
ThermalDeviceException: The camera could not be opened.
Example
DeviceInfo? first = Sdk.EnumerateDevices().FirstOrDefault(); if (first is not null) { await using var camera = ThermalCamera.Open(first); }
public static ThermalCamera Open(CameraOptions? options)
Open the first camera found, saying where its calibration may come from.
options: Where calibration may come from, ornullfor the defaults.
Returns: The camera. Dispose it when finished.
- Throws
ThermalDeviceException: No camera is attached. - Throws
CalibrationException: The open failed and calibration was found missing along the way, in which case the message names which source fell short. Missing calibration on its own does not throw: the camera opens and streams, andThermalCamera.CalibrationStatusreports it.
public static ThermalCamera Open(DeviceInfo device, CameraOptions? options)
Open one specific camera, saying where its calibration may come from.
device: An entry fromSdk.EnumerateDevices.options: Where calibration may come from, ornullfor the defaults.
Returns: The camera. Dispose it when finished.
- Throws
ArgumentNullException:deviceisnull. - Throws
ThermalDeviceException: The camera could not be opened. - Throws
CalibrationException: The open failed and calibration was found missing along the way, in which case the message names which source fell short: the directory, the download, or both. Missing calibration on its own does not throw: the camera opens and streams, andThermalCamera.CalibrationStatusreports it.
Example
var options = new CameraOptions { CalibrationDirectory = @"D:\calibration", AllowCalibrationDownload = false, }; await using var camera = ThermalCamera.Open(device, options);
public static ThermalCamera Open(NetworkTarget target)
Open a camera at a network address.
target: Where the camera is, and optionally which one to accept.
Returns: The camera. Dispose it when finished.
- Throws
ArgumentNullException:targetisnull. - Throws
ArgumentException:NetworkTarget.Addressis empty. - Throws
ThermalDeviceException: Nothing answered at the address withinNetworkTarget.ConnectTimeout, the camera that answered was notNetworkTarget.Serial, or the camera is already open in another process.
For a camera Sdk.EnumerateDevices cannot find: discovery is a broadcast and a broadcast does not cross a router, so a camera behind one, or on a subnet this machine has no interface on, can only be reached by naming its address.
Never falls back to USB. A caller that asks for a camera at an address and silently gets a different one over USB has no way to tell.
When NetworkTarget.Serial is null the address is probed first to learn which camera is there, then that camera is opened. Use Sdk.Probe(…) instead if you want to show the operator what was found before committing to open it.
Example
await using var camera = ThermalCamera.Open( new NetworkTarget { Address = "10.0.0.99" });
public static ThermalCamera Open(NetworkTarget target, CameraOptions? options)
Open a camera at a network address, saying where its calibration may come from and which operation mode to start in.
target: Where the camera is, and optionally which one to accept.options: Calibration and operation-mode settings, ornullfor the defaults, in which case this is exactlyThermalCamera.Open(…).
Returns: The camera. Dispose it when finished.
- Throws
ArgumentNullException:targetisnull. - Throws
ArgumentException:NetworkTarget.Addressis empty. - Throws
ThermalDeviceException: Nothing answered at the address withinNetworkTarget.ConnectTimeout, the camera that answered was notNetworkTarget.Serial, or the camera is already open in another process. - Throws
CalibrationException: The open failed and calibration was found missing along the way, in which case the message names which source fell short. Missing calibration on its own does not throw: the camera opens and streams, andThermalCamera.CalibrationStatusreports it.
The network counterpart of ThermalCamera.Open(…), for an offline site with an Ethernet camera: a calibration directory, no download, a mode to start in. Everything documented on ThermalCamera.Open(…) applies unchanged.
The timeouts come from target. NetworkTarget.ConnectTimeout and NetworkTarget.DiscoveryTimeout bound this open; CameraOptions.ConnectTimeout and CameraOptions.DiscoveryTimeout are ignored here, because the target always carries a pair of its own. Set the bounds on the target and use the options for what the target cannot say.
Example
await using var camera = ThermalCamera.Open( new NetworkTarget { Address = "10.0.0.99" }, new CameraOptions { CalibrationDirectory = @"D:\calibration", AllowCalibrationDownload = false, });
public static Task<ThermalCamera> OpenAsync(DeviceInfo device, IProgress<OpenPhase>? progress = null, CancellationToken cancellationToken = default)
Open one specific camera without blocking the caller, reporting progress as it goes.
device: An entry fromSdk.EnumerateDevices.progress: Receives eachOpenPhasethe open reaches, ornullfor no reporting. See the remarks for which thread it is called on.cancellationToken: Stops this method waiting. Read the remarks; it does not stop the camera opening.
Returns: The camera. Dispose it when finished.
- Throws
ArgumentNullException:deviceisnull. - Throws
OperationCanceledException:cancellationTokenwas cancelled before the open finished. - Throws
ThermalDeviceException: The camera could not be opened.
What cancellation does, exactly. It stops you waiting. It does not stop the SDK: the native open carries on to completion on its own thread, because the connect path underneath cannot be interrupted once it has started. So that this cannot leave a camera half-open, the camera that eventually finishes opening is disposed automatically: it is never returned, never handed a callback, and never left claimed indefinitely.
What that costs you. Between cancelling and the native open finishing, the device is still claimed. Opening the same camera again in that window fails, typically as a ThermalDeviceException about the device being unavailable. This is the one sharp edge here: if your UI lets an operator cancel and immediately retry the same camera, expect that failure and retry rather than reporting it. The window is as long as the open had left to run: under a second for a camera with calibration on disk, potentially many seconds mid-download.
It costs a thread-pool thread, too. The native call blocks, so it runs under Task.Run(…) and occupies a pool thread for the whole open, cancelled or not. This is the same honest trade as ThermalCamera.AcquireFrameAsync(…). Do not open many cameras concurrently and expect the pool to absorb it.
Which thread progress runs on. For a real camera the SDK reports phases on an internal event thread of its own, not on the thread performing the open; only a simulated camera reports them on the opening thread. This said "the thread performing the open" and that was never true of a real camera. What happens next depends on what you passed: Progress captures the synchronization context it was constructed on and posts there, so a UI handler is safe but arrives when the UI thread is next free: on a busy UI thread a report can land after the open has already finished. Any other IProgress is called inline on whichever SDK thread published the phase, so a slow handler slows the open down and a handler touching shared state has to synchronise it.
A handler that throws loses its report, not your process. The report crosses from C++ into managed code, and an exception must not unwind back through the C++ frames. Anything thrown by progress is therefore caught and discarded at the boundary. The open continues.
Example
using var cancelling = new CancellationTokenSource(); var phases = new Progress<OpenPhase>( phase => status.Text = phase switch { OpenPhase.Locating => "Looking for the camera...", OpenPhase.CalibrationDownload => "Downloading calibration...", OpenPhase.CalibrationMissing => "No calibration - readings will be invalid", _ => phase.ToString(), }); await using ThermalCamera camera = await ThermalCamera.OpenAsync(device, phases, cancelling.Token);
public static Task<ThermalCamera> OpenAsync(DeviceInfo device, CameraOptions? options, IProgress<OpenPhase>? progress = null, CancellationToken cancellationToken = default)
Open one specific camera without blocking the caller, saying where its calibration may come from and reporting progress as it goes.
device: An entry fromSdk.EnumerateDevices.options: Where calibration may come from, ornullfor the defaults, in which case this is exactlyThermalCamera.OpenAsync(…).progress: Receives eachOpenPhasethe open reaches, ornullfor no reporting.cancellationToken: Stops this method waiting. It does not stop the camera opening, see the remarks.
Returns: The camera. Dispose it when finished.
- Throws
ArgumentNullException:deviceisnull. - Throws
OperationCanceledException:cancellationTokenwas cancelled before the open finished. - Throws
ThermalDeviceException: The camera could not be opened. - Throws
CalibrationException: The open failed and calibration was found missing along the way, in which case the message names which source fell short. Missing calibration on its own does not throw: the camera opens and streams, andThermalCamera.CalibrationStatusreports it.
This is the combination of ThermalCamera.Open(…) and ThermalCamera.OpenAsync(…), and it is the one an offline site needs. Pointing the SDK at a directory is not a quiet open: it is the case where the open is slowest, so it is the case where the phases matter most. Having to choose between the options and the reporting meant giving up the reporting exactly where it earned its keep.
Everything documented on ThermalCamera.OpenAsync(…) applies here unchanged: what cancellation does and does not do, the automatic disposal of an abandoned camera and the window in which reopening that camera fails, the thread-pool thread the open occupies, which thread progress is called on, and what happens to a handler that throws. Read it; this overload weakens none of it. In particular, cancelling still does not stop the SDK: the native open runs to completion and the camera it produces is disposed rather than returned.
A missing calibration is reported, not thrown. When the files are not in CameraOptions.CalibrationDirectory, could not be obtained from the camera, and CameraOptions.AllowCalibrationDownload is false, the open succeeds and the camera streams pictures whose temperatures cannot be trusted. The progress handler sees OpenPhase.CalibrationMissing, and afterwards ThermalCamera.CalibrationStatus and ThermalCamera.CalibrationDiagnosis name which source fell short: the directory, the download, or both. That report is the reason the options exist, and a program that opens a camera and never asks ships streaming non-measurements with nothing reported. A CalibrationException arrives only when the open itself failed and calibration was found missing along the way.
Naming options is worth it at the call site. OpenAsync(device, null) on its own is ambiguous between this overload and the one taking only a progress handler, and the compiler will say so. Write OpenAsync(device, options: null), or simply OpenAsync(device).
Example An offline machine, with the files on a share, that still shows the phases and lets the operator give up:
var options = new CameraOptions { CalibrationDirectory = @"\\fileserver\optris\calibration", AllowCalibrationDownload = false, }; using var cancelling = new CancellationTokenSource(); var phases = new Progress<OpenPhase>( phase => status.Text = phase.ToString()); await using ThermalCamera camera = await ThermalCamera.OpenAsync( device, options, phases, cancelling.Token);
public ProcessInterface OpenProcessInterface()
Open this camera's process interface: its industrial I/O.
Returns: The interface. Dispose it before this camera.
- Throws
FeatureNotSupportedException: There is no camera behind this object to have one: it is simulated, or a recording. Every physical camera opens, whether or not anything is detected on the connector. - Throws
ObjectDisposedException: The camera has been disposed.
Where the absence of an interface is routine -- anything that also has to run against a simulated camera -- use ThermalCamera.TryOpenProcessInterface(…) instead of catching the exception.
Example
using ProcessInterface pif = camera.OpenProcessInterface(); Console.WriteLine($"{pif.Hardware.DigitalOutputCount} digital outputs");
public static ThermalCamera OpenRecording(string path)
Open a recording and replay it as if it were a camera.
path: Path to an.mkvrecording.
Returns: The camera. Dispose it when finished.
- Throws
ArgumentException:pathis null or empty. - Throws
SdkIOException: The file does not exist or cannot be read.
Example
await using var playback = ThermalCamera.OpenRecording("run.mkv"); playback.Start();
public static ThermalCamera OpenRecordingSeries(string path)
Open a multipart recording, from any one of its parts, and replay every part as one recording. Added in 12.0.10.
path: Any part of the recording, such asrun_part001.mkv, or a whole recording.
Returns: The camera. Dispose it when finished.
- Throws
ArgumentException:pathis null or empty. - Throws
SdkIOException: The file cannot be read, or a part of the recording is missing. The message names the missing part and the file it should be. Open the parts that are there withThermalCamera.OpenRecording(…).
A recording started with a segment limit is written as run_part000.mkv, run_part001.mkv and so on. ThermalCamera.OpenRecording(…) replays the one file it is given; this replays the whole recording from its first frame, whichever part it is given. ThermalCamera.PlaybackDuration and ThermalCamera.PlaybackPosition are the whole recording's and run on across each part boundary, ThermalCamera.SeekTo(…) and ThermalCamera.SeekToFrame(…) reach into any part, and regions and alarm rules carry on across a boundary as they do from one frame to the next. ThermalCamera.PlaybackPart says which part is playing.
The parts are found beside path by the series id each one carries, never by name alone. A whole recording opens exactly as ThermalCamera.OpenRecording(…) opens it.
Example
await using var playback = ThermalCamera.OpenRecordingSeries("run_part001.mkv"); Console.WriteLine($"{playback.PlaybackPartCount} parts, " + $"{playback.PlaybackDuration}"); playback.Start();
public static ThermalCamera OpenSimulated(SimulatedCameraOptions? options = null)
Open a camera that needs no hardware.
options: What the simulated camera should produce, ornullfor the defaults.
Returns: The camera. Dispose it when finished.
This is the supported way to develop and test an integration. A simulated camera supports everything in this package that does not require physical hardware; it has no process interface, so ThermalCamera.TryOpenProcessInterface(…) returns false on one.
Example
await using var camera = ThermalCamera.OpenSimulated( new SimulatedCameraOptions { Width = 320, Height = 240, FrameRate = 32, Pattern = TestPattern.HotSpot, });
public static Task<ThermalCamera?> OpenSimulatedAsync(SimulatedCameraOptions? options = null, IProgress<OpenPhase>? progress = null, CancellationToken cancellationToken = default)
Open a camera that needs no hardware, reporting progress.
options: What the simulated camera should produce, ornullfor the defaults.progress: Receives each phase reached.cancellationToken: Behaves exactly as it does onThermalCamera.OpenAsync(…).
Returns: The camera. Dispose it when finished.
A simulated camera has nothing to look for and no calibration to acquire, so this reports OpenPhase.Locating and then OpenPhase.Established, with nothing in between and no measurable delay. It exists so an application's progress and cancellation plumbing can be exercised without hardware, not because a simulated open is slow.
public static ThermalCamera OpenStill(string path)
Open a saved snapshot and measure it as if it were a camera.
path: A PNG or TIFF still written by this SDK. The format is detected from the file's content, not from its extension.
Returns: The source. Dispose it when finished.
- Throws
ArgumentException:pathis null or empty. - Throws
SdkIOException: The file does not exist, cannot be read, or carries nootc:metadocument, which is how a file from before this format, or from another program, is recognised. - Throws
FeatureNotSupportedException: The file holds raw detector counts or energy rather than temperature. There is no radiometric model beside such pixels, so every temperature would be invented; useSnapshot.ReadRawPixelsfor the counts themselves.
A still this SDK wrote is a measurement, not a picture of one: the file carries the temperatures and the settings they were computed at. This turns it back into something an operator can interrogate; drop a measuring area on it and read what the temperature was.
It comes back as a ThermalCamera on purpose, the way ThermalCamera.OpenRecording(…) does, because a still is the third kind of frame source rather than a type of its own. So ThermalCamera.AddRegion(…), ThermalCamera.GetRegionStats(…), the alarm rules, ThermalCamera.Palette, the colour scaling, the frame callbacks and ThermalCamera.Radiation are the code that already runs on a camera: no second path to keep in step.
A still has exactly one frame and that frame never changes. ThermalCamera.Refresh measures and delivers it once, on the calling thread, which is the call for a program that wants an answer rather than a stream. ThermalCamera.Start re-delivers it at ThermalCamera.StillRedeliveryRate, as a camera pointed at an unchanging scene would, so a region moved while it runs is measured without anything being restarted.
What a still cannot do, it throws FeatureNotSupportedException for rather than answering with a plausible number: the shutter, the focus motor, the network settings, the transport, and the colour windows, which need a pipeline a file does not have. Branch on ThermalCamera.IsStill.
Example
using var still = ThermalCamera.OpenStill("capture.tiff"); // What it was measured with, out of the file's own metadata. Console.WriteLine(still.Radiation.Emissivity); ulong id = still.AddRegion( Region.Rect(new(0.5f, 0.375f), new(0.2f, 0.2f))); still.Refresh(); Console.WriteLine(still.GetRegionStats(id).Maximum);
public void PausePlayback()
Stop advancing, holding the current frame and position.
- Throws
ObjectDisposedException: The camera has been disposed. - Throws
FeatureNotSupportedException: This is a live camera, which has no transport to pause.
Not ThermalCamera.Stop, which ends the run: a paused replay is still open, still at the frame it was on, and still seekable, so ThermalCamera.ResumePlayback carries on from there.
Do not reach for ThermalCamera.PlaybackSpeed of zero instead. The pacing divides the frame interval by the speed, so zero plays the file as fast as the disk allows -- a space bar that makes the recording sprint. Zero is refused for that reason.
A paused replay produces nothing. Every frame an application sees is one the decode thread pushed, so a setting changed while paused does not reach the picture until the replay resumes. Call ThermalCamera.RefreshPlayback to see it now.
A no-op on a replay that is not running or is already paused.
public void PublishSignal(uint slot, double value)
Publish a new value for an application signal.
-
slot: The slot fromThermalCamera.RegisterSignal(…). -
value: The value, in the application's own unit. -
Throws
ObjectDisposedException: The camera has been disposed.
Rules watching it are evaluated immediately rather than on the next frame.
The SDK does not know what an application signal measures, so it does not convert value, whatever Sdk.TemperatureUnit says: a rule on it compares its limits with the number as published, and reading it back answers that number.
public IReadOnlyList<AlarmEvent> ReadAlarmLog(int maximum = 64)
The most recent state transitions, oldest first.
maximum: At most this many.
Returns: The transitions.
- Throws
ObjectDisposedException: The camera has been disposed.
For a display that repaints faster than it wants to subscribe. To be told about each one as it happens, use ThermalCamera.AlarmEventsAsync(…).
Every entry carries AlarmEvent.HostTime, so a transition that happened before you subscribed still has a time of day on it. AlarmEvent.Timestamp cannot give you one, see its own remarks.
This is not a durable history. The log is an in-memory ring of the last 256 transitions belonging to this camera object. Reading does not drain it, but two things empty it that an alarm history would rather they did not: the 257th transition pushes out the first, and disposing this ThermalCamera discards the ring entirely. A reconnect that opens a new camera therefore starts with an empty log, and the transitions from before it are gone rather than undated. An application that has to survive a reconnect must persist what it reads.
public byte[] ReadAttachment(int index)
Copy one carried file's bytes out.
index: Which file, as a position inThermalCamera.Attachments.
Returns: The file's content.
- Throws
ArgumentOutOfRangeException:indexis negative. - Throws
FeatureNotSupportedException: This is a live camera, which carries no file to read from. - Throws
OptrisSdkException:indexis past the end ofThermalCamera.Attachments. - Throws
ObjectDisposedException: The camera has been disposed.
public Vector2[] ReadRegionBlobContour(ulong id, int blobIndex)
One blob's outline, in region coordinates.
id: The identifierThermalCamera.AddRegion(…)returned.blobIndex: The blob's position in the arrayThermalCamera.ReadRegionBlobs(…)returns, which is a per-frame index and not an identity.
Returns: The outline, or an empty array when the region asked for BlobRenderMode.Box.
- Throws
SdkObjectNotFoundException: No region has that identifier, or the index is past the end. - Throws
ObjectDisposedException: The camera has been disposed.
A closed loop, thinned by BlobDetection.Smoothing and capped at BlobDetection.ContourMaxPoints. Only the outer boundary, so a blob with a cold hole in it yields one loop and the hole is invisible here. The winding direction is whatever the trace produced; do not build an inside test on it.
public int ReadRegionBlobs(ulong id, Span<RegionBlob> destination)
Read the blobs one RegionKind.BlobGroup region found on the most recent frame, into a buffer you own.
id: The identifierThermalCamera.AddRegion(…)returned.destination: Where to write the blobs.
Returns: How many blobs the region found. If that is more than destination holds, the first destination.Length were written and the rest were not.
- Throws
SdkObjectNotFoundException: No region has that identifier. - Throws
ObjectDisposedException: The camera has been disposed.
Zero for any region that is not a RegionKind.BlobGroup, and zero for a blob group that found nothing or has not yet seen a frame -- which is a different answer from SdkObjectNotFoundException, meaning there is no such region. Configure detection with Region.BlobDetection.
Pass an empty span to ask only for the count -- the same convention ThermalCamera.ReadRegionSamples(…) uses. A blob's outline is a variable-length array of its own and is not carried by RegionBlob; RegionBlob.ContourPointCount says how many points it has and ThermalCamera.ReadRegionBlobContour(…) returns them.
public RegionBlob[] ReadRegionBlobs(ulong id)
The blobs one region found on the most recent frame, in a newly allocated array.
id: The identifierThermalCamera.AddRegion(…)returned.
Returns: The blobs, or an empty array when the region found none.
- Throws
SdkObjectNotFoundException: No region has that identifier. - Throws
ObjectDisposedException: The camera has been disposed.
Allocates on every call, and twice: once to learn the length and once to fill it. In a per-frame loop prefer ThermalCamera.ReadRegionBlobs(…) with a reused buffer.
public int ReadRegionSamples(ulong id, Span<RegionSample> destination)
Read the individual pixel readings one region took on the most recent frame -- the temperature profile along a line region.
id: The identifierThermalCamera.AddRegion(…)returned.destination: Where to write the samples.
Returns: How many samples the region has. If that is more than destination holds, the first destination.Length were written and the rest were not.
- Throws
SdkObjectNotFoundException: No region has that identifier. - Throws
ObjectDisposedException: The camera has been disposed.
Zero unless the region was added with Region.KeepSamples set: a region that did not ask keeps none. Pass an empty span to ask only for the count -- the same convention ThermalCamera.ReadRegionStates(…) uses.
A profile is per-frame and its length varies with the region's geometry and the frame size, so it cannot be a fixed array; but the SDK allocates nothing per frame to produce it, and a caller that keeps one buffer across frames does not either. See RegionSample for what a sample is, how it is ordered, and how an unmeasurable pixel is reported.
Example
using var line = Region.Line(new Vector2(0.2f, 0.3f), new Vector2(0.8f, 0.3f)); line.KeepSamples = true; ulong id = camera.AddRegion(line); // Size once, then reuse the buffer every frame. var profile = new RegionSample[camera.ReadRegionSamples(id, [])]; int count = camera.ReadRegionSamples(id, profile); foreach (RegionSample sample in profile.AsSpan(0, count)) { // NaN where the pixel could not be measured: chart a break. Console.WriteLine($"{sample.Position:F4}: {sample.Value:F1} C"); }
public RegionSample[] ReadRegionSamples(ulong id)
One region's samples for the most recent frame, in a newly allocated array.
id: The identifierThermalCamera.AddRegion(…)returned.
Returns: The profile, or an empty array when the region kept no samples.
- Throws
SdkObjectNotFoundException: No region has that identifier. - Throws
ObjectDisposedException: The camera has been disposed.
Allocates on every call, and twice: once to learn the length and once to fill it. In a per-frame loop prefer ThermalCamera.ReadRegionSamples(…) with a reused buffer.
public int ReadRegionStates(Span<RegionState> destination)
Read every region's state in one pass, into a buffer you own.
destination: Where to write the states.
Returns: How many regions the camera has. If that is more than destination holds, the first destination.Length were written and the rest were not.
- Throws
ObjectDisposedException: The camera has been disposed.
One lock and one copy of a dense array. This is what a live display should call per frame, rather than a getter per region. Pass an empty span to ask only for the count.
Example
// Size once, then reuse the buffer every frame. var states = new RegionState[camera.RegionCount]; int count = camera.ReadRegionStates(states); foreach (RegionState state in states.AsSpan(0, count)) { Console.WriteLine($"{state.Id}: {state.Stats.Mean:F1} C, " + $"{state.Alarm}"); }
public RegionState[] ReadRegionStates()
Every region's state, in a newly allocated array.
Returns: One entry per region, in no particular order.
- Throws
ObjectDisposedException: The camera has been disposed.
Allocates on every call. In a per-frame loop prefer ThermalCamera.ReadRegionStates(…) with a reused buffer.
Example
foreach (RegionState state in camera.ReadRegionStates()) { Console.WriteLine($"{state.Id}: {state.Stats.Maximum:F1} C"); }
public void Reconnect()
Re-open this camera, in place, now.
- Throws
ObjectDisposedException: The camera has been disposed. - Throws
ThermalDeviceException: The camera could not be re-opened, or delivered no frame.
A reconnect is a re-open, not a retry. A host suspend or a replug invalidates the device handle rather than making it stale: on Windows the Media Foundation read fails with 0xc00d3ea2 and the asynchronous read chain is never re-armed, so nothing can resume it. This tears the whole session down and opens a fresh one, so expect it to cost what an open costs, startup calibration included.
This ThermalCamera stays valid and every setting survives: the palette, the colour range and auto-scale policy, the temperature range and operation mode, the radiation settings, the regions, the alarm rules, the colour windows, the orientation, the connection timeout, the process-interface configuration and every registered handler. What does not survive is what belonged to the interrupted session: the startup calibration runs again.
The process-interface configuration carries over only as far as the camera that comes back allows. The channel table set with ProcessInterface.Configure(…) and the state of ProcessInterface.FailSafe are re-applied to the re-opened camera, so an armed fail-safe is armed again and its line keeps alternating. If the camera comes back reporting a different process interface (or none, because the interface was unplugged during the outage), the old table cannot be applied. The SDK then logs, at error level, exactly what it could not restore and whether the fail-safe is armed, and ProcessInterface.GetConfiguration reports the table the camera actually has rather than the one it used to have. Before v12.0 none of this happened: the table came back empty and the fail-safe came back off, silently, on every reconnect.
A recording in progress is stopped and finalized before the teardown, and is not started again. The file on disk is complete and playable, and RecordingPhase.Stopped reaches the handler registered with ThermalCamera.OnRecording(…) so an application can see that its recording ended and decide for itself whether to begin a second one when the camera is back. The alternative was worse than losing the recording: a file left open across a drop has no index written, so nothing can play it, and the frames either side of the gap are stitched together as if no time had passed.
A time-lapse keeps running and simply writes nothing while the camera is away. The retained frame goes with the link, so neither the interval writer nor ThermalCamera.SaveSnapshot(…) can produce a stale image under a fresh name; ThermalCamera.SaveSnapshot(…) throws instead, because a timestamped file holding a picture from before the drop is a measurement record that is quietly wrong.
Returns once the camera is open and a frame has arrived, not merely once the open returned. An open can succeed against a stream the operating system has not finished closing, accept every read and deliver nothing, so "the open returned" is precisely the claim that cannot be trusted. If no frame arrives the camera is closed again and this throws, so a later attempt starts from clean.
The camera is genuinely unclaimed for the gap between the close and the open, so another process can take it. This then throws, and calling again is valid.
Not from inside a handler. The SDK threads this call tears down cannot wait for themselves, so it throws rather than deadlocking. Use ThermalCamera.ReconnectAsync(…), or ThermalCamera.EnableAutoReconnect(…), which has a thread of its own.
public Task ReconnectAsync(CancellationToken cancellationToken = default)
ThermalCamera.Reconnect, off the calling thread.
A reconnect blocks for as long as an open does, which on a camera that has just come back is seconds. This is the form to call from a UI thread, and the form to call from inside an ThermalCamera.OnConnectionStatus(…) handler; the work then happens on the pool rather than on the SDK thread that must not perform it.
public void Refresh()
Measure and deliver the still once, now.
- Throws
ObjectDisposedException: The source has been disposed. - Throws
FeatureNotSupportedException: This is a camera or a recording. A camera delivers because it is pointed at something; there is nothing to re-measure on demand.
Runs the region and alarm pass over the frame and fires the registered callbacks, on the calling thread, whether or not the source is running. This is the call for a program that wants an answer rather than a stream: add a region, refresh, read the statistics.
A still delivers only while it is running or once per call to this, so a source that has been opened and neither started nor refreshed has no frame to acquire yet, exactly as a camera that has not been started does not.
Example
ulong id = still.AddRegion( Region.Rect(new(0.5f, 0.375f), new(0.2f, 0.2f))); still.Refresh(); float hottest = still.GetRegionStats(id).Maximum;
public PlaybackRefreshResult RefreshPlayback()
Re-process the frame now held and deliver it again.
Returns: Which of the four things happened.
- Throws
ObjectDisposedException: The camera has been disposed. - Throws
FeatureNotSupportedException: This is a live camera, which delivers frames of its own and needs nothing re-delivered.
The call for a paused replay whose settings have changed. Pausing halts the decode thread and a paused replay therefore produces nothing, so changing the emissivity, the orientation or the palette while paused left the picture on screen exactly as it was until the replay was resumed. Seeking to the frame already showing was not a way around it either.
Re-runs the whole delivery path from the frame as the decoder handed it over, so the frame callback and ThermalCamera.TryAcquireFrame(…) see it exactly as they see a decoded one.
It deliberately leaves three things alone: the position, because the same frame was delivered again; the alarm rules, because a refresh is the same instant measured again rather than a new observation, and evaluating would let a caller walk a delayed alarm to firing by refreshing a standing picture; and the colour scale, which is temporally damped, so re-filtering would draw a slightly different picture on every call.
What a recording can be told after the fact: the global emissivity, transmissivity and ambient reach the pixels when ThermalCamera.PlaybackCanChangeRadiation is true; a region's own emissivity reaches that region's numbers only, never the picture, when ThermalCamera.PlaybackHonoursRegionEmissivity is true; orientation, palette, colour range, auto-scale and isotherms reach the picture always; the temperature range reaches nothing and is refused, because a different range is a different calibration. Size-of-source correction, the noise filters and detail enhancement reach nothing and cannot be set on a replay at all -- they need a pipeline backend and a replay has none. That is why a refresh cannot quietly honour part of what it was asked for.
The frame callback runs on the calling thread here, unlike a decoded frame which arrives on the decode thread. Do not call this from inside a frame callback: the delivery path is serialised, so it would wait on the pass it is inside.
Example
playback.PausePlayback(); if (playback.PlaybackCanChangeRadiation) { RadiationParameters r = playback.Radiation; playback.Radiation = r with { Emissivity = 0.80f }; // The picture changes now, not on ResumePlayback(). playback.RefreshPlayback(); }
public uint RegisterAlarmCallback(Action<AlarmEvent> handler)
Register a handler that a rule's CallbackAction can name, and return the slot to name it by.
handler: What to run when a rule carrying aCallbackActionfor this slot changes state. It is given the transition.
Returns: The slot, for CallbackAction's CallbackAction.Slot.
- Throws
ArgumentNullException:handlerisnull. - Throws
ObjectDisposedException: The camera has been disposed.
Per rule, not for every rule. ThermalCamera.AlarmEventsAsync(…) is told about every transition of every rule and needs no action. This is for a handler that should run only for the rules that name it, as one action among the others a rule carries.
Slots are kept for the life of the camera and cannot be removed: a rule already installed refers to its handler by number, and reusing a number would silently point that rule at somebody else's handler. Register once, at setup.
The handler runs on the SDK's alarm action thread, not on the thread that registered it and not on any synchronization context. Keep it short, marshal to your UI yourself, and do not dispose this camera from inside it. An exception it throws is swallowed, because it cannot be allowed to unwind into the SDK.
Example
uint slot = camera.RegisterAlarmCallback( e => Console.WriteLine($"{e.RuleName}: {e.Current}")); var rule = new AlarmRule { Name = "bearing too hot", Input = SignalId.Region(SignalField.Max), Condition = AlarmCondition.Above(80.0f), }; rule.Actions.Add(new CallbackAction(slot)); camera.AddRule(bearing, rule);
public uint RegisterSignal(string name)
Register a value your application publishes, so rules can watch it.
name: Identifies the signal. Registering the same name twice returns the same slot, so a caller need not remember whether it has done this already.
Returns: The slot, for SignalId.User(…).
- Throws
ArgumentException:nameis empty. - Throws
ObjectDisposedException: The camera has been disposed.
A line pressure, a batch number, a reading from another instrument: once registered it behaves exactly like a temperature, with the same bands, hysteresis, delays and actions.
Example
uint pressure = camera.RegisterSignal("pressure"); camera.AddRule(new AlarmRule { Name = "overpressure", Input = SignalId.User(pressure), Condition = AlarmCondition.Above(4.0f), }); camera.PublishSignal(pressure, 7.5);
public void RemoveColorWindow(uint id)
Remove one colour window.
-
id: Which one. -
Throws
ObjectDisposedException: The camera has been disposed.
public void RemoveExternalBuffer(IntPtr buffer)
Stop writing into a buffer.
-
buffer: The address it was registered with. -
Throws
ObjectDisposedException: The camera has been disposed.
Returns once the SDK will no longer write there, so the memory can be freed afterwards.
public void RemoveMotionZone(uint id)
Stop watching one zone.
-
id: Which one. -
Throws
ObjectDisposedException: The camera has been disposed.
public bool RemoveRegion(ulong id)
Remove a region, and every alarm rule attached to it.
id: The identifierThermalCamera.AddRegion(…)returned.
Returns: true if the region existed and was removed.
- Throws
ObjectDisposedException: The camera has been disposed.
Removing a region that is not there is not an error -- it is the state you wanted -- so this reports it with false rather than throwing.
Example
if (!camera.RemoveRegion(id)) { Console.WriteLine("that region was already gone"); }
public bool RemoveRule(ulong ruleId)
Remove a rule.
ruleId: Which rule.
Returns: true if it was removed, false if there was no such rule.
- Throws
ObjectDisposedException: The camera has been disposed.
public NetworkConfigurationReply RequestNetworkConfiguration(NetworkConfiguration configuration)
Ask the camera to take a new network configuration, and report its answer, including a refusal, as a value.
configuration: The settings to write; readThermalCamera.NetworkConfigurationfirst and change what you mean to change, exactly as forThermalCamera.ApplyNetworkConfiguration(…).
Returns: The camera's verdict. Read NetworkConfigurationReply.Accepted first, then NetworkConfigurationReply.Outcome or NetworkConfigurationReply.Refusal.
- Throws
FeatureNotSupportedException: This camera has no Ethernet interface, or its control path cannot configure it. - Throws
ThermalDeviceException: EverythingThermalCamera.ApplyNetworkConfiguration(…)throws this for except the camera's own refusal: a stream destination equal to the address (the SDK's check, before the camera is asked), or a write the camera did not answer. - Throws
ObjectDisposedException: The camera has been disposed.
The same write as ThermalCamera.ApplyNetworkConfiguration(…), with the same checks and the same four outcomes when it is taken. A camera that states why it refuses (the Xi 640 ETH over USB, firmware reporting 4200..4399) has its reason and the configuration it kept returned here instead of thrown.
Example
var reply = camera.RequestNetworkConfiguration( new NetworkConfiguration("10.0.2.213", "255.255.240.0", "10.0.1.37", 50101)); if (!reply.Accepted) { Console.WriteLine($"refused ({reply.Refusal}); the camera keeps " + $"{reply.CameraConfiguration.Address}"); }
public void ResetReferenceTemperature()
Discard the reference-temperature correction and go back to the camera's own scale.
- Throws
FeatureNotSupportedException: This source could never have carried a correction, seeThermalCamera.ReferenceCorrectionSupport. Reporting success for clearing a correction that was never possible is the same comfortable lie in the other direction. - Throws
ObjectDisposedException: The camera has been disposed.
Rebuilds the energy table without the correction rather than merely forgetting it, so temperatures move back on the next frame rather than at the next shutter cycle.
public void ResetStatistics()
Reset the SDK's frame and dropped-frame counters to zero.
- Throws
FeatureNotSupportedException: This is a recording or a still. - Throws
ObjectDisposedException: The camera has been disposed.
Zeroes ThermalCamera.FrameCount and ThermalCamera.DroppedFrameCount, so a measurement can be taken over an interval rather than over the life of the camera. Safe to call while streaming.
It does not touch ThermalCamera.BufferedFrameDropCount, which belongs to this package rather than to the SDK, or ThermalCamera.ProcessingLatency, which is not measured.
Camera only. A recording and a still report both counts but cannot zero them: the counts run from the moment the file was opened, and a reset would make "did this replay lose anything" unanswerable for the span already played. Take a difference across the span you care about instead. Branch on ThermalCamera.IsPlayback rather than on the exception.
public void ResumePlayback()
Carry on from where ThermalCamera.PausePlayback stopped.
- Throws
ObjectDisposedException: The camera has been disposed. - Throws
FeatureNotSupportedException: This is a live camera, which has no transport.
A no-op on a replay that is not running or is not paused.
public ClipResult SaveClip(TimeSpan from, TimeSpan to, string path)
Cut a keepable file out of the history.
from: In point, on the camera clock: the domainTimelineSpan.Fromuses.to: Out point. Must be afterfrom.path: Where the clip goes. An existing file is replaced only once the clip is written and verified.
Returns: What was produced. Check ClipResult.IsIncomplete.
- Throws
InvalidOperationException: No history is running, or it holds no frame in the window at all.
This is the replacement for "start recording and hope the interesting part has not happened yet": the window is chosen after the fact, from frames already on disk.
The cut is a container copy (no frame is decoded and none is re-encoded), so the clip's temperatures are the history's temperatures exactly, and the work is proportional to the bytes of the window rather than to its pixels.
public void SaveConfiguration(string path)
Export the camera's whole configuration to a file.
-
path: Where to write. The directory must exist. -
Throws
ArgumentException:pathis null or empty. -
Throws
SdkIOException: The file could not be written.path's previous contents are intact. -
Throws
ObjectDisposedException: The camera has been disposed.
This writes path and nothing else. Before v12 it also rewrote the SDK's own per-camera archive on this machine -- a second file, in a directory you never named, which the SDK reloads the next time that camera is opened. So an export changed how the camera would behave on the next run. It no longer does; ThermalCamera.SaveDeviceConfigurationArchive is that write, by its own name.
The remark this replaces said the camera-side settings were "written to the camera's own memory". They never were. Nothing in either call reaches the camera's EEPROM.
The file covers the measurement parameters, the temperature range, the palette (including a custom colour table, as colours rather than a name), the output directory, the motion zones, the colour windows, the canvas placement, the measuring regions and the alarm rules, and it records this camera's serial.
Written whole or not at all: the bytes go to a sibling .partial file which is then renamed over path, so an interrupted export cannot leave a truncated file where a good one used to be.
Example
camera.SaveConfiguration("line-3.json");
public void SaveCsvSnapshot(string path, CsvOptions csv, SnapshotInfo? info = null)
Write the most recent frame as a CSV snapshot, spelled the way csv asks.
-
path: Where to write. -
csv: The delimiter, the decimal separator, how an unmeasured pixel is written and whether the#header lines appear. Anew CsvOptions()writes exactly the CSVThermalCamera.SaveSnapshot(…)writes. -
info: What the file should say about its own capture, ornullfor what the source knows, exactly as forThermalCamera.SaveSnapshot(…). -
Throws
ArgumentException:pathis null or empty. -
Throws
ArgumentNullException:csvis null. -
Throws
SdkConfigurationException: A delimiter other than,,;or a tab, a decimal separator other than.or,, or the two being the same character. Nothing is written then. -
Throws
SdkIOException: On the same terms asThermalCamera.SaveSnapshot(…). -
Throws
ObjectDisposedException: The camera has been disposed.
Works on a live camera, a recording and a still, like ThermalCamera.SaveSnapshot(…). An alarm's snapshot action writes its CSV in the default spelling.
Example
// For a spreadsheet set to German: semicolons, decimal commas, // and a blank cell where a pixel was not measured. camera.SaveCsvSnapshot("capture.csv", new CsvOptions { Delimiter = ';', DecimalSeparator = ',', LeaveUnmeasuredEmpty = true, });
public void SaveDeviceConfigurationArchive()
Write the SDK's own per-camera archive for this camera.
- Throws
SdkIOException: The archive could not be written. - Throws
ObjectDisposedException: The camera has been disposed.
Nothing to do with ThermalCamera.SaveConfiguration(…): this is the host-side XML the SDK keeps per serial number under the user's application data, and reloads the next time that camera is opened. Calling it is how a program says "remember these settings for this camera", which is the only thing the write inside the export was ever doing.
It is not a write to the camera's memory or EEPROM, whatever the v11 documentation said. Move the camera to another machine and none of this goes with it.
Does nothing on a simulated camera and on playback, neither of which has an archive.
Example
camera.Radiation = camera.Radiation with { Emissivity = 0.95f }; camera.SaveDeviceConfigurationArchive(); // remember it
public void SaveSnapshot(string path, SnapshotFormat format = 0)
Write the most recent frame to a still image.
-
path: Where to write. -
format: What to write. Defaults toSnapshotFormat.Png. All three keep the temperatures; only PNG and TIFF can be read back withSnapshot.Open(…). -
Throws
ArgumentException:pathis null or empty. -
Throws
SdkIOException: The file could not be written, or there is no frame to write: none has been delivered yet, or none sinceThermalCamera.TemperatureRange,ThermalCamera.ActiveOperationMode,ThermalCamera.TemperatureRangeExtension,ThermalCamera.HighPrecisionor the clipped window changed, none marked as a measurement (FrameMetadata.IsThermalDataReliable). The frame held until then was taken with the settings just left, or during the recalibration after the change, so it is not written under the range now in force; save again once a frame marked as a measurement has arrived. -
Throws
ObjectDisposedException: The camera has been disposed.
A provider registered with ThermalCamera.SetAttachmentProvider(…) is pulled as this file's header is written, which for a snapshot is inside this call, so an application's own context travels inside it. For a recording the pull is not inside the start call, see ThermalCamera.SetAttachmentProvider(…).
Works on a replay and on a still too, not only on a live camera. On a recording it writes the frame the replay is showing, the moment found while scrubbing; on a still opened with ThermalCamera.OpenStill(…) it writes what that still is measuring. See ThermalCamera.SaveSnapshot(…) for which metadata fields such a file can lack, and for the two ways it differs from a live one.
Example
// A picture for the report... camera.SaveSnapshot("event.png"); //...and the measurement to go with it. camera.SaveSnapshot("event.tiff", SnapshotFormat.Tiff);
public void SaveSnapshot(string path, SnapshotFormat format, SnapshotInfo? info = null, SnapshotOptions? options = null, string? extraJson = null)
Write the most recent frame to a still image, with metadata and encoder settings.
-
path: Where to write. -
format: What to write. All three keep the temperatures; onlySnapshotFormat.PngandSnapshotFormat.Tiffcan be read back withSnapshot.Open(…). -
info: What the file should say about its own capture, ornullfor what the source knows. The identity, radiometry and measurement range are filled in for you either way; anything set here wins over them. -
options: Encoder settings, ornullfor the defaults. -
extraJson: A JSON object merged into the metadata document at the top level. Keys the SDK's own schema uses are not overwritten. Separate frominfobecause it has no length bound, and because the one type has to serve reading as well as writing. -
Throws
ArgumentException:pathis null or empty. -
Throws
SdkConfigurationException:SnapshotOptions.Scalecannot represent this frame, orextraJsonis not a JSON object. -
Throws
SdkIOException: The file could not be written, or there is no frame to write: none has been delivered yet, or none sinceThermalCamera.TemperatureRange,ThermalCamera.ActiveOperationMode,ThermalCamera.TemperatureRangeExtension,ThermalCamera.HighPrecisionor the clipped window changed, none marked as a measurement (FrameMetadata.IsThermalDataReliable). The frame held until then was taken with the settings just left, or during the recalibration after the change, so it is not written under the range now in force; save again once a frame marked as a measurement has arrived. -
Throws
ObjectDisposedException: The camera has been disposed.
A provider registered with ThermalCamera.SetAttachmentProvider(…) is pulled as this file's header is written, which for a snapshot is inside this call.
Works on all three kinds of source. On a live camera it writes the most recent frame; on a recording opened with ThermalCamera.OpenRecording(…) it writes the frame the replay is showing; on a still opened with ThermalCamera.OpenStill(…) it writes what that still is measuring, re-derived if ThermalCamera.ApplyStillConfiguration(…) changed the emissivity. Replays and stills used to throw FeatureNotSupportedException here, so a replay tile could not export anything.
A replay or still snapshot carries what its file carries, and leaves out what it does not. A field the recording or the still never recorded is absent from the new file rather than written as a default, because a file stating an emissivity nobody set cannot be told apart from one stating the emissivity an operator chose. So any of these can be missing, and a reader must treat each as "not recorded" rather than as zero:
SnapshotInfo.EmissivityandSnapshotInfo.Transmissivity: the source file carried no radiometry block, as a v11 recording or one from another writer does not.SnapshotInfo.AmbientTemperature, as above, and also whenever the original had none worth writing: a camera estimating ambient with no reading yet, or configured the v11 way. Never a placeholder.- the measurement range, and the model, serial, hardware and firmware revision and field of view: whichever of them the original did not name.
- the characteristic curve and the radiometry data. Carried forward when the original had them, so the new file can be reopened with
ThermalCamera.OpenStill(…)and measured at another emissivity exactly as the original can. Absent for anything written before 12.0.
Two differences from a live snapshot, both deliberate. The recorded render says overlays are false; overlays are composited into a picture by the GPU pipeline alone and neither a replay nor a still has one, so the picture really has none. And ThermalCamera.SetAttachmentProvider(…) is not pulled on those two: it is a camera's registry. What the source file carried of its own travels; what your application would have attached live does not, so pass it on info.
The picture is drawn in the colours the source is set to now, not the ones the recording was made with: the same rule a live camera follows, which writes the picture on screen rather than a second rendering. A replay that nothing is displaying has no colour scale, and its snapshot is then the 16-bit greyscale form, again exactly as a camera's is with no live view.
Example
camera.SaveSnapshot( "event.tiff", SnapshotFormat.Tiff, new SnapshotInfo { Description = "bearing 3, second shift" }); using Snapshot saved = Snapshot.Open("event.tiff"); Console.WriteLine(saved.Info.Description); // The same call on a replay, for the frame being shown. using var replay = ThermalCamera.OpenRecording("run.mkv"); replay.SeekTo(TimeSpan.FromSeconds(12)); replay.SaveSnapshot("found_it.png");
public void SeekTo(TimeSpan position)
Jump to a point in the recording.
-
position: How far in, measured from the start of the recording. -
Throws
ArgumentOutOfRangeException:positionis negative. -
Throws
ObjectDisposedException: The camera has been disposed. -
Throws
FeatureNotSupportedException: This is a live camera, which has no transport.
Example
// Halfway through. playback.SeekTo(playback.PlaybackDuration / 2);
public void SeekToFrame(ulong frameIndex)
Jump to a frame, counted from the start of the recording.
-
frameIndex: Which frame. -
Throws
ObjectDisposedException: The camera has been disposed. -
Throws
FeatureNotSupportedException: This is a live camera, which has no transport.
public void SetAttachmentProvider(Func<AttachmentRequest, IReadOnlyList<Attachment>>? provider)
Supply the files that travel inside every snapshot and recording this camera writes.
-
provider: Asked for files once per file written, as that file's header goes down, ornullto stop supplying them. Registering replaces any previous provider. -
Throws
ObjectDisposedException: The camera has been disposed.
Why you are asked rather than telling. A recording started by an alarm rule is never started by your code, so there is no call to hang an "attach this" off, and a manual start gives no usable window either, because the provider is asked when the header is written, which is after ThermalCamera.StartRecording(…) has returned, and once the header is down an attachment can no longer be added. Being asked is what makes the manual case and the triggered case the same case.
For a recording the provider never runs on the thread that started it. It runs on the recording controller's own writer thread (where every frame a recording stores is encoded and written, a live frame, a flushed pre-roll and a segment rollover alike) or on the thread that stops a recording which ended while the cover's look-ahead was still unresolved. For a snapshot it is the thread of the ThermalCamera.SaveSnapshot(…) call, the SDK's action thread for an alarm-fired one, or the SDK's timer thread for an interval capture.
The recording controller's lock is not held while the provider runs; it is released before the write. This used to be the camera's frame thread with that lock held, and both halves of that are now wrong.
Return promptly all the same: the writer thread is the one draining the queue, so a provider that blocks there lets the queue grow and, past its bound, costs frames. Do not call back into this camera's recording or snapshot methods from it (that re-enters the recorder the provider is supplying a header for), and do not wait on a lock your own code holds while calling ThermalCamera.StopRecording, which still deadlocks because that call waits for the writer to finish the frame in flight. Prepare the bytes in advance where you can.
AttachmentRequest.IsOnSdkThread does not reliably tell you whether you are on an SDK thread; see that property.
It is called exactly once per file: once per snapshot, and once per segment of a segmented recording, so every segment stands on its own. Returning an empty list, or null, attaches nothing and is perfectly normal.
An Attachment the SDK refuses (an empty name, or one past 255 bytes of UTF-8) is skipped, and the rest of the list is still attached. There is no way to report it: an exception thrown out of a provider cannot unwind into the SDK's own thread, so the provider's exceptions are swallowed too. Validate what you attach.
You are asked before any frame is written to the file. That is the guarantee: nothing reaches the file ahead of your attachments. The provider fires as the header goes down, which for a recording is when the cover's look-ahead resolves (on the first frame that makes a usable cover, at six frames, or at 400 ms of capture time, whichever comes first), and for a recording that ended while that look-ahead was still unresolved, inside ThermalCamera.StopRecording, which writes the frames still held. A recording that received no frame at all asks the provider nothing, because its file is discarded rather than finished.
Anything that only exists once the recording has ended (a summary, a run statistic, a history gathered while it played) cannot go into that file. Attach what you know at the start and keep the rest beside it. And because the pull happens after ThermalCamera.StartRecording(…) returns, state your code sets up just after that call may or may not reach the file: have it ready beforehand.
Attachment.Compress does nothing on a recording. It deflates the payload inside a PNG or TIFF; an MKV attachment stream is stored verbatim, so the flag is silently ignored there. It is harmless, just inert.
Reading any of it back is Snapshot.Attachments for a still, ThermalCamera.Attachments on a handle replaying a recording, and RecordingFile.Open(…) for a recording on disk with no camera involved.
Example
camera.SetAttachmentProvider(request => [ new Attachment("operator.json", JsonSerializer.SerializeToUtf8Bytes(shift)) { Mime = "application/json", }, ]); camera.SaveSnapshot("event.tiff", SnapshotFormat.Tiff); using Snapshot saved = Snapshot.Open("event.tiff"); byte[] operatorJson = saved.ReadAttachment(0);
public void SetAutoCorrection(bool enabled, Nullable<TimeSpan> minimumInterval = default, Nullable<TimeSpan> maximumInterval = default, Nullable<float> temperatureDrift = default)
When the camera decides on its own to run a correction.
-
enabled: Whether it does at all. -
minimumInterval: The shortest it will wait between corrections, ornullto leave that setting as it is. -
maximumInterval: The longest it will go without one, ornullto leave that setting as it is. -
temperatureDrift: How far an internal temperature probe may drift before a correction is due, a difference in degrees of the SDK's temperature unit (kelvin-sized in Celsius, Fahrenheit-sized whenSdk.TemperatureUnitchose Fahrenheit), ornullto leave that setting as it is. The default is 0.1 K, which reads 0.18 in Fahrenheit. Read it back withThermalCamera.ShutterDriftThreshold. -
Throws
ArgumentOutOfRangeException:temperatureDriftwas given and is not a finite value above zero. Zero, a negative value, NaN and an infinity are all refused: zero and below would fire on every frame, and an infinity switches the drift arm off for good whileThermalCamera.AutoShutterstill readstrue. Usenullto leave the threshold alone; zero has no "keep" meaning here, although it does in the C ABI underneath. -
Throws
ObjectDisposedException: The camera has been disposed.
Only enabled is required, and nothing you do not name is changed. Each null leaves the setting that is already in force alone, including ThermalCamera.ShutterForecast, which this method has no parameter for and which it used to switch off as a side effect. A shutter page can call this without disturbing the rest of itself.
temperatureDrift is measured against the camera's box, chip and flag probes, using whichever has moved furthest since the last correction, compared as strictly greater than, and is only consulted once minimumInterval has elapsed. It must be a finite value greater than zero. It starts at 0.1 K on every open; the per-serial configuration archive stores no threshold, so it is not carried over from the last session.
maximumInterval still forces a correction regardless of drift. Raise it for fewer interruptions and more drift between corrections; lower it for the reverse.
TimeSpan.Zero keeps an interval as it is, exactly as null does, so this method cannot remove a ceiling; use ThermalCamera.ShutterInterval for that, where a maximum of zero means no ceiling. For the same reason this method cannot switch the drift arm off by passing a zero minimum.
Everything here is also reachable one setting at a time, through ThermalCamera.AutoShutter and ThermalCamera.ShutterInterval. This method applies them in one round trip, and is the only way to set the drift threshold.
public void SetCanvas(Canvas canvas)
Place this camera's frames in a canvas.
- Throws
FeatureNotSupportedException: On a player or a snapshot source, neither of which has a canvas.
The camera copies the canvas, so disposing yours afterwards does not disturb it, and later edits to yours do not reach the camera; use ThermalCamera.SetPlacement(…) for a live drag.
Two things change once a canvas is placed, and nothing changes before it, because the default canvas is a pass-through: the BGRA callback starts delivering the canvas composite at the canvas's extent rather than the sensor-native frame, and regions are read as canvas coordinates. The thermal, raw and energy callbacks are untouched and stay sensor-native; the composite resamples, and resampled thermal data is exactly what this design exists to avoid.
public void SetChipHeating(ChipHeating mode, float temperature = 40)
How the sensor chip's own temperature is held.
-
mode: Which way. -
temperature: The target forChipHeating.Fixed, in the SDK's temperature unit (Celsius unlessSdk.TemperatureUnitchose Fahrenheit). Ignored otherwise. The default of 40 is the SDK's own setpoint and means 40 C in either unit: 40 F is below the 20 C a setpoint is clamped to, so nobody who passes 40 means Fahrenheit by it. Any other value is read in the SDK's unit. -
Throws
ObjectDisposedException: The camera has been disposed.
public void SetClippedWindow(int x, int y)
Move the clipped window's top-left corner, in detector pixels.
-
x: Left edge, clamped into[0, ]. -
y: Top edge, clamped into[0, ]. -
Throws
ObjectDisposedException: The camera has been disposed. -
Throws
FeatureNotSupportedException: The active operation mode is not a clipped format, or no camera is open.ThermalCamera.GetClippedWindowanswers both without throwing.
Positions outside the travel clamp to it rather than being refused, so a slider dragged to its end does the obvious thing.
This costs what an operation-mode switch costs. The window is not only a command to the camera: the calibration is cropped to it, the lens-distortion correction's optical centre is measured from it, and the dead-pixel list is in detector coordinates. Moving it rebuilds the processing chain so that all four agree. Do not bind it to a slider's every intermediate value.
If the rebuild fails the previous position is restored and the failure is reported, so the camera is never left reading one strip while the pipeline is calibrated for another.
public void SetColorRange(Nullable<float> minimum, Nullable<float> maximum)
Fix the temperatures the palette spans, or let the camera track the scene.
-
minimum: The temperature the palette starts at, in the SDK's temperature unit (Celsius unlessSdk.TemperatureUnitchose Fahrenheit), ornullto track the scene's own minimum. -
maximum: Where it ends, in the same unit, ornullto track the scene's own maximum. -
Throws
ObjectDisposedException: The camera has been disposed.
Auto-scaling makes a room-temperature scene legible and makes two moments incomparable: an object leaving the frame re-colours everything that stayed. Fix the range whenever the picture is meant to be read rather than merely watched.
Read it back with ThermalCamera.ColorRange, which answers for whatever set the range, including a replay, which opens on the range its recording was made with without this being called at all. ThermalCamera.ColorScaling reports ColorScaling.Manual whenever both ends are in force.
Example
// Hold 20..60 C, so a warm object entering does not re-colour // the background. camera.SetColorRange(20.0f, 60.0f); // Back to following the scene. camera.SetColorRange(null, null);
public void SetColorScaling(ColorScaling mode)
Choose how the palette's range tracks the scene.
-
mode: The policy. PassingColorScaling.Manualis not meaningful, see the exception below. -
Throws
ArgumentOutOfRangeException:modeisColorScaling.Manual, or is not a definedColorScalingvalue. Manual is entered by supplying a range toThermalCamera.SetColorRange(…); there is no range for this call to return to. -
Throws
ObjectDisposedException: The camera has been disposed.
This also lifts any fixed range, so the picture starts tracking the scene again immediately.
Example
// A furnace door: ignore the few very hot pixels so the rest // of the scene keeps its contrast. camera.SetColorScaling(ColorScaling.Sigma1); // What the palette actually spans right now, for a slider. if (camera.EffectiveColorRange is (float min, float max)) { slider.Show(min, max); }
public void SetColorWindow(uint id, ColorWindow window)
Draw one temperature band in colour over a grayscale base: an isotherm.
-
id: Names the window. Setting the same id again replaces it. -
window: The band and how to draw it. -
Throws
SdkConfigurationException: The band is empty or inverted, the opacity is outside [0, 1], or the colour table is longer thanPalettes.ColorCount. -
Throws
FeatureNotSupportedException: This would be theThermalCamera.MaxColorWindows+ 1st window. Refused rather than dropped: a band accepted and not drawn is the defect this call was fixed for. -
Throws
ObjectDisposedException: The camera has been disposed.
Read ThermalCamera.ColorWindows to confirm what is in force.
public void SetCustomPalette(CustomPalette palette)
Colorize with colours you supply instead of a built-in palette.
-
palette: The name and the colours. -
Throws
ArgumentNullException:paletteisnull. -
Throws
ArgumentException: The name is empty, the table is notPalettes.ColorCountentries, or every colour in it is the same. -
Throws
ObjectDisposedException: The camera has been disposed.
Overrides ThermalCamera.Palette until ThermalCamera.ClearCustomPalette or a fresh assignment to ThermalCamera.Palette puts it back. ThermalCamera.Palette goes on reporting the built-in it would return to.
The colours are copied, and the palette belongs to this camera alone -- nothing is registered process-wide and no other camera or application sees it.
public void SetDetailEnhancement(float baseGain, float detailGain)
Detail enhancement. Setting either gain switches it on; (0, 0) switches it off.
-
baseGain: How much of the base image to keep. -
detailGain: How much local detail to lift. -
Throws
FeatureNotSupportedException: A non-zero gain was asked of a source that has no pipeline backend: playback of a recording, for one. Enhancement runs inside the backend, so there is nothing on such a source that could apply it. AskThermalCamera.IsDetailEnhancementSupportedfirst to grey the control out rather than handle the refusal. -
Throws
ObjectDisposedException: The camera has been disposed.
1.0 and 1.0 reconstruct the picture exactly. Raise detailGain above baseGain to lift local contrast.
Display only. These change the picture and nothing else: reported temperatures, measuring regions, recordings, snapshots and any registered buffer are unaffected, on every backend. That was not true before version 12, see the CHANGELOG.
A simulated camera accepts this and shows it, like a real one. It did not in earlier releases: a simulated camera's picture is colorized outside the pipeline, downstream of the display buffer the enhancement writes, so the gains were accepted and reached no pixel. See ThermalCamera.IsDetailEnhancementSupported.
Read ThermalCamera.DetailEnhancement to confirm what is in force.
public void SetExternalBuffer(IntPtr buffer, UIntPtr sizeBytes, ExternalBufferFormat format, ExternalBufferHandler? onWritten = null)
Have the SDK write every frame straight into memory you own.
-
buffer: Where to write. It must stay alive and pinned untilThermalCamera.RemoveExternalBuffer(…)or the camera is disposed; the SDK writes into it from its own thread. -
sizeBytes: Its size. -
format: What to write. -
onWritten: Called after each write, on the SDK's processing thread, ornullto poll instead. -
Throws
ArgumentOutOfRangeException:sizeBytesis zero. -
Throws
ObjectDisposedException: The camera has been disposed.
Several buffers can be registered at once, in different formats. Each is identified by its address, which is also what removes it again.
The size is validated against the frame before anything is written, so a buffer that is too small is refused rather than overrun.
This is unmanaged memory by design. Use NativeMemory, a pinned array, or on a Jetson a unified-memory allocation that an inference kernel can then read with no upload.
public void SetFlagWhileRecording(FlagWhileRecording policy, float overrideDriftCelsius = 0)
Choose what a running recording does to the shutter schedule.
-
policy: What to do.FlagWhileRecording.Useis the default and is what every camera has always done. -
overrideDriftCelsius: ForFlagWhileRecording.AvoidUnlessDrift, the drift past which a correction happens anyway: a difference in degrees of the SDK's temperature unit (kelvin-sized in Celsius, Fahrenheit-sized whenSdk.TemperatureUnitchose Fahrenheit), whatever the name says. Ignored by the other two policies. -
Throws
ArgumentException:policyisFlagWhileRecording.AvoidUnlessDriftandoverrideDriftCelsiusis at or below zero. That pair is refused rather than accepted because every drift is more than zero: the override would fire every time and the policy would silently behave asFlagWhileRecording.Use. There is deliberately no default, because how much drift a measurement can bear is a property of what is being measured, not of the camera. -
Throws
ObjectDisposedException: The camera has been disposed.
A shutter cycle interrupts the measurement for about a second. Avoiding it during a recording buys an unbroken stream and pays in drift, and a recording stores finished temperatures, so that drift is in the file permanently and no replay removes it. Watch ThermalCamera.ShutterDeferral to see what it is costing, and ThermalCamera.RecordedFlagPolicy to read it back off a file afterwards.
Stored but inert while a process-interface input owns the flag: the SDK runs no cycle of its own then, so there is none to hold. ThermalCamera.ShutterDeferral.PolicyInForce is the honest answer about whether it is doing anything.
public void SetFocus(float position)
Where the lens is focused, from 0.0 near to 1.0 far.
-
position: The wanted position, as a fraction of the lens's travel: 0.0 is one end and 1.0 the other. -
Throws
ArgumentOutOfRangeException:positionis outside 0.0 to 1.0. -
Throws
FeatureNotSupportedException: The camera has no motorized lens, or is not open. AskThermalCamera.CanFocusfirst and the exception never arises. -
Throws
ObjectDisposedException: The camera has been disposed.
The portable way to ask for a focus: it needs no knowledge of this motor's own units. The fraction is mapped onto ThermalCamera.GetFocusRange and rounded to the nearest step.
Only on a camera with a motorized lens; ThermalCamera.FocusCapability says which, on an open camera, and DeviceCapabilities.HasMotorizedFocus says the same of an enumerated one before it is opened.
public void SetMotionZone(uint id, MotionZone zone)
Watch an area for movement.
-
id: Names the zone. Setting the same id again replaces it. -
zone: What to watch for. -
Throws
ObjectDisposedException: The camera has been disposed.
To react to movement, add an AlarmRule on the zone's signals rather than handling ThermalCamera.MotionEventsAsync(…): a rule gets delay frames, latching, inhibit sources and the action model, and fires on a transition rather than on every qualifying frame.
Example
camera.SetMotionZone(1, new MotionZone( MinimumTemperature: 30.0f, MaximumTemperature: 40.0f)); camera.AddRule(new AlarmRule { Name = "someone in the cell", Input = SignalId.Motion(1, SignalField.MotionBlobCount), Condition = AlarmCondition.Above(0.0f) with { OnDelay = TimeSpan.FromMilliseconds(250), }, });
public void SetNoiseFilter(NoiseFilterMode mode, float strength = 1)
The spatial noise filter.
-
mode: Which filter. -
strength: How strongly it is applied, as a multiple of the filter's nominal setting: 1.0 is nominal, 2.0 twice as aggressive, 0.5 half. Must be greater than 0 and at most 100. It has no effect on the filters with no strength to vary (the medians and box blurs are fixed kernels) nor onNoiseFilterMode.Temporal, whose time constant isThermalCamera.TemporalSmoothing. -
Throws
ArgumentException:modeis not aNoiseFilterMode, orstrengthis outside (0, 100]. -
Throws
FeatureNotSupportedException: This camera's pipeline does not implementmode. The filter in force is unchanged; the SDK never substitutes a different one. AskThermalCamera.IsNoiseFilterSupported(…)first to avoid this rather than handle it. -
Throws
ObjectDisposedException: The camera has been disposed.
Unlike ThermalCamera.SetDetailEnhancement(…) this changes reported temperatures. The noise filters run inside the radiometric path, which is what denoising a measurement means.
This took an int before version 12, and the number meant a different filter on different cameras. Detail enhancement is no longer reachable through it at all; it is ThermalCamera.SetDetailEnhancement(…), and it is display-only. See NoiseFilterMode and the CHANGELOG.
public void SetOrientation(float rotationDegrees, Mirror mirror = 0)
Turn and/or mirror the frames this source delivers.
-
rotationDegrees: A multiple of 90. This release accepts quarter turns only. -
mirror: Applied after the rotation. -
Throws
ObjectDisposedException: The source has been disposed. -
Throws
SdkConfigurationException:rotationDegreesis not a multiple of 90. Any other angle leaves output pixels with no source pixel behind them, and this release has no concept of an unmeasurable pixel, so it is refused rather than resampled.
The orientation is part of the radiometric pipeline rather than a display transform, so there is only ever one coordinate system: regions are authored in the oriented frame and need no mapping. Quarter turns are an exact index remap (values are relocated, never averaged), so a turned frame measures identically to an unturned one.
A quarter turn swaps ThermalCamera.Width and ThermalCamera.Height, while ThermalCamera.SensorWidth and ThermalCamera.SensorHeight keep reporting the detector.
On a still this is applied on top of what the file already holds: a snapshot records the picture the operator was looking at, so it is stored already oriented.
public void SetPaletteByName(string name)
Colorize with a palette from PaletteLibrary, by name.
-
name: APaletteInfo.Name-- the stem of a CSV file in one of the SDK's palette directories, or one of the SDK's own palette names. -
Throws
ArgumentNullException:nameisnull. -
Throws
SdkObjectNotFoundException: The machine has no palette by that name.PaletteLibrary.Alllists the ones there are. -
Throws
ObjectDisposedException: The camera has been disposed.
This is how an operator's own CSV palette reaches the picture. It is shorthand for reading the colours and calling ThermalCamera.SetCustomPalette(…), so it overrides ThermalCamera.Palette the same way and ThermalCamera.ClearCustomPalette undoes it.
For one of the SDK's own palettes, assigning ThermalCamera.Palette is the cheaper path and the one that survives a configuration round-trip as an enum value.
public void SetPlacement(int index, Placement placement)
Edit one placement in place, without a copy round trip.
- Throws
SdkObjectNotFoundException: When no canvas has been set, which includes the ordinary case of not having set one yet, or whenindexis past the end.
This is the call a drag handler wants: the swap happens under the frame thread's own lock, so it does not have to copy the canvas out, edit it and set it back while frames are arriving.
public void SetProcessingOutputs(ProcessingOutputs outputs)
Choose which frame types the pipeline produces.
-
outputs: All five flags. Start fromThermalCamera.GetProcessingOutputsand change what you mean to change. -
Throws
ObjectDisposedException: The camera has been disposed.
This writes all five flags. A value you constructed rather than read back carries the SDK's defaults in the fields you did not name, which is not the same as the camera's current state, and on a camera somebody else configured it silently undoes their choice.
The rest of the processing configuration (the noise filter, the detail-enhancement gains, distortion correction) is untouched.
Clearing ProcessingOutputs.ThermalFrames stops measurement as well as the picture; read that property's remarks before you do it.
Example
ProcessingOutputs outputs = camera.GetProcessingOutputs(); camera.SetProcessingOutputs(outputs with { BgraFrames = false });
public void SetReferenceTemperature(float reference, float measured, Nullable<float> ambient = default)
Correct the whole temperature scale against a known reference.
-
reference: What the reference body really is, in the SDK's temperature unit (Celsius unlessSdk.TemperatureUnitchose Fahrenheit). -
measured: What the camera read for it, in the SDK's temperature unit. -
ambient: The air temperature at the reference, in the SDK's temperature unit, ornullto leave it to the camera. -
Throws
FeatureNotSupportedException: This source cannot be corrected, seeThermalCamera.ReferenceCorrectionSupport. The message isThermalCamera.ReferenceCorrectionDiagnosis. -
Throws
ArgumentException: Either temperature is −100 or below, which is the SDK's no-temperature sentinel and cannot be a reading. The sentinel is a marker, not a temperature, so it is −100 in either unit. -
Throws
ObjectDisposedException: The camera has been disposed.
The correction is folded into the camera's energy-to-temperature table, so every temperature the pipeline reports (pixels, spots, regions and the recorded stream alike) is corrected by one act. Undone with ThermalCamera.ResetReferenceTemperature, read back with ThermalCamera.GetReferenceTemperature.
Check ThermalCamera.ReferenceCorrectionSupport first and hide the control unless it reports ReferenceCorrectionSupport.Supported, rather than discovering the refusal by making the call.
Through version 12.0 this returned without error and applied no correction at all, with no reader anywhere that could contradict it: an operator pointed a camera at a reference body, applied the correction, and every temperature afterwards was uncorrected while the SDK agreed it had been corrected. There is a reader now.
Which fit is applied (a shift of the whole scale, or a re-solved emissivity) is chosen when the table is next rebuilt, from how far the reference is from the shutter temperature. So this call cannot report it; ReferenceCorrection.IsGainFit reports what was applied.
public void SetShutterInterval(TimeSpan minimum, TimeSpan maximum)
How long the camera waits between automatic shutter cycles.
-
minimum: The shortest it will wait.TimeSpan.Zeroswitches the drift arm off, so only the ceiling can start a cycle. -
maximum: The longest it will go without one.TimeSpan.Zeromeans no ceiling, and is the default, seeThermalCamera.ShutterInterval. -
Throws
ArgumentException:minimumis longer thanmaximumandmaximumis aboveTimeSpan.Zero. -
Throws
ObjectDisposedException: The camera has been disposed.
public void SetSubsampledFramerate(float framerate)
Deliver fewer frames than the camera sends.
-
framerate: Frames per second, or0to switch it off and return the camera to the sensor's own rate. -
Throws
ArgumentOutOfRangeException:framerateis negative. -
Throws
ObjectDisposedException: The camera has been disposed.
public bool SkipStartupCalibration()
Skip the calibration the camera runs when it starts.
Returns: true if it was skipped, false if this camera will not.
- Throws
ObjectDisposedException: The camera has been disposed.
The frames during that calibration are unreliable and the SDK says so. Skipping gets a picture sooner and gets worse numbers until the camera has settled: a reasonable trade for a viewfinder, a bad one for a measurement.
It also delays the first reliable frame, by more than it saves. The start-up calibration closes the shutter three times of its own accord, and the detector-settling criterion needs two references it can compare before it will say the detector has stopped moving. Measured on an Xi 410, warm: the first frame with FrameMetadata.IsThermalDataReliable set arrived at 20.9 s without skipping and 231.7 s with it, and, before the SDK asked for a reference of its own, never within five minutes in two runs where nothing else was done.
The SDK now asks for that shutter cycle itself once the configured minimum flag interval has elapsed, so the wait is bounded. It is still longer than not skipping. If you need a measurement, do not skip; ThermalCamera.TriggerShutter is the fastest way back if you already have.
It does not have to be called before ThermalCamera.Start. Called while the calibration is running it ends it there, which is how a "skip" button uses it; it returns false once the calibration has finished, because there is then nothing to skip.
public void Start()
Begin acquiring and processing frames.
- Throws
ThermalDeviceException: The camera refused to start. - Throws
ObjectDisposedException: The camera has been disposed.
Frames reach ThermalCamera.FramesAsync(…) and ThermalCamera.AcquireFrameAsync(…) only after this returns. Calling it on a camera that is already running does nothing.
Example
camera.Start(); Console.WriteLine(camera.IsRunning); // True
public void StartContinuous(ContinuousOptions options)
Start writing everything this camera sees to disk, for as long as it runs.
-
options: Directory, segmentation, retention and the disk-full decision. -
Throws
ArgumentNullException:optionsisnull. -
Throws
InvalidOperationException: A history is already running, or pre-roll is enabled: the two answer the same question at two scales and running both would store every frame twice. -
Throws
SdkConfigurationException: No retention bound is set at all. Keeping everything is what fills the volume, and doing it because nobody set a field is an accident rather than a decision. -
Throws
SdkIOException: The directory cannot be used, or the volume is already belowContinuousOptions.MinimumFreeBytesplus room for one segment, refused here rather than on the first frame. -
Throws
FeatureNotSupportedException: This is a replay, which has no recorder.
Nothing is started at the interesting moment, because by then it is already recorded: the history rolls on, the oldest is pruned against the retention window, and what somebody keeps comes out of ThermalCamera.SaveClip(…).
ThermalCamera.IsRecording stays false while this runs (a take and a history are different things), and ThermalCamera.StartRecording(…) still works alongside it, writing its own file.
public void StartIntervalCapture(TimeSpan interval, string? directory = null, SnapshotFormat format = 0, string? namePattern = null)
Write a still image every interval, for a time-lapse or a long unattended run.
-
interval: Time between images. Must be greater than zero. -
directory: Where to write. Null or empty usesThermalCamera.OutputDirectory, and failing that the current directory. A folder that is not there yet is created, with the folders above it. -
format: Image format, which also picks the extension. -
namePattern: Filename stem without extension. One placeholder table serves this and the alarm actions:{sequence}(a counter from 1, zero-padded to six digits),{timestamp}(YYYYmmdd_HHMMSSin local time),{serial}and{model}. A token with nothing behind it expands to nothing rather than to itself. Reusing a directory and a pattern no longer overwrites the previous run's images: the SDK appends-1,-2and so on, the way an alarm's files have always worked. -
Throws
ArgumentOutOfRangeException:intervalis not positive. -
Throws
SdkIOException: The folder cannot be created or written to, for example because a file has its name. The message names the folder, and nothing starts. -
Throws
ObjectDisposedException: The camera has been disposed.
Independent of recording: ThermalCamera.StopRecording does not end it. An interval shorter than the camera's frame period is raised to the frame period, since no more images than frames can exist; ThermalCamera.IntervalCaptureInterval reports what is in force.
Example
// One frame a minute for an overnight run. camera.StartIntervalCapture( TimeSpan.FromMinutes(1), "/data/timelapse", SnapshotFormat.Png, "night_{sequence}"); await Task.Delay(TimeSpan.FromHours(8)); camera.StopIntervalCapture(); Console.WriteLine($"wrote {camera.IntervalCaptureCount} images");
public void StartIntervalCapture(TimeSpan interval, string? directory, SnapshotFormat format, string? namePattern, CsvOptions csv)
Write a still image every interval, with the unit and spelling of each CSV image chosen by csv.
-
interval: Time between images. Must be positive. -
directory: Where to write, as forThermalCamera.StartIntervalCapture(…). -
format: What to write.csvapplies toSnapshotFormat.Csvand is ignored by the others. -
namePattern: File name stem, as forThermalCamera.StartIntervalCapture(…). -
csv: The unit, delimiter, decimal separator and the rest, exactly as forThermalCamera.SaveCsvSnapshot(…). The overload without it writes the default CSV, so a capture started with that one afterwards does not keep these options. -
Throws
ArgumentOutOfRangeException:intervalis not positive. -
Throws
ArgumentNullException:csvis null. -
Throws
SdkConfigurationException:csvholds optionsThermalCamera.SaveCsvSnapshot(…)refuses, whatever the format. Nothing starts then. -
Throws
SdkIOException: The folder cannot be created or written to, as forThermalCamera.StartIntervalCapture(…). -
Throws
ObjectDisposedException: The camera has been disposed.
Example
// One CSV a minute, in degrees Fahrenheit, for a German Excel. camera.StartIntervalCapture( TimeSpan.FromMinutes(1), "/data/timelapse", SnapshotFormat.Csv, "night_{sequence}", new CsvOptions { TemperatureUnit = TemperatureUnit.Fahrenheit, Delimiter = ';', DecimalSeparator = ',', });
public void StartRecording(string path)
Start recording to a file.
-
path: Where to write. An.mkvcontainer. -
Throws
ArgumentException:pathis null or empty. -
Throws
ObjectDisposedException: The camera has been disposed. -
Throws
PathExistsException: A regular file is already atpath. Nothing is opened, nothing is truncated, and the file that is there is untouched; the message names the path. A caller that means to overwrite a fixed name deletes the file itself first.
If pre-roll is enabled its buffer is written first. Recording continues until ThermalCamera.StopRecording, or until the camera is disposed.
The file is opened during this call, so a path that cannot be written (a directory that does not exist, a permission that forbids it, a stick that is not mounted) throws here rather than producing a recording that reports itself as running and writes nothing.
Its header is not written during this call. The header waits for the cover's look-ahead and goes down on one of the first few frames, which is also when any attachment provider is asked. See ThermalCamera.SetAttachmentProvider(…).
A disk that fills, or a drive removed half an hour later, cannot be seen from here. That failure lands on the frame thread, and the SDK responds by stopping the recording: ThermalCamera.IsRecording goes false without anyone calling ThermalCamera.StopRecording. So a recording that stops on its own, before the duration it was given, is a recording that failed.
ThermalCamera.IsRecording going false does not mean the file is finished. It goes false as soon as the recording is torn down, and the file is finalized afterwards, on a thread of its own; the trailer and the close are more disk I/O on a disk that has just refused a write, and neither the frame thread nor the SDK's timer thread waits for them.
The signal that the file is complete is the Stopped recording phase, and it means the same thing for a failed recording as for one that was asked to stop. Anything that acts on the finished file (reading its length, deleting a recording that holds no frame, rewriting it with RecordingFile.AttachFiles(…)) belongs on Stopped and not on ThermalCamera.IsRecording. ThermalCamera.StopRecording waits for it too, and so does disposing the camera, so a caller that would rather block than subscribe can do that instead.
A provider registered with ThermalCamera.SetAttachmentProvider(…) is pulled before any frame is written to the file, but not inside this call. It is asked when the header goes down, which is shortly after this method returns, on the thread that writes the recording. So have whatever the provider reads ready before starting the recording. Anything that only exists once the recording has ended cannot go into it. Read what did go in with RecordingFile.Open(…).
Example
camera.Start(); camera.StartRecording("run.mkv"); await Task.Delay(TimeSpan.FromSeconds(10)); camera.StopRecording();
public void StartRecording(string path, TimeSpan duration)
Record for a fixed length of time, then stop without being asked.
-
path: Output MKV file path. -
duration: How long to record. Must be greater than zero. -
Throws
ArgumentException:pathis null or empty. -
Throws
ArgumentOutOfRangeException:durationis not positive. -
Throws
ObjectDisposedException: The camera has been disposed. -
Throws
PathExistsException: A regular file is already atpath. Nothing is opened, nothing is truncated, and the file that is there is untouched; the message names the path. A caller that means to overwrite a fixed name deletes the file itself first.
The clock starts once recording is live, which is after any pre-roll buffer has been flushed, so with pre-roll enabled the file covers roughly the pre-roll plus duration. Calling ThermalCamera.StopRecording early is fine and cancels the deadline.
Example
// Ten seconds, hands off. camera.StartRecording("clip.mkv", TimeSpan.FromSeconds(10)); while (camera.IsRecording) { await Task.Delay(250); }
public void StartRecording(string path, RecordingOptions options)
Start recording with duration and segmentation settings.
-
path: Where to write, and the stem every segment is named from. -
options: Duration and segment limits. -
Throws
ArgumentException:pathis null or empty. -
Throws
ArgumentNullException:optionsis null. -
Throws
InvalidOperationException: A recording is already running. -
Throws
ObjectDisposedException: The camera has been disposed. -
Throws
PathExistsException: A regular file is already at the first part's path --pathitself with no segment limit, and_part000with one, which is the file the recorder is about to open. Nothing is opened, nothing is truncated, and the file that is there is untouched; the message names that file andpathas well. A caller that means to overwrite a fixed name deletes the file itself first.
Every part is numbered, the first one included: path with a segment limit writes _part000, _part001, _part002 and so on before the extension, and each finished file arrives as a RecordingPhase.SegmentCompleted event on ThermalCamera.OnRecording(…).
Every part carries a suffix, the first one included, and that changed in API version 24. run.mkv with a segment limit writes run_part000.mkv and nothing at run.mkv, so an application that passed a path and then reopened it is broken by this: it must take the name from the RecordingPhase.SegmentCompleted event, which reports every finished file including the first, or open _part000 itself. With no segment limit path is used exactly as given -- one whole file is not a part of anything -- so only recordings that asked to roll over are affected.
Example
// An hour to a stick that cannot hold a file above 4 GiB. camera.StartRecording("/media/usb/run.mkv", new RecordingOptions { Duration = TimeSpan.FromHours(1), MaxSegmentBytes = 4290772992, // whatever your destination holds });
public void Stop()
Stop acquiring frames.
- Throws
ObjectDisposedException: The camera has been disposed.
Blocks until any callback in flight has returned, so after this no further frame can arrive until the next ThermalCamera.Start. Calling it on a camera that is not running does nothing.
This does not close ThermalCamera.FramesAsync(…): frames already buffered are still delivered, and starting again resumes into the same stream. Cancel the token you gave ThermalCamera.FramesAsync(…) to end the enumeration.
public void StopContinuous()
Stop writing the rolling history.
The segments stay on disk and stay cuttable, and the next ThermalCamera.StartContinuous(…) on the same directory adopts them. Succeeds when nothing is running.
public void StopIntervalCapture()
Stop writing images at intervals.
- Throws
ObjectDisposedException: The camera has been disposed.
Does nothing when no time-lapse is running.
public void StopRecording()
Stop the current recording and close the file.
- Throws
ObjectDisposedException: The camera has been disposed.
Stopping when nothing is recording does nothing. Safe to call alongside a time-limited recording that is stopping itself.
A recording in parts has reported every part it finished by the time this returns: RecordingPhase.Stopped is raised only after each RecordingPhase.SegmentCompleted of those parts has been delivered and its handler has returned, so those parts and the one Stopped ends are every file of the recording. A ThermalCamera.OnRecording(…) handler still running for such a part therefore holds this call up until it returns, for at most 5 seconds. Never wait in that handler for the thread that calls this one: use BeginInvoke or InvokeAsync to reach a UI thread, not Invoke.
public Nullable<float> TemperatureAtEmissivity(float measuredCelsius, float targetEmissivity)
Re-evaluate a temperature the SDK reported at a different emissivity, using the same correction the pipeline uses.
measuredCelsius: The reading, as the SDK reported it: in the SDK's temperature unit (Celsius unlessSdk.TemperatureUnitchose Fahrenheit), whatever the name says.targetEmissivity: What to re-evaluate it at. Refused below 0.01: dividing by it is the conversion, and there is no answer at zero.
Returns: The converted reading, in the same unit, or null when this source cannot convert.
- Throws
ObjectDisposedException: The camera has been disposed.
This is the tool for RadiationParameters.EmissivityAffectsImage being false: in that mode the picture stays on the global emissivity and the SDK does not adjust the reported region readings either, because the correction inverts the camera's energy curve by bisection and is far too costly per region on the frame thread. Apply it to the readings you display, on the thread that displays them.
null means this source cannot convert, not that the conversion made no difference. The call behind this used to hand back its input, which is indistinguishable from a target emissivity that happened to land on the same number. Ask ThermalCamera.EmissivityConversionSupport which reason it is.
Ask ThermalCamera.RegionEmissivityInFrames first when the value came out of a frame: a region's own emissivity may already be in those pixels, and converting again moves a number that was already right.
public void TriggerShutter()
Close and reopen the shutter now, and re-reference the detector from it. This is the non-uniformity correction.
- Throws
OptrisSdkException: The camera refused, or is not connected. - Throws
ObjectDisposedException: The camera has been disposed.
A correction and a shutter cycle are one operation on this hardware. The shutter closes over the detector, a per-pixel offset table is built from the frames captured while it is closed, and the shutter reopens. The camera has no command that corrects without moving the flag: the firmware does not compute a correction at all, the host does, from what the closed flag gives it. An application offering explicit control wants one button, not two.
The frames during a shutter cycle are not measurements: the camera is looking at its own flag. They are therefore not delivered at all: the stream simply pauses for about a second and a half, and resumes when the shutter reopens.
To follow the cycle, use ThermalCamera.OnShutterState(…). FrameMetadata.IsFlagOpen cannot report it: there is no frame for it to be false on.
public bool TryAcquireFrame(out ThermalFrame? frame)
Take a frame if one is already waiting, without blocking.
frame: The frame, ornullif none was ready. Dispose it when it is not null.
Returns: true if a frame was taken.
- Throws
InvalidOperationException: The camera is not streaming. CallThermalCamera.Startfirst. - Throws
ObjectDisposedException: The camera has been disposed.
"No frame yet" is routine on a running camera, not a failure, so this reports it with false rather than an exception -- a poll loop should not have to be a try block. Anything that is genuinely wrong still throws.
Example
// Drive the camera from an existing render loop. if (camera.TryAcquireFrame(out ThermalFrame? frame)) { using (frame) { Draw(frame); } }
public bool TryGetRegionId(string name, out ulong id)
Find a region by name, without throwing if it is not there.
name: The region'sRegion.Name.id: Its identifier, or zero.
Returns: true if a region with that name exists.
- Throws
ArgumentException:nameis null or empty. - Throws
ObjectDisposedException: The camera has been disposed.
Example
if (camera.TryGetRegionId("middle", out ulong id)) { Console.WriteLine(camera.GetRegionStats(id).Mean); }
public bool TryGetRegionSignalSlot(ulong regionId, out uint slot)
A region's packed signal slot, without throwing if the region is not there.
regionId: The identifierThermalCamera.AddRegion(…)returned.slot: Its slot, or zero.
Returns: true if a region with that identifier exists.
- Throws
ObjectDisposedException: The camera has been disposed.
public bool TryOpenProcessInterface(out ProcessInterface? processInterface)
Open this camera's process interface, if it has one.
processInterface: The interface, ornull. Dispose it before this camera.
Returns: true if there is a camera behind this object.
- Throws
ObjectDisposedException: The camera has been disposed.
false means there is no hardware to declare anything about: a simulated camera or a recording. That is a property of what you opened, not a failure, which is why it is a bool rather than an exception: code that runs against either needs no try block.
Every physical camera answers true, including one that reports nothing on its connector. Detection is advisory: the firmware cannot read the PIF EEPROM on the PI 1 family, sees nothing for a proprietary interface or an external probe, and on an autonomous camera reports whatever its on-board type switch says, which hides an attached stackable PIF whenever the switch disagrees with the wiring. Such an interface reports PifDeviceKind.None, PifDetection.Unknown, zero channels and ProcessInterface.IsConnected false, and exists so that ProcessInterface.DeclareIdentity(…), the documented remedy for exactly that, can be called on it.
Example
if (camera.TryOpenProcessInterface(out ProcessInterface? pif)) { using (pif) { pif.WriteDigitalOutput(0, DigitalState.High); } } else { Console.WriteLine("no process interface on this camera"); }
public bool TryReadSignal(SignalId signal, out double value)
Read any signal, in any domain.
signal: Which one.value: Its value, when this returns true, in the unit of the quantity the signal carries: a temperature in the SDK's temperature unit (Celsius unlessSdk.TemperatureUnitchose Fahrenheit), a region's standard deviation as a difference in degrees of it. A coverage, an area, a count, a process-interface voltage and an application signal are not converted.
Returns: true if the producer supplied a value this cycle. false means there is nothing to read, which is a normal answer for a region that has not been measured yet, or a process interface that is unplugged.
- Throws
ObjectDisposedException: The camera has been disposed.
A Try-shaped method because an absent signal is routine rather than exceptional. A rule on a signal that stops being produced reports AlarmState.Orphaned rather than holding its last state.
public bool TryReadSignal(SignalId signal, out double value, out TimeSpan timestamp)
Read any signal, with the time its producer stamped it.
signal: Which one.value: Its value, when this returns true, in the unitThermalCamera.TryReadSignal(…)describes.timestamp: When the value was produced, when this returns true.
Returns: true if the producer supplied a value this cycle, as ThermalCamera.TryReadSignal(…).
- Throws
ObjectDisposedException: The camera has been disposed.
Which clock this is depends on the signal's domain, and the difference matters. A signal evaluated on a frame (a region statistic, or camera telemetry) carries that frame's timestamp, measured from the camera's start exactly like FrameMetadata.Timestamp. A process-interface channel carries whatever the poll that read it stamped. A value published with ThermalCamera.PublishSignal(…) is evaluated immediately and carries wall-clock time instead, as seconds since the Unix epoch.
Added because the native call always supplied this and the binding discarded it, so reading several signals gave no way to tell whether they came from one moment or several. Reading N signals is still N calls, each of which can see a different frame; comparing the timestamps is how you find out.
public bool UpdateRegion(ulong id, Region source)
Change an installed region's geometry and settings, keeping its identity.
id: Which region.source: A region holding the wanted state. It is copied, and its own identity is ignored: the id belongs to the camera, not to the copy.
Returns: true if it was changed, false if there is no such region.
- Throws
ArgumentNullException:sourceisnull. - Throws
ObjectDisposedException: The camera or the region has been disposed.
This is how a user interface drags a measuring box. The change is applied under the same lock the frame thread takes to measure, so editing while frames arrive is safe.
Prefer this over removing and re-adding. The region keeps its id and its signal slot, so every AlarmRule already attached to it stays valid. Remove-and-re-add changes the id and orphans them.
Example
// Follow the pointer without disturbing the rules on the box. using (Region box = camera.GetRegion(id)!) { box.Centre = cursor; camera.UpdateRegion(id, box); }
public bool UpdateRule(ulong ruleId, AlarmRule rule)
Replace an installed rule, keeping its identifier.
ruleId: Which rule.rule: Its new state. Copied.
Returns: true if it was updated, false if there was no such rule or the edit was refused.
- Throws
ArgumentNullException:ruleisnull. - Throws
ObjectDisposedException: The camera has been disposed.
The change is validated before it is applied, so a rejected edit leaves the rule exactly as it was rather than half-applied, and returns false rather than throwing, as an unknown rule does. Keeping the identifier is the point: anything holding it, and any acknowledgement in flight, stays valid.
A rule added against a region stays bound to that region. Its input's SignalId.Index is re-resolved here, so writing back a rule you built from the thresholds on screen, with SignalId.Region(…) and no index, keeps measuring the same region rather than another one. You do not need to read the installed rule back first to carry its index over.
Returns false if the rule's region has been removed since: the edit is refused rather than installed measuring nothing.
public void UpdateSimulatedScene(SimulatedCameraOptions options)
Point a running simulated camera at a different scene.
-
options: The new scene. Easiest built by readingThermalCamera.SimulatedOptionsand editing it. -
Throws
ArgumentNullException:optionsisnull. -
Throws
FeatureNotSupportedException: This is a real camera. -
Throws
SdkConfigurationException: A fixed property differs from the running value, the requested pattern isTestPattern.FromFileon a camera opened without a frame file, orSimulatedCameraOptions.FrameCycleStepsis neither zero nor inSimulatedCameraOptions.MinFrameCycleStepstoSimulatedCameraOptions.MaxFrameCycleSteps. A refused update changes nothing. -
Throws
ObjectDisposedException: The camera has been disposed.
Takes effect on the next frame, with no reconnect: regions, alarm rules, recording and every open handle survive it. That is the point -- switching a virtual camera from a gradient to a hot spot used to mean closing it, opening another and replaying everything configured on the first.
Only the scene may move. SimulatedCameraOptions lists which properties are fixed for the life of the camera; a fixed one that differs from the running value is refused by name rather than ignored, so a control wired to the wrong call says so instead of appearing to work. Changing the model or the frame rate still needs a close and reopen.