Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

MATLAB bindings will not be generated

Hello, I can't get the MATLAB bindings generated and search for your help. CMake throws the message:

Matlab:

mex: C:/Program Files/MATLAB/R2014b/bin/mex.bat

Compiler/generator: Not working (bindings will not be generated)

I am running Win 7 Pro 64 bit, the current versions (all downloaded yesterday (11th Feb 2015)) of openCV 3.0 Beta, Python 3.4.2 and CMake 3.1.2, and have installed and running MATLAB R2014b 64 bit and the Windows SDK7.1 for providing the compilers. I have not Visual Studio installed, because I do not find a free-of-cost "Express" version on the MS site anymore. The new "Community" version is not listed as a MATLAB compatible choice on THE MATHWORKS site. So I prefer to stay with the SDK, which anyway contains all compilers and tools of the VS, and seems to mainly differ only in excluding to provide the Visual Studio IDE and some very advanced software development tools.

I confirmed that I can in MATLAB compile MEX files with the SDK provided compiler.

I start from the SDK Command Prompt (this is needed to avoid that SDK path variables and SDK registry keys are missing when CMake connects to the compiler) the CMake-GUI, and configure the Visual Studio 10 2010 Win64 compiler, with the option set to use default native compilers. In the SDK Command Prompt I also tried to first use the SetEnv command to already there set the target as /Release X64 Win 7 . Well, so far I can't overcome the message mentioned above, and after 2 days of exhausting searches in the internet I kindly ask for your help: Any idea what I shall try next? Thanks!

MATLAB bindings will not be generated

Hello, I can't get the MATLAB bindings generated and search for your help. CMake throws the message:

Matlab:

mex: C:/Program Files/MATLAB/R2014b/bin/mex.bat

Compiler/generator: Not working (bindings will not be generated)

I am running Win 7 Pro 64 bit, the current versions (all downloaded yesterday (11th Feb 2015)) of openCV 3.0 Beta, Python 3.4.2 and CMake 3.1.2, and have installed and running MATLAB R2014b 64 bit and the Windows SDK7.1 for providing the compilers. I have not Visual Studio installed, because I do not find a free-of-cost "Express" version on the MS site anymore. The new "Community" version is not listed as a MATLAB compatible choice on THE MATHWORKS site. So I prefer to stay with the SDK, which anyway contains all compilers and tools of the VS, and seems to mainly differ only in excluding to provide the Visual Studio IDE and some very advanced software development tools.

I confirmed that I can in MATLAB compile MEX files with the SDK provided compiler.

I start from the SDK Command Prompt (this is needed to avoid that SDK path variables and SDK registry keys are missing when CMake connects to the compiler) the CMake-GUI, and configure the Visual Studio 10 2010 Win64 compiler, with the option set to use default native compilers. In the SDK Command Prompt I also tried to first use the SetEnv command to already there set the target as /Release X64 Win 7 . Well, so far I can't overcome the message mentioned above, and after 2 days of exhausting searches in the internet I kindly ask for your help: Any idea what I shall try next? Thanks!

EDIT: I meanwhile found out that in the openCV 3.0 Beta distribution the CMakeLists.txt or openCVFindMatlab.cmake files might not be complete: The following is an excerpt from the CMakeLists.txt file, around line 1064:

status("  Matlab:")
status("    mex:"         MATLAB_MEX_SCRIPT  THEN  "${MATLAB_MEX_SCRIPT}"   ELSE NO)
if (MATLAB_FOUND)
  status("    Compiler/generator:" MEX_WORKS    THEN  "Working"                ELSE "Not working (bindings will not be generated)")
endif()

The variable MEX_WORKS only becomes mentioned in the above cited CMakeLists.txt line 1064, and of course then has to produce, as not existent, the message "Not working". While in the file OpenCVFindMatlab.cmake it can be found in lines 160, 161, 167, and 169 that MATLAB_MEX_SCRIPT becomes generated, no code (I searched for the string "MEX_WORKS" in all files in the source directory) could be found concerning MEX_WORKS. Am I wrong ? Any help is appreciated!

Bindings to access openCV from MATLAB do not generate

WAS ORIGINALLY: "MATLAB bindings will not be generated

generated". Reason to edit the question header text: I changed the question header text after having learned that I have to better distinguish between all the different available bindings.

Hello, I can't get the MATLAB bindings generated and search for your help. CMake throws the message:

Matlab:

Matlab:
    mex:  C:/Program Files/MATLAB/R2014b/bin/mex.bat

Files/MATLAB/R2014b/bin/mex.bat Compiler/generator: Not working (bindings will not be generated)

generated)

I am running Win 7 Pro 64 bit, the current versions (all downloaded yesterday (11th Feb 2015)) of openCV 3.0 Beta, Python 3.4.2 and CMake 3.1.2, and have installed and running MATLAB R2014b 64 bit and the Windows SDK7.1 for providing the compilers. I have not Visual Studio installed, because I do not find a free-of-cost "Express" version on the MS site anymore. The new "Community" version is not listed as a MATLAB compatible choice on THE MATHWORKS site. So I prefer to stay with the SDK, which anyway contains all compilers and tools of the VS, and seems to mainly differ only in excluding to provide the Visual Studio IDE and some very advanced software development tools.

I confirmed that I can in MATLAB compile MEX files with the SDK provided compiler.

I start from the SDK Command Prompt (this is needed to avoid that SDK path variables and SDK registry keys are missing when CMake connects to the compiler) the CMake-GUI, and configure the Visual Studio 10 2010 Win64 compiler, with the option set to use default native compilers. In the SDK Command Prompt I also tried to first use the SetEnv command to already there set the target as /Release X64 Win 7 . Well, so far I can't overcome the message mentioned above, and after 2 days of exhausting searches in the internet I kindly ask for your help: Any idea what I shall try next? Thanks!

EDIT: EDIT I: I meanwhile found out that in the openCV 3.0 Beta distribution the CMakeLists.txt or openCVFindMatlab.cmake files might not be complete: The following is an excerpt from the CMakeLists.txt file, around line 1064:

status("  Matlab:")
status("    mex:"         MATLAB_MEX_SCRIPT  THEN  "${MATLAB_MEX_SCRIPT}"   ELSE NO)
if (MATLAB_FOUND)
  status("    Compiler/generator:" MEX_WORKS    THEN  "Working"                ELSE "Not working (bindings will not be generated)")
endif()

The variable MEX_WORKS only becomes mentioned in the above cited CMakeLists.txt line 1064, and of course then has to produce, as not existent, the message "Not working". While in the file OpenCVFindMatlab.cmake it can be found in lines 160, 161, 167, and 169 that MATLAB_MEX_SCRIPT becomes generated, no code (I searched for the string "MEX_WORKS" in all files in the source directory) could be found concerning MEX_WORKS. Am I wrong ? Any help is appreciated!

EDIT II: I found that besides the opencv code there exists also an opencv_contrib code at github, and this code has to be used additionally. So, I first "configured" in CMake-GUI the opencv sources, then added the OPENCV_EXTRA_MODULES_PATH to point to my opencv_contrib sources subfolder "...modules/matlab", solved by this all above mentioned problems, but now got stuck in the following error message:

CMake Error at C:/temp/opencv-sources/opencv_contrib-master/modules/matlab/test/CMakeLists.txt:17 (add_dependencies):
  add_dependencies called with incorrect number of arguments

Hmm, I didn't expect it to be such a bumpy road to success, after having read so enthusiastic reports on the internet about this new feature of direct openCV bindings for MATLAB users. Those reports sounded as if it would be a straight forward process to install that feature, although still part of an openCV version without official release yet. It is still in BETA phase. Well, I am obviously now part of the beta testing process. Ok, I will try to do my best to help, but stuck would again appreciate your kind help!

Bindings to access openCV from MATLAB do not generate

WAS ORIGINALLY: "MATLAB bindings will not be generated". Reason to edit the question header text: I changed the question header text after having learned that I have to better distinguish between all the different available bindings.

The MATLAB "Not working" state persists.

The CMake-GUI configuration phase meanwhile terminates error message free for me.

Find below the original question, still serving as a blog on what I did and what I encountered so far:

Hello, I can't get the MATLAB bindings generated and search for your help. CMake throws the message:

Matlab:
    mex:                         C:/Program Files/MATLAB/R2014b/bin/mex.bat
    Compiler/generator:          Not working (bindings will not be generated)

I am running Win 7 Pro 64 bit, the current versions (all downloaded yesterday (11th Feb 2015)) of openCV 3.0 Beta, Python 3.4.2 and CMake 3.1.2, and have installed and running MATLAB R2014b 64 bit and the Windows SDK7.1 for providing the compilers. I have not Visual Studio installed, because I do not find a free-of-cost "Express" version on the MS site anymore. The new "Community" version is not listed as a MATLAB compatible choice on THE MATHWORKS site. So I prefer to stay with the SDK, which anyway contains all compilers and tools of the VS, and seems to mainly differ only in excluding to provide the Visual Studio IDE and some very advanced software development tools.

I confirmed that I can in MATLAB compile MEX files with the SDK provided compiler.

I start from the SDK Command Prompt (this is needed to avoid that SDK path variables and SDK registry keys are missing when CMake connects to the compiler) the CMake-GUI, and configure the Visual Studio 10 2010 Win64 compiler, with the option set to use default native compilers. In the SDK Command Prompt I also tried to first use the SetEnv command to already there set the target as /Release X64 Win 7 . Well, so far I can't overcome the message mentioned above, and after 2 days of exhausting searches in the internet I kindly ask for your help: Any idea what I shall try next? Thanks!

EDIT I: I meanwhile found out that in the openCV 3.0 Beta distribution the CMakeLists.txt or openCVFindMatlab.cmake files might not be complete: The following is an excerpt from the CMakeLists.txt file, around line 1064:

status("  Matlab:")
status("    mex:"         MATLAB_MEX_SCRIPT  THEN  "${MATLAB_MEX_SCRIPT}"   ELSE NO)
if (MATLAB_FOUND)
  status("    Compiler/generator:" MEX_WORKS    THEN  "Working"                ELSE "Not working (bindings will not be generated)")
endif()

The variable MEX_WORKS only becomes mentioned in the above cited CMakeLists.txt line 1064, and of course then has to produce, as not existent, the message "Not working". While in the file OpenCVFindMatlab.cmake it can be found in lines 160, 161, 167, and 169 that MATLAB_MEX_SCRIPT becomes generated, no code (I searched for the string "MEX_WORKS" in all files in the source directory) could be found concerning MEX_WORKS. Am I wrong ? Any help is appreciated!

EDIT II: I found that besides the opencv code there exists also an opencv_contrib code at github, and this code has to be used additionally. So, I first "configured" in CMake-GUI the opencv sources, then added the OPENCV_EXTRA_MODULES_PATH to point to my opencv_contrib sources subfolder "...modules/matlab", solved by this all above mentioned problems, but now got stuck in the following error message:

CMake Error at C:/temp/opencv-sources/opencv_contrib-master/modules/matlab/test/CMakeLists.txt:17 (add_dependencies):
  add_dependencies called with incorrect number of arguments

Hmm, I didn't expect it to be such a bumpy road to success, after having read so enthusiastic reports on the internet about this new feature of direct openCV bindings for MATLAB users. Those reports sounded as if it would be a straight forward process to install that feature, although still part of an openCV version without official release yet. It is still in BETA phase. Well, I am obviously now part of the beta testing process. Ok, I will try to do my best to help, but stuck would again appreciate your kind help!

Bindings to access openCV from MATLAB do not generate

WAS ORIGINALLY: "MATLAB bindings will not be generated". Reason to edit the question header text: I changed the question header text after having learned that I have to better distinguish between all the different available bindings.

The MATLAB "Not working" state persists.

The CMake-GUI configuration phase meanwhile terminates error message free for me.

Find below the original question, still serving as a blog on what I did and what I encountered so far:

Hello, I can't get the MATLAB bindings generated and search for your help. CMake throws the message:

Matlab:
    mex:                         C:/Program Files/MATLAB/R2014b/bin/mex.bat
    Compiler/generator:          Not working (bindings will not be generated)

I am running Win 7 Pro 64 bit, the current versions (all downloaded yesterday (11th Feb 2015)) of openCV 3.0 Beta, Python 3.4.2 and CMake 3.1.2, and have installed and running MATLAB R2014b 64 bit and the Windows SDK7.1 for providing the compilers. I have not Visual Studio installed, because I do not find a free-of-cost "Express" version on the MS site anymore. The new "Community" version is not listed as a MATLAB compatible choice on THE MATHWORKS site. So I prefer to stay with the SDK, which anyway contains all compilers and tools of the VS, and seems to mainly differ only in excluding to provide the Visual Studio IDE and some very advanced software development tools.

I confirmed that I can in MATLAB compile MEX files with the SDK provided compiler.

I start from the SDK Command Prompt (this is needed to avoid that SDK path variables and SDK registry keys are missing when CMake connects to the compiler) the CMake-GUI, and configure the Visual Studio 10 2010 Win64 compiler, with the option set to use default native compilers. In the SDK Command Prompt I also tried to first use the SetEnv command to already there set the target as /Release X64 Win 7 . Well, so far I can't overcome the message mentioned above, and after 2 days of exhausting searches in the internet I kindly ask for your help: Any idea what I shall try next? Thanks!

EDIT I: I meanwhile found out that in the openCV 3.0 Beta distribution the CMakeLists.txt or openCVFindMatlab.cmake files might not be complete: The following is an excerpt from the CMakeLists.txt file, around line 1064:

status("  Matlab:")
status("    mex:"         MATLAB_MEX_SCRIPT  THEN  "${MATLAB_MEX_SCRIPT}"   ELSE NO)
if (MATLAB_FOUND)
  status("    Compiler/generator:" MEX_WORKS    THEN  "Working"                ELSE "Not working (bindings will not be generated)")
endif()

The variable MEX_WORKS only becomes mentioned in the above cited CMakeLists.txt line 1064, and of course then has to produce, as not existent, the message "Not working". While in the file OpenCVFindMatlab.cmake it can be found in lines 160, 161, 167, and 169 that MATLAB_MEX_SCRIPT becomes generated, no code (I searched for the string "MEX_WORKS" in all files in the source directory) could be found concerning MEX_WORKS. Am I wrong ? Any help is appreciated!

EDIT II: I found that besides the opencv code there exists also an opencv_contrib code at github, and this code has to be used additionally. So, I first "configured" in CMake-GUI the opencv sources, then added the OPENCV_EXTRA_MODULES_PATH to point to my opencv_contrib sources subfolder "...modules/matlab", solved by this all above mentioned problems, but now got stuck in the following error message:

CMake Error at C:/temp/opencv-sources/opencv_contrib-master/modules/matlab/test/CMakeLists.txt:17 (add_dependencies):
  add_dependencies called with incorrect number of arguments

Hmm, I didn't expect it to be such a bumpy road to success, after having read so enthusiastic reports on the internet about this new feature of direct openCV bindings for MATLAB users. Those reports sounded as if it would be a straight forward process to install that feature, although still part of an openCV version without official release yet. It is still in BETA phase. Well, I am obviously now part of the beta testing process. Ok, I will try to do my best to help, but stuck would again appreciate your kind help!