Software:

For the software side I decided to go with C/C++ since having the lowest possible latency is really important. I also decided to use OpenCV for the image analysis side and OpenGL to show some results. I’ve never used OpenCV before and I found it very good in general, apart from some outdated documentation in places.

Brief Program Explanation:

Initialization:

  • Create / store 3D model of markers
  • Apply gaussian blur to the image to prevent false blobs from being detected

Core functionality:

  • Blob analysis: detect ellipses, obtain center coordinates, color and type
  • Point detection: Match results of blob analysis with 3D model, numbering each marker
  • Pose estimation: use the matched 3D model points and 2D image points to estimate the pose of the object

Show results:

  • Apply Kalman filter
  • Paint results of blob analysis and point detection with OpenCV
  • Paint simple in-game map with OpenGL

To start off I decided to create my own blob detection algorithm in order to have greater control of the conditions and results. I was pleasantly surprised that my custom scanning patterns proved very reliable detecting up to 5 different colors (red, green, blue, white, yellow) under very different light conditions (complete darkness, artificial light and direct sunlight) and up to 1.5m distance approximately; not as good a distance as I would like but I’m quite confident that this could be improved to 2.5 – 3m without too much difficulty. Still, for now it was good enough to move the main focus to other parts of the problem.

For the point detection I faced the problem of having to identify 22 different markers having only 5 different colors. In order to do that I created quite a big number of fairly complex rules for each marker, that take into account not only the color of the current marker but the relative position and angles of the adjacent ones from all the possible views. This part can still be improved as sometimes the detection fails, but at this point I realized it would be better to rethink a bit the distribution of the LEDs on the hardware before trying to improve the software side.

SEE ALSO
New 'Skydance's Behemoth' Trailer Shows Off New Boss, Gameplay & More Ahead of December Release

For the pose estimation part I decided to use the OpenCV implementation of the POSIT algorithm. Unfortunately is not as simple as calling a function since the input expects the whole list of points of the object you want to detect, starting always with the same origin point, and for each frame we only have a small subset of these (the points visible by the camera). I managed to get around this by using a few tricks, which I won’t go into detail for now.

After we have the position and orientation values I thought it would be cool to show a simple real-time representation of a room, so it’s easier to evaluate the quality of the output. To do this i created my own OpenGL “engine”, so I could have total control of how the combination of inputs affect the in-game movement. The map I used is a hand-modified version from one of Nehe’s OpenGL tutorials: the result is a funky colored temple, with some kind of ‘tombstones’ inside. Head motion detection is exaggerated on purpose for demonstration, should be toned down when using it with a real HMD.

Results:

I think the first results — although not perfect — are quite promising, as I managed to get a fairly reliable tracking with a good response and good precision, which even at 30 FPS feels very fluid. I have tested 60 FPS successfully but the blob analysis results are not as good as with 30 FPS because the intensity of LEDs is not properly adjusted. This should be fixed with a fairly simple hardware modification.

In the video the little ‘wings’ that you can see on top and bottom of the prototype were added to simulate the top part of the head and the neck blocking some of the LEDs. You can still see some small glitches from time to time due to the LED detection failing. As I mentioned, it could probably be corrected with more complex rules but I have already thought of some modifications in the hardware and marker distribution to prevent it.

SEE ALSO
Nintendo Could Be Making a New Labo VR Add-on for Its Next Switch

Also most of the jitter you can see (especially with the Kalman filter off) is related to orientation, but the main purpose of this system is to get positional tracking; combined with an IMU for orientation values and leaving the optical tracking to get only the positional information, the final result should be much better. Even though finding orientation was not the main goal of this project, these values are still very usable as you can see on the video.

I don’t really know the latency introduced by the PlayStation Eye camera itself but I decided to take some measurements in order to see the latency introduced by my software:

  • normalized box filter blur = 3.38 ms
  • blob analysis = 4.20 ms
  • point detection + pose estimation = 0.06 ms
  • opencv paint results = 0.60 ms
  • opengl paint results = 0.06 ms
  • Total: 8.30 ms apox.

First I used OpenCVs Gaussian Blur, but that was taking about 5.20 ms. Later I realized I could get away replacing it with a standard blur (normalized box filter). Blob detection still works great, and latency was reduced by almost 2ms (from 5.20 to 3.38 ms). I believe there’s still room for improvement in this area though.

Recap of Current Prototype Limitations:

  • Blob analysis distance 1.5m. With hardware and software modifications could be improved to 2.5 – 3m
  • Point detection fails sometimes; could be fixed using a different LED distribution
  • 30 FPS. 60 FPS should be easy to obtain (with adjustments to the LED intensity). 120 FPS possible (at the expense of detection distance due to reduced resolution)

1
2
3
4
Newsletter graphic

This article may contain affiliate links. If you click an affiliate link and buy a product we may receive a small commission which helps support the publication. More information.


Ben is the world's most senior professional analyst solely dedicated to the XR industry, having founded Road to VR in 2011—a year before the Oculus Kickstarter sparked a resurgence that led to the modern XR landscape. He has authored more than 3,000 articles chronicling the evolution of the XR industry over more than a decade. With that unique perspective, Ben has been consistently recognized as one of the most influential voices in XR, giving keynotes and joining panel and podcast discussions at key industry events. He is a self-described "journalist and analyst, not evangelist."
  • Daan Kortenbach

    Great work Jordi, the renders look amazing. Sing me up for one ;)

    • Jordi

      Thanks Daan!

      The plan is to release detailed instructions and files for building it (as easy and cheap as possible) + free tracking software + integrate it with 1 or more existing games, so anyone can try!

  • Paul James

    Fantastic article Jordi. I wonder if anyone from Oculus is watching ….

  • Eli

    What if there was a way to calibrate the LED spacing with the software. So as long as the patterns were the same, the distances wouldn’t really matter. If you held up the PosiTTron close to the camera where it has the best tracking, and then spun it around or held it at different orientations so the software could map out the size of the device and then store that as the shape/pattern grid. And maybe you measure the distance between 2 of the LEDS in millimeters or something so that the software has a starting point for the rest.

  • Jordi

    Yes, a calibration method similar to what you describe should be possible Alkapwn; in fact I mentioned it just a few days ago in one of my last posts on the MTBS forum, as a way to counter the low precision of “cheap” building techniques!

  • Gerald Terveen

    This is really awesome!!

    Idea .. could you use a cam with an optic and set it unsharp instead of using the blur (might even be possible with eye cam?

    I can’t wait for this to become reality! If you ever make it a commercially supported product I guess I will buy one.

    • Jordi

      Thank you Gerald!

      Yep, that is something i want to test a bit more as well; playing with the camera focus or trying to put different types of filter in front of the lens.

  • eyeandeye

    Any new news? I’d love to build one of these once I have my dev kit. I was planning on sacrificing one of my Hydras for positional but this sounds pretty sweet.

  • Jordi

    Hey eyeandeye, thanks for the interest! You can check my last update (from today) in here:
    http://www.mtbs3d.com/phpBB/viewtopic.php?f=138&t=16072&start=80

  • eyeandeye

    Awesome, thanks