Through the Looking Glass: Real-Time Optical Text Reversal on iOS with Vision and Metal

How computer vision, convolutional bounding box detection, and low-level GPU fragment shaders combine to mirror printed words in the physical world.

Lewis Carroll's Through the Looking-Glass opens with Alice wondering what world exists on the other side of the drawing room mirror:

"How would you like to live in Looking-glass House, Kitty? I wonder if they'd give you milk in there? Perhaps Looking-glass milk isn't good to drink—And oh, Kitty! now we come to the passage."

When Alice steps through the mantelpiece, she discovers a book written in an incomprehensible script. Holding it up to a mirror reveals the poem Jabberwocky.

ReverseWorldGo brings this literary conceit into physical reality. As you point your iPhone camera at book pages, street signs, or cereal boxes, the app isolates printed text and renders it in real-time mirror reversal while keeping the background physical environment stable.

Building this feature required solving an intense performance puzzle: how to run deep optical character recognition (OCR) alongside a 60 fps camera preview without dropping frames or overheating the iPhone. This article details the architecture connecting Apple's Vision framework with custom Metal render passes.


1. The Architectural Challenge: The Frame Budget

On an iPhone 14 or 15 running a 60 fps camera session, each video frame must be captured, processed, and displayed in 16.66 milliseconds.

Vintage motel reception desk with green banker lamp, rotary phone, and guest register
Vintage motel reception desk with green banker lamp, rotary phone, and guest register

Apple's VNRecognizeTextRequest is a state-of-the-art neural character detection model. However, on mobile silicon:

  • takes per frame.