OptrisOptrisDocumentation

Documentation/OTC SDK/optris_sdk — Python API referencev12.0

Camera

class optris_sdk.camera.Camera

An open camera, or a recording being replayed.

Use it as a context manager. Closing stops streaming, waits for any callback still running to return, and releases the camera -- in that order, which is what makes it safe to drop the objects a callback was using.

Camera — properties

serial

The serial of the camera this is, as it reports it.

model

connection_interface

What it is attached by, as a sentence rather than an enum.

is_simulated

measured_frame_rate

How many real frames arrived, over how long.

The configured rate -- what the SDK intends to deliver after subsampling -- cannot know about a shutter cycle, a frame held because the flag was in the way, a frame dropped under load, or a camera that is not keeping up. This is the counted answer.

A frame only counts if it carried new pixels: one whose Frame.is_repeated_frame is set does not. That is the point -- counting callbacks gives the callback rate, which does not fall during a shutter cycle because the stream stays continuous.

The rate is real_frames / (window_ms / 1000), a count over a sliding window ending now. Both numbers are returned, so the rate can be re-derived and its resolution worked out: the count quantises the answer to one frame per window, which is 1000 / window_ms Hz. The window holds at least eight frames at the rate the source is configured for, bounded to 1..4 seconds, so a 4 Hz camera is not judged over a second that holds four of its frames.

valid is False until two frames have been delivered and enough time has passed to divide by. That is not the same as a measured zero: a stalled camera reports valid True with measured_hz 0.

Two rates come out, not one. measured_hz counts only frames that carried new pixels and is the number to show a user; delivered_hz counts every frame and is the number to decide whether the camera is alive. A camera mid-closure has the first near zero and the second at its nominal rate, while a camera that has stopped has both at zero -- so treating a low measured_hz as a lost camera would report every healthy shutter cycle as a fault.

  • Returns — a dict with valid, measured_hz, delivered_hz, window_ms, real_frames, repeated_frames, total_real_frames and total_repeated_frames.

live_frame_rate

Real frames per second over the time the scene was measured.

The frame rate to show a user. measured_frame_rate counts real frames over wall time, so its measured_hz dips towards zero through every shutter cycle and falls to zero while a replay is paused. This is the same count over live time: the intervals that ended in a repeated frame (the shutter flag closed, in motion, or settling after it reopens) and the time a replay is paused are left out, numerator and divisor alike, so hz is real_frames / (window_ms / 1000).

A healthy shutter cycle reads the camera's rate throughout and a paused replay keeps the rate it had, reading the file's rate again straight after it resumes. A camera that stops delivering still reads 0, a dropped frame still lowers it, and with nothing held or paused within the window it equals measured_hz. valid is False until there is live time to divide by, which can be later than measured_frame_rate for a stream that started with the flag closed.

  • Returns — a dict with valid, hz, window_ms and real_frames.

is_running

width

height

radiation_sources

Which radiation parameters a PIF input is driving.

A optris_sdk.recording.RadiationSources.

radiation reads the parameters back from the engine rather than echoing the last write, so a value a process interface supplied comes back from it looking exactly like one that was set through this API. This is what tells them apart: an application that lets an operator edit the emissivity or the ambient temperature can show the field read-only, and say which input owns it, instead of accepting an edit the next PIF sample discards.

The answer follows the channel table, not the samples. An input configured as optris_sdk.PIF_KIND_EMISSIVITY owns the emissivity from the moment it is configured -- before the first frame carries a reading for it, and whether or not any sample ever arrives. So reading this once after configuring the process interface is enough; it does not have to be polled per frame. It changes only when the channel table does, which is when this application changed it, or when a camera refused a channel it was asked for -- which is why guessing from an application's own table is not the same answer.

  • Raises ~optris_sdk.errors.NotSupportedError — on a replay or a still. Neither has a process interface, so there is no question to answer about them, and reporting optris_sdk.RADIATION_SOURCE_SDK would be a value standing in for "does not apply".

emissivity

The emissivity the whole image is corrected with.

has_radiation

Whether this source states its radiation parameters.

emissivity and its two siblings are 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" read the same -- and 1.0 / 1.0 / 20 C are plausible values rather than obviously missing ones. This tells them apart. True for a live camera always. For a recording or a still it is True only when the file states the emissivity, the transmissivity and the ambient; False for a recording written by v11, for one from other software, and for any file whose metadata is silent. Where it is False, show nothing rather than a number. A fact about the file, not about what is in force: setting emissivity on a recording changes what the frames are re-derived at and does not move this.

operation_mode

The combination in force now.

temperature_range

The active span, as (min_c, max_c) whole degrees of the SDK's temperature unit (Celsius unless optris_sdk.set_temperature_unit chose Fahrenheit): -20..100 C reads -4..212 F.

Assigning one in Fahrenheit is converted and rounded to the nearest whole Celsius degree before it is matched against the camera's ranges. Every range a camera offers is a multiple of 5 C, so each has an exact whole Fahrenheit spelling and a span read back is accepted as it was read.

has_temperature_range

Whether this source states temperature_range.

The range is two plain integers, so "this recording was made in -20..100 C" and "the file never said, so you are looking at the default" read the same. This tells them apart. True for a live camera always -- it is measuring in some range whether or not anybody selected it. For a recording or a still it is True only when the file states both bounds; False for a recording written by v11, for one from other software, and for any file whose documents are silent about the range. Where it is False the -20..100 C (-4..212 in Fahrenheit) you get back is this SDK's own default: show nothing, and draw no scale bar against it. A fact about the file, not about what is in force.

range_extension_enabled

Whether the range extension is switched on.

Not a measuring range: the extended part lies outside the calibration and reads with poor precision. It is there so the field of view can be aimed on a camera whose range has a high lower limit -- a 150..900 C range typically extends down to 20 C. Off by default, as in SDK 11.

Camera-wide, not per mode: the request is kept whether or not the active mode can act on it. Whether it is in force is OperationMode.extendable together with the limits that mode reports.

high_precision_enabled

Whether the high-precision temperature table is selected.

True by default, as in SDK 11. It trades the span the 16-bit internal value can represent -- (T + 100) * 10 over -100..+6453 C in 0.1 C steps, against (T + 100) * 100 in 0.01 C steps but clamped at +300 C -- and NOT the frame rate, which is identical either way. OperationMode.high_precision_available is the calibration's own answer for a given range.

What it does not change today: the step size of the temperatures this SDK reports. The pipeline carries thermal pixels as T*10 + 1000 in an int16, so the finer table is built and then rounded to 0.1 C. SDK 11's 0.01 C reporting needs that representation changed, tracked separately.

This property cannot tell you any of that, which is why high_precision_state 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, not a number SDK 11 displayed over coarser data.

high_precision_state

Whether the finer step is reaching the temperatures you read, and when it is not, why not.

One of HIGH_PRECISION_UNKNOWN, HIGH_PRECISION_UNAVAILABLE, HIGH_PRECISION_DISABLED, HIGH_PRECISION_SELECTED_NOT_DELIVERED or HIGH_PRECISION_DELIVERED.

Read this rather than inferring an answer from high_precision_enabled, 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 a mode's high_precision_available gets closer and still cannot see the rounding, which is the part a caller has no other way to learn.

HIGH_PRECISION_SELECTED_NOT_DELIVERED is today's answer on every camera that offers the finer table at all: the table is genuinely built in centidegrees and the pipeline then rounds every pixel onto the 0.1 degC grid. Do not label that to a user as finer readings.

Answers HIGH_PRECISION_UNKNOWN on a camera that is not open rather than raising.

temporal_smoothing

The time constant of the temporal noise filter, 0 to 1.

Lower is smoother and slower to respond; 1 disables the smoothing. Reading this is authoritative and answers before anything has been written: smoothing is a stage of the SDK's own pipeline rather than a setting held in the camera, so a camera nobody has configured reports the value both pipelines start from. It survives a change of filter -- every other mode ignores the alpha rather than clearing it.

There was no reader at all in earlier releases.

palette

The built-in palette the picture is colorized with.

One of the PALETTE_* constants. Assign one to change it::

camera.palette = optris_sdk.PALETTE_IRON_BOW

This reports the built-in that is selected, which is not the same question as what is currently being drawn: a custom palette overrides it without replacing it, so custom_palette_name is what says whether this value is reaching the picture. Clearing the custom palette brings this one back.

optris_sdk.palettes is the rest of the subject -- the names, the colours, and the palette files on the machine.

color_scale_dynamics

How fast the auto-scaled colour range may move.

A ColorScaleDynamics. Auto-scaling recomputes the range from every frame, and an unfiltered range makes the picture breathe: a soldering iron leaving re-colours the wall behind it in one frame, and on a narrow scene the scale is the sensor noise, so a still wall shimmers. This is the damping that stops that.

It decides the picture and nothing else. Every temperature the SDK reports -- Frame.min_c, every measuring area, everything written to a recording -- is produced before colouring and is identical whatever this is set to.

The response depends on how big the change is, because the two things wanted of an auto-scaled picture pull in opposite directions and one smoothing constant cannot do both::

d = camera.color_scale_dynamics
camera.color_scale_dynamics = d._replace(deadband_k=1.0)

close_time and open_time are float seconds, as every duration in this package is; the ABI carries whole milliseconds and the conversion rounds rather than truncating.

Below deadband_k the scale does not move at all -- not slowly, not at all. At or above immediate_fraction of the span it adopts the scene on the frame it arrives. Between damped_fraction and immediate_fraction it eases smoothly from one to the other.

For the instantaneous behaviour that shipped through 12.0.0 -- what anyone comparing two captures frame by frame wants -- assign ColorScaleDynamics.unadapted. Setting close_time and open_time to zero switches the damping off entirely, deadband and adaptive rate included.

custom_palette_name

The custom palette in force, or '' when there is none.

'' is the answer that says palette is what is reaching the picture.

The ABI reports "no custom palette" as NOT_FOUND rather than as an empty string. That is right for C, where the two cases have to be distinguishable without an out-of-band value, but from Python "is there one" is a question with a plain answer and raising for the ordinary case would make every caller write a try/except around a property. So the absence is translated, and only the absence: any other failure still raises.

overlay_compositing

Whether the SDK draws the region outlines into the colour image it delivers.

Reads True on a fresh camera or recording, on every backend. It is the setting, not a report of the picture. A camera whose picture is made on the graphics card (a GPU backend) draws the outlines 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 it reads True and no outlines are drawn.

To draw them yourself at display resolution, set it to False. Whether a saved picture has outlines in it is optris_sdk.snapshot.SnapshotRender.overlays. Before v12 there was no reader at all and an application had to cache what it wrote.

display_temperature_unit

The unit this camera shows temperatures in, wherever the SDK itself turns a temperature into text for a person to read.

TEMPERATURE_UNIT_CELSIUS or TEMPERATURE_UNIT_FAHRENHEIT. Until one is assigned it follows the SDK's temperature unit (optris_sdk.set_temperature_unit, Celsius by default) and reads back as that; once assigned, this camera draws in it whatever the SDK's unit is. Assign one to change it::

camera.display_temperature_unit = \
    optris_sdk.TEMPERATURE_UNIT_FAHRENHEIT

That is the reading in a region's label drawn into the picture (the show_label style flag), 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 optris_sdk.temperatures.format, so a label and your own text for the same reading agree to the last digit. In Fahrenheit a label reads INLET 70.3F where it read INLET 21.3C.

Display only. Every number this API takes and returns is in the SDK's temperature unit, whatever this is set to: frames, regions, alarm limits, process interface mappings, the colour range, radiation parameters and recordings follow optris_sdk.set_temperature_unit, not this. Everything written for a program to read stays Celsius: the radiometric PNG and TIFF, the metadata in every snapshot, and log lines. A CSV snapshot keeps its own optris_sdk.snapshot.CsvOptions.temperature_unit.

In Celsius, with this never assigned, every picture and file is byte for byte what it was before this setting existed. Works on a camera, a recording and a still (a still draws no region labels, so there it is the JPEG line alone). Assigning a value that is neither unit raises optris_sdk.InvalidArgumentError and changes nothing.

segment_limit_action

What a recording does when it reaches its segment limit -- the max_segment_bytes or max_segment_duration_s it was started with. Added in 12.0.10.

optris_sdk.SEGMENT_LIMIT_CONTINUE_SERIES (the default: the next part of the same recording, which open_recording_series replays as one), optris_sdk.SEGMENT_LIMIT_START_NEW_RECORDING (end it and start a new one, named with its own start time), and optris_sdk.SEGMENT_LIMIT_STOP_RECORDING (end it at the limit, with a stopped event carrying optris_sdk.RECORDING_STOP_SEGMENT_LIMIT; added in 12.0.28). 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.

  • Raises ~optris_sdk.errors.NotSupportedError — on a replay or a still, which record nothing.
  • Raises ~optris_sdk.errors.InvalidArgumentError — on setting a value that is none of the three.

is_recording

Whether a recording is running.

True does not mean frames are reaching the file; see start_recording.

is_recording_bounded

Whether the running recording has a deadline at all.

remaining_recording_time_s is zero both for a recording that runs until stopped and for one whose deadline has just passed, and those are different things.

remaining_recording_time_s

How long a time-limited recording still has to run.

Zero when nothing is recording, and zero when the recording has no limit -- is_recording_bounded separates those.

recording_stats

Frame accounting for the current -- or last -- recording.

A optris_sdk.recording.RecordingStats. Reset when a recording starts and kept after it stops, so it is readable once the file is closed, which is when it is worth reading: optris_sdk.recording.RecordingStats.frames_lost is how a caller finds out that a recording which reported no error nonetheless did not write everything.

pre_roll

What the pre-roll buffer is doing, as a optris_sdk.recording.PreRollState.

Read through optris_sdk_imager_get_pre_roll_state(). There was a four-out-parameter getter beside it until API version 30, and the span held and whether the buffer is full were not among those four -- so without the struct, optris_sdk.recording.PreRollState.full could only be the frame comparison that is never true on a camera delivering below its sensor rate.

pre_roll_memory_budget

The most memory the pre-roll buffer may take, in bytes.

Zero means no cap. The default is 512 MiB, which is a long time at a small sensor and a few seconds at a large one -- the budget, not the duration, is what actually bounds the buffer.

is_interval_capturing

Whether a time-lapse is running.

interval_capture_interval_s

The interval actually in force, after any raise to the frame period. Zero when no time-lapse is running.

interval_capture_count

How many images the time-lapse has written.

is_playback

Whether this is a recording being replayed rather than hardware.

The one question both kinds answer, and so the one to branch on.

attachment_count

How many files the recording being replayed carries.

Raises optris_sdk.errors.NotSupportedError on a live camera, which carries nothing.

attachments

Every file the recording being replayed carries.

A list of optris_sdk.snapshot.Attachment, in container order, with their bytes fetched on first use. The same enumeration, at the same positions, as optris_sdk.recording.RecordingFile.attachments on the same file -- two ways in, because there are two questions: this one when the recording is already open for playback, and optris_sdk.recording.RecordingFile when it is a path in a folder listing and no decoder is wanted.

Raises optris_sdk.errors.NotSupportedError on a live camera.

playback_speed

Replay speed. 1.0 is real time, 0.5 half, 2.0 double.

is_looping

Whether replay starts again from the beginning at the end.

playback_duration_s

How long the recording is, in seconds.

playback_start_time_us

When the recording started, in microseconds since the epoch.

UTC, from the file's creation time. For a recording made from a camera, when the recording began, to the second; for one converted from a PIX Connect .ravi by optris_sdk.ravi.import_ravi, when the original was recorded. 0 when the file does not say. Add playback_position_s for the wall-clock time of the frame on screen.

playback_started_at

playback_start_time_us as an aware UTC datetime.

None when the file does not say when it was recorded.

playback_time_zone

The time zone the recording was made in, as a optris_sdk.recording.RecordingTimeZone.

The recording computer's for a recording of a camera; the one given (or, marked assumed, the one taken) at conversion for one converted from a PIX Connect .ravi. None for a recording that does not say: one made by an SDK release before this existed, or by another program.

playback_position_s

How far into the recording replay has got, in seconds.

An offset into the file -- the same thing seek_to takes -- so it always satisfies 0 <= position <= playback_duration_s. Polling the two against each other is how a caller sees that a recording has played out.

It is not the replayed frame's capture stamp; Frame.timestamp_us is that, and it counts from an epoch belonging to the transport the recording was made on. Reporting the latter here is what made a four-second file answer with days.

Zero before playback starts, and zero again after a stop.

last_seek_walked_frames

Frames the last seek decoded without delivering them.

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 optris_sdk.playback.FrameIndex over the file: optris_sdk.playback.FrameIndex.anchor_for answers it without decoding anything. This one is how an application finds out that its prediction was wrong.

  • Raises ~optris_sdk.errors.NotSupportedError — on a camera or a still. There is no seek on either, so zero would be a number standing in for "the question does not apply".

last_seek_replayed_records

Region records the last seek replayed off the metadata track.

A seek's second cost, bounded by a different distance from last_seek_walked_frames, 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.

  • Raises ~optris_sdk.errors.NotSupportedError — as above.

is_playback_paused

Whether the replay is paused.

Distinct from "not running": a stopped replay is not paused, and both answer False here. Pair it with is_running.

playback_can_change_radiation

Whether the global radiation can be changed on this recording and have it reach the delivered pixels.

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. 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. 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 raises NotSupportedError.

Says nothing about a region's own emissivity, which goes through the curve alone and needs no bundle -- playback_honours_region_emissivity is that question.

playback_honours_region_emissivity

Whether a per-region emissivity reaches that region's numbers on this recording.

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 EMISSIVITY_READING_ONLY 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 EMISSIVITY_CAMERAS says so.

is_still

Whether this is a saved still rather than a camera or a recording.

Answered by all three kinds, so it is the one to branch on.

still_redelivery_rate

How often a running still re-delivers its one frame, in Hz.

Between 0.1 and 120; 10 by default. No effect on refresh.

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 start be measured without a restart.

honours_region_emissivity

Whether a region's own emissivity reaches the numbers here.

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 REGION_EMISSIVITY_READING_ONLY, 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 REGION_EMISSIVITY_CAMERAS says so -- 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.

The camera's emissivity, the one every pixel was computed at, is recorded either way and is what emissivity 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 they 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. An interface offering both should not present them as interchangeable at low emissivity.

still_path

The file this still was opened from.

still_metadata_json

The whole metadata document the file carries, as JSON.

The pixel scale, the scene statistics, the capture telemetry, the regions the writer recorded and anything it merged in -- the same document Snapshot.metadata_json 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 attributes, including the recorded region list and the render block that says what the colours meant.

sensor_width

The detector's own width, before any orientation.

width reports what is delivered, which a quarter turn swaps. This reports what the hardware -- or, on a file, the stored frame -- actually is.

sensor_height

The detector's own height, before any orientation.

orientation

The orientation in force, as (rotation_deg, mirror).

distortion_correction

Radial distortion correction: one of the RDC_* values.

Reading this is authoritative for what was set: the correction is a stage of the SDK's own image pipeline, not a setting held in the camera, so nothing outside this process can change it. Whether it is reshaping anything is a different question -- see picture_correction.

size_of_source_correction

Whether the size-of-source correction is switched on.

SoS is size-of-source: the halo of stray flux around a hot target, subtracted back out of the signal. On by default, matching v11.

This is the caller's switch, not the outcome. Switching it on is not enough to change a pixel -- the gate and the magnitude are separate, and size_of_source_strength defaults to zero, which is an exact identity. picture_correction reports which of those is the case.

size_of_source_strength

How much of the signal arrives via the halo, as a fraction.

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 normalised to unit sum, so it describes the shape of the halo and carries no magnitude at all, and no calibration document the SDK has ever shipped supplies one. It has to be measured for a camera and its optics. Until it is, the correction is an exact identity however size_of_source_correction is set.

device_type

The camera's model as an enumerator, not as a string.

device_type_name spells one out. Branch on this rather than on model, which is what the camera itself reports and is a label.

firmware_revision

The camera's firmware revision, or 0 if it reports none.

hardware_revision

The camera's hardware revision, or 0 if it reports none.

frame_rate

The nominal frame rate in Hz.

What the camera is configured for. measured_frame_rate is what is arriving, and frame_rate_info is why the two differ.

frame_rate_info

Why the delivered rate is what it is, as a FrameRateInfo.

The one place a reduced rate is explained rather than merely observed: a request above the sensor's own rate, a pipeline that cannot keep up, or a camera whose firmware declares itself export restricted and is therefore held to 9 Hz at intake.

pipeline_info

Which pipeline the SDK chose for this camera, and why, as a PipelineInfo.

Not a setting: the choice follows from the camera's resolution, its calibration and what this machine's GPU can do. Read it when two identical hosts behave differently -- that is what reason, gpu_adapter_is_software and streaming_backend_source are for.

simulated_config

What a simulated camera is drawing, as a SimulatedCamera.

Every field comes back resolved to what the camera is actually doing -- the width, height, rate and serial are the values chosen when it was created, not the zeros that stood for "use the model's default". That is what makes read, change, write work: pass it to update_simulated_scene after changing a scene field and the fixed fields already match.

  • Raises ~optris_sdk.errors.NotSupportedError — on a real camera.

frame_count

How many frames have been delivered since the last reset.

dropped_frame_count

How many frames the pull queue discarded because a consumer could not keep up.

Exactly that, and nothing else: frames evicted from the queue behind acquire. It says nothing about frames the camera never sent, frames lost in the transport, or frames discarded in a buffer of your own.

Do not read it as a health figure unless you are actually pulling frames. The queue is four frames deep and is filled on every frame whether or not anything takes frames out of it, so an application driven by on_thermal_frame that never calls acquire sees this rise by roughly one per frame for the whole session. That is the queue working as intended.

Cumulative over the life of the handle, and not reset by starting or stopping; reset_statistics is the only thing that zeroes it. Answers on a recording and a still as well as on a camera -- all three hand frames over through the same queue, so all three lose frames to a slow consumer.

processing_latency_s

Time from capture to delivery for the most recent frame.

Always raises optris_sdk.errors.NotSupportedError in this release. The SDK does not measure processing latency, and the measurement was withdrawn rather than never written: v11 had this call and returned a hardcoded zero on every camera.

It refuses rather than answering 0 on purpose. A caller 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.

To measure delivery latency now, compare a frame's Frame.timestamp_us against your own reading of the same clock when the frame arrives -- time.monotonic(), not a wall clock: the frame stamp counts from the host's boot rather than from any epoch a date is measured in.

is_connected

Whether a device is open. The coarse answer.

connection_status distinguishes the five states this collapses, and the distinction between stalled and lost is the one an operator needs.

connection_status

The link, as one of the CONNECTION_* constants.

optris_sdk.reconnect.connection_status_name spells one out. CONNECTION_STALLED is open-but-silent and CONNECTION_LOST is gone -- there is nothing left to wait for in the second, which is why they are not one state.

This says nothing about whether the temperatures can be believed: a camera whose calibration is missing has a perfectly healthy link. calibration_status is that axis.

connection_timeout_s

How long without a frame before the status says stalled.

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. Readable before the camera is open, when it reports what a fresh configuration would use.

calibration_status

Whether this camera's temperatures can be believed.

One of the CALIBRATION_* constants; optris_sdk.reconnect.calibration_status_name spells one out. A camera whose calibration files could not be found opens anyway, streams anyway and reports temperatures anyway -- and they are wrong. connection_status will not say so, because the link is fine and that is all it reports.

Latched during the open and readable for as long as the handle lives, including after the stream has stopped.

calibration_diagnosis

Why the calibration is missing, in words, when it is.

Empty when calibration_status is anything but CALIBRATION_MISSING. It names which source let this machine down -- the directory the caller 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.

is_auto_reconnect_enabled

Whether automatic reconnection is in force.

The state, not the request. It goes False once the SDK has given up: after that nothing is watching the camera, and a flag still reading "in force" described a request nobody was acting on. enable_auto_reconnect switches it back on.

reconnect_config

The backoff automatic reconnection was given, as a optris_sdk.reconnect.ReconnectConfig.

The defaults when it has never been switched on.

color_range

The fixed range in force, as (min_c, max_c), in the SDK's temperature unit (Celsius unless optris_sdk.set_temperature_unit chose Fahrenheit).

Either end is None when it is not fixed, so (None, None) means the picture is auto-scaled. This is the setting, and it answers for whatever set it: a recording made on a fixed range carries it in the file and a replay reports it here before a single frame has been drawn, which is when an application decides what to label the scale.

A camera reports both ends or neither -- it holds the range as two numbers and reads "fixed" off min < max. A recording and a reopened still can report one end alone.

Three different questions, and reading one for another is a real defect that shipped: this is the setting, color_scaling is the mode that applies while no fixed range is in force, and effective_color_range is what the last frame was actually drawn with.

effective_color_range

What the most recent frame was actually drawn with, as (min_c, max_c) in the SDK's temperature unit, or None before any frame.

What a temperature slider displays while auto-scaling. Under the sigma modes it is temporally filtered, so it is neither what any single frame's pixels imply nor what was last requested, and it cannot be reconstructed from outside the SDK.

None before the first frame is coloured and after a change of scaling mode. That is a routine state rather than a failure, and a slider should keep showing whatever it showed rather than jump to a fabricated 0..0 -- which is why this is None and not a pair of zeros.

color_scaling

The auto-scaling policy that applies while no fixed range is in force, as one of the COLOR_SCALING_* constants.

Not "the scale this source is drawn with". Setting a fixed range does not clear the mode -- clearing the range has to leave a mode to go back to -- so this keeps answering whatever was last chosen while the picture is on a fixed range. On a recording it is the mode the file named, and a file made on a fixed range names none, so this answers the default for a replay that is not percentile-scaled at all.

Read color_range to learn whether a fixed range is in force. The two together are the scale; this one alone is not.

dde

Detail enhancement as it stands, as (enabled, base, detail).

Reports what was accepted, not what was last written: a refused set_dde_gain leaves the previous setting in force and this keeps reporting that.

On a recording or a still this answers (False, 0.0, 0.0) rather than refusing, 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 none has been applied to the picture.

is_dde_supported

Whether this source can run detail enhancement at all.

True for a live camera on either backend and for a simulated camera; False for a replay and for any other source with no pipeline. False means false, and it is an answer rather than a refusal -- ask it, rather than inferring from an exception that enhancement is unavailable.

filter

The spatial noise filter in force, as (mode, strength).

Authoritative: it reports what was last accepted, and a rejected selection is never accepted, so this can never name a filter the pipeline is not running.

Refuses on a recording or a still, deliberately. The only value it could report there is FILTER_NONE, because that is what the player runs, and an application would reasonably read that as "this recording is unfiltered" -- which is unknowable: a recording's temperatures carry whatever filter was in force when it was written and the file records no filter settings at all. Refusing says less and says it truthfully.

frame_queue_policy

Which frame acquire's queue loses when it is full.

FRAME_QUEUE_DROP_OLDEST or FRAME_QUEUE_DROP_NEWEST.

gpu_instance

The SDK's WebGPU instance as an integer address, or None when there is no GPU backend.

For creating a WGPUSurface to hand to configure_surface. Owned by the SDK: do not release it.

None and a refusal are different answers. This reports None for a camera with no GPU backend and raises only for a source that has no GPU path at all, such as a replay -- so test the value rather than only catching the exception.

has_surface

Whether a surface is configured.

network_config

The camera's Ethernet settings, as a NetworkConfig.

  • Raises ~optris_sdk.errors.NotSupportedError — on a camera with no Ethernet interface -- the normal answer for a USB model, and not a malfunction -- and on a replay. The same status for both, so tell them apart by how the handle was made.

emissivity_conversion_support

Whether a reading can be re-evaluated at another emissivity here, as one of the EMISSIVITY_CONVERSION_* constants.

Treat only EMISSIVITY_CONVERSION_SUPPORTED as support. The other three say why not -- no energy curve at all, or a curve that cannot be inverted -- which is what lets a control be greyed out with a reason instead of raising when it is used.

region_emissivity_in_frames

Whether the temperatures the SDK is handing out already carry each region's own emissivity.

This is not the setting read back. emissivity_affects_image 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 temperature_at_emissivity 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.

playback_at_end

Whether a non-looping replay has read the file to its end.

The end of a replay, asked rather than inferred. Polling the position against the duration does not work: those two never meet, so every consumer had to invent a tolerance, and one that waited for equality waited forever.

False before playback starts, and False again after start or any seek -- both of those are somewhere to play from. A replay with looping on never reports True, because it never ends. A stop leaves it set, which is not an oversight: a stop leaves the file where it is rather than rewinding, so a replay that has played out has still played out. Seek to zero to replay.

This says the file has been read out, not that nothing is left to collect: acquire may still have queued frames to hand over, so drain them rather than stopping on this.

  • Raises ~optris_sdk.errors.NotSupportedError — on a live camera. Check is_playback first.

playback_part

Which part of a multipart recording is playing, counting from 0 -- the number in the file's _partNNN suffix.

For a replay opened with open_recording_series; 0 for one opened with open_recording, which holds a single file. Added in 12.0.10.

  • Raises ~optris_sdk.errors.NotSupportedError — on a live camera.

playback_part_count

How many parts this replay holds: 1 for a single file. Added in 12.0.10.

  • Raises ~optris_sdk.errors.NotSupportedError — on a live camera.

recorded_lossy

What was done to this recording's samples, or None when it is lossless.

None is the answer rather than an exception because the block is omitted entirely for an exact recording, and every recording written before the setting existed is exact. Returns a dict with quantize_counts, max_error_k, visual_quality and visual_codec. max_error_k is a temperature difference in degrees of the SDK's temperature unit (kelvin-sized in Celsius, Fahrenheit-sized in Fahrenheit).

A recording stores finished temperatures, so quantisation altered the measurement permanently; this is how a reader asks by how much, rather than discovering it from the numbers.

  • Raises ~optris_sdk.errors.NotSupportedError — on a live camera. There is no file to ask about.

recorded_render

What the recording says its colours meant, or None when it carries no render metadata.

None is every file written before the block existed, and it is distinguishable both from a file that carries a block saying nothing useful and from the SDK's own defaults -- which is the whole point of the call. Returns a dict whose range_min_c, range_max_c, overlays and thermal_data_reliable are each None when the file did not record them. The two range ends are in the SDK's temperature unit (Celsius unless optris_sdk.set_temperature_unit chose Fahrenheit); the file stores Celsius.

  • Raises ~optris_sdk.errors.NotSupportedError — on a live camera.

output_directory

Where snapshots and recordings are written.

The counterpart to set_output_directory.

Camera — methods

simulated(cls, config = None, on_progress = None)

Open a camera that is not there.

Deterministic, needs no hardware, and answers the whole API. Every example in this package opens one by default so that it runs on a machine with no camera attached.

on_progress is called with each OPEN_PHASE_* value while the open runs, and never after this returns -- which is what makes it safe for the handler to use anything that lives only for the duration of the call. A simulated camera reports its phases on the calling thread; a real one does not, so write the handler as though it could arrive on another.

open_first(cls, options = None)

Open the first camera the SDK can find, without enumerating.

The difference from open with no arguments is where the search happens: this hands the whole job to the SDK, so a program that only ever wants "the camera on this machine" does not have to hold a device list it is going to throw away. There is no way to say which camera, so use open with a serial as soon as there can be two.

options is a CameraOptions.

  • Raises ~optris_sdk.errors.DeviceError — when there is no camera. A machine with none is the ordinary case for this call, and it is reported rather than returning None.

open(cls, device = None, serial = None, options = None, on_progress = None)

Open a real camera.

With no arguments, the first one attached that this process can open, as open_first (with on_progress, the first one attached). With serial, the one with that serial number -- which is what to use as soon as there can be two, because attachment order is not stable across reboots and index is not a name. A serial that is not on USB is looked for on the network next, by broadcast, so a camera on a network cable opens with the same call; that costs the discovery wait, three seconds, only when the camera is not on USB.

serial may be a string or an integer: 16030066 and "16030066" name the same camera. Anything else is a TypeError that says so.

options is a CameraOptions -- where to find the calibration, whether it may be downloaded, the two timeouts and which operation mode to open in. on_progress is called with each OPEN_PHASE_* value while the open runs; the phases around the calibration are the ones worth showing, because they are where a slow open spends its time.

open_network(cls, serial = None, address = None, port = None, connect_timeout_s = None, discovery_timeout_s = None, options = None)

Open a camera over Ethernet.

Naming only the serial is the form to copy, and it is the reason open is usually enough: the SDK looks on USB first and then broadcasts, so an application does not have to be rewritten because a camera moved onto a network cable.

An explicit address is needed only for a camera this host cannot broadcast to -- one behind a router, or on another VLAN. Discovery is a broadcast and crosses neither.

Set discovery_timeout_s -- not connect_timeout_s -- to make a wrong address fail quickly. With an address and no serial the SDK asks that address who is there, to learn the serial, and a wrong address never gets past the asking: the discovery wait is the whole cost of the failure and connect_timeout_s is never reached. Measured against an address nobody answers, 0.2 s of discovery costs 0.61 s and 3 s costs 3.04 s -- about 0.6 s is the floor whatever is asked for, because one discovery pass is a blocking read plus a short sleep. connect_timeout_s bounds the control channel, which is reached only once a camera has identified itself, so it is what to set when a serial is named as well.

options carries the calibration settings and the operation mode, which this call cannot otherwise express. Note that a CameraOptions of its own carries these same two timeouts and they have no effect here -- the two arguments above are the operative pair, because they go on the network target, which is the record the SDK reads for this call.

Both timeouts are carried as whole milliseconds, rounded, and never down to zero from a positive value. Zero on either means "use the SDK's default" -- five seconds for the connect, three for the discovery -- so a short timeout that collapsed to zero would come out far longer than was asked for, not shorter.

open_recording(cls, path)

Open a recording and replay it as if it were a camera.

The counterpart to recording. What comes back is an ordinary Camera: start, acquire, regions, alarms and the palettes all work on it unchanged, so code written against a live camera measures a file without being rewritten.

What only hardware can do is refused rather than faked -- the shutter, the focus motor, the network settings, the recorder, snapshots and the process interface all raise optris_sdk.errors.NotSupportedError. Branch on is_playback rather than catching that: in v11 these were silent no-ops whose getters returned invented defaults, which made a broken transport bar look like a working one.

The measuring regions do not come back with the file. A recording carries frames; the regions are a camera's configuration, so load_config on a recording raises. Add them again on the playback handle and every replayed frame is measured exactly as the live one was.

open_recording_series(cls, path)

Open a multipart recording, from any one of its parts, and replay every part as one recording. Added in 12.0.10.

A recording started with a segment limit is written as run_part000.mkv, run_part001.mkv and so on. open_recording replays the one file it is given; this replays the whole recording from its first frame, whichever part it is given. playback_duration_s and playback_position_s are the whole recording's and run on across each part boundary, a seek reaches into any part, and regions and alarm rules carry on across a boundary as they do from one frame to the next. playback_part 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 open_recording opens it.

  • Raises ~optris_sdk.errors.IoError — if the file cannot be read, or if 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 with open_recording.

open_still(cls, path)

Open a saved snapshot and measure it as if it were a camera.

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 that can be interrogated -- drop a measuring area on it and read what the temperature was.

What comes back is an ordinary Camera, for the reason open_recording does: a still is the third kind of frame source rather than a type of its own. start, acquire, regions, alarms, the palettes, the colour scaling and emissivity all work on it unchanged.

A still has exactly one frame and that frame never changes. 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::

with optris_sdk.Camera.open_still('capture.tiff') as still:
  rid = still.regions.add(
      optris_sdk.Region.rect((0.5, 0.375), (0.2, 0.2)))
  still.refresh()
  print(still.regions.stats(rid).max_c)

start re-delivers it at still_redelivery_rate, as a camera pointed at an unchanging scene would, so a region moved while it runs is measured without anything being restarted.

What only hardware can do is refused rather than faked, and so is the transport: the shutter, the focus motor, the network settings, seeking and the colour windows all raise optris_sdk.errors.NotSupportedError, naming what this handle is. Branch on is_still.

  • Raises ~optris_sdk.errors.IoError — the file cannot be read, or carries no otc:meta document -- which is how a file from before this format, or from another program, is recognised.
  • Raises ~optris_sdk.errors.NotSupportedError — 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; use Snapshot.read_raw_pixels for the counts themselves.

start()

Begin acquiring. Frames reach callbacks only after this.

stop()

Stop acquiring, waiting for any callback in flight.

acquire(timeout_ms = WAIT_FOREVER)

Take the next frame from the acquisition queue.

Returns a Frame you own. Use it as a context manager, or close it, so the SDK can reuse the buffer.

frames(count = None, timeout_ms = WAIT_FOREVER)

Iterate over frames, closing each one after the loop body.

for frame in camera.frames(10): is the whole of a pull loop. The frame is closed when the iteration moves on, so a body that keeps one must Frame.clone it.

try_acquire()

The next frame if one is ready, otherwise None.

The non-blocking variant of acquire. The ABI spells "do not wait" as a zero timeout and reports nothing-ready as WouldBlockError; from Python an empty answer is better said with None, so that status is turned back into one here. Every other failure still raises.

from_pixels(x, y)

A pixel position as region coordinates.

Regions are placed in frame-normalized, isotropic coordinates: both axes divided by the frame width, so x runs 0..1 and y runs 0..height/width. See optris_sdk.Vec2.

Use this whenever you are thinking in pixels. Passing pixels straight to a region constructor puts it far off-frame, where it measures nothing and reports valid = False rather than raising -- which is a quiet afternoon to debug.

centre = camera.from_pixels(camera.width / 2,
                            camera.height / 2)
spot = optris_sdk.Region.spot(centre)

to_pixels(point)

Region coordinates back to a pixel position.

The inverse of from_pixels. Useful for the locations in optris_sdk.RegionStats -- max_loc is where the hottest pixel was, in region coordinates, and drawing it means turning it back into pixels.

operation_modes()

Every combination this camera offers.

Optics, temperature range, resolution and frame rate are not independent knobs: the camera offers a list of combinations and you pick one of them.

get_clipped_window()

Where a clipped video format's window sits on the detector.

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.

Answers on every camera, open or not: clipped is false on a mode that reads the whole detector. Ask this before offering a control -- it is set_clipped_window that refuses.

set_clipped_window(x, y)

Move that window's top-left corner, in detector pixels.

Positions outside the travel clamp to it rather than being refused, so a slider dragged to its end does the obvious thing. The travel is max_x and max_y on get_clipped_window.

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 all four agree. Do not drive it from a slider's every intermediate value.

  • Raises NotSupportedError — the active mode is not a clipped format, or no camera is open.

available_temperature_ranges()

Every span this camera can be switched to, as (min, max) whole degrees in the same unit as temperature_range.

set_palette_by_name(name)

Colorize with a palette from the machine's palette library.

name comes from optris_sdk.palettes.library_names. This is a convenience over reading the colours and setting them as a custom palette, and it behaves as exactly that: custom_palette_name afterwards reports name, and clear_custom_palette undoes it.

For one of the SDK's own palettes, assigning palette is cheaper and survives a configuration round-trip as a number rather than a string.

Raises optris_sdk.errors.SdkError when no palette has that name.

set_custom_palette(name, colors)

Colorize with colours your own code supplies.

colors is a sequence of optris_sdk.palettes.Color, or of any (r, g, b) triple, coldest first. name is how the palette identifies itself afterwards -- it is a label, not a lookup, and it need not exist in the library.

This overrides palette without replacing it; clear it with clear_custom_palette.

clear_custom_palette()

Stop using a custom palette, and go back to palette.

custom_palette_colors()

The colours of the custom palette in force, coldest first.

An empty list when there is no custom palette; see custom_palette_name for why that is not an exception.

save_config(path)

Write the camera's whole configuration to a file.

load_config(path)

Read a configuration file back and apply it.

Prefer load_config_checked, which says what it changed. This one applies and tells you nothing, which is fine only when you wrote the file yourself a moment ago.

load_config_checked(path, require_matching_serial = None)

Apply a configuration file and report what happened.

Returns a optris_sdk.config.ConfigLoadReport: which sections the file carried, which are in effect, which were left out, and a sentence for a person. An application with an import dialog branches on the first three and shows the last.

get_config()

This camera's whole configuration, as one record.

Returns a optris_sdk.config.CameraConfig: everything save_config writes, without the file. Hand it to apply_config to put the camera back the way it was.

Saving and restoring setting by setting cannot be complete -- a setting added in a later version is silently missing from it and nothing says so. A record grows with the SDK.

The record owns a handle. Use it as a context manager, or call close().

apply_config(config, require_matching_serial = None)

Put a whole configuration record back, and report what took.

The in-memory half of load_config_checked, through the same staged applier and returning the same optris_sdk.config.ConfigLoadReport. What cannot work on this camera is decided while nothing has moved, so a record carrying a temperature range this model has not got comes back as LOAD_APPLIED_WITH_OMISSIONS with the range named rather than leaving the camera holding half of somebody else's setup.

report.present is always SECTION_ALL: a record always carries every section -- 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, and every region gets a new id.

apply_still_config(config)

Put a configuration record back onto a still.

A still's own spelling of apply_config, and it has to be separate rather than folded into that method, because what it returns is different: a still either re-derives every pixel or refuses naming what the file cannot do, so there is no partial apply for a optris_sdk.config.ConfigLoadReport to describe. There is nothing to report, so nothing is returned.

The serial-matching option has nothing to check against either: the record came out of this same file.

To change the emissivity, assign emissivity instead. This cannot do it, and that is a property of the record rather than of this call: an optris_sdk_config is opaque and the ABI has no setters on one, so a record from get_config carries the values it was copied with and applying it back changes nothing. The emissivity setter branches onto the still's own entry point for exactly that reason.

What it is for is restoring a record captured earlier -- palette, colour range, regions, rules -- onto the still it came from.

Raises optris_sdk.errors.NotSupportedError on a live camera or a recording, where apply_config is the spelling, and when the still carries no radiometry bundle: one saved before 12.0, or from a camera with no characteristic curve. The temperature range cannot be reached through it at all, deliberately -- a different range is a different calibration, and the file holds only the one it was saved in.

set_output_directory(path)

Where snapshots and recordings are written.

save_snapshot(path, format = _ffi.OPTRIS_SDK_SNAPSHOT_PNG, info = None, options = None, extra_json = None)

Write the frame this source is showing to a still image.

Works on all three kinds of source, not only on a live camera. On a recording from open_recording it writes the frame the replay is showing -- the moment found while scrubbing; on a still from open_still it writes what that still is measuring. Both used to raise optris_sdk.errors.NotSupportedError.

A scale that cannot represent the frame raises optris_sdk.errors.InvalidArgumentError rather than clipping a measurement silently.

On a camera, a frame must have been delivered first, or this raises optris_sdk.errors.IoError. The same holds straight after the temperature range, the operation mode, the range extension, high precision or the clipped window has been changed, until a frame marked as a measurement (Frame.thermal_data_reliable) has arrived: the frames before it were taken with the settings just left, or during the recalibration after the change, so they are not written under the range now in force. Save again once such a frame has arrived. Outside that case a frame that is not a measurement is written, and Camera.open_still reads it back with thermal_data_reliable False.

Any provider registered with set_attachment_provider is pulled as the file is opened -- on a camera only. It is a camera's registry, so a snapshot written from a replay or a still carries the characteristic curve and the radiometry data the source file carried and does not call your providers. Pass your own files on info.

On a replay or a still, a field the source file does not carry is left out rather than written as a default. A file stating an emissivity nobody set cannot be told apart from one stating the emissivity an operator chose, so the radiometry, the measurement range, the device record and the field of view can each be absent -- read each as "not recorded" rather than as zero. The characteristic curve and the radiometry data are carried forward when the source had them, so the new file can be reopened with open_still and measured at another emissivity exactly as the source can.

Two further differences from a live snapshot on those two: the recorded render reports no overlays, because only the GPU pipeline composites them and neither source has one; and a replay that nothing is displaying has no colour scale, so its snapshot is the 16-bit greyscale form -- the same rule a camera follows with no live view.

  • Parameter path — where to write it.
  • Parameter format — SNAPSHOT_PNG (the default), SNAPSHOT_TIFF or SNAPSHOT_CSV. All three keep the temperatures; only PNG and TIFF can be read back, because a CSV carries no metadata document.
  • Parameter info — a optris_sdk.snapshot.SnapshotInfo, or None. The source's identity, radiometry and measurement range are filled in for you either way; anything set here wins over what the source would have said.
  • Parameter options — a optris_sdk.snapshot.SnapshotOptions, or None for the SDK's own defaults.
  • Parameter extra_json — a JSON object, merged into the metadata document at the top level. Keys the schema already uses are not overwritten. It is separate from info because it has no length bound.

save_csv_snapshot(path, csv, info = None)

Write the frame this source is showing as a CSV snapshot, spelled the way csv asks.

A spelling the SDK does not accept raises optris_sdk.errors.InvalidArgumentError and writes nothing. Otherwise this behaves as save_snapshot with SNAPSHOT_CSV: on a camera, a replay or a still, with the same metadata and the same refusals. An alarm's snapshot action writes its CSV in the default spelling.

For a spreadsheet set to German::

camera.save_csv_snapshot('capture.csv', optris_sdk.CsvOptions(
    delimiter=';', decimal_separator=',',
    leave_unmeasured_empty=True))
  • Parameter path — where to write it.
  • Parameter csv — a optris_sdk.snapshot.CsvOptions choosing the delimiter, the decimal separator, how an unmeasured pixel is written and whether the # header lines appear. CsvOptions() writes exactly the CSV save_snapshot writes.
  • Parameter info — a optris_sdk.snapshot.SnapshotInfo, or None, exactly as for save_snapshot.

set_attachment_provider(provider)

Supply the files carried inside everything this camera writes.

provider(request) is called once per file -- once per snapshot, and once per segment of a segmented recording -- and returns a list of optris_sdk.snapshot.Attachment. Returning an empty list, or None, attaches nothing and is normal. Pass None as the provider to stop supplying files.

It is a pull rather than a setter because a recording started by an alarm rule is never started by the application, so there is no call it could hang an "attach this" off; asking, rather than waiting to be told, is what makes the manual and the triggered case the same case.

Called synchronously, before any frame is written to the file -- which is the guarantee to rely on. It is asked as the file's header goes down, not while the file is opened: for a recording the header waits for the cover's look-ahead, so the pull happens after start_recording has returned.

For a recording the provider therefore 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 save_snapshot 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.

Every rule in optris_sdk.callbacks applies, and two more: do not call back into this camera's recording or snapshot methods from here -- 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 stop_recording, which still deadlocks because that call waits for the writer to finish the frame in flight. A provider that merely blocks lets the write queue grow and, past its bound, costs frames.

start_recording(path, duration_s = None, options = None)

Start writing frames to an .mkv.

If pre-roll is enabled, its buffer is written out first, so the file begins before this call did.

The path is checked here. This call opens the container, so a directory that does not exist, a permission that forbids writing or a stick that is not mounted raises here, while there is still a caller to raise at, and is_recording stays False. This docstring used to say the opposite. Warning. What cannot be seen from here is a failure after a successful start: a disk that fills, a drive pulled mid-recording, or a write refused part way through. Those surface on the frame path, not at this call. Register on_recording to be told, or check recording_stats afterwards. The recording context manager does the second of those for you.

Asking for a second recording while one is running raises optris_sdk.errors.StateError and changes nothing -- the running recording keeps its file and path is not created.

  • Parameter path — where to write. Also the stem every segment is named from, when options asks for segmentation -- and in that case every part carries a suffix, the first one included, so run.mkv with a segment limit writes run_part000.mkv, run_part001.mkv and so on, and nothing is written at run.mkv. That changed in API version 24 and it breaks a caller that passed a path and then reopened it: take the path out of the optris_sdk.RECORDING_SEGMENT_COMPLETED notification instead, which reports every finished file including the first, or open run_part000.mkv yourself. With no segment limit path is used exactly as given, so only recordings that asked to roll over are affected.
  • Parameter duration_s — stop by itself after this long. Shorthand for RecordingOptions(duration_s=...); pass one or the other, not both.
  • Parameter options — a optris_sdk.recording.RecordingOptions for duration and segment limits.

stop_recording()

Stop the current recording and close the file.

Stopping when nothing is recording succeeds and does nothing.

A recording in parts has reported every part it finished by the time this returns: RECORDING_STOPPED is delivered only after each RECORDING_SEGMENT_COMPLETED of those parts has been delivered and its handler has returned, so those parts and the one the stop ends are every file of the recording. A handler of on_recording still running for such a part holds this call up until it returns, for at most 5 seconds, so it must never wait for the thread that calls this one.

recording(path, duration_s = None, options = None)

Record for the duration of a with block.

The form to copy, because the recording is stopped and the file closed even when the body raises::

with camera.recording('run.mkv') as rec:
  for frame in camera.frames(100):
    ...
print(rec.stats.frames_lost)

What it yields is a RecordingHandle, whose RecordingHandle.stats is read once on the way out -- after the file is closed, which is the only point at which the totals are final. Read it and you have the check the ABI cannot give you at the call that starts a recording.

on_recording(handler)

Call handler(RecordingEvent) when a recording starts, stops, rolls over or fails.

The event an application otherwise cannot get. Polling is_recording 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.

Register it before starting a recording: a segment rollover reports to the handler that was installed when the recording opened. Pass None to stop delivery.

Subject to every rule in optris_sdk.callbacks, and one more: this runs on an SDK thread that varies with the event -- your own thread for a start you asked for, the timer thread for a recording that reached its duration, the frame-delivery thread for a failure. Set a flag and act on a thread of your own.

A handler that hands the event to a thread of its own reads optris_sdk.recording.RecordingEvent.statistics there, not recording_stats: if an alarm rule or your code has started the next recording in the meantime, that start has reset recording_stats. optris_sdk.recording.RecordingEvent.recording_id says which start a stop belongs to. Both were added in 12.0.15.

enable_pre_roll(duration_s)

Keep the last duration_s of frames in memory.

So that a recording started by an event covers the event. Without it, the file begins at the moment you noticed, which is always after the thing you wanted to see.

The buffer costs memory: whole frames, at the camera's rate, for as long as you asked for. pre_roll_memory_budget caps it.

Wait for pre_roll to report optris_sdk.recording.PreRollState.full before recording, or the file simply begins wherever the buffer had got to.

disable_pre_roll()

Stop keeping history, and release the buffer.

start_interval_capture(interval_s, directory = None, format = _ffi.OPTRIS_SDK_SNAPSHOT_PNG, name_pattern = None, csv = None)

Write a still image every interval_s.

For a time-lapse or a long unattended run. Independent of recording: stopping a recording does not end it.

One CSV a minute, in degrees Fahrenheit::

camera.start_interval_capture(
    60.0, 'timelapse', format=optris_sdk.SNAPSHOT_CSV,
    csv=optris_sdk.CsvOptions(
        temperature_unit=optris_sdk.TEMPERATURE_UNIT_FAHRENHEIT))
  • Parameter interval_s — time between images. An interval shorter than the camera's frame period is raised to the frame period -- no more images than frames can exist -- and interval_capture_interval_s reports what is actually in force.
  • Parameter directory — where to write. None uses set_output_directory, and failing that the current directory. A folder that is not there yet is created, with the folders above it; one that cannot be created or written to raises optris_sdk.errors.IoError naming it, and nothing starts.
  • Parameter format — SNAPSHOT_PNG (the default), SNAPSHOT_TIFF or SNAPSHOT_CSV.
  • Parameter name_pattern — filename stem without extension. None means snapshot_{sequence}. The placeholders are {sequence} (a counter from 1, zero-padded to six digits), {timestamp} (YYYYmmdd_HHMMSS, local time), {serial} and {model}. Reusing a directory and a pattern does not overwrite the previous run's images; the SDK appends -1, -2 and so on.
  • Parameter csv — a optris_sdk.snapshot.CsvOptions for each SNAPSHOT_CSV image: the unit, the delimiter, the decimal separator and the rest, exactly as for save_csv_snapshot. Ignored by the other formats. None writes the default CSV, so a capture started without it does not keep an earlier capture's options. Options save_csv_snapshot refuses raise optris_sdk.errors.InvalidArgumentError, whatever the format, and nothing starts.

stop_interval_capture()

Stop writing images at intervals.

Succeeds and does nothing when no time-lapse is running.

interval_capture(interval_s, directory = None, format = _ffi.OPTRIS_SDK_SNAPSHOT_PNG, name_pattern = None, csv = None)

Run a time-lapse for the duration of a with block.

read_attachment(index)

Copy one carried file's bytes out, as bytes.

index is a position in attachments. A negative one is refused rather than counting from the end, for the reason optris_sdk.recording.RecordingFile.read_attachment gives: the ABI indexes with an unsigned size_t.

Raises optris_sdk.errors.NotSupportedError on a live camera.

seek_to_frame(frame_index)

Jump to a frame, counted from the start of the recording. Warning. A recording is not all-intra, so a seek lands on the nearest frame the decoder can start from and the frames between that point and the target are reconstructed. Seeking into a long run of predicted frames can return one that is visibly wrong, with no error reported. Seek, then read a frame or two before trusting what you measure.

seek_to(position_s)

Jump to a point in the recording, in seconds from its start.

The same caution as seek_to_frame applies.

pause_playback()

Stop advancing, holding the current frame and position.

Not stop, which ends the run: a paused replay is still open, still at the frame it was on, and still seekable, so resume_playback carries on from there. Do not reach for a playback_speed of zero instead -- the pacing divides the frame interval by the speed, so zero plays the file as fast as the disk allows. It is refused. A paused replay produces nothing. Every frame a program sees is one the decode thread pushed, so a setting changed while paused does not reach the picture until the replay resumes. Call refresh_playback to see it now. A no-op on a replay that is not running or is already paused.

resume_playback()

Carry on from where pause_playback stopped.

A no-op on a replay that is not running or is not paused.

refresh_playback()

Re-process the frame now held and deliver it again.

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 acquire 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 playback_can_change_radiation;
  • a region's own emissivity reaches that region's numbers only, never the picture, when playback_honours_region_emissivity -- the region then reports EMISSIVITY_READING_ONLY;
  • orientation, palette, colour range, auto-scale and isotherms reach the picture on any radiometric recording;
  • the temperature range reaches nothing and is refused: 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.

Named refresh_playback rather than refresh because refresh is the still's spelling of the same idea on this same class.

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.

  • Returns — one of PLAYBACK_REFRESH_DELIVERED, PLAYBACK_REFRESH_NO_HELD_FRAME, PLAYBACK_REFRESH_RUNNING or PLAYBACK_REFRESH_PICTURE.

refresh()

Measure and deliver the still once, now.

Runs the region and alarm pass over the frame and fires the 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 acquire on a still that has been opened and neither started nor refreshed raises -- exactly as it does on a camera that has not been started.

set_orientation(rotation_deg, mirror = MIRROR_NONE)

Turn and/or mirror the frames this source delivers.

rotation_deg must be a multiple of 90: this release accepts quarter turns only, and refuses anything else rather than resampling, because any other angle leaves output pixels with no source pixel behind them and v12 has no concept of an unmeasurable pixel.

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, so a turned frame measures identically to an unturned one.

A quarter turn swaps width and height while sensor_width and sensor_height keep reporting the detector. On a still this is applied on top of what the file already holds, because a snapshot is stored as the operator saw it.

set_canvas(canvas)

Place this camera's frames in a canvas.

The camera copies the canvas, so closing yours afterwards does not disturb it, and later edits to yours do not reach the camera -- use set_placement 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.

  • Raises NotSupportedError — on a optris_sdk.playback.Player or a snapshot source, neither of which has a canvas.

copy_canvas()

A copy of the canvas in force. You own it; close it.

A context manager, like any optris_sdk.canvas.Canvas.

  • Raises NotSupportedError — on a player or a snapshot source.

set_placement(index, placement)

Edit one placement in place, without a copy round trip.

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.

  • Raises NotFoundError — when no canvas has been set -- which includes the ordinary case of not having set one yet -- or when index is past the end.

pif()

The camera's process interface, or None if it has none.

None rather than an exception: most cameras have no PIF and a simulated source has none either, so not having one is an ordinary answer about a working camera rather than a failure.

attach_simulated_pif(kind = _ffi.OPTRIS_SDK_PIF_STANDARD, layout = None)

Plug an in-memory process interface into a simulated camera.

A simulated camera has no PIF socket, so pif answered None on one and no process-interface behaviour could be tested without hardware at all. After this call pif hands back a real controller 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.

Drive its inputs with set_simulated_pif_digital_input and set_simulated_pif_analog_input. Read its outputs back the ordinary way, off the optris_sdk.pif.Pif: an output is what the SDK drove, and there is deliberately no call that writes one from outside.

Calling it again replaces the interface, as swapping the box on the connector would; a optris_sdk.pif.Pif taken before then goes stale.

  • Parameter kind — What the interface presents itself as, one of the optris_sdk.pif DEVICE_KIND_* values. Every kind is accepted, so declaring an identity can be exercised.
  • Parameter layout — A optris_sdk.pif.SimulatedPifLayout, or None for a standard shape: two channels of each sort, with a fail-safe line.
  • Raises NotSupportedError — this is a real camera or a recording.

set_simulated_pif_detected_kind(kind, layout = None)

Connect a PIF to the socket, for the next re-detection.

This changes nothing by itself, exactly as plugging a cable in changes nothing until the camera is asked. The identity, the capabilities and the channel layout all move on the next optris_sdk.pif.Pif.redetect_identity and not before, so the sequence an application actually performs -- notice the socket is empty, plug something in, press "detect again" -- is the sequence a test performs.

This is what attach_simulated_pif cannot model. Attaching again replaces the controller and makes every handle stale, which is a box swapped on the connector; a PIF found on the socket that was always there is the same controller, so a optris_sdk.pif.Pif already held stays valid and its own re-detection is the call under test.

  • Parameter kind — What is now on the connector, one of the DEVICE_KIND_* values. Pass the "none" kind to model a PIF that has been removed or powered down.
  • Parameter layout — A optris_sdk.pif.SimulatedPifLayout describing what that PIF can do, or None for the default shape. A declaration still does not move the capabilities; this does, because it models the hardware changing rather than the application asserting.
  • Raises NotSupportedError — this is a real camera or a recording, or nothing is attached.

detach_simulated_pif()

Unplug it again. pif then answers None.

Succeeds when nothing is attached: "this camera has no process interface" is the state it is asked to reach.

  • Raises NotSupportedError — this is a real camera or a recording.

has_simulated_pif()

Whether a simulated process interface is plugged in now.

False for a real camera or a recording rather than raising: it is the question asked before deciding whether the interface in hand is a fake.

set_simulated_pif_digital_input(index, high)

Drive one digital input pin of the simulated interface.

The outside world talking: this is the level the next optris_sdk.pif.Pif.poll reads off pin index.

  • Raises NotSupportedError — not a simulated camera, or nothing is attached.
  • Raises ConfigurationError — index is past the layout.

set_simulated_pif_analog_input(index, volts)

Drive one analog input pin of the simulated interface.

Volts, not raw counts: the reading a multimeter on that pin would show, before any channel decode.

  • Raises NotSupportedError — not a simulated camera, or nothing is attached.
  • Raises ConfigurationError — index is past the layout.

step_simulated_pif_watchdog()

Advance the simulated fail-safe watchdog by one check.

The fail-safe line is deliberately not driven by optris_sdk.pif.Pif.poll: on a real camera it moves only when the frame watchdog says the pipeline is alive, so a line that kept alternating because an application kept polling would tell a PLC "the camera is healthy" when it means "this process is still running". This is the explicit step instead.

  • Raises NotSupportedError — not a simulated camera, or nothing is attached.

set_simulated_pif_external_probe(celsius)

Put a probe reading on the simulated interface, in the SDK's temperature unit (Celsius unless optris_sdk.set_temperature_unit chose Fahrenheit); the argument's name is older than the switch.

A probe reading does not arrive on a channel -- it is decoded out of the frame's PIF telemetry -- so there is no pin to drive and this is the only way to produce one without hardware. It reads back from optris_sdk.pif.Pif.external_probe_temperature and is published as FIELD_PROBE_TEMP, only on an interface attached as pif.DEVICE_KIND_TEMPERATURE_PROBE, as on a real camera; on any other kind the reading is ignored.

  • Raises NotSupportedError — not a simulated camera, or nothing is attached.

clear_simulated_pif_external_probe()

Take the probe reading away, as a frame carrying none would.

The missing half of set_simulated_pif_external_probe. Without it the simulated interface could give a reading but never remove one, so a probe that reported and then stopped could not be reached without hardware. Afterwards optris_sdk.pif.Pif.external_probe_temperature is None, FIELD_PROBE_TEMP is no longer valid, a rule on the probe goes ALARM_ORPHANED and a COMPARE_INVALID watchdog on it fires. Calling it with no reading set is not an error.

  • Raises NotSupportedError — not a simulated camera, or nothing is attached.

picture_correction()

What the two optical corrections are actually doing.

Returns a PictureCorrection. A simulated camera and a recording have no processing pipeline behind them, so they report valid = False and both statuses unknown; that is not a failure and must never be read as "active".

set_motion_zone(zone_id, zone)

remove_motion_zone(zone_id)

clear_motion_zones()

on_motion(handler)

Call handler(MotionEvent) when a zone reports movement.

Subject to every rule in optris_sdk.callbacks.

on_thermal_frame(handler)

Call handler(Frame) as frames arrive.

The frame is borrowed and stops being valid when the handler returns. Read optris_sdk.callbacks before using this; acquire is the easier route and is usually the right one from Python.

on_raw_frame(handler)

Call handler(Image) with uncalibrated sensor counts.

Accepted and then never called, today. See Image.

on_bgra_frame(handler)

Call handler(Image) with the false-colour display image.

on_energy_frame(handler)

Call handler(Image) with linear radiometric values.

Accepted and then never called, today. See Image.

on_pipeline_change(handler)

Call handler(PipelineChange) when this camera's pipeline changes while it is open; None stops.

pipeline_info 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.

Fires on the SDK's frame thread, once per change, before the first frame the new pipeline computed. Every rule in optris_sdk.callbacks applies.

update_simulated_scene(config)

Point a running simulated camera at a different scene.

Takes effect on the next frame with no reconnect: regions, alarm rules, recording and every open handle survive it.

Only the scene may move. The device type, width, height, rate, serial, seed and frame file are fixed for the life of the camera, and one that differs from the running value is refused by name rather than ignored -- so build the new scene from simulated_config rather than from a fresh SimulatedCamera, whose zeros would otherwise have to be read as "unchanged".

  • Raises ~optris_sdk.errors.NotSupportedError — on a real camera.
  • Raises ~optris_sdk.errors.ConfigurationError — when a fixed field differs, or the pattern needs a frame file this camera was not created with. A refused update changes nothing.

reset_statistics()

Zero frame_count and dropped_frame_count.

Safe while streaming: a frame arriving during the call is counted on one side of it or the other, never both, but which one is not defined. Camera only.

reconnect()

Tear this camera's session down and open a fresh one.

Synchronous, and one attempt. It returns once the camera is open and a frame has arrived -- not merely once the open returned, because an open can succeed against a stream session the operating system has not finished tearing down, accept every read and complete none. If no frame arrives the camera is closed again and this raises, so the next attempt starts from nothing.

Every setting survives. A recording in progress is stopped and finalized before the teardown -- the file on disk is complete and playable -- and is not started again.

The camera is genuinely unclaimed for the width of the gap between the close and the open, so another process can take it. This then raises, and calling again is valid.

Not from inside a callback. The frame thread, the event dispatch thread and the reconnect thread are all torn down by this call and cannot wait for themselves; called from any of them it raises rather than deadlocking. Set a flag in your handler and act on a thread of your own -- or use enable_auto_reconnect, which already has one.

enable_auto_reconnect(config = None)

Have the SDK re-open this camera by itself whenever it drops.

config is a optris_sdk.reconnect.ReconnectConfig; None takes the SDK's own backoff. Calling this again replaces the configuration.

A background thread watches the link and performs reconnect on the backoff schedule. An attempt is made only when the camera is actually on the bus: a USB camera that is not enumerated is waited for, and the wait spends no attempt, so a camera left unplugged is looked for indefinitely rather than exhausting the budget against an empty bus. A network camera that answers discovery nowhere is waited for the same way, and one that answers at another address is re-opened there.

Two cases are deliberately not recovered. A failure raised by the very first open is the application's -- it asked for that open and is holding the error. And a camera that is being asked for frames and has never delivered one is left alone, because connected is published at the end of the open, before any frame, so an open on its own cannot tell a session that worked from one that merely opened.

  • Raises ~optris_sdk.errors.ConfigurationError — for a configuration that is not a backoff -- a multiplier below 1 or a zero initial delay. Both hammer a camera that is not there.

disable_auto_reconnect()

Stop reconnecting this camera automatically.

Harmless when nothing is enabled, so tidy-up code need not check. Returns after the watcher has stopped, so anything its handler captured is safe to drop afterwards.

An attempt already in flight is abandoned, not waited out, and the camera is left closed. So a cancelled attempt comes to rest at CONNECTION_DISCONNECTED where a failed one rests at CONNECTION_FAILED, and that difference is deliberate: nothing failed, you asked the SDK to stop, so switching recovery off does not read in a log like a recovery that did not work.

on_connection_status(handler)

Call handler(ConnectionChange) when the link changes.

Only on an actual change: a link that is dead and stays dead reports stalled once, not once per timeout period.

Delivered from more than one SDK thread, and from two of them at the same time, so the handler must be thread-safe. A device transition arrives on the event dispatch thread; an automatic reconnect publishes connecting and failed synchronously on its own reconnect thread, and nothing serializes the two -- measured, with two threads observed inside one handler together. Keep the handler to recording what changed.

Serializing them was considered and refused: a lock held across the handler deadlocks against the dispatch thread, and routing the reconnect's publishes through the dispatch queue would enqueue the last of them onto a queue torn down with the session it belongs to, losing the event silently.

on_reconnect(handler)

Call handler(ReconnectEvent) at each step of a recovery.

Fires on the SDK's reconnect thread, which is neither the frame thread nor the event dispatch thread. From here you must not close the camera, and must not call reconnect, enable_auto_reconnect or disable_auto_reconnect -- all of them need state the call is holding, and the SDK raises rather than hanging.

A recovery is a schedule, not a notification. After any phase but RECONNECT_GAVE_UP and RECONNECT_RECOVERED there is another attempt coming and that thread is still running when your own code has moved on, so do not drop what the handler reads because a phase you were waiting for has arrived.

on_reconnect_attempt(handler)

Let handler(serial, model, attempt, max_attempts) refuse one attempt. Return True to attempt, False to stop recovering.

There is deliberately no third answer. False ends the recovery; it does not skip one attempt and keep watching. A handler that refuses because the camera is briefly unreachable has stopped the recovery rather than postponed it -- return True in that case and leave the bus to the SDK, whose presence gate already withholds an attempt for an absent camera without spending one.

This is the hook for what only the application knows: that the device is deliberately powered down, that the operator closed the camera's tile, that a camera has been re-addressed.

Same thread and the same restrictions as on_reconnect. One lifetime difference: clearing this handler is not a fence, because the veto is copied out from under its lock and called with the lock released -- which is what stops installing one from inside a handler being a hang -- so a call already in flight runs to completion afterwards. Disable the reconnect, or close the camera, before you drop what it reads.

on_error(handler)

Call handler(str) when the SDK reports an asynchronous failure.

For what goes wrong on the SDK's own threads, where there is no call of yours to raise out of: an acquisition thread that died, a write that failed. Everything a call can report, it reports by raising.

on_video_format(handler)

Call handler(width, height, hz) when the stream's shape changes.

A camera renegotiates its video format on an operation-mode change and on a reconnect, and the new geometry is what every buffer sized against the old one has to be rebuilt for.

on_rgb_frame(handler)

Call handler(Image) with the picture as 24-bit RGB.

The three-byte sibling of on_bgra_frame, for a toolkit whose image type has no alpha channel.

set_color_range(min_c = None, max_c = None)

Fix the temperatures the palette spans, in the SDK's temperature unit (Celsius unless optris_sdk.set_temperature_unit chose Fahrenheit).

None on an end lets the SDK track the scene's own, so set_color_range() with no arguments returns the picture to auto-scaling under whatever color_scaling says.

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.

set_dde_gain(base, detail)

Set the base and detail gain. (0, 0) switches it off.

1.0 and 1.0 reconstruct the picture exactly; raise detail above base to lift local contrast.

Display only: reported temperatures, measuring regions, recordings, snapshots and any registered buffer are unaffected on every backend.

  • Raises ~optris_sdk.errors.NotSupportedError — when a non-zero gain is asked of a source with no pipeline behind it -- a replay, for one. Ask is_dde_supported and grey the control out instead of handling the refusal.

set_filter_mode(mode)

Select the spatial noise filter.

  • Raises ~optris_sdk.errors.InvalidArgumentError — if mode is not one of the FILTER_* values.
  • Raises ~optris_sdk.errors.NotSupportedError — if it names a filter this camera's pipeline does not implement. In both cases the filter in force is unchanged -- no value is ever silently replaced with a different one.

set_filter_strength(strength)

How strongly the filter is applied, as a multiple of its nominal setting: 1.0 nominal, 2.0 twice as aggressive.

One meaning on every camera. It has no effect on filters with no strength to vary -- the medians and box blurs are fixed kernels -- nor on FILTER_TEMPORAL, whose time constant is temporal_smoothing.

  • Raises ~optris_sdk.errors.InvalidArgumentError — outside (0, 100].

is_filter_mode_supported(mode)

Whether this camera's pipeline implements mode.

Which pipeline runs depends on the camera's resolution rather than on anything the application chose, so this is the way to decide what to offer. Before a camera is attached the answer is the conservative one: True only for the filters every pipeline implements. An out-of-range mode answers False rather than raising -- it is not supported, and a capability query that fails is harder to use than one that answers.

A recording and a still answer False for every mode, and that is not a statement that the recording is unfiltered: it means you cannot choose a filter here.

set_external_buffer(buffer, format, on_written = None)

Register a buffer for the SDK to write every frame into.

buffer is any writable object supporting the buffer protocol -- a bytearray, a numpy array, a ctypes array. format is one of the EXTERNAL_* constants. Several buffers can be registered at once in different formats; the SDK writes each one every frame, and each is identified by its address, which is also what remove_external_buffer takes.

The buffer must stay alive and must not move until it is removed or the camera is closed -- the SDK writes into it from its own thread. This package holds a reference for you, so a buffer registered and then dropped by the caller is still safe; what it cannot do is stop a numpy array being reallocated, so register the array you keep rather than a temporary view.

What is written is always sensor-native, unlike the RGBA and RGB callbacks, which deliver the picture as placed on the canvas -- so a canvas placement never changes the size a registered buffer has to be.

on_written is called as on_written(width, height) after each write, or left out to poll the buffer instead.

  • Raises ~optris_sdk.errors.InvalidArgumentError — when the buffer is smaller than width * height * bytes per pixel. It is validated before anything is written, so a buffer that is too small is refused rather than overrun.

remove_external_buffer(address)

Stop writing into one buffer, by what set_external_buffer returned.

Returns once the SDK will no longer write there, so the buffer is safe to drop afterwards.

clear_external_buffers()

Stop writing into all of them.

configure_surface(surface, width, height)

Render every frame straight to a surface, at display size.

Once configured, the colorized output and the region overlays are drawn to surface instead of being read back, and the overlays are built for the surface's size so they stay crisp rather than being scaled up from the sensor's.

surface is a WGPUSurface as an integer address, created against gpu_instance. Warning. That pointer is not validated and cannot be, with one exception. NULL is refused by name, and measured, that refusal comes before the backend check -- so a zero is always an InvalidArgumentError rather than a crash. Anything else belongs to another library, so there is nothing here that could check it, and passing a pointer that is not a live WGPUSurface from that same instance is a segfault inside the graphics driver on the first frame -- not an exception. On a camera with no GPU backend this refuses before looking at it, which means a bad handle can appear harmless on one camera and be fatal on the next.

  • Raises ~optris_sdk.errors.NotSupportedError — on a replay, and on a camera with no GPU backend. A replay is refused before the surface is examined, so a bad handle is harmless there and fatal on a camera -- do not read a successful call on one as having validated anything for the other.

composite_overlays(buffer, width, height)

Draw the region overlays onto a BGRA buffer of any size.

buffer is a writable buffer of at least width * height * 4 bytes. The size is stated rather than inferred: width and height say how to draw, the buffer's own length says how much memory there is, and the two are checked against each other before anything is written. There was no size parameter at all until API version 12, and a caller whose width its buffer could not cover had its heap overwritten with no diagnostic.

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 an error.

  • Raises ~optris_sdk.errors.BufferTooSmallError — when the buffer is below width * height * 4.
  • Raises ~optris_sdk.errors.NotSupportedError — when there is nothing to draw, or the camera is a still opened with Camera.open_still.

apply_network_config(config)

Write a new network configuration to the camera.

Read network_config first and change what you mean to change: every field is written, so a config built from scratch moves the camera to 0.0.0.0 as surely as a typed one moves it anywhere else.

Returns one of the NETWORK_* constants, because what happened to this connection depends on which fields changed. A new stream destination or subnet mask ends it; a new address or port does not -- the SDK follows the camera to its new address and reports NETWORK_APPLIED_CONNECTION_KEPT on a handle that still works, leaving any address you cached stale. An identical configuration writes nothing and reports NETWORK_UNCHANGED. Over USB nothing takes effect until the camera is next on Ethernet. Warning. 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 fetched and put on a USB cable.

  • Raises ~optris_sdk.errors.DeviceError — when the configuration was refused, in which case nothing was written. The commonest reason is a stream destination equal to the address, which the SDK rejects itself before writing -- so that failure is not the camera refusing anything.

request_network_config(config)

Ask the camera to take a new network configuration, and return its answer -- including a refusal -- as a NetworkConfigReply.

The same write as apply_network_config, with the same checks before anything is sent and the same 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 raised.

  • Raises ~optris_sdk.errors.NotSupportedError — on a camera with no Ethernet interface, or one whose control path cannot configure it.
  • Raises ~optris_sdk.errors.DeviceError — for everything apply_network_config raises it for except the camera's own refusal.

temperature_at_emissivity(measured_c, target_emissivity)

Re-evaluate a reading at a different emissivity.

measured_c and the answer are temperatures in the SDK's temperature unit (Celsius unless optris_sdk.set_temperature_unit chose Fahrenheit).

This is the tool for emissivity_affects_image being off: 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.

  • Raises ~optris_sdk.errors.NotSupportedError — when this source has no usable characteristic curve, or target_emissivity is below 0.01 -- dividing by it is the conversion, and there is no answer at zero. The refusal means this source cannot convert, not that the conversion made no difference: the call behind this once returned measured_c unchanged, which is a value standing in for an answer. Ask emissivity_conversion_support which reason it is, and ask it before offering the control.

save_device_config_archive()

Remember this camera's settings for the next time it opens.

Writes the SDK's own per-camera XML, which it keeps per serial number under the user's application data and reloads the next time that camera is opened. Nothing to do with save_config, which writes a file you name.

Not a write to the camera's memory, 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 a replay, neither of which has an archive.

interrupt_fail_safe(active, reason = None)

Stop, or restart, the fail-safe heartbeat from the application.

The fail-safe watchdog already watches the camera and the SDK's own processing. It cannot watch your application. This is how an application reports its 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 any 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.

reason is free text for the log, so the reason a line stopped is recoverable afterwards.

  • Raises ~optris_sdk.errors.DeviceError — if the camera is not connected.

close()

Stop, join, and release.

optris_sdk_imager_destroy cannot fail: it stops streaming, waits for any callback in flight, joins the SDK's threads for this camera and frees it. After it returns no callback registered here can fire again, which is what makes it safe to drop the thunks.

__enter__()

__exit__(*exc)

__del__()

__repr__()