I have been experimenting with some cheap ESP32 cameras for various projects. At some point I wondered if it was possible to achieve a stereoscopic vision with two cameras side by side.
Setting up the cameras
3D printed some camera mounts for two ESP cameras.
The mounts has the camera on a flexure that allows vertical adjustment. A small eccentric arm pushes on the bottom of the frame to adjust elevation angle;
The mounts were fitted with magnetic pots. and placed on a piece of steel plate. This allowed for easy IPD and parallax adjustment.
Displaying the stereoscopic image
I had some of these early VR goggles, the kind where you can put your phone inside.
I figured the easiest way to display the stereo video would be to create a web page with some embedded JavaScript that would simply display the video stream from each camera in front of each eye.
I made a basic HTML page that would show two images side by side. This page would load on the phones browser and go into full screen mode.
JavaScript imbedded in the page would adjust the images to fit the size and shape of the phone display as well as receiving the video streams.
An Arduino program that would run on both ESP cams. A variable in the code would make the camera take the role of either the left or right eye. The left eye would start a wireless access point that both the right eye and the phone would connect to. The left eye also started a small webserver that launched the viewer webpage via. a captive portal. Once launched the webpage connected to each camera via. a WebSocket interface to receive the video streams.
Results
Considering that this was a crude prototype I was pretty surprised by the result. It is totally possible to make wireless stereo vision with in this simple setup. When both cameras are connected and adjusted correctly you have a real sense of depth and the images blends seamlessly in the goggles.
The framerate is not great and it can be somewhat disorientating if one of the cameras lags for a few frames. I had to make some compromises between the framerate and image resolution but I feel I found a good combination.
Possible improvements
The WIFI range of the ESP cams are notoriously bad. Something seems to be wrong with the antennas. I have measured the RF output compared to other ESP32 modules and they seem to be outputting only of fraction of the usual amount. With improved antennas or by connecting the cameras and goggles to e.g. a wireless router the range may be improved drastically.
Additions could easily be made to the JavaScript running on the phone that would enable remote control of e.g. a robot, pan/tilt unit or other stuff connected to the cameras.
Try it out
If you want to try it yourself I have included the Arduino sketch for the cameras (AS-IS NO SUPPORT!!). You need to set the variable at the top of the sketch to determine what camera does what.
When both cameras are connected you can connect your phone to the WiFi network:
SSID: “STEREO_VISION” password: “crossEyed”.
Once connected the default browser should pop up with the viewer page. If not go to 192.168.4.1 in the browser. The viewer should toggle fullscreen when you click on the background.
You can use a pair of Google Cardboard goggles or similar, this works fine. If you want to 3D print the mounts for the cameras here are the .stl files.