Skip to content

AR_MATRIX_CODE_GLOBAL_ID decoding not implemented; ARMarkerInfo::global_id always 0 #89

@kalwalt

Description

@kalwalt

Summary

AR_MATRIX_CODE_GLOBAL_ID matrix decoding is not implemented; consequently ARMarkerInfo::global_id is never populated.

Environment

Reproduction Steps

  1. Configure the pipeline with matrix_code_type = ARMatrixCodeType::GlobalID (if/when present in the enum) or any code type that upstream ARToolKit treats as global-ID.
  2. Run detection against a global-ID marker.
  3. Inspect marker.global_id on the resulting ARMarkerInfo.

Expected Behavior

Per include/AR/ar.h:214:

globalID — If arPattDetectionMode is a matrix mode, matrixCodeType is AR_MATRIX_CODE_GLOBAL_ID, and idMatrix >= 0, will contain the globalID.

C populates this via arPattGetIDGlobal as one of the out-params at arGetMarkerInfo.c:80. ARMulti uses it explicitly at arMultiGetTransMat.c:96-98 and arMultiReadConfigFile.c:92-113 to dispatch on a 64-bit global identifier.

Actual Behavior

  1. crates/core/src/ar/matrix.rs:529-532 explicitly punts on the variant:
    _ => {
        // The unhandled types include GLOBAL_ID, etc.
        Ok((code_raw as i32, 0))
    }
  2. ar_get_marker_info therefore has no value to write into marker_info[j].global_id, and the field remains 0 (its Default::default() value).

Source References

Impact

Medium-Low — only affects users who would otherwise want to use AR_MATRIX_CODE_GLOBAL_ID (a 64-bit identifier scheme). Users on AR_MATRIX_CODE_3x3, 4x4_BCH_*, 5x5_BCH_* are unaffected. Blocks any future port of ARMulti's global-ID path.

Suggested Approach

This is genuinely a missing feature, not just plumbing:

  1. Decide whether AR_MATRIX_CODE_GLOBAL_ID should be added as an explicit ARMatrixCodeType variant (currently swallowed by the _ => arm).
  2. Port the C decoding (encoding is described at arGetMarkerInfo.c and helpers in lib/SRC/AR/arPattGetID.c).
  3. Plumb the resulting u64 out of ar_matrix_code_get_id and write it into marker_info[j].global_id in ar_get_marker_info.
  4. Add unit tests with hand-crafted global-ID bit patterns from upstream test data, if available.

Recommend treating this as its own work item — do not bundle it with the cutoff_phase plumbing issue, the scope is qualitatively different.

Additional Context

Labels suggested: enhancement, area:matrix-code, help-wanted.
Priority: Low (no current consumer in the repo blocked).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions