OptrisOptrisDocumentation

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

optris::sdk::CanvasMap

A precomputed canvas-pixel -> frame-pixel table.

PixConnect3 builds the same thing (PixelMixer, a per-destination index array initialised to -1 for "no source"), and it is the right idea for the right reason: a placement changes when a user drags something, which is rarely, while frames arrive thirty times a second. The mapping is rebuilt on a change and merely indexed on a frame.

This table is display only. It resamples, by nearest source pixel, and nothing measured is ever read through it. That is the one place this design departs from PixConnect, which measures ROIs on the merged buffer and therefore reports every temperature in a merged scene from resampled data.

Public static attributes

kNoSource

static constexpr int32_t kNoSource = -1

The index stored for a canvas pixel with no camera behind it.

Public functions

Update

void Update(const Canvas &canvas, uint32_t frame_width, uint32_t frame_height)

Rebuild for canvas over a frame_width x frame_height source. Cheap to call every frame: it returns immediately unless something that affects the mapping actually changed.

Width

auto Width() const -> uint32_t

Height

auto Height() const -> uint32_t

Empty

auto Empty() const -> bool

Indices

auto Indices() const -> const int32_t *

Source pixel index per canvas pixel, row-major, kNoSource where the canvas has no camera behind it.

Fill

auto Fill() const -> float

The fraction of the canvas that has a camera behind it. Useful for a UI that wants to tell "zoomed out" from "panned away".

One sample per canvas pixel, taken at its centre. A pixel counts in full when the frame is behind that centre and not at all when it is not, so a part-covered edge pixel counts exactly when its own centre is covered.

So this is a count of pixels and not a coverage-weighted area -- Fill() times Width() times Height() is a whole number -- and it is totalled before the edge is measured, so it is not the fraction of pixels carrying a source index either: Coverage() gives a part-covered pixel a fraction, and Indices() gives one a source even where its centre missed. All three agree except around the perimeter. Pinned by CanvasMapTest.FillCountsAPixelByItsCentreAndNotByItsCoverage, which separates the three on a geometry where they differ.

Coverage

auto Coverage() const -> const uint8_t *

How much of each canvas pixel the frame actually covers: 255 inside, 0 outside, and the real fraction along the edge.

The edge is the only place this is not one or the other, and it is why a turned picture has a clean boundary instead of a staircase. Composite() blends with the void colour by it.

Composite

void Composite(const uint8_t *src_bgra, uint8_t *dst_bgra) const

Paint a BGRA8 frame of the source's size into a BGRA8 buffer of the canvas's size. Void pixels get the canvas's void colour.