http://stackoverflow.com/questions/5622894/how-do-i-link-a-64-bit-matlab-mex-file-to-opencv-libraries

 

mexFunction내에서 opencv가 라이브러리로 있을 때, mex 어떻게 시키는지 참고할수 있었음.

 

 

Normally in MATLAB I can compile a mex file which uses OpenCV functions using:

mex -O "mxFunc.cpp" -I"C:\OpenCV2.1\include/opencv" -L"C:\OpenCV2.1\lib" -lcv210 -lcvaux210 -lcxcore210 -lhighgui210

However, having switched to a 64-bit version of MATLAB, I now get unresolved symbols, e.g.

mxFunc.obj : error LNK2019: unresolved external symbol cvReleaseImage referenced in function mexFunction

How can I fix this?

System: Windows 7 64-bit; MSVC 2005; MATLAB R2010b 64-bit; OpenCV 2.1.0.

 

-----------------------------------------------------------------------------------

Generally: You need to recompile the used libraries in 64-bit.

As far as I know, it's not enough. If you use STL (and the OpenCV uses a lot) you need to use the same CRT version what the Matlab uses. So you need to use the same version of MSVC what the Mathworks guys...

You can check the dependency of the libmex.dll to figure out which CRT is needed. After it you need to install the proper Visual C++ (normally the free version is enough).

-----------------------------------

Using 64-bit libraries worked. I had to configure a new 64-bit MSVC solution using CMAKE, naming the "Generator" as "Visual Studio 8 2005 Win64". I don't know whether the compiler that I used was the same as that used to generate libmex.dll, but it worked anyway. – user664303 Apr 12 '11 at 10:23
    
@user664303: The 32-bit version of the 2010a/20010b uses VS 2005. I suppose they use the same version for the 64-bit. You were lucky. :) – tr3w Apr 15 '11 at 16:54

Posted by uniqueone
,