StereoPi - taking 3D photos with Pi

By Rob Zwetsloot. Posted

Powered by a Raspberry Pi Compute Module, this open-source camera board can capture stereoscopic 3D photos and videos.

Did you know that since 2014, Raspbian has offered built-in support for stereoscopic photography? The only obstacle to making use of it is that standard Raspberry Pi models only have a single Camera port. The Pi Compute Module, on the other hand, supports the connection of two Camera Modules, which is why the Russian virt2real team have used it to power StereoPi – a project that has taken over three years to develop.

This article first appeared in The MagPi 79 and was written by Phil King

“Starting in the middle of 2015, we did our first generation board on Compute Module 1,” recalls virt2real’s Eugene Pomazov. “We understood that we needed not only to control our drones or robots, but add more autonomous features. The age of AI and computer vision had come.

“We tried to find ready-to-use solutions on the market. But all of them were either expensive industrial-level solutions, or crappy-quality toys. […] That’s why we decided to create StereoPi. Two cameras with fully controlled options, friendly Raspberry Pi ecosystem with a lot of ready-to-use examples, and an inexpensive solution with computing power on board which costs about $100-150.”

 Two Pi Camera Modules can be connected to the StereoPi board, for stereoscopic photography

Attaching to any Compute Module via its SODIMM connector, the latest version of the StereoPi board features two Camera ports, positioned at the ideal spacing (65 mm) for stereoscopic photography.

Standard Pi ports

It also features standard Pi model connections such as a 40-pin GPIO header; ports for Ethernet, USB, and HDMI; and a microSD slot. Eugene says the team’s favourite addition is a small power switch, enabling you to restart the system without having to unplug the cable or turn off at the mains.

With Raspberry Pi at its core, StereoPi works with the standard Raspbian OS. Since stereoscopic support is already built into the raspistill or raspivid commands, as well as the Python picamera library, it’s ready to use out of the box.

Naturally, you’ll need some kind of mounting plate for the two cameras, to keep them spaced and aligned correctly. The virt2real team have created a few mounts for different uses, including 3D photography (with cameras side by side) and panoramas (with wide-angle lenses facing in opposite directions). “We plan to share all drawings and ready-to-print STL files so anyone can use and modify them for their needs,” says Eugene.

 A depth map generated in ROS – the StereoPi is ideal for computer vision systems on robots, to aid collision avoidance

Double the possibilities

Eugene envisages two main application scopes for StereoPi: “The first one is a 3D video live-stream to the user. The second is computer vision.”

Stereoscopic video can be live-streamed to the internet (e.g. YouTube) or viewed on a VR headset such as an Oculus Go. “You can obtain 90 frames per second with smaller resolutions (like 640×480),” reveals Eugene, “or higher resolutions at smaller fps (30 with Full HD).”

The compact and light nature of StereoPi makes it particularly useful for attaching to drones and robots. As well as live-streaming video from them, this is where the computer vision aspect comes into play. “Collision avoidance was the first idea that came to our mind when we decided to create StereoPi,” explains Eugene. “You can use OpenCV or ROS [Robot Operating System] and on-board computations by means of the Raspberry Pi Compute Module to obtain a depth map or SLAM [simultaneous localisation and mapping].”

He concludes, “In both live-stream and computer vision cases, we think StereoPi will be a great tool for learning and experiments.”

If this article has piqued your interest in the possibilities of 3D photography, see StereoPi’s crowdfunding campaign.

From The MagPi store

Subscribe

Subscribe to the newsletter

Get every issue delivered directly to your inbox and keep up to date with the latest news, offers, events, and more.