Research
Ninja Codes: Neurally Generated Fiducial Markers for Stealthy 6-DoF Tracking
Overview Research area: Computer vision — fiducial markers for 6-DoF location tracking, combining deep steganography with neural object detection. Technical level: Advanced. The paper assumes familiar

- arXiv
- 2510.18976
- Published
- 2025-10-21
- Authors
- Yuichiro Takeuchi, Yusuke Imoto, Shunya Kato
AI summary
Overview
Research area: Computer vision — fiducial markers for 6-DoF location tracking, combining deep steganography with neural object detection.
Technical level: Advanced. The paper assumes familiarity with encoder/decoder architectures, U-Net, SSD object detection, adversarial training, and differentiable noise augmentation.
Scope: The paper introduces "Ninja Codes," a class of neurally generated fiducial markers that blend into real-world surface textures while still supporting printed, camera-detected 6-DoF tracking.
What This Paper Is About
Conventional fiducial markers such as ArUco, AprilTag, and ARTag are cheap, easy to deploy, and robust, but their eye-catching appearance makes them undesirable in homes, offices, and other settings where aesthetics matter. The authors train an encoder network that converts an arbitrary photograph of a surface texture (wood, marble, asphalt, tile) into a marker by applying only subtle visual alterations, so the printed result looks like ordinary surface material. The goal is a marker that can be printed on regular paper with a standard color printer and detected by any RGB camera device capable of running inference — most modern smartphones included — to deliver reliable 6-DoF tracking while hiding from human notice.
Key Contributions
- Introduces Ninja Codes, described by the authors as the first example of neurally generated, inconspicuous fiducial markers built upon deep steganography techniques.
- Presents an end-to-end training pipeline in which five modules — encoder, region detector, corner detector, decoder, and adversary — are trained jointly, with differentiable noise functions applied at two stages to simulate printing and camera perturbations.
- Reports experimental results validating the codes as a reliable and discreet tracking solution, including code detection accuracy, 6-DoF tracking accuracy, and a human visual conspicuity test.
- Identifies outstanding issues and limitations, covering visual artifacts, maximum detection range, privacy, color calibration, and materiality, and maps out countermeasures and extensions.
Main Findings
-
Corner detection accuracy is around one pixel. Across the three trained module sets, average corner error was 0.994 px for NC_100, 1.057 px for NC_200, and 1.145 px for NC_300, compared with 0.586 px for ArUco. Values are reported at the region detector's 300×300 input scale. The authors note no significant differences in error across the eight camera positions.
-
Drop rates rise as artifact suppression increases. Drop rate (percentage of failed detections, where the code was not found or its 36-bit ID was not fully recovered) was 3.20% for NC_100, 7.30% for NC_200, and 11.10% for NC_300, versus 0.00% for ArUco.
-
Fine-tuned modules generalize across encoders. Detector/decoder modules taken from NC_100 and fine-tuned for 30 additional epochs produced comparable results (0.958 px / 3.50% for NC_100 codes, 1.042 px / 5.90% for NC_200 codes, 1.220 px / 12.80% for NC_300 codes), suggesting a single detector/decoder set can serve a suite of encoders.
-
High-contrast textures are the main failure mode. Failures were background-specific and concentrated in images with high local RMS (standard deviation of pixel YUV values computed at 32×32 patches and averaged). The two highest-RMS images (tile and grass) produced the most failures; omitting them reduced drop rate to 1.30% for NC_100, 4.67% for NC_200, and 8.15% for NC_300.
-
Most failures come from ID retrieval, not localization. The majority of failed detections occurred after the code was successfully located but the decoder failed to recover the full 36-bit ID. A test using 12 of the 36 bits as Reed-Solomon check symbols cut the NC_300 drop rate from 11.10 to 6.00, at the cost of reducing unique IDs from 68.7 billion to approximately 16.8 million.
-
6-DoF tracking reaches centimeter and near-single-degree accuracy. Using NC_200 codes on A2 (59.4 × 42.0 cm) poster boards, position error was 2.988 cm and pose error 1.084 degrees, compared with 2.121 cm and 0.854 degrees for ArUco. No issues were observed with multi-code detection or with the printing method/material.
-
Humans take significantly longer to find Ninja Codes than ArUco markers. In the conspicuity test with nine subjects, detection time for Ninja Codes was longer and highly variable, with high-contrast textures causing particular trouble — the same image type that produced high drop rates.
-
Robustness observed in informal use. With NC_300 codes printed at 4.25 × 4.25 cm, detection held up across varied lighting, including partial obscuration by specular reflection, suggesting spatially redundant encoding. Detection degraded less under underilluminated than overilluminated conditions, which the authors attribute partly to the iPhone's auto-exposure.
-
Material mismatch is a real-world weak point. Informal testing found that differences between the marker material and the background surface often made codes noticeable, especially on three-dimensional textures such as textiles.
Methodology in Plain English
The system is trained end to end as one pipeline. Training images (1024×1024) are sampled, and up to four square patches of random sizes are cut out at random locations. Each patch is warped (vertices shifted in x and y by at most 15% of the patch's edge length) and rotated into a convex quadrilateral, then rectified and resized to 256×256 — these are called "cover images."
Each cover image is paired with a randomly assigned 36-bit ID. The encoder (a U-Net, given the cover image concatenated with an ID-derived tensor as a 6-channel input) outputs an encoded image, the Ninja Code. Before pasting the code back onto the original training image, printer noise is applied: randomized color shift (hue ±0.1, brightness ±10%, contrast and saturation ±15% each) plus a synthetic specular reflection. The re-warped codes are pasted back to mimic a real scene. A second noise stage simulates camera capture: the same color shift, Gaussian blur (kernel 1, 3, 5, or 7 px), Gaussian noise (σ uniform on [0, 0.2]), and random-quality JPEG compression. The image is resized to 300×300 and fed to the region detector (SSD-based with a VGG backbone, single class, square anchors), then the corner detector (a U-Net plus fully connected layers performing direct corner regression) refines locations. Located codes are rectified to 256×256 and passed to the decoder (convolutions plus two fully connected layers, no spatial transformer) to recover IDs. An adversary network tries to tell Ninja Codes from unprocessed cover images, and is trained separately using the reverse of its loss.
Training used two NVIDIA 3090 GPUs with the Adam optimizer (learning rate 1.0e-5, weight decay 0, β₁ 0.9, β₂ 0.999, ε 1.0e-8). The dataset contained 48,000 images: 43,300 from COCO and 4,700 from DTD, all resized and cropped to 1024×1024, plus a 9,600-image validation set from the same sources. Training ran in two phases. Phase 1 (20 epochs) ignored image, message, and adversary loss to focus on detection (w_r = w_c = 1.0, w_k = 5.0e3). Phase 2 (60 epochs) minimized all losses, starting with w_m = 10.0 and w_a = 0.001 and ramping w_i to 100.0 over the first 30 epochs; the remaining 30 epochs were split into three sessions with w_i at 100.0, 200.0, and 300.0, yielding the NC_100, NC_200, and NC_300 module sets. Detection accuracy was tested using 25 texture images shown on a 22-inch LG UltraFine 5K monitor (codes displayed at 8.5 × 8.5 cm) and photographed from eight positions with an iPhone 15 Pro, with ArUco as a baseline.
Why This Matters
Impact on research: The work sits at the intersection of deep steganography and fiducial marker design, extending steganographic encoder/decoder training with region and corner detection so that codes placed at unknown locations and in unknown numbers can be found, precisely localized, and then decoded. It opens an under-explored direction: inconspicuous markers for tracking, rather than for data transmission or purely aesthetic QR alternatives.
Real-world applications:
- Augmented reality, where tracking accuracy governs the breadth and quality of possible effects, including diminished reality and freeform environmental transformations.
- Robotics, including research demonstrations such as drone-based construction that require precision tracking.
- Film production, where codes could act as anchors for placing CGI elements and could be removed from the final scene using a reverse encoder.
- Residential and other non-professional settings, where the conspicuous appearance of conventional markers has limited adoption despite their cost and reliability advantages.
Industry relevance: Because Ninja Codes print on regular paper with standard color printers and run on devices as common as modern smartphones (combined detector/decoder inference is around 30 ms on an iPhone 15 Pro), the approach fits cost-sensitive deployments. The authors note, however, that the modules interoperate only with others co-trained in the same session, so a single vendor's detector/decoder pair is tied to its own encoders.
Future Directions
- Suppressing visual artifacts. Artifacts remain strongest for codes generated from plain or light-colored cover images; proposed remedies include model refinements, dedicated texture datasets, and loss functions that make residual artifacts aesthetically unobjectionable rather than eliminating them.
- Extending detection range. The region detector's 300×300 input means small or distant codes lose enough visual features to be missed; under the detection test setup, robust detection held to roughly 160 cm. Accepting larger input images is the straightforward fix, at the cost of potentially slower training and inference.
- Broadening materiality. The concept is theoretically adaptable to any media with digitally controllable fabrication, such as 3D printed objects and textiles, though the noise functions would likely need updating for the limited color space of 3D printers.
- Addressing privacy and developing the reverse encoder. Since a photo of a Ninja Code could leak precise location data even with metadata stripped, the authors propose session-specific "private" codes as an incomplete defense, and note that a U-Net reverse encoder — trained to reconstruct the cover image from a code — could obscure codes automatically in photographs or remove them from augmented scenes.
Additional open items include integrating error correction more fully (the Reed-Solomon test reduced unique IDs to approximately 16.8 million from 68.7 billion) and building practical color calibration tools, since the authors' current approach relies on a custom tool that captures photos under controlled LED lighting.
Target Audience
Researchers and practitioners in computer vision, augmented reality, and robotics who work with location tracking and marker systems, particularly those interested in deep steganography, neural object detection, or adversarially trained encoders. It is also relevant to engineers weighing practical deployment trade-offs — detection range, drop rate, error correction, printing material, and calibration — and to HCI or media-production researchers exploring inconspicuous tracking anchors. The dense model and loss descriptions make it best suited to readers with prior exposure to deep learning architectures.
Authors’ abstract
In this paper we describe Ninja Codes, neurally generated fiducial markers that can be made to naturally blend into various real-world environments. An encoder network converts arbitrary images into Ninja Codes by applying visually modest alterations; the resulting codes, printed and pasted onto surfaces, can provide stealthy 6-DoF location tracking for a wide range of applications including robotics and augmented reality. Ninja Codes can be printed using standard color printers on regular printing paper, and can be detected using any device equipped with a modern RGB camera and capable of running inference. Through experiments, we demonstrate Ninja Codes' ability to provide reliable location tracking under common indoor lighting conditions, while successfully concealing themselves within diverse environmental textures. We expect Ninja Codes to offer particular value in scenarios where the conspicuous appearance of conventional fiducial markers makes them undesirable for aesthetic and other reasons.