Use the OpenCV Interface files to integrate your OpenCV C++ code into MATLAB® and build MEX-files that call OpenCV functions.
mexOpenCV interface utility functions convert data between OpenCV
and MATLAB. These functions support CPP-linkage only. GPU support is available on
glnxa64, win64, and Mac platforms. The GPU-specific utility functions support CUDA enabled
NVIDIA GPU. See the Parallel Computing Toolbox™
Requirements and GPU Support by Release (Parallel Computing Toolbox). The GPU utility
functions require the Parallel Computing Toolbox software.
The Computer Vision Toolbox™ Interface for OpenCV in MATLAB API supports OpenCV version 4.2.0.
This example creates a MEX-file from a wrapper C++ file and then tests the newly
created file. The example uses the OpenCV template matching algorithm wrapped in a C++
file, which is located in the
Change your current working folder to the
Create the MEX-file from the source file:
Run the test script, which uses the generated MEX-file:
mxArray function with your source
For help creating MEX files, at the MATLAB command prompt, type:
Each example subfolder in the Computer Vision Toolbox Interface for OpenCV in MATLAB support package contains all the files you need to run the example. To run
an example, you must call the
mexOpenCV function with one of the
supplied source files.