OptrisOptrisDocumentation

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

snapshot — functions

Writing a still image with everything in it, and reading it back.

This binding could once only ask the camera to write a file and nothing more. The metadata the C++ API takes, the encoder settings it takes, and its four read-back calls had no route through the flat C ABI, so a Python caller could produce a file this SDK understands and then had to parse the otc:meta document and the 16-bit grid itself -- reimplementing format knowledge that is already here.

Two shapes, mirroring the ABI:

Writing takes SnapshotInfo -- what the file says about itself -- and SnapshotOptions -- how the file is encoded. optris_sdk.camera.Camera.save_snapshot takes both, and optris_sdk.camera.Camera.set_attachment_provider supplies the files carried inside it.

Reading opens a Snapshot, because a snapshot answers half a dozen questions and parsing the file once per question would be the wrong trade. It is a context manager; use it as one.

with optris_sdk.Snapshot.open('bearing.png') as shot:
  print(shot.info.emissivity, shot.width, shot.height)
  frame = shot.load_thermal()

Optional measurements are None rather than zero

Each optional field in SnapshotInfo is a has_ flag and a value in C, so a reader can tell "not recorded" from "recorded as zero" -- which matters when the value is a measurement. In Python that is None against a number, and this module never collapses the two: an emissivity that was never written comes back as None, not as 0.0.

encoding_name(encoding)

What a pixel means, spelled out rather than as an ordinal.

scope_name(scope)

Why a provider is being asked, spelled out.

format_name(format_)

Which container is being written, spelled out.