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.
Add Python 3 support to the Python test.py script.
The print function is used in place of the print statement.
The urlopen function has been moved to urllib.request in Python 3, so
attempt to import it from either location.
TestCase.assert_() has been deprecated in place of
TestCase.assertTrue().
The tests all pass in both Python 2 and 3.
Build the Python 3 cv2 module in lib/python3/, to avoid potential naming
conflicts with the Python 2 bindings.
The Python 2 bindings are placed directly in lib/, where they are
required for the Buildbot to successfully execute the Python tests.
Place the built Python module library in a dedicated folder inside of
lib/. This ensures that even if the Python 2 and Python 3 module names
conflict, they will not overwrite one another.
If both Python 2 and Python 3 are found, then build bindings for both of
them during the build process. Currently, one version of Python is
detected automatically, and building for the other requires changes the
CMake config.
The largest chunk of this change generalizes OpenCVDetectPython.cmake to
find both a Python 2 and Python 3 version of Python. Secondly, the
opencv_python module is split into two modules, opencv_python2 and
opencv_python3. Both are built from the same source. but for different
versions of Python.
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")