Friday, February 18, 2011

adding two images in OpenCV

Hi Guys, in this post we look at how to add two images and display them in a single image (adding images vertically).


Btw, My other programs in OpenCV will be posted here

  1. Basically we need to set the ROI of resultant image to size of first image and copy the entire image using cvCopy.
  2. Next, we set the ROI of resultant image to end of the resultant image and copy the second image to the end of the resulant image.
  3. Save image and Show Image.
//the code has been included with comments and they are self-explanatory.



Sunday, February 13, 2011

Symbian, Maemo, Meego and now Windows Phone 7? Where is Nokia heading?

Its been a rough ride for Nokia after Apple iPhone and Google Android started to take over the smartphone world. Nokia has been a manufacturer of great smartphones in the past. I remember the days when i used to own a Nokia NGage QD (a smartphone) in 2004-2005,it was a great feeling to hold a gaming smartphone with 3d gaming capabilities. I remember the UI being very dry and naive but didn't feel so as I never knew what iPhone was. It was J2ME enabled phone (what is that says today's Y generation). I remember I used to download .jar files from getjar.com to my sdcard and install "apps" from it. There were also the .sis files (compared to .apk files in android) which were the "apps" for a S60 OS of a Nokia phone.

I feel sorry for Nokia as it finally abandoned Symbian recently after trying Meego and Maemo. Nokia first supporting Symbian (also supported by Ericsson, other companies), then acquring Symbian, open-sourcing the platform and nothing seemed to help Nokia. For Symbian app development in Qt(C++), there were no developer friendly documentation to build good apps. This was where Nokia lost it, if Nokia would have extended Symbian development for other platforms which had wide developer support, good UI it might have had some impact.

I like the way android was persented to the developer community (java, dvm) which was very helpful in gaining developer support for the platform. Android apps were written in Java and recently support for Native development was extended (with Java Native Interface) and there is also active development on Android for executing python scripts. This significantly extended the diversity of developers to support the platform. I think Google being a software, services and .com company listens carefully to what developers have to say (the guys who create great applications for phones) and constantly updating OS support with their and community's consent (opensource).

I think Intel should be finally letting go of its plans to dominate the mobile world with its processors with competetion coming from all sides. Face it Symbian, Meego, Maemo are dead. TI's OMAP processors, Nvdia's Tegra processors (with now reaching dual core and announcing the quad core processors), ARM's cortex and dual-core Cortex processors.

I also am a fan of the Zune HD and the Zune music subscription service which I use regularly. I liked the idea of Microsoft to extend the interface to Windows Phone 7. Everything seems to be fine except for Microsoft needs to takle the problem of lengthy menus (scorlling up and down seems to be very irritating to many Windows Phone 7 owners).

Nokia adopting Windows Phone 7 still has some shortcomings, like they have to wait for atleast to roll-out their first Windows Phone 7 handset with customized UI (if Nokia decides to as Windows Phone 7 OS is licensed to other Hardware manufacturers).  Nokia and Microsoft have a lot to do to ensure good performance from their platform in the market.. Though, the concept phones from Nokia look gorgeous. Many of traditional app makers for Symbian might completely jump into the bandwagon of Android of Apple iPhone for quick money.

The only key to making is a great Smartphone is to make the Developers happy, have some elegance in the UI with userfriendliness and of course cheap handsets. Microsoft has to meanwhile outsmart, outperform quality and quantiy of all the webservices Google is providing on Android (mail, voice, maps, etc). This will be good for Microsoft and Nokia (of course, the other Hardware Manufacturers).

Keeping my fingers crossed!

Thursday, February 10, 2011

ONE Infinite LOOP: Knowledge(){Knowledge();}

Hi all! This is not a technical article that I'm blogging about. Its been a while since I've been a Research Assistant at WVU and my quest for knowledge is only at its beginning stages I believe.

One of the most recent subjects that have smitten me are Pattern Recognition. Even though its been all about statistics (which happens to be one of the most boring and tough subjects that I've taken), I am slowly liking it.

Looks like every problem in the world can quantized (into math), can be computed using the principles of probability and statistics into a theory/statement/knowledge. Artificial Intelligence, Machine Learning, High Performance programming and computing, Life Sciences are rooted in math and statistics in some way.

Hopefully my quest for knowledge leads to better future. I am reminded of the famous quote by Plato "Never discourage anyone who continually makes progress, no matter how slow". Keeping my spirits high  and looking forward to life with a positive attitude!!

Rahul Kavi.

Wednesday, February 2, 2011

OpenCV on Visual Studio 2008

Hi Guys. In this post I explain:

  • Configuring OpenCV 2.1 on Visual Studio 2008.
  • A sample OpenCV 2.1 program to run on Visual Studio.
Click here for Configuring OpenCV 2.2 on Linux

Btw, My other programs in OpenCV will be posted here.

I see lot of you facing problems in configuring OpenCV 2.1 for Visual Studio on Windows OS. In this post I seek to explain the way it is to be configured.

Step1: Download
Download OpenCV from http://sourceforge.net/projects/opencvlibrary/
Present version is 2.2, but I show here working with OpenCV 2.1 (configuring OpenCV 2.2 will be the same if you follow this procedure).

Step2: Install OpenCV
Double click to install the downloaded file. I am sure nobody needs help on this. It usually is installed in C:\ as "C:\OpenCV2.1"



Steps 3 to 14: Configure OpenCV with Visual Studio 2008


Step3: Open Visual Studio 2008. I am assuming you have already installed Visual Studio with VIsual C++ editor. Select New->Project


Step4: Give the name of the project, the name i've given is "OpenCam". Make sure that it is a "Win32 Console Application" program.

Step5: Right click on the Project in Solution Explorer and select properties.

Step6: Now we configure the Visual Studio to include the headers that come with OpenCV 2.1. Go to Configuration Properties->C/C++->General->Additional Include Directories and select to add new directories.


Step 7: Open the OpenCV installation directory, browse through the folders "C:\OpenCV2.1\include\opencv" and copy the address to the path. Basically, what we are doing here is to browse into the OpenCV  C/C++ headers folder (look for ".h" files). Paste it into the Visual Studio window already opened (into additional include directories). It will look something as show below. Press OK.












Step8:  Now we configure the Visual Studio to look for libraries installed (OpenCV libraries).Go to Linker->input->Additional Dependencies and click to add new libraries.




Step 9: Open the OpenCV installation directory, browse through the folders "C:\OpenCV2.1\lib" and copy the address to the path. Basically, what we are doing here is to browse into the OpenCV C/C++ libraries folder (look for ".lib" files). Paste it into the Visual Studio window already opened (into additional dependencies).






Step 10: Add the libraries "cv210.lib", "cvaux210.lib", "cxcore210.lib", "highgui210.lib" into the additional dependencies.Please make sure that you give complete path to the above mentioned ".lib" files. It SHOULD look something as below. 



Step 11: Press OK. If you do not have a program of your own to run by copying the following, else proceed to Step 12.




Step 12: Now its time to build the solution. Go to Build->Build Solution.








Step 13: If everything is right (it will be if you are following the exact steps that I'm following here) something like this should show up in the output window.





Step 14: Now its time to run the program. Click on run and BING! Its there. You should be able to see yourselves (if you are running the program and assuming you have a webcam of your own attached to your computer).




Basically what we've done is give "exact path" to the include directories folder and "excat path" to the ".lib" files that are to be included to run the program and it works.

Cheers. Check out the other OpenCV articles over here.