[Tutor] Image Processing

Eike Welk eike.welk.lists1 at gmx.de
Mon Dec 17 22:39:14 CET 2012


Hello Ashkan!


On Saturday 15.12.2012 23:20:31 Ashkan Rahmani wrote:
> I have developed some simple c++/qt/opencv application with face
> detection functionality.
> for some reasons I'm going to start again them and I wan to use python 3.
> Unfortunately I found opencv not supported in python 3.
> 1- as I'm new in python programming, is python 3 good choice for me?

Python 2 and Python 3 are very similar. Use the latest version for which all 
libraries are available, possibly Python 2.7. The biggest difference between 
the languages for a beginner is:

Python 2:
  print "Hello World"

Python 3:
  print("Hello World")

Furthermore Python is a very simple language. As you can already program in 
C++, it will take you two afternoons to learn Python. Use the tutorial from 
the official documentation:

http://www.python.org/doc/


> 2- Opencv binding will be available for python 3?

Ask the makers of Opencv. But I expect that they eventually will switch to 
Python 3, because Python 2 is not further developed. 

However not all Linux distributions have currently moved to Python 3: OpenSuse 
comes with Python 2.7 while Ubuntu has already moved to Python 3. 


> 3- Is there any other image processing library for python 3?

* Numpy is an N-dimensional array library. It is much more low level than 
Opencv, but can be used to prototype algorithms, that you later implement in 
C, C++, or Cython. Opencv images can directly be converted to Numpy arrays and 
vice versa.

http://www.numpy.org/
http://www.cython.org/

* Scipy (which needs Numpy) contains some image analysis algorithms, but is 
still more low level than most of Opencv.

http://docs.scipy.org/doc/scipy/reference/tutorial/ndimage.html

* PIL is not really suitable for what you want. It is intended for loading and 
saving images, converting image formats, adjusting colors, and similar tasks. 
PIL images can also be directly converted to Opencv and Numpy images.

http://www.pythonware.com/library/pil/handbook/index.htm


> 4- Basically python 3 or 2.7 is suitable for image processing?

I think you should use Python 2.7 because Opencv is currently not ported to 
Python 3.


Eike.



More information about the Tutor mailing list