OptrisOptrisDocumentation

Documentation/OTC SDK/OTC SDK — C++ API referencev12.0

optris::sdk::Roi

A measuring region of interest on the thermal frame. All coordinates are normalized to [0, 1] relative to the frame dimensions. The origin (0, 0) is the top-left corner. Each ROI has a unique numeric ID assigned by the container.

Public attributes

id

uint64_t id = 0

Unique ID (assigned by RoiContainer, do not set manually).

type

RoiType type = RoiType::Rectangle

Field type.

name

std::string name

Human-readable name.

rect

std::array< float, 4 > rect = {0.0f, 0.0f, 0.0f, 0.0f}

Bounding rect. Meaning depends on type: Rectangle/Oval: [x, y, width, height] Circle: [center_x, center_y, diameter, 0] Line: [x0, y0, x1, y1] Point/Spot: [x, y, 0, 0]

location

std::array< float, 2 > location = {0.0f, 0.0f}

Tracked marker location for PointMax/PointMin/PointAvg.

vertices

std::vector< std::array< float, 2 > > vertices

Polygon vertices (normalized). Ignored for non-polygon types.

color

std::array< float, 4 > color = {1.0f, 0.0f, 0.0f, 1.0f}

Outline colour as RGBA, each channel 0..1. Becomes RegionStyle::color unchanged.

text_color

std::array< float, 4 > text_color = {1.0f, 1.0f, 1.0f, 1.0f}

Label colour as RGBA, each channel 0..1. Becomes RegionStyle::text_color unchanged.

line_width

float line_width = 2.0f

Outline width in pixels. A screen quantity, not normalized, so the coordinate change does not touch it. Becomes RegionStyle::line_width unchanged.

marker_style

MarkerStyle marker_style = MarkerStyle::kCrosshair

Marker shape drawn at a point or tracked spot. Becomes RegionStyle::marker_style; MarkerStyle itself now comes from region.h, with k-prefixed enumerators.

marker_size

float marker_size = 5.0f

Marker size in pixels, not normalized. Becomes RegionStyle::marker_size unchanged.

smoothing_factor

float smoothing_factor = 0.5f

Intended as a low-pass on a tracked PointMax/PointMin location, 0..1, so the marker does not jump between neighbouring pixels from frame to frame.

It never did that. Nothing in the SDK reads it: it is populated when an ROI is loaded from JSON and then ignored, and there is no RegionStyle field for it, so ToRegion() drops it. A stored preset that sets it loses the value on conversion and loses no behaviour, because there was none. Do not build on it.

show_label

bool show_label = false

Draw the ROI's name and reading beside it. Becomes RegionStyle::show_label unchanged.

label_anchor

LabelAnchor label_anchor = LabelAnchor::kNorth

Which side of the ROI the label sits on. Becomes RegionStyle::label_anchor; LabelAnchor itself now comes from region.h.

label_margin

float label_margin = 10.0f

Gap between the ROI and its label, in pixels. Becomes RegionStyle::label_margin unchanged.

font_size

float font_size = 0.0f

Label size in pixels; 0 lets the renderer choose one that suits the frame. Becomes RegionStyle::font_size unchanged.

children

std::vector< Roi > children

Nested ROIs: a hot spot searching inside this one, the members of a BlobGroup. Converted recursively, so a child's coordinates get the same y scaling as its parent's, and becomes Region::children.

RoiContainer::Add() assigns IDs to the added ROI and to these direct children only. A grandchild keeps whatever id it arrived with, which for a freshly built tree is 0, and cannot then be found with Get().

emissivity

float emissivity = 0.0f

Emissivity for this ROI's pixels, 0..1. Zero means "use the imager's global emissivity", not "perfectly reflective". Becomes Region::emissivity unchanged, with the same convention.

Setting it here no longer affects any image. Per-region emissivity reaches the pipeline through the Region, so an unconverted Roi is a value with no path to the camera.

blob_threshold

float blob_threshold = 30.0f

A pixel joins a blob at or above this temperature, in degrees Celsius. Becomes BlobConfig::threshold unchanged.

blob_threshold_max

float blob_threshold_max = 0.0f

Upper bound in degrees Celsius, so a band can be detected rather than only a floor; 0 means no upper bound. Becomes BlobConfig::threshold_max unchanged.

blob_min_size

uint32_t blob_min_size = 10

Smallest blob worth reporting, in pixels. Becomes BlobConfig::min_size unchanged.

blob_max_count

uint32_t blob_max_count = 0

Most blobs to report; 0 means unlimited. Becomes BlobConfig::max_count unchanged.

blob_smoothing

float blob_smoothing = 0.005f

Outline smoothing, as a length in normalized-x units. Becomes BlobConfig::smoothing unchanged -- x is normalized by the frame width in both models, so this is one of the few lengths the coordinate change leaves alone.

blob_render_mode

BlobRenderMode blob_render_mode = BlobRenderMode::kBox

Whether a detected blob is drawn as its bounding box or its outline. Becomes BlobConfig::render_mode; BlobRenderMode itself now comes from region.h.

max_blob_size

float max_blob_size = 0.0f

Largest blob to report, as a fraction of the group's area; 0 means no limit. Worth setting when a warm background would otherwise come back as one enormous blob. Becomes BlobConfig::max_blob_size unchanged -- note it is the one blob field here without the blob_ prefix.

blob_contour_max_points

uint32_t blob_contour_max_points = 200

Cap on the points in a kContour outline, so one ragged blob cannot cost an unbounded amount of overlay geometry. Becomes BlobConfig::contour_max_points unchanged.

motion

std::optional< RoiMotionPath > motion

Set to move the ROI along a path over time; unset leaves it where it was placed. Becomes Region::motion.

One-way. ToRoi() does not restore it: a Region carrying a MotionPath converts to an Roi with no motion at all, so a round trip through Region and back leaves a moving ROI static. Keep the original if you need the path.

anim_time

float anim_time = 0.0f

The playhead: seconds elapsed along motion, from 0 to total_duration_ms / 1000. Advanced by whoever drives the animation, not by the ROI itself.

Region has no equivalent -- MotionPath describes the path and nothing holds a position along it -- so ToRegion() drops this along with anim_direction, and a converted animation resumes from the beginning rather than from where it was.

anim_direction

int8_t anim_direction = 1

Which way the playhead is travelling: +1 forwards, -1 backwards once kPingPong has turned around, 0 once kOnce has finished. Dropped by ToRegion() together with anim_time.

stats

RoiStats stats

This frame's readings, filled in by ComputeStats() or RoiContainer::UpdateStats(). An output, not an input: whatever is set here is overwritten by the next measurement.

ToRegion() does not carry it, so a converted Region starts unmeasured and RegionStore fills its statistics on the next frame. ToRoi() fills it from RegionStats, minus the five fields RoiStats has no room for.

alarm_triggered

bool alarm_triggered = false

Render hint only: draw this ROI in the alarm colour. The alarm itself lives on the Region's rules; ToRoi() copies the rolled-up state down to this flag so the overlay can colour it.

Public functions

Contains

bool Contains(float x, float y) const

Test if a normalized point is inside this ROI's geometry.

ComputeStats

void ComputeStats(const float *data, uint32_t width, uint32_t height)

Compute statistics from celsius temperature data.

ComputeStats

void ComputeStats(const int16_t *data, uint32_t width, uint32_t height)

Compute statistics from internal int16 data.