edmBernard / pybind11_opencv_numpy

Implementation of cv::Mat conversion to numpy.array for pybind11
Apache License 2.0
198 stars 41 forks source link

Struggling to build this #9

Closed MathewFlemmer closed 5 years ago

MathewFlemmer commented 5 years ago

Im running Windows 10 and I've tried following both sets of set up instructions without success.

I've installed vcpkg, used that to install pybind11, and then ran: pybind11_opencv_numpy-master\build>cmake .. -DCMAKE_TOOLCHAIN_FILE='.......\vcpkg.cmake' and I get the following errors: CMake Error at C:/Users/m.flemmer/Programs/vcpkg/installed/x86-windows/share/cmake/pybind11/FindPythonLibsNew.cmake:114 (list): list index: 9 out of range (-8, 7) Call Stack (most recent call first): C:/Users/m.flemmer/Programs/vcpkg/scripts/buildsystems/vcpkg.cmake:266 (_find_package) C:/Users/m.flemmer/Programs/vcpkg/installed/x86-windows/share/cmake/pybind11/pybind11Tools.cmake:16 (find_package) C:/Users/m.flemmer/Programs/vcpkg/installed/x86-windows/share/cmake/pybind11/pybind11Config.cmake:100 (include) C:/Users/m.flemmer/Programs/vcpkg/scripts/buildsystems/vcpkg.cmake:266 (_find_package) CMakeLists.txt:19 (find_package)

CMake Error at C:/Users/m.flemmer/Programs/vcpkg/installed/x86-windows/share/cmake/pybind11/FindPythonLibsNew.cmake:122 (message): Python config failure: Python is 64-bit, chosen compiler is 32-bit Call Stack (most recent call first): C:/Users/m.flemmer/Programs/vcpkg/scripts/buildsystems/vcpkg.cmake:266 (_find_package) C:/Users/m.flemmer/Programs/vcpkg/installed/x86-windows/share/cmake/pybind11/pybind11Tools.cmake:16 (find_package) C:/Users/m.flemmer/Programs/vcpkg/installed/x86-windows/share/cmake/pybind11/pybind11Config.cmake:100 (include) C:/Users/m.flemmer/Programs/vcpkg/scripts/buildsystems/vcpkg.cmake:266 (_find_package) CMakeLists.txt:19 (find_package)

If I use the above CMake command with -G"Visual Studio 15 2017 Win64" I get the error: CMake Error at C:/Users/m.flemmer/Programs/vcpkg/scripts/buildsystems/vcpkg.cmake:266 (_find_package): Could not find a configuration file for package "OpenCV" that is compatible with requested version "3".

The following configuration files were considered but not accepted:

C:/Users/m.flemmer/Programs/OpenCV/build/install/OpenCVConfig.cmake, version: 4.1.0

I've also tried the python setup method: pip install pybind11, python setup.py build

and I get: example.cpp example.cpp(3): fatal error C1083: Cannot open include file: 'opencv2/core/core.hpp': No such file or directory error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe' failed with exit status 2

Could someone advise me on how to proceed?

Cheers!

edmBernard commented 5 years ago

@MathewFlemmer I haven't try this with opencv4 yet. Opencv4 install header in opencv4/opencv2 instead of just opencv2. I will check to fix that. Thanks for the report

edmBernard commented 5 years ago

@MathewFlemmer to find opencv4 you have to change 3 with 4 here https://github.com/edmBernard/pybind11_opencv_numpy/blob/master/CMakeLists.txt#L10 but at this time opencv4 seem to not be compatible with the ndarray converter we implement. I will work on it.

edmBernard commented 5 years ago

@MathewFlemmer I made some change on this branch https://github.com/edmBernard/pybind11_opencv_numpy/tree/opencv4 . I have only fix the build with cmake. At this time I was only able to test it on ubuntu. Is it work for you ?

MathewFlemmer commented 5 years ago

@edmBernard Just saw the responses, thank so much! I'll have a look now.

MathewFlemmer commented 5 years ago

Thanks for the help!

edmBernard commented 5 years ago

@MathewFlemmer I merged Opencv4 branch in master. https://github.com/edmBernard/pybind11_opencv_numpy/pull/10