OptrisOptrisDocumentation

Documentation/OTC SDK/Optris.Sdk — C# API referencev12.0

CanvasMap

public sealed class CanvasMap : IDisposable

Which source pixel is behind which canvas pixel.

Recomputed by CanvasMap.Update(…), which is the only call that reads a canvas, so a map is a snapshot and goes stale deliberately rather than tracking a canvas it does not own.

CanvasMap: constructors

public CanvasMap()

An empty map. CanvasMap.Update(…) fills it.

CanvasMap: constants

public const int NoSource = -1

What CanvasMap.ReadIndices carries where the canvas has no camera behind it.

The ABI's own named value, not a number chosen here. It is -1, outside the range of any source pixel index, so it cannot be confused with a real one.

CanvasMap: properties

public float Fill { get; }

The fraction of the canvas with a camera behind it, 0 to 1.

Useful for telling "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.

That makes it a count of pixels, not an area: multiply it by Width * Height and the result is a whole number. It is also totalled before the edge is measured, so it is not the fraction of pixels that have a source either: CanvasMap.ReadCoverage gives a part-covered pixel a fraction of 255, and CanvasMap.ReadIndices gives one a source even where its centre missed. The three disagree around the perimeter only.

An earlier version of this remark said Fill tracked the coverage-weighted area. It does not; centre sampling merely approximates one, which is why the two agree to within a fraction of a percent and why bracketing Fill between the whole and touched counts could not tell them apart.

public bool IsEmpty { get; }

Whether nothing has been mapped yet.

public ValueTuple<uint, uint> Size { get; }

The mapped area. (0, 0) before the first update.

CanvasMap: methods

public byte[] Composite(ReadOnlySpan<byte> sourceBgra)

Composite sourceBgra through this map.

The result is the canvas as BGRA, with the void colour wherever no placement covers.

public void Dispose()

Release the map.

public byte[] ReadCoverage()

How much of each canvas pixel the frame covers, 0 to 255.

255 inside, 0 outside, and the real fraction along the edge, which is the point of it: it is why a turned picture has a clean boundary instead of a staircase, and CanvasMap.Composite(…) blends with the void colour by it.

public int[] ReadIndices()

The source pixel index behind each canvas pixel.

Row-major, Width * Height long, where each entry indexes the camera's frame, not the placement. So a 382x288 camera yields values up to 110015, and a compositor reads its own frame through this table rather than repeating the transform per pixel. CanvasMap.NoSource where the canvas has no camera behind it.

public void Update(Canvas canvas, uint frameWidth, uint frameHeight)

Recompute against canvas for a frame of that size.