Jacobo Rouces

Old Work   


These are old projects from when I was doing my bachelor degree, which I later decided to release in case it could be of any use for someone.


Constellation - Self-calibrated Stereoscopic 3D Vision System Using Off-the-shelf Digital Cameras

This is a software system that makes use of stereoscopic vision through cheap off-the-shelf cameras, to offer a tridimensional Human Interface Device. In other words: the computer knows in real time the three-dimensional coordinates of devices held by the user, by using two or more cheap webcams. So that the tracking may be done in real time, each device has one LED (or more), so low-exposure can be used with high contrast. The more cameras, the more accurate is the min-square approximation of the positions, and the more resilient to occlusion by the user's body the system becomes. The model used is the pinhole camera with a radial distorsion parameter. The system is able to work with different kinds of cameras in any relative positions and orientations (as long as they are different enough to be well formed). The system automatically infers the whole set of parameters when the user holds a simple 4-point pattern in front of the screen (a DIN-A4 flat sheet on a black background is the most convenient choice). It uses Newton-Raphson to solve the parameters.

The resulting system was reasonably usable for non-precision tasks (with a resolution of a few centimeters with cheap low-resolution cameras). The mathematical details are in the report in PDF, but unfortunately, this is only in Spanish.

The system is mostly implemented in Matlab, with some critical parts in C. I never tested it in Octave, but it might be adapted. The only fancy library I remember using was the one for video acquisition.

Calibration of the system
Fig1. - Calibrated system with two-camera configuration
The pinhole model uses a virtual plane in front of the focal point.

Location of a LED
Fig2. - Location of one LED point (synthetic example).


Download source    The code is released under the BSD 2-Clause license.



JTennis - A Java tennis game with a very simple 3D engine

This is a Tennis game that I wrote in Java when I was a student in a programming 101 course. It is very simple but can be fun to play or tweak. If you decide to delve into the code, be aware that it is very naive and inefficient (when I wrote it, I didn't know what was a binary tree or a hash table), and it is mostly written in Spanish.

The main class is org.rouces.jac.main.jtennis.Ventana. The only dependency is JMF 2.1.1e. It is tested on Java 1.6.

3D engine

The game implements a very simple 3D engine from scratch, which was never meant to be efficient but rather showcase object oriented programming applied to basic linear algebra concepts.

Control

The player movements are controlled with the typical arrow keys and the ball, when hit, is sent with a speed vector that is the result of a weighted sum of the incoming speed vector, and the three-dimensional force vector exerted by the player. This three-dimensional force vector is obtained from the two-dimensional speed vector of the mouse in the moment of the impact, with an added tilt whose angle can be controlled with the mouse scroll wheel at any point of the game. Overall, it is like hitting the ball with the mouse while holding it on a surface whose tilt is controlled with the scroll wheel. There is a constant but rudimentary visual feedback for these components.

The method was meant to provide richer control than old-fashioned combinations of buttons, and to exploit the analog nature of the mouse, while not needing any complex 3D input device. It is the part of the game that I considered most innovative.

Artificial "Intelligence"

The machine knows the physics of the ball and can predict its deterministic trajectory assuming no further intervention from a human player. Different levels of difficulty add different levels of noise to impair this "cognitive" ability from the machine, but its physical abilities remain equal to the human player's. In the hardest mode, where the noise introduced is very small, the machine becomes practically impossible to beat -if you are able to do so, please let me know!

Screenshot

Download source    The code is released under the GPL v3 license.