Posts

Showing posts from May, 2012

Of focus and well digging

Swami Gulagulaananda said: " If you lack focus, you will end up like Trishanku " This is a short story I read a long time ago in Tinkle. The story starts off with a man who wants to dig a well. He starts digging at one spot. As hours roll by, the man who has dug up several metres of earth decides to catch a break. As he rests under the shade of a nearby tree, a zamindar who was walking nearby comes up to him and asks him what he's doing. The man tells him that water has always been a problem and he wanted to resolve the issue by digging a well there. The zamindar nods his head after listening to the man's words and then gives his piece of advice " Dear sir, your idea is very noble. But you have picked the wrong place. You see, this place is not suited for wells. What you need to do is go further towards that  side. Since it's closer to the river, you can get water there a lot faster. You are unnecessarily wasting energy here " and walks away The ma

Kinect, Python and first few lines of code

Baba Gyani Triviani remembered: " Example is always better than precept " Many times, we are interested to do something but we don't find  the right resources. Some times, we find resources badly presented or presented at a very high level and when we beginners try to skim through the material, we are reminded of the feelings we had while skimming through Engineering text books, fondly remembered by EC students as "Over head transmission". I intend to keep this post short at this moment, for my knowledge in the subject is very very limited. However, as I pick on more stuff, I will perhaps update this post with more stuff or provide links to newer posts. In this post, I would like to show two simple programs to capture a normal photograph as well as to capture an IR photograph and show it on screen using Kinect, Python and OpenCV. If you don't know how to get up and running with Kinect, refer to my previous post here . The program to capture normal

Programming with Kinect - Up and running

Swami Gulagulaananda said: " If you a lot of potential, convert it to Kinectic " After recently messing around with OpenCV and Python , I thought the next thing to mess around should be Kinect. Today I played around a tad bit, but was happy that the stuff I was trying out worked fine. So if you are interested to play around with Kinect and don't know how to proceed, read on... First of all, Kinect as most of you would already be knowing is a Microsoft product. So, programming it with MS Visual Studio (C# and VB) is probably way easier... I haven't tried that out yet since I don't have a good machine with Windows at the moment. So this post mainly is how to install it on Linux and see an output to show that "My kinect is up and running". The language is Python. Do you have a Kinect (with power supply)? You first need to have a Kinect. If you don't own an XBox with Kinect, you should buy one :-) It's awesome for playing games. But instea

The Sita Conundrum

Image
Swami Gulagulaananda wondered: " We all become who WE choose to become. And that choice cannot be forced by anyone upon us. " With the internet becoming more easily available, significant changes have come along. Now, the world is divided into two zones - The real world with people, and the virtual world with tweeple . The difference between these two worlds is that, in the virtual world, a lot of people hide behind curtains of anonymity. And since it's difficult for others to trace them, they become bolder, they speak out vehemently - Something that they probably wouldn't have done if asked to talk amidst other people - because they fear repercussions, the fear accountability or they fear the obvious things that happen if you raise fingers at politicians or hoodlums. However, under the cloak of anonymity they are free to have opinions. Those of you who have been following news regularly would be familiar with a certain judge's controversial remark. I am not

Lessons in humility

Swami Gulagulaananda said: " It's good to be proud, it's bad to be vain " There are times when arrogance creeps into our minds and hearts, when we begin to think that we are the greatest and none come close to us. And this could be due to your qualities - be it wealth, beauty, talent, popularity or intellect. But what we fail to understand is that there's always someone better right around the corner. If you think you are rich, there's someone richer... And even if you are the richest, how long will you be like that? For, like Ozymandias and his fate, this too shall pass. Both good and bad are passing phases in the eternally volatile time. Let's read a couple of short stories and pick some nice pearls of wisdom along the way. Bhima humbled Bhima was the strongest among the Pandavas and indeed one of the most powerful warriors. He could easily overpower anyone without breaking a sweat. And as is the theme of this post, he had grown quite arrogant. On

Gyroscope like a spirit level

Image
Baba Gyani Triviani said: " Speaking of our spirits being balanced, I thought, can we use a spirit level to check orientation with electronics? " I was just thinking about that spider camera in a cricket stadium and thought " How cool would it be if we had a bunch of autonomous flying bots in the air? " The crowds would be thrilled and it's just plain cool! And as those thoughts were in my mind, I was wondering how you would be able to know the orientation of your bot? What if it was tilted and flying about haphazardly? And a comical image came to my mind - some guy keeping a spirit level on the bot to check if it is level. But then I thought - why not? What would happen if we have two spirit levels perpendicular? And by extension, a circular spirit level? So I thought - what would happen if you have a circular spirit level, where the spirit is in reality some conducting liquid. And we have some kind of small electrodes into the unit at regular intervals

Open CV Python Face Detection making LED Glow via Arduino

Image
Swami Gulagulaananda said: " There was light... I blocked my face and *poof* Off it went! " I had some spare time on me, and I thought " You know what? Let me do something " - I decided to have a look at Open CV and Python. I am just a beginner at this point of time and have done nothing very clever. But if you share my enthusiasm, you will find this little thing pretty nice. In my previous post , you will see how to write a very small program to get Face Detection done. Notice that you don't need to know anything about Image Processing (It is an awesome subject if you are interested in) but you can still get some stuff up and running. After I did that and it worked, I thought, let me take this one step higher. What is the use of Face Detection if you don't do anything after that? So in this post, I show you how to make an LED glow or turn off, depending on whether a face is detected or not. It is not at all as complicated as the title seems. All y

Face Detection using Open CV and Python

Image
Swami Nikhilaananda said: " Face Detection and other awesome stuff have been greatly simplified with OpenCV and Python " I am no expert in this field, but I was just excited to have a piece of code working. In this little program, we attempt to do a face detection using Python and OpenCV. First get Open CV and Python up and running following simple tutorials found here . The following is a piece of code - Replace the path of the Haar Classfier file (xml) with the one in your system. Save the file, and run the script. As you could have probably guessed, absolutely nothing intelligent is there in the program above. Everything is taken care of by OpenCV. Which is what makes it really good for people who don't know much of Image Processing, nor want to know the mathematical nitty gritties. Perhaps in the next post, you should be able to see how to Glow an LED when a face is detected - by interfacing with Arduino You can see LED Glowing with Face Detection us

Comment & Uncomment multiple lines in Vim

Baba Gyani Triviani said: " When someone said 'No Comments' I just had to intervene. No comments? Have multi-line comments my friend! " Commenting and uncommenting multiple lines in Vim can be a little tricky. Here is a small snippet of code to show how you can do this. I have done this for just a few of languages. But you can extend this to any number as per your choice. Save the following into a file and call it vcomments.vim Once this is done, open your ~/.vimrc  file if it exists, or create a new one. There, put the following code. :source ~/ vcomments.vim :map <C-a>  :call Comment()  <Enter> :map  <C-b>  :call Uncomment()  <Enter> Where you can replace a and b of and by whatever is convenient to you. This just calls the functions when the Ctrl + <key>  combination is hit. To use it, just select the lines to comment by using Shift + v and moving cursor up or down to select lines. Then, hit the Ctrl + <key>

Common VIM Mappings to make life easier

Swami Nikhilaananda said: " When you transition from a known to an unknown, the similarities allow the transition to become smoother " If you have not checked out the previous post about Vi(m) editor , now is the time to read it. Many times, we are used to common keyboard short-cuts like Ctrl + C to copy, Ctrl + v to paste, and so on. However, when we move to Vim, it is tedious to remember all the new shortcuts like y to yank (copy) and p to put (paste). To avoid that, I created a bunch of remappings to enable me to perform common tasks quickly using the same set of keyboard shortcuts that we are so used to. You can do it too. Just open your ~/.vimrc file. If it is not there, create it. Then, paste the contents below as is into the file. Save it and restart vim. These shortcuts will start working (in escape mode) set smartindent set tabstop=4 set shiftwidth=4 set expandtab set mouse=a se nu :map <C-a> GVgg :map <C-n> :enew :map <C-o> :