OpenCV - Haar Training Resources

There were lot of good feed back for my OpenCV articles (Article1, Article 2). There were lot of inquires regarding Haar Training and how to do it. Since I was bit busy with my work at hSenind I couldn't put any replies for that. Finally I managed to find some time to put together few URL and important tools where you can use to create your own classifier XML.

If you are interested in OpenCV vision library you should join to OpenCV yahoo group. It is very active and has lot of resources as well.  Following are some good links I used when I was learning on how to do Haar Training with OpenCV.

Most important thing to consider when doing Haar training is to have good positive and negative image set. We have created a small utility modifying sample program provide with OpenCV to create positive samples. You can download the source here. Using that you can create positive samples to detect some object using a video. You can move frame by frame in the video using 'Space Bar', mark the areas that contain the object you want to detect using mouse and save it just by pressing 'S'. Utility will create the text file required fro training.

Utility can also be used to create sample images to be used for HMM training as well. If you are interested in HMM following http://www.bernardotti.it/portal/showthread.php?t=17777 has a good article on how to use HMM with OpenCV.

 

Refactoring Messy Code

Few days back I started to refactor some code of a project which I started few years back. Well actually I started working on that project during my second year first semester at the university. It is kind of a pet project which I started with one of my friends. When we started the project, our knowledge about best practices to be used when coding was near zero (I guess it is actually zero).

When I look back the source code of the project, it is like a hell. All possible bad practices are there in our code, very long methods (there is a one method doing some complex calculation which has more than 1350 lines :D ), code duplication, one class doing many things and the list goes on...

Well I can't blame my self for coding this kind of mess, since at that time I was just beginning my journey as a developer and didn't knew any thing about best practices. But I can't keep the code this way since it's readability is 0%; can you imagine reading a method with 1350 lines and understanding. Code has become more messy sine we have included lot of new features and requirement changes here and there. Any how we managed to deal with the code up to now, but now it is overwhelming.

Refractoring is not an easy task, we have to make sure that existing functionalities do not break as well as have to keep up with the new requirements as well.  As Martin Fowler describes in his famous book Refactoring: Improving the Design of Existing Code, there should not be any "Grand redesigns", recatoring should be an incremental process. This is going be be a good experience for me. Let's see how it goes.....

 

Craftsmanship and Ethics

This is nice presentation by Robert C. Martin posted at InfoQ. Here he talk about things that makes us professional. He talk about lot of important topics which help us to do better programming. If you are interested in programming this a going to be really really helpful for you.
In my point of view it is a MUST read for every programmer.