Previously the Python3 cv2 package ends up with no submodules (bgsegm, face,
etc) in it, which makes a lot of functionality unusable. By not writing over
our root reference we ensure the new submodules are added to the correct cv2
module.
I had to make this modification locally to get opencv to build with python 2.6. Python 2.6 requires indices in the format string (the `0` I added). This requirement was relaxed in 2.7, so what used to be there would be working for people who could upgrade. I don't think the change has any negative consequences for future python versions, but I'm no expert.
The implicit narrowing in the initializer list throws a compiler error for some compilers with C++11 support turned on. The specific error message is: "error: narrowing conversion of 'PyInt_AsLong(((PyObject*)o))' from 'long int' to 'double' inside { }".
Tested on Clang 5.1.0 and Mac OS X 10.9.4.
some of the stuff will be moved to opencv_contrib module.
in order to make this PR pass buildbot, please, comment off opencv_legacy, opencv_contrib and opencv_softcascade test runs.
The keys() and values() functions on dictionaries in Python 3 no longer
return lists. pyopencv_to() for flann::IndexParams now iterates over
the dictionary in a way that is version-agnostic.
- all parsed headers are included into "cv2.cpp" with "pyopencv_generated_include.h"
- types starting with "Ptr_" converted to "Ptr<...>" form (avoids many typedefs in "cv2.cpp")
In Python 3, version 3.3+, PyUnicode_AsUTF8() provides similar
functionality to Python 2's PyString_AsString().
In older versions of Python 3, there is no public function to provide
the same functionality. However, the "internal" _PyUnicode_AsString()
does provide that functionality, so use it to replace
PyString_AsString().
With this patch, cv2 should compile for Python 3.[0-2].