Late answer. If you do not need to depend on earlier versions and want to use OpenCV with Python, select the latest stable version. Today it is OpenCV 2.3.1.
The main advantage of OpenCV β₯ 2.3 for Python users is the new cv2 module in addition to the old (backward compatible) cv module. The new cv2 module is much more pythonic and does not require manual memory allocations for intermediate data structures. The old cv module is more like a direct translation of the C ++ API.
For example, compare the new Python cv2.findContours (OpenCV β₯ 2.3):
findContours(image, mode, method[, contours[, hierarchy[, offset]]]) -> contours, hierarchy
It requires only three parameters and can automatically process all memory allocations; it returns only the final result. Just one line of user code.
Vs. old cv.FindContours :
FindContours(image, storage [, mode [, method [, offset]]]) -> None
This requires that the user explicitly allocate "storage" before the call (+ 1 or 2 lines of code). It does not return the result, instead it stores it in a dedicated storage (it works as a linked list, and the user must write some loop to actually retrieve the data from the storage). In general, lower level and more similar to C ++ than Python. At least 4-5 lines of code in the general case of use instead of one line with the new cv2 module.
sastanin
source share