New artificial intelligence (AI) portals such as DALL-E2 that can conjure an image to match a text description, DeepDream, that applies an artistic style to a photograph to turn it into a painting, and plenty of others, are changing the world; here is a fascinating survey
I recently stumbled upon an AI application that I would have loved to have been part of– creating depth maps from standard, non-3D, non-stereo images. Why didn’t I think of this? What a brilliant idea!
A depth map of course, provides that third dimension of distance from the photographer. And with that information, one can (almost) make a stereoscopic image, a scene in a virtual reality world.
I have been dabbling with stereoscopic (3D) images for much of my life. I’ve enjoyed antique stereopticons, I have used stereo cameras, experimented with left-right image pairs, 3D shutter glasses, immersive 3D headsets,.and red-blue anaglyphs (I even wrote a paper about the best colors to use for them).
I am now in a project to make my own Viewmaster reel. Viewmasters were a popular stereo viewer invented in 1939 taking advantage of the new Kodachrome color film to capture 3D images of tourist and travel destinations. They continue to be manufactured and popular, especially with children’s material.
I own several stereo cameras, but I don’t have them with me very often. But I do have my iPhone with me, pretty much always. And it has a photo mode called “portrait”, which uses its multiple lenses to generate a depth map (from the measured parallax between lenses). The iPhone uses the depth map to detect what is foreground and what is background, and then it blurs the background and combines it with the foreground to make a pleasing portrait. You know, the kind where the subject is in beauty light in front of a dreamy background.
But I have a different use for the depth map. With a depth map, it is possible to (almost) reconstruct the left- and right-eye views of the scene and create a stereoscopic picture. I wrote a program to do exactly this, kind of a “reverse parallax” technique, and now I can generate stereo pairs from my portrait-mode iPhone pictures.
Alas, I do not always use portrait mode on my phone (it is not the default, and it does not allow zooming), and so many of the pictures I might like to experience in 3D don’t have the depth map needed to do so.
Which brings me to the AI site that generates a depth map from a single 2D image. I was excited to discover it, and I have now created several stereo pairs from the depth maps it generates. It is not perfect; there are only so many implicit depth cues in a 2D image to work with, but it is remarkably good. Like I said, I wish I had thought of this application (but I’m really glad someone else did)!
I adapted the program I wrote for the iPhone portrait-mode images to take a photo and apply its (AI-generated) depth map to make a left and a right eye view. It is not truly what each eye would have seen (there are different obstructions behind the foreground objects), but it is still pretty convincing.
Instructions for cross-eyed viewing of stereo pairs: Position your finger about 6″ in front of your nose while looking at the pair of images. Now focus on your finger; the picture will go out of focus, but you will see a “middle” image where the two side images overlap. Now relax your focus without shifting your gaze (keep the overlapped middle image overlapped). With a little practice, you can make the middle overlapped image come into focus and you can drop your finger and enjoy the 3D experience of viewing a stereographic image pair!