Luxar Viewer API Documentation - v2026.9.22
    Preparing search index...
    • Normalised cross-correlation of two equal-length sample buffers.

      Each buffer is mean-centred and divided by its standard deviation, then the products are averaged — so the result is invariant to overall brightness and contrast, and depends only on structure. That invariance is the point: two captures of the same pose can differ in exposure (auto-exposure re-runs) or in how much of a progressively-streamed scene has arrived, and neither should read as "different pose".

      Returns a value in [-1, 1]: +1 identical structure 0 unrelated — and also what a FLAT buffer yields, see below -1 inverted

      A flat buffer (all pixels equal, e.g. an all-black failed capture) has zero standard deviation and no structure to correlate. Rather than dividing by zero and returning NaN — which would compare false against any threshold and so silently disable the check — it is left mean-centred at all zeros, giving a correlation of 0. That reads as "disagree", which is the right answer: an all-black gallery frame is a failed capture whether or not its counterpart matches it.

      Parameters

      • a: ArrayLike<number>

        First buffer.

      • b: ArrayLike<number>

        Second buffer, same length as a.

      Returns number

      Correlation in [-1, 1], or 0 when either buffer is flat.

      If the buffers have different lengths, or are empty — both indicate a caller bug (mismatched downscale, or a decode that produced nothing) that would otherwise surface as a meaningless number.