View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

3.5 | 6 ratings Rate this file 76 Downloads (last 30 days) File Size: 1.11 MB File ID: #40665 Version: 1.2
image thumbnail

Matalb and OpenCV



07 Mar 2013 (Updated )

How to Connect Matlab with OpenCV to use the different functions offered by OpenCV using mex-files.

| Watch this File

File Information

How to Connect Matlab with OpenCV to use the different functions offered by OpenCV using mex-files.

The purpose of this connections is to be able to write function in C++ using the OpenCV library to call functions that can for exemple extract feature points using SIFT/SURF or ORB algorithem or detect faces that are on an image ...

To use this functionality you need to have some knowledge about C++ and also how the mex compiler of Matlab work.


Image Processing With Guide inspired this file.

MATLAB release MATLAB 7.11 (R2010b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (16)
13 Dec 2016 peng wang

30 Oct 2016 Myraj

Myraj (view profile)

Hi sir
I'm using matlab r2015a, opencv 2.4.13 and visual studio 2013

I can't connect matlab with opencv by following steps that you put, please help!!!

Comment only
26 Jul 2016 Karel Lebeda

I expected an actual wrapper...

17 Oct 2015 Rose Ann Haft

This file doesn't seem to be working with 2014 or 2015 versions. Is there an update or suggestions of how to make this compatible?

Comment only
23 Oct 2014 jose verdugo

26 May 2014 Dimaz Hafizhan

hi,i'm using Matlab2012b-64bit, VS2010-Ultimate, and openCV 2.3

when running mex displayimage.cpp i got this eror :

displayimage.cpp(5) : fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory

C:\PROGRA~1\MATLAB\R2012B\BIN\MEX.PL: Error: Compile of 'displayimage.cpp' failed.

Error using mex (line 206)
Unable to complete successfully.

please help me kind sir and thanks in advance

Comment only
19 May 2014 BIREM Merwan


For "sehreen" try to read carefully the file that show how to connect OpenCv with Matlab.

For "imran" I try my self using 32bit version and it is working well unfonutly i didn't try it using the 64bit version but we can try if you want and try to fix this problem.

best regards Merwan

Comment only
13 May 2014 Corey

Corey (view profile)

Can you explain what the difference is between this library?:

Comment only
12 May 2014 imran

imran (view profile)


I am working on a project which consist to control two FireWire Cameras simultaneously. I am looking for a toolkit which allow controlling two cameras simultaneously in Matlab. I see OpenCV in Matlab but I don't know How to Install OpenCV in Matlab.

I'm using 64-bit Matlab, Open CV 2.4.9 and Microsoft SDK 7.1

Can you help me to install OpenCV in Matlab because I don't understand too the tutorial.

How to create MEX file

kind regards

Comment only
09 Jan 2014 sehreen

Can anyone plz tellme the detailed procedure of how to connect the matlab with opencv and run the functions of opencv in matlab.

21 May 2013 BIREM Merwan

Did you modify the "mexopts.bat" file ??

Comment only
18 May 2013 rana

rana (view profile)

hey .. i am using matlab 2013a and opencv2.4.5 .. i obtained this error
'displayImage.cpp(5) : fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory '
i can't include any header,, is that because a configuration to visual studio 2012 is necessary?

Comment only
15 May 2013 SenyaLab

I am using Matalb2012b-64bit, VS2010-Professional, and OpenCV 2.4.5.

During the compilation I got the following error:

c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xutility(287) : error C2582: 'operator '='....

Adding _SECURE_SCL=1 to COMPFLAGS into mexopts.bat file solved this problem for me.



28 Apr 2013 Rodrigo

23 Apr 2013 BIREM Merwan

I didn't try to connect OpenCV with Matlab-2012, but i think it's possible (with the appropriate compiler and version of OpenCV) ...

Comment only
22 Apr 2013 Fernando Sato

Does this tutorial works on MATLAB 2012a?

Comment only
07 Mar 2013 1.1

Start with : "How to connect Matlab with OpenCV on Windows7.pdf"

22 Mar 2013 1.2

A new PDF file added to help and guid the user on how to connect Matlab and OpenCV

Contact us