kyamagu / mexopencv

Collection and a development kit of matlab mex functions for OpenCV library
http://kyamagu.github.io/mexopencv
Other
661 stars 319 forks source link

error: OpenCV library path not found #385

Closed NIDHIPANDA closed 6 years ago

NIDHIPANDA commented 6 years ago

Hello I am using Matlab 2015a ,visual stdio 2015 , openCV and openCV contribution 3.3.1

In the final step while running mexopencv.make('opencv_path','C:\opencv\build\install', 'opencv_contrib',true) I am getting this error.

Error using mexopencv.make>pkg_config (line 325)
OpenCV library path not found: C:\opencv\build\install\x64\vc10\lib

Error in mexopencv.make>mex_options (line 265)
    [cv_cflags, cv_libs] = pkg_config(opts);

Error in mexopencv.make (line 82)
    mex_flags = mex_options(opts);

My C:\opencv\build\install folder includes \x86\vc14 not the \x64\vc10. I really appreciate if somebody helps me. Thank you

amroamroamro commented 6 years ago

two things:

NIDHIPANDA commented 6 years ago

Thank you for your response. I tried mex -setup in MATLAB it is showing

MEX configured to use 'Microsoft Visual C++ 2015 (C)' for C language compilation.

Also on following your second suggestion

When you run CMake, make sure to select the right generator, i.e "Visual Studio 14 2015 Win64"

I was able to successfully build in Visual studio. But the error is now also same i.e.

Error using mexopencv.make>pkg_config (line 325)
OpenCV library path not found: C:\opencv\build\install\x64\vc10\lib

Error in mexopencv.make>mex_options (line 265)
    [cv_cflags, cv_libs] = pkg_config(opts);

Error in mexopencv.make (line 82)
    mex_flags = mex_options(opts);

I have already uninstalled the visual studio 10.

amroamroamro commented 6 years ago

You should do both mex -setup and mex -setup C++ for C and C++ compilers respectively.

NIDHIPANDA commented 6 years ago

I tried both of the command it is detecting VS15 only. capture_1

amroamroamro commented 6 years ago

That's weird, if VS2015 is configured as compiler, how come it still picks vc10?

Can you run this in MATLAB and post the output:

>> cc = mex.getCompilerConfigurations('C++', 'Selected');
>> disp(cc)
NIDHIPANDA commented 6 years ago

Sorry for my late reply. I tried your suggested command. The output is test Now it is not take visual stdio 10 but now the error is test2 One more thing I noticed that in my build-install folder there is no bin folder created. test3.

amroamroamro commented 6 years ago

Seeing the above images, you passed the wrong path, it should be:

>> mexopencv.make('opencv_path','C:\opencv\build\install', 'opencv_contrib',true)

Please follow the installation instructions more carefully: https://github.com/kyamagu/mexopencv/wiki/Installation-(Windows,-MATLAB,-OpenCV-3)


Now just to be clear, you must build opencv and mexopencv all using the same compiler with the same architecture, this means compiling both as x64 in VS2015.

Seeing your previous comments, you once had VS2010 vs VS2015, you were also mixing 32-bit and 64-bit binaries... So first thing is make sure you're using the correct configuration. Run this in MATLAB and post the output here:

>> !tree /F "C:\opencv\build\install\x64"
NIDHIPANDA commented 6 years ago

Thank you so much for your replies and support. It finally worked. On running the command !tree /F "C:\opencv\build\install\x64" the matlab output is test_4