Ghastly Mirror Displays Ghoulish AI-Generated Reflections

Tim created this haunted mirror that displays spooky reflections generated by an AI.

Mirrors and ghosts have a long history. Today's popular image of a semi-transparent apparition is, in fact, a direct result of the mirror-based illusions and double-exposure photographs utilized by perpetrators of occult hoaxes. And thanks to modern technology, today we can create paranormal illusions that are far more powerful than their 19th and 20th century predecessors. To that end, Tim created this haunted mirror that displays spooky reflections generated by an AI.

This project combines two well-known practical uses of technology: smart mirrors and AI art.

Smart mirrors display content that seems to come from the reflective surface itself. They work because brightly lit areas will shine through a two-way mirror, but dark areas won't. So if you place an LCD screen behind a two-way mirror and keep most it black, then anything shone in white will shine through. Other colors will also come through if they're bright enough, but white is most common because it combines the brightness of the red, green, and blue subpixels of LCD screens.

AI-generated art exploded in popularity over the past couple of years, as a couple of very capable models hit the scene and generated buzz on social media. Those usually work with text prompts, but they can also redraw images in new styles or with additional content. In this case, the Stable Diffusion AI takes a photo of the user as input and then redraws it in a cartoonish and slightly morbid style that suits the Halloween theme.

On the hardware side, this didn't take much more than a PC with a decent GPU, a monitor of the appropriate size, and a webcam. Tim put the monitor behind an ornate frame with a two-way mirror panel. The webcam perches on top of the frame where it gets a good view of the user. OpenCV detects a person in front of the mirror and snaps a photo, which it then passes on to Stable Diffusion for the AI treatment. As soon as that's ready, it appears on the monitor and shows "through" the mirror — hopefully scaring the user with their own macabre visage.

Though they're optional, Tim added some Arduino-controlled lights to the top of the frame. Those help provide good illumination for the original photo, then turn off at the exact moment that the AI image appears in order to hammer home the effect.

We can't think of a better use for AI art and this mirror is sure to be a big hit on Halloween this year.

Cameron Coward
Writer for Hackster News. Proud husband and dog dad. Maker and serial hobbyist. Check out my YouTube channel: Serial Hobbyism
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles