Begining Open CV with python – Installing and configuring OpenCV and python

As salam-o-alaikum. May Peace be upon you.

So, I decided to learn Computer vision. Easier way would have been to stick with matlab or something like that i suppose but if its easy its not gonna be as fun and as challenging write? and whats better than such an extensive opensource library that lets you do all kind of stuff on its domain for free and is cross platform and so on.its gonna be fun and worth it.

I am studying Computer vision using matlab but also am interested in open cv. I use c/c++ for most of my programming needs which is the basic Intended Open CV language too( if intended is the right word) but I have always wanted to learn python. and i have decided to learn both python and open cv together. I think my this approach will either exhaust me too soon or It will keep me interested in both of these things, which is a big deal when trying to learn something by yourself without any real need,compulsion or some constant source of motivation.

For past couple of days i have been looking for any kind of help or guidance or tutorials online but sadly found out python community support for OpenCV is as good as none for a beginner like me so i decided to note and poste every new thing i learn here. so that my this learning  journy or notes may help somone else too someday.

So  with that being said keep it in mind I am also an absolute beginner at the time of this writing. I will gradually learn and will keep posting new stuff here . At start I think my posts are going to be random and in no sequence whatsoever. But hopefully with passage of time and as i learn more and more i will try using some structured approach by writing full tutorials in some sequence or something.

Please feel free to comment , suggest,share ,ask stuff as it may please you.

IF i have helped in some way do leave some comment or some thing to let me know .

so thats about it.

enough chit chat

let get to the business

First thing first

Installing Open CV with python the right and easy way.

Installing and configuring openCV  may seem complicated but in fact it is not. thanks to “Abid rehan” and his tutorial I had no problem Installing it.

follow the below steps and Installation part will be soon done like taking a cup of Coffee

1. Download Python 2.7 for Windows From here

1.1.     Run the Installer and install it. leave everything default.

2. Download Numpy from here

Numpy is basically a python library that enables python to do better calculations. We will learn more about it soon.

2.1.     Run the installer and Complete the installation. leave everything default.

3. Download Latest Version of OpenCV from here. Current Version right now is 2.4.4.

3.1    After the download is finished run the setup. It will ask for a path to extract the files. Give it ”  c:/  “without the quotes

Let the extraction Finish.

3.2    If you installed OpenCV in c:/ go to this adress ”  C:\opencv\build\python\2.7  ”

3.3     Copy everything from there. which will be only one file most probably called”cv2.pyd”

3.4    Paste that copied stuff into ”   C:\Python27\Lib\site-packages  “.

now go to Start and open Python IDLE ( It is just a GUI for python).

try runing

import cv2.cv

if everything was done ok Hopefully You will not see any error.

And that’s it. Congratulations you have successfully taken the first step and have installed OpenCV along with python.

now the basic installation is done and fully functional. You can use notepad or notepad++ to write python code. Save it as filename.py and run it. but that’s not how i like it. For me this installation is yet incomplete. I want a decent IDE. I belive a Decent IDE can really assist and easy you with you tasks . I just cant do much with out having a powerful and Strong IDE at my hand. So for python we will use Eclipse with “Pydev” python Plugin for eclipse.

I Will be covering it in the next post.

Hope this post was helpfull. Do leave comments,suggestion,questions ,ratings . Peace.

As salam-o-alaikum. May Peace be upon you.

Leave a comment