Saturday, December 25, 2010

2010 year recap code!

I wanted to recollect all the memories of 2010 before I closed the laptop for the year! I was wondering how best to do and wrote the following code in 30 mins that generates an image of predefined size with thumbnails of all the pics that I transferred from my Iphone. This definitely is not a true representation of things for the year but its very close!! Below is an output of the sample run! (I need to refine the code to remove repetitions but I do not care, the purpose is served)

The code takes a text file that contains paths to all the images in a directory(absolute paths). You can generate this file using "dir /B *.JPG" on windows and "ls -1 *.jpg" in Linux. Pass this to the code as a command line argument and it should save "year.jpg" in the working directory which will be the image that contains the thumbnail. I am pretty sure some softwares do this but instead of wasting time to find out I thought I will keep myself busy for 30 mins! I love the final image .. I can so recollect that specific occasions I took the particular picture! :-) The thumbnail captures many of my friends and the happy times I had with them..

You can download the visual studio project from ::

Friday, December 24, 2010

Thursday, December 23, 2010

Wednesday, December 22, 2010

Linear Algebra - MIT OCW

Started revising Linear algebra from the online lectures available on ocw site from mit.  For people who do not know this is the link:

Its very basic Lin Alg stuff but explained really well. I had a good start and finished 4 lectures and wrote down the gist of whatever I learnt in the best possible handwriting :-) I am pretty sure to lose the notes at some point of time so took some pictures and will be posting them on the blog. My hope is to recollect most of what I got out of the video lectures by glancing at these notes probably a few months or even years from now. My present goal is to finish the 34 lectures in a week. Will see if I can keep it going for the next 7 days.

Lecture1 -

Lecture2 -


Lecture4 -

Tuesday, October 26, 2010

Horner scheme - Evaluating a polynomial in O(n) complexity

using namespace std;

double evaluate( double *coeffs, int n, double x )
        double val = coeffs[n]*x;
        for( int i = n-1 ; i > 0 ; i-- )
                val = (val + coeffs[i])*x;
        val += coeffs[0];
        return val;

int main()
        int n;
        cout << "Enter the degree::";
        cin >> n;
        double *coeffs = new double[n+1];
        for( int i = 0 ; i <= n ; i ++ )
                cout << "Enter the coefficient of "<< i <<"th degree term::";
                cin >> coeffs[i];

        double prev, x;
        cout << "Enter the value at which polynomial needs to be evaluated::";
        cin >> x;
                cout << evaluate( coeffs, n, x ) << endl;
                prev = x;
                cout << "Enter the value at which polynomial needs to be evaluated::";
                cin >> x;

        delete [] coeffs;

Sunday, July 25, 2010

C++ Optical Flow code

This is an implementation of the paper Brhun et. al. I plan to make this open source soon! I have to reimplement it due to IBM's clause of intellectual property. I will do so as soon as I get time. I want to add a few mathematical and image processing routines so that it does not have dependency on external libraries. It should compile both on Linux and Windows. For an overview of the approach and also how it relates to other famous flow techniques please take a look at this presentation: [ppt]
Code Coming soon......

Wednesday, July 21, 2010

VirtuaWin + DisplayFusion + TaskSwitch = Noticeable Increase in Productivity on Windows!!

I have been switching between Windows and Linux through my Bachelors, Internships, Jobs and Grad school. So, the switch is not that painful but I dearly miss certain features of Windows in Linux and vice-versa. One of the features in Linux that is lacking in Windows by default is handling multiple desktops. Support for multiple displays on the other hand is much easier in Windows compared to Linux ( though its getting better in Linux).

For my recent internship I am working on windows. I am working on multiple projects and coding on multiple platforms like Matlab/.Net and also using cloud computing for computationally intensive processes. So, managing all this has been an overhead and ate into my productive time. I found three cool softwares which I put forth in the subject of this post for people who do not have time to go through the post. The links to the respective webpages are:

Virtuawin --  Gives you the much needed multiple desktops functionality.
DisplayFusion -- Allows you to seamlessly switch between displays and move tasks from one display to another.
Taskswitchxp -- Shows graphical views of the windows when you switch between them.

After taking the pain of finding them and configuring the shortcuts for all three I am thoroughly enjoying my multiple display, multiple desktop and keyboard controlled task switching!!  I multi task very effectively and without losing much concentration. I hope others try the combination and find it as useful!

Send me a message to know the most effective shortcuts, I will be glad to share them. Happy working!!

Thursday, July 8, 2010

Getting Motherboard Model using a script

Recently I have been spending long nights helping my sister configure my desktop back in India. She is a complete novice and it has been a learning lesson for me to try and teach stuff over phone :-) I even got her to install XP after a 30 minute long conversation. As experienced users might already know when you reinstall the operating system you need to install drivers manually. She was able to install most of the required drivers except for the Soundcard. I do not remember if the soundcard was onboard or in the PCI slot. If it is onboard I assume the drivers will be in the motherboard cd. In any case I wanted to get the motherboard model number but did not know how to. One of my friends(Srujan) contacted the system administrator at Microsoft and found me the following script:

strComputer = "."
Set objWMIService = GetObject("winmgmts:"& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colMB = objWMIService.ExecQuery("Select * from Win32_BaseBoard")  
For Each bbType In colMB
If  bbType.Manufacturer=("") then
MbVendor = "Unknown"
ElseIf bbType.Product=("") then
MbModel = "Unknown"
MbVendor = bbType.Manufacturer
MbModel = bbType.Product
wscript.Echo MbVendor & " " & "[" & MbModel & "]"
End If

Save this into a "motherboard.vbs" file and execute it in the command prompt with administrator privileges. Worked like a charm! Hopefully this post will help people who run into similar problem :-)

Thursday, July 1, 2010

**Research is Writing and Writing is Research**

The sooner you realize the more you will enjoy research! I am trying to inculcate the habit of writing technical reports. These can be of papers I read, talks I attend or even ideas that come to my mind. This decision comes after reading the following saying:-

"Writing, like teaching, is a great clarifier. Committing to paper that which is fuzzy in your mind focuses attention on detail"

It did not require a third person to convince me on this but this pushed me beyond the border of procrastination! My hope is the quality of my writing will improve over time and the time it takes will reduce as well. Only way to know is by doing it consistently and evaluating :-)

Jumping into the main topic, I plan to share my knowledge on the following topics in the coming weeks. The long weekend hopefully will be fruitful and I will have at the least two of these nailed!

1) Optical Flow ( various methods, codes available and their pros and cons)
2) Anomalous behavior detection ( Anomaly Detection )
3) Geometric Blur as an invariant feature
4) Spectral Clustering

Saturday, June 26, 2010

Anomalous behavior detection from Videos

I have been looking at the problem of Anomaly detection for a month now! I have less than two months to solve it or at the least provide a reasonable solution! :-) I summarized whatever I learnt in the following presentation


I am hoping that this will be serve as a good guideline or a starting point for people who will look at this problem or for people who want to understand the problem. This is by no means close to exhaustive or even a survey :-) Within the next couple of weeks my goal is to have a pdf which will be more theoretical and mathematical and by the end of my internship I plan to have a draft with a convincing approach and good results!!

My apologies for not having the link to the video, the data I am working on is confidential! As soon as I get time I will run the algorithm on hand made video and upload! Cheers!!