Today I am going to show you how to use and improve the main component of your 3D position tracker to improve your virtual reality experience : the camera.
The cameras are based CMUcam5 from Charmed Labs which is a position tracking camera which can output 2D coordinates.
Why this camera ?
I have tested almost every alternatives, and the first prototypes were even based on Raspberry Pi camera, and the 2D position tracking was made using OpenCV image library on the Raspberry. I have also been working with the wiimote sensors and many standard HD webcam with FreeTrack. None of them did the job by a long shot !
You can order this camera on Amazon for 69$.
What’s under the hood of a CMUcam5 ?
- Multi point tracking (great for multiple users)
- 640*480 @ 50FPS
- 1280*800 @ 30FPS
- Lens field-of-view: 75 degrees horizontal, 47 degrees vertical
- Voltage : 5 to 12V
- Power consumption : 140mA
- Open Source (hardware and firmware)
- Removable optics
OK we found the camera, what do we “Gear Up” ?
That camera is nice, but we have to add some stuff to make it great. Here is what we are going to do :
In another post, we will see how to make it wireless, this one is already long enough !
Get to know your camera
An important part is to understand how your camera works and how it see the outside world and how it talks about it.
I am not going to write a lot about it as the guys from CharmedLabs did a great job at explaining all about their product !
Here is the Main Website
And her is the Quick Start page to setup your camera for its first use.
Play around with the camera, connect it to your computer and try to get an image.
Now you are supposed to know enough about the camera for the following steps. It is especially important to make it wireless.
Remove infrared blocking to filter
As you have seen on the video above, the camera tracks objects based on their colors. After a little testing, I found out that the color tracking is not good enough for our application, therefore we have to improve the tracking. Here is what we will do : instead of tracking color, we are going to track an infrared light. Infrared light is a light with a wavelength around 940nm, that can’t be seen by humans. Infrared is commonly used in remotes for examples.
Almost any camera can see infrared even though our eyes can’t. Unfortunately, in most cases we don’t want to see infrared with a camera, so the lens contains an infrared blocking filter. The CmuCam 5 has such a filter in its lens. We will have to remove that filter !
Different methods can be used to remove IR filters, such as eating the lens until the glue melts. In my case I took a screwdriver, broke the lens and remove the small pieces of glass left.
Here is how to do it step by step :
- Unscrew the lens from the camera
- Identify the IR filter. It is on the sensor side of the lens. It has a red-ish reflection like so :
- Break the filter with a small screwdriver. Don’t go to far, you would broke the others lenses. Remove the small pieces of glasses left.
- You’re done !
Add infrared pass filter
Now your camera can see usual light and IR light. As we are only going to track IR, we could add a filter that removes usual light, called “infrared pass filter“. With this filter, the camera will see infrared and only infrared ! The tracking will be much better !
I am sure you are now thinking “Damn, where am I going to find such a filter ?”, well it used to be easy 15 years ago, today it’s going to be a little more complicated… Here is what you have to find :
Because when you open a floppy disk, you see that round plastic thing on the next picture ? Well it can act an IR pass filter ! You just have to cut a small round in this disc with a pair of scissor and put it between the camera sensor and the lens, or at the end of lens.
Update the firmware
The firmware inside the camera is made to detect colors, not white (IR) on black. So we have to update that firmware. Thanks to IR-LOCK team, a special firmware has already been made. Those guys use a Pixy cam too on their drones to make a target tracking system using infrared, for automated landing and much more ! You can also order a Pixy Cam right from their website with the right lenses and filter and a bunch of infrared LEDs If you prefer for 99$. I wouldn’t personally recommend it if you are low on budget, but if you want to gain some time, it could be a solution.
To download, install and configure the new firmware, please follow instructions 2 – 6 on IR-LOCK Getting Started page.
Now you can start playing around with infrared tracking 😉
Make the case
This step is not necessary, but I am going to give you all the steps and files to make a nice case for your camera and wireless module (we’ll talk about that a bit later).
The case is very easy and low cost to make. It is not the most beautiful case ever, but it will be practical and won’t require any tools (except a screwdriver).
The case is made of two pieces of plastic, laser cut, assembled with a few screws.
If you have never made any laser cutting ever, here is what I usually do :
- Go on SeeedStudio Laser cutting service
- Upload the following files Case CAD (you have to do it twice, once for the bottom and once for the top)
- Finish the order (login, shipping…) and should have 5 cases delivered to your home for less than 20$ !
Once received, you just have to find some long screws and assemble everything !
Note : If you are planning to order on SeeedStudio, you might want to order the PCB for the wireless transceiver at the same time. So checkout the next article on this subject.
In the next step, we will make an electronic circuit to make the camera wireless. I’ll give you all the files and instructions to build it yourself ! It is in another post as this is pretty long…