OptrisOptrisDocumentation

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

Regions

class optris_sdk.measurement.Regions

The regions a camera is measuring.

Reached as camera.regions. Indexing and iteration are by the id the camera gave when the region was added, because that is what the measurement calls take.

Regions — methods

add(region)

Add a region and return the id the camera gave it.

The region is copied. Changing or freeing the object afterwards does not affect what the camera measures; use update to change a region that is already in place.

add_child(parent_id, region)

Add a region as a child of an existing one.

A child is measured through its parent's geometry: a region of kind REGION_HOT_SPOT added this way follows the warmest pixel inside the parent rather than across the whole frame, and a spot's aperture is clipped to it. Without this a hot-spot region could only track the whole scene.

The child is a region in every other respect -- its own id, its own statistics, its own alarm rules -- and every per-id call takes it.

A child is not a blob. Blobs are per-frame detection results whose ids churn on every frame, which is why they are deliberately not children. A child region is declared once and keeps its id until it is removed, so a rule naming one is never orphaned.

Children do not appear in states: a child's alarm already rolls up into its parent's, so listing it separately would count it twice. Enumerate them with children.

  • Raises NotFoundError — parent_id is unknown.

children(parent_id)

The ids of one region's direct children, in add order.

Empty for a region with none, and for an unknown id.

update(region_id, region)

Replace the region at region_id with region.

remove(region_id)

clear()

copy(region_id)

An owned copy of a region the camera is already measuring.

The way to change one thing about an installed region without rebuilding its geometry from memory: copy it, change it, hand it back to update. Changing the copy does not reach the camera until you do.

__len__()

ids()

The id of every region the camera holds, top level only.

Children -- hot and cold spots, nested areas -- are not listed; they are reached through their parent.

id_of(name)

The id of the region with this name.

stats(region_id)

The latest statistics for one region.

percentiles(region_id)

The latest percentiles, if the region asked for them.

threshold_share(region_id)

How much of the region was past its threshold.

valid is false unless the region was given a threshold with Region.threshold and produced a measurement.

emissivity_state(region_id)

Whether the region is on an emissivity of its own.

One of EMISSIVITY_CAMERAS, EMISSIVITY_OWN_VALUE, EMISSIVITY_READING_ONLY or EMISSIVITY_OWN_SCALE. This is what a label draws to say an area is not being measured at the same emissivity as everything around it -- compared against the value the frame was corrected at, not the one currently configured.

is_from_recording(region_id)

Whether the region belongs to the recording being replayed.

As against having been added on the playback handle afterwards. The question an application reviewing footage has to answer about every region it shows: a recorded region is the file's statement about what was measured, and one the operator drew during the review is the operator's. The two are indistinguishable through get.

Ask this rather than comparing the id against the replay id floor. Regions added on a replay are numbered from a floor of 1 << 32, so "a low id is the recording's" happens to hold today -- as a numbering convention, which nothing promises to keep. It is also not the whole answer even now: a region born mid-replay from a per-frame record is the recording's, carries a recorded id, and did not exist when the file was opened; and one the take deleted stops being the recording's on the frame it goes. A comparison sees neither.

False on a live camera, on a still and for an unknown id -- in every case because nothing there is a recording's rather than as a refusal, so this is safe to call on a handle whose kind is not known and an id whose region was removed a frame ago answers False instead of raising.

It says nothing about whether the region can be edited. A replay accepts an edit to a recorded region. The next per-frame record naming it sets again what the recording states (where it is, its shape, name, style and emissivity, and its minimum, maximum, mean, coverage and alarm state), so an edit to any of those lasts one frame. Which optional statistics it computes (Region.want_percentiles for the median and percentiles, the threshold, the samples) is yours once you change it: the replay computes them from the recorded temperatures, and no record changes the choice after that, including when a seek removes the region and a later record brings it back. A computed statistic is withheld (NaN, not valid) on a frame the record says the region was not measured, and for a region with an emissivity of its own whose recorded pixels do not carry it.

samples(region_id)

Every pixel a line region's statistics came from.

blobs(region_id)

The blobs one BLOB_GROUP region found this frame.

Empty for any other kind, and empty for a blob group that found nothing or has not yet seen a frame -- which is a different answer from an unknown id, which raises. Configure detection through Region.blobs before adding the region.

Each blob's outline is fetched with it when the region asked for BLOB_CONTOUR, so a caller never has to make the second call by hand.

states()

Every region's id, statistics and alarm state, in one call.

One call rather than one per region, so every row describes the same frame. Asking region by region can straddle two.