OptrisOptrisDocumentation

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

camera — functions

Opening a camera, taking frames from it, and closing it.

The two ways to get frames

Pull. Camera.acquire blocks until the next frame and hands you a Frame you own. This is the one to reach for from Python. It runs on your own thread, it is a plain loop, and the frame lives until you are finished with it.

Push. Camera.on_thermal_frame registers a callable the SDK invokes as frames arrive. It is the lower-latency route and it comes with rules; optris_sdk.callbacks states them. Read that before using it.

Both reach the same frames. A recording answers acquire exactly as a camera does, which is what lets one processing loop be written against live and recorded data alike.

rdc_status_name(status)

A distortion-correction status as a word, for printing.

sos_status_name(status)

A size-of-source correction status as a word, for printing.

explain_rdc_status(status)

What a distortion-correction status means, as a sentence.

The other half of the pair rdc_status_name belongs to: the enumerator is a closed set to branch on, this is the sentence to show or log. Phrased to be displayed as it stands, and it names the recovery where there is one -- RDC_STATUS_NO_COEFFICIENTS has none, because nothing is wrong: the optics simply carry no radial distortion to correct.

Comes from the SDK (optris_sdk_explain_rdc_status) rather than from a table here, so the wording is the same one C, C# and Rust callers see. An unrecognised value yields 'unknown' rather than failing.

explain_sos_status(status)

What a size-of-source status means, as a sentence.

The companion to explain_rdc_status, and the one that earns its keep: SOS_STATUS_ZERO_STRENGTH is the default state on every camera that has a table, so a caller reading the bare enumerator cannot tell that the correction is enabled, has its table, and is still an exact identity. The sentence says so and names the call that changes it.

enumerate_devices(options = None)

Every camera attached to this machine.

The SDK's list handle is freed before this returns; what comes back is a list of plain DeviceInfo snapshots.

options is an optris_sdk.discovery.EnumerationOptions, and the one worth passing is include_network=True -- which is off by default because it is a broadcast whose replies have to be waited for, and that wait is the whole cost of a sweep.

pixel_format_name(format)

'BGRA8', 'RAW16' and so on, rather than an ordinal.

internal_to_celsius(raw)

The SDK's fixed-point format to Celsius.

Celsius by design, whatever optris_sdk.set_temperature_unit chose: the format is defined in Celsius.

Mirrors optris_sdk_internal_to_celsius, which is an inline function in the header and therefore has no exported symbol to call. That makes this a transcription, and transcriptions drift, so PythonBindingTest.InternalToCelsiusAgreesWithTheSdk compares it against optris_sdk_frame_get_temperature over a whole frame.

Works on a scalar or on a NumPy array.

pixel_is_measured(raw)

Whether a raw sample is a measurement at all.

Mirrors optris_sdk_pixel_is_measured, which is an inline function in the header and therefore has no exported symbol to call. A sample the SDK could not measure carries -32768, the encoding's own "nothing was measured": not a cold pixel and not a bad reading, but the absence of one. Wide-mode distortion correction produces it on every frame, wherever an output pixel's source falls outside the sensor, so anything that averages, ranks or compares raw samples has to leave these out. This is that test, spelled once.

For raw samples, from Frame.samples or Frame.to_numpy(celsius=False). A temperature that was not measured is nan instead; test those with optris_sdk.is_measured.

Works on a scalar, giving True or False, or on a NumPy array, giving an array of booleans of the same shape.

celsius_is_encodable(celsius)

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

Mirrors optris_sdk_celsius_is_encodable. False exactly when celsius_to_internal is about to answer -32768 -- the input is not a measurement -- or 32767, because the input is hotter than 3176.7 C and this format does not reach it.

The companion that lets celsius_to_internal stay total without lying, and the shape the SDK uses throughout for "does this value mean anything": a companion rather than a magic value inside the value space, because 0.0 and the bounds are legitimate readings.

There is no cold end to check. Absolute zero puts the coldest measurable input at -1731.5 counts, so no measurement can saturate downwards and none can be driven onto the sentinel.

celsius_to_internal(celsius)

Celsius to the SDK's fixed-point format.

Takes Celsius whatever optris_sdk.set_temperature_unit chose, because the format is defined in Celsius: a temperature read in Fahrenheit goes through optris_sdk.temperatures.to_celsius first.

The inverse of internal_to_celsius, and mirrors optris_sdk_celsius_to_internal, which carries the full reasoning. Scalars only -- unlike internal_to_celsius, which also takes a NumPy array; for a whole frame in the other direction there is Frame.to_numpy.

Three answers, and the first two are the point:

  • an input that is not a measurable temperature -- nan, or at or below absolute zero -- gives -32768, the encoding's own reserved "nothing was measured". It used to raise ValueError: cannot convert float NaN to integer while the other three bindings silently answered 0, an ordinary -100.0 C reading. The input is not exotic: to_numpy(celsius= True) answers nan for an unmeasured pixel, and Wide mode produces those on every frame -- 15.8 % of a G7.
  • an input hotter than the format reaches saturates at 32767 rather than returning an integer outside the type it claims to produce. celsius_to_internal(3200.0) used to be 33000, which no int16_t parameter can hold.
  • everything else is the format, truncated toward zero -- computed in float32, as the other three bindings do, which is what keeps the four bindings' answers identical. See _as_float32.

celsius_is_encodable says which of the three you got.

device_type_name(device_type)

A camera model, spelled as the marketing name.

Not an identifier. Camera.model is what the camera itself reports and is the string to show; this is for a program that holds the enumerator and wants a label for it.

open_phase_name(phase)

An open phase, spelled out rather than as an ordinal.

network_apply_result_name(result)

A network-apply outcome, spelled out.

network_refusal_name(refusal)

A network-configuration refusal reason, spelled out.