Wednesday, February 17, 2010

Whats "right" and whats "wrong" ?

When I was a kid, the answer to the above question used to be straightforward. The rules were defined by my parents and brother and the answer used to be based on those rules + a little bit of intuition. The same was the thing with who is "good" and who is "bad". Most of the times the answers used to be loud and clear. Also, every person used to be either "good" or "bad", there were no middle categories. And yeah, I generally used to keep myself into my limits of a good person according to those rules.

Then came the teen-age. When I was entering my teen-age, there was a hell lot of discussion going on about how to handle teenagers, be it newspaper, television etc etc etc. In most of them, I was referred to be a part of a specie called "Today's Generation", and there were some particular tags associated with this specie; "resilient" , "arrogant" ,"pre-mature" and a whole sort of things, which I probably wasn't even able to decipher at that time. That was a time when doing a "wrong" thing also felt fine. Breaking the rules was the "in" thing for our specie. After all, preconsciously though, I was a part of this specie (well I still am, although the name has changed). Even in this case I used to be pretty sure about, what is right and what is wrong, although doing "wrong" was not even so "wrong". People still used to be either "good" or "bad", but now they were according to my own limit of wrongness, If their deeds were "wronger" than me then I used to consider them as "bad" else "good". Also, there was an added category of "no comments", which used to consist of very small population though.

Finally, came the latter half of college life, when all these categories seemed to merge with each other. I went on to the most basic thing, the rules. Who defined those rules that we follow. Some of them were defined by my parents, some other were defined by teachers, some were defined by my peers. Well the problem was that, it wasn't even them who defined those rules, they just told those rules to us, and god knows who else defined those rules for them. Obviously these rules trickled down to me with some modifications(modifications which my parents, teachers etc would have made to make their life better).

Then came the question, shall I follow all these rules or trash all of them. Well I have already been following these rules, and probably my life hasn't been flowing that smooth by following these rules. I guess that was the reason why I was thinking so deep about this matter. So this option was auto canceled. Then came the option of redefining rules, I soon realized that one cannot define all rules by himself, probably I didn't had that much experience about things. So, I started changing those rules which I thought were wrongly created, according to me(This decision making was based on my previous experience as well as on the solution to the situation at hand).

So now there is nothing defined as "right" and nothing defined as "wrong". Its just "right for me"(at that time) or "wrong for me". No person is "good" and no person is "bad". Its just "good according to me" and "bad according to me". But these lines are very very bleak, heavily mixing with each other. Because, whenever I am at a stage to tag a person "bad" in accordance with some action of that person, I happen to think "okay, maybe it isn't wrong according to him".

I guess the best thing of this approach till now has been this only, "None is good, none is bad, its just that some people are compatible with me and some are not". Also, I believe that the converse of this is also true, "None hates me, its just that I am not compatible with some of the people".

Wednesday, February 10, 2010

Your own home made Youtube Video Downloader

Well , till quite some time back I have been using some Youtube video downloader application, most of which have stopped working now. So, there was this one awesome video which I wanted to download.

Suddenly, I come to stuck with this simple logic, that hey if firefox is playing this video then it must be downloading that video onto the memory and then playing it. So why don't I pick up this video from there. So the most obvious place to check for such a thing was the /tmp/ folder ( I am on Ubuntu currently) and voila here it was resting in peace waiting for me to close the tab and get deleted.

So all that one has to do for his home made Youtube Downloader to work is to cut this video from your temp folder and save it at some good place before you close the tab and here you go, you home made Youtube Downloader is ready.

Wednesday, February 3, 2010

OpenCv 2.0 with Ubuntu 9.04

Recently I have started working on my final year project, and I got stuck with a pretty nice idea of documenting it on my blog.
I am working on 3-D Modeling using Videos. As usual the first steps of doing a project is to get the development environment settled up, and doing the feasibility study. In our case we had decided to use OpenCV for video manipulation, because of two reason :
1.) It's faster than any other library present out there for the same purpose.
2.) Its pretty advanced(read as a lot of inbuilt functionality) and optimized.

I am just documenting the method which worked for me, there were other easier one's which didn't worked for me :(.

First of all one needs the ffmpeg (for video support) and GTK 2.0 for OpenCv to work properly. Sadly, one needs to check out ffmpeg from trunk and compile it for his own platform, no binaries in Ubuntu repositories.

1.) Check out ffmpeg from their svn repo:
cd ~
svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
cd ffmpeg


2.) Then for sure one needs to compile ffmpeg and install it:
./configure --enable-shared
make
sudo make install


This thing takes its own sweet time, So you can go and get some coffee for yourself.

3.) Then you need to get GTK Development libraries:
sudo apt-get install libgtk2.0-dev


4.) Finally one needs to download code for OpenCV 2.0 and Compile and install it :
cd ~
wget http://downloads.sourceforge.net/project/opencvlibrary/opencv-unix/2.0/OpenCV-2.0.0.tar.bz2
tar -xvf OpenCV-2.0.0.tar.bz2
cd OpenCV-2.0.0
./configure --with-ffmpeg --with-gtk --with-quicktime=false
make
sudo make install


This is again a thing which will give you ample of time to take a break and make some calls to your fiends.

After you are done installing OpenCv, then comes the issue of how to use it. I was using openCV with C++ and tried some sample examples of O'Rielly book.
After a little searching I figured out that to include the OpenCv files while compiling my C++ files I need to use :
g++ `pkg-config --cflags opencv` `pkg-config --libs opencv` filename.cpp -o test


Now, this is neither easy to remember nor easy to type every time I compile some code. So, I found this nice little hack of adding aliases.

There exists a .bashrc file in your home folder. It is basically a config file for your login profile. One can add aliases for terminal commands in this file and then use them :
alias gcv="g++ `pkg-config --cflags opencv` `pkg-config --libs opencv`"


Now whenever, I type gcv in my terminal , it is interpreted as g++ blah blah blah.

I will keep adding the progress of my project to this blog, so stay tuned.