Skip to content

AR content anchors at the marker's top-left corner, not its center #38

Description

@kalwalt

Summary

In the Teblid AR examples (static-image #30 and the new webcam example #36 / #37), the rendered content (cube + axes) is anchored at the marker's top-left corner, not its center. We'd like content to sit in the middle of the marker by default.

Why

The tracked pose's origin is object point (0,0,0), which is the reference image's top-left pixel — the tracker's 3D object points are raw image pixel coordinates (pt3d = cv::Point3f(x, y, 0) in TrackingPointSelector / GetTrackedFeatures3d). So root.matrix places the marker origin at that corner, and content at local (0,0,z) renders there (= corner 0 / reference top-left).

Options

  1. Example-side offset (local, simple). Translate the content by half the marker size in marker-local units, e.g. box.position.set(refW/2 * s, refH/2 * s, z) with the correct Y sign (object Y is down → GL Y up after DRD). Done per example; no library impact.
  2. Library-side origin centering (broad, ArtoolkitX-like). Center the object points (pt3d = (x - refCols/2, y - refRows/2, 0)) in TrackingPointSelector so the pose origin is the marker center for every consumer — matching the usual ArtoolkitX marker-center convention. This changes the pose origin for all examples (a convention change), so it would live in webarkit/WebARKitLib and be coordinated with the existing pose work (fix(#55): rename pose getters (getPoseMatrixCV/GL) + getPoseMatrixCV zero-matrix fix #45).

Recommendation

Decide between a quick per-example offset (Option 1) and a library origin-centering convention (Option 2). Option 2 is cleaner long-term (all consumers get a centered origin) but is a broader, cross-repo change; Option 1 is an immediate local fix.

Context

Observed on the static-image example (#30) and the webcam example (#36, PR #37): content currently anchors at corner 0 (reference top-left). Not in scope for #37.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions