Estimating the Focus of Expansion (FoE)

One of the most intriguing things about Optical Flow is the calculation of Focus of Expansion or FoE. FoE is the point where all flow vectors converge when  a camera moves in a forward direction. It often indicates the direction where a camera is heading or aimed at, and is also regarded as the same point where flow vectors diverge from when the camera moves backwards. FoE plays a key role in most computer vision applications, including self-driving cars, guided missiles, obstacle detection and in robotics. To succeed in its applications, FoE should be calculated in real-time consistently at a fairly accurate level. The following is a demonstration of my algorithm for this, where I estimate the FoE using a probabilistic approach. This calculates the FoE for a single camera that has an inconsistent motion model.

The red circle signifies the FoE in question below.

Here I first obtain a set of sparse flow vectors as described in here. The flow vectors are obtained at frame rate using the Lucas Kannade method and when the number of flow vectors fall below a minimum threshold, flow vectors are re-calculated. Then the algorithm seeks the linear functions for those flow vectors (normalized) and then finds the intersection points for those linear functions. In the ideal case, these intersection points must coincide with each other as it theoretically represents the FoE, but due to the error, they don’t. Therefore we need to filter out the error. To do this, intersection points are arranged into a histogram and then the maximum bin will be taken out. Intersection points that fit inside the maximum bin are further filtered out through a Discrete Kalman Filter in order to estimate (or predict) the most likely intersection point (i.e. FoE).



Compiling ARToolkit on Ubuntu 10.04

Apparently I’ve given more thought on to ARToolkit these days  (mainly due to my research), so that it makes me  attempt different things with it. Consequently I’ll be writing a series of posts pertaining to my small experiments for future references. I know it’s pretty boring stuff, talking about a dull subject again and again… but it merely gives us a sensation when doing it physically (particularly when you have nothing left to do 😉 ). In general everybody feels great when their imaginations turn into a physical realization.


So… enough lecturing & let me keep aside my talking. In today’s post I’ll cover-up the installation of ARToolkit in Ubuntu 10.04. Continue reading “Compiling ARToolkit on Ubuntu 10.04”

Demistifying DSVL Configuration

directx-logoIn my previous post I just mentioned how we can use ARToolkit in conjunction with a 3D rendering engine. The camera connection was made by the ARToolkit via DSVL (DirectShow Video Library) . As I promised, through this post, I’ll expose how we can configure DSVL with its supported parameters.

DSVL is a wrapper for DirectShow which in turn is a part of DirectX. We all know that DirectX is the prominent media framework used in windows platforms. Other than DirectShow, Direct3D and DirectSound also come under the brotherhood of DirectX. So what is the specialty of DirectShow? In computers data can be generated in many places, such as file system, network, TV cards or video cameras etc. And data which is produced at each of these locations take many formats. Therefore front-end applications have to explicitly communicate with these underlying data sources and deal with its formats. Obviously this would be pretty cumbersome and overwhelmingly incompatible with different hardware devices. This is where DirectShow comes in to handy. It synchronizes and unifies all the communication flow between our application and the underlying hardware. In particular DirectShow talks directly with the camera drivers, capture card drivers etc… and provide feedback for the user application. This is the simplest way we can understand it, but for more details go here .

Continue reading “Demistifying DSVL Configuration”

MySql C++ Connector Problem when Retrieving values with getString()

Recently I’ve been messing around with MySql Connector for C++ in a Fedora core 10. I used Eclipse CDT (Galileo) for compiling/debugging  and it was always giving incomplete result sets whenever getString() method was called. Incomplete in the sense it gives only the first row of the result set inside the loop for enumerating result set items.

I had a carefull observation at the build output and it was popping some sort of a message like ‘libstdc++.s0.5 needed by might conflict with’. There were no compile time errors neither runtime errors.However in the Debug mode I observed it line by line and came to know it crashes at the first occurence of the getString() method. I was stumbling around with this for somr time and finally able to dismantle the issue.

What I did was I just removed the from the lib. And remove any files with a name like ‘’. Doing this caused to display the build output smoothly (without the above warning message) and getString() method returned all the items in the result set as well. Hope this work around might be useful for anyone to get rid of this headache.

Sharepoint Deployment (MOSS)

Sharepoint deployment waz not that eazy. There’s no defined method to do that. But we can use some mechanisms wchich are built into MOSS. One such component is stsadm. For the deploymet purposes we can use either export/import or backup/restore mechanisms. My recommendation is export/import since the latter is appropriate for a catatrophic scenario. Our friendly stsadm tool will help to perform export/import.

First you export your custom sharepoint site from your development server into a file with a .dat extention. This file can be imported from the target server (at client end may be) so that we can deploy the customized version at client’s end this way. Within the import command we can specify the site collection as below.

stsadm -o import -url http://<servername>/site -filename <filename>

Although we can deploy a site collection like this, change requirements might raise some issues. for example if the client need to change the UI and all the styles, we have to export and import for each client requirement. and the data which was originally existed might be replaced due to the new import operation. This is not what developers would like to confront.

Therefore the solution to tackle this scenario is the Web Solution Packages (WSP). Package all UI components and style sheets into a one bundle as a feature and deploy it.  This involves creating a manifest file, feature manifest file, feature file and a data definition file (.ddf). As for my opinion, this is the best way for deploying standalone components to a front-end wwweb server. After the deployment, you can enable the feature from Site collection features under Site Actions. For the purpose of deploying .wsp files (cab file with a .wsp extention) we can following commands.

stsadm -o addsolution -name <filename>

stsadm -o deploysolution -name <filename> -local

This way, sharepoint developers can easily handle change requirements.

Knight Rider Circuit for AVR Micro controller

I crafted a code snippet which would give us the lighting sequence of famous Knight Rider car. This would work in Atmel ATMega 16 series micro controller and the program consumes only 266 bytes. Following goes the code.

#include <avr/io.h>

typedef unsigned char  u08;

int main( void )

u08 led, i, j, k,flag;
DDRC = 0xff;

led = 1;
flag = 1;

for (;;)
PORTC = led;
led = led<<1;

led = led>>1;

if (!led && flag)
led = 128;
flag = 0;

if (!led && !flag)
led = 1;
flag = 1;

for (i=0; i<127; i++)   /* outer delay loop */
for(j=0; j<127;j++) /* inner delay loop */

The speed of the lighting sequence can be altered by adjusting the i and j values of the outer or inner loops. These loops will provide some delay for the circuit. If anybody who wishes to improve this code, go ahead and enjoy.

View Disk info on your web page

This is a very simple C# code snippet which allows you to display the Hard Disk info such as Total disk storage and Free Disk space on your machine. I found this intersting since it reveals a bit of local machine’s info through a browser.

Here goes the code.

using System.Management;

public partial class _Default : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)
ManagementObject disk = new ManagementObject(“win32_logicaldisk.deviceid=\”c:\””);
Response.Write(“Logical Disk Space = ” + disk[“Size”] + “bytes. “);
Response.Write(“Free space on C:\\ is ” + disk[“FreeSpace”] + ” bytes. “);

As you can see a Management object is created specifying the System Drive. You can access to its properties by the index of the Management Object. ex:- disk[“Size”] will give you the Total size of the drive.