Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

Invalid MEX-file #122

Closed
Eder01 opened this issue Oct 12, 2014 · 4 comments
Closed

Invalid MEX-file #122

Eder01 opened this issue Oct 12, 2014 · 4 comments

Comments

@Eder01
Copy link

Eder01 commented Oct 12, 2014

Sorry to set up this issue again, but the solution from ( Invalid Mex file. #58 ) is not working for me...

I followed the steps shown in Surya's youtube tutorial and get everything so far. After running "mexopencv.make" without any errors, and adding the path AND restarting matlab, i try to start the facedetect example (also other examples, or even cv.help) running but matlab gets always an error. For the facedetect example:

Invalid MEX-file 'C:\Program Files\opencv\mexopencv-master+cv\private\CascadeClassifier_.mexw64': Das angegebene Modul wurde nicht gefunden.

(in english: specified module could not be found)

If i look into the given path i CAN find the CascadeClassifier_.mexw64 file...

I am using: MATLAB R2012b (x64), Visual Studio 2010 Express (x64) with Microsoft Software Development Kit (SDK) 7.1 as compiler, openCV 2.4.9.

In the path "C:\Program Files\opencv" there is my opencv folder with build\x64\vc10 subfolders and the sources subfolder. AND there is also my mexopencv-master folder with +cv and +mexopencv subfolder.

I changed the paths in the make.m file:

    %I_path = fullfile(opts.opencv_path,'include');
    %L_path = fullfile(opts.opencv_path,arch_str(),compiler_str(),'lib');
    I_path = 'C:\Program Files\opencv\opencv\build\include';
    L_path = 'C:\Program Files\opencv\opencv\build\x64\vc10\lib';
   %opts.opencv_path = 'C:\opencv';  % OpenCV location
    opts.opencv_path = 'C:\Program Files\opencv\opencv';

I also tried to edit the mexopts regarding the secure-flag which is originally set to D_SECURE_SCL=0 without any effect.

Many thanks. Greetings,
Philip

@amroamroamro
Copy link
Collaborator

you also need to add the folder with the OpenCV DLL files to the system's PATH environment variable (that would be C:\Program Files\opencv\opencv\build\x64\vc10\bin in your case).

You could do this from inside MATLAB, but the change will only last for the current session:

>> setenv('PATH', ['C:\Program Files\opencv\opencv\build\x64\vc10\bin' pathsep() getenv('PATH')])

BTW you didn't have to manually edit the make.m file, you could have just set the opencv_path option on call, as in:

>> mexopencv.make('opencv_path','C:\Program Files\opencv\opencv\build')

And there is no need to change _SECURE_SCL (that was only needed for old VS2008)

@Eder01
Copy link
Author

Eder01 commented Oct 12, 2014

Oh my god, that was easy! Always just added the opencv dll files to the matlab path and not to the system path...

Im really really gratefull!
Thaaaaaaaaaaaanks

@brianbaloch
Copy link

i am using BCILAB on MATLAB 2015b. I am getting an error regarding Mex File. please help me. I don't know about Mex file. I am very new to these things. please help me and tell me step by step

@amroamroamro
Copy link
Collaborator

@brianbaloch this is not the place to ask random MATLAB questions! Please keep it related to issues regarding mexopencv...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants