Installing Open-CV python library in Ubuntu 11.10 is pretty much easy. You just have to install 'python-opencv' library and you are ready to go. Just copy and run following command to install 'python-opencv' library. You need to have superuser permission.
sudo apt-get install python-opencv
In order to test if it is installed properly, we will run a sample code 'test.py'. This code will open and display an image using opencv. Take any .jpg file and put it in a same folder as 'test.py'.
Now open 'test.py' in emacs or gedit or any of your favorite text editor and write the following code.
import cv image = cv.LoadImageM("image_file_name.jpg") cv.ShowImage("Title", image) cv.WaitKey()
Now open terminal and go to the folder containing 'test.py'. Type the following command and you will see the image in a window.
python test.py
This window with image will disappear upon keyboard input. Thats it! you have successfully installed opencv libraries for python.
No comments:
Post a Comment