Trouble generating Matlab bindings using latest OpenCV 3.4.0 software
Hello,
I'm trying to install the new OpenCV source files on Windows along with the latest opencv_contribute using CMake but keep running into this error:
CMake Warning at C:/OpenCV/opencv_contrib-master/modules/matlab/CMakeLists.txt:77 (message): Your compiler is 64-bit but your version of Matlab is 32-bit. To build Matlab bindings, please switch to a 32-bit compiler. Call Stack (most recent call first): C:/OpenCV/opencv_contrib-master/modules/matlab/CMakeLists.txt:90 (warn_mixed_precision)
However, I know I am using a 64-bit version of Matlab:
Here are the paths I am using:
I had to manually find the paths for the libmat, libmex, and libmx DLLs, but the rest were found by CMake. Not sure if those are correct.
Here are my setup details:
- CMake 3.10.2 using Visual Studio 15 2017 Win64 (as seen in one of the screenshots above)
- OpenCV 3.4.0 and OpenCV_Contribute 3.4.0 (assumed, latest build from GitHub)
- Matlab 2017b, C++ compiler set as Microsoft Visual C++ 2017, Computer Vision System Toolbox OpenCV Interface installed (v 17.2.1.0)
- Python 3.6.4 64 bit
- Windows 10 Pro 64 bit
Did I have to create the opencv_contribute modules first using CMake? I have set the path to the opencv_contribute modules in CMake.
Any help would be greatly appreciated.
I think the issue is the way the CMake files determine what architecture of Matlab is installed.
In the Cmake file ''OpenCVFindMatlab.cmake', line 139:
I think the function automatically sets MATLAB_ARCH=win32 in the 'CMakeVars.txt' file if it finds a 'win32' folder in the Matlab install directory.
So I removed "win32" from the function parameters:
The option 'BUILD_opencv_matlab' appears in the configuration options window of CMake. I check the option and click on the 'Configure' button and now receive the following in the output window:
(Sorry, ran out of characters)
Note: both win32 and win64 directories are created when installing Matlab 64bit.
Will build and report back later on how everything went.
Seems to work for the most part except I do get one failed project.
Output from Visual Studio:
Not sure how to resolve this error. Or if it even matters. How to check if Matlab files are correctly built?
Building the opencv_matlab project by itself gives these errors: