Code covered by the BSD License  

Highlights from
C/C++ and Matlab types convertor

image thumbnail

C/C++ and Matlab types convertor

by

 

31 Jul 2008 (Updated )

Bidirectional conversion between C/C++ type (STL, openCV) and Matlab matrix (compile or run time)

make.m
%% IMPORTANCE!!!
% set OpenCV installed directory here!
OpenCVRoot = 'C:\Program Files\OpenCV\';
%% Run this cell for Release version
IncPath1 = ['-I',fullfile(OpenCVRoot,'cxcore','include')];
IncPath2 = ['-I',fullfile(OpenCVRoot,'cv','include')];
% LibPath = ['-L',fullfile(OpenCVRoot,'lib')];
LibPath = fullfile(OpenCVRoot,'lib');
HasOpenCV = '-DHAS_OPENCV';

AddiIncPath = ['-I','..\..\src'];
OutFile = 'mx_resize';

mex('mex_main.cpp','../../src/mc_convert.cpp',...
    fullfile(LibPath,'cxcore.lib'),...
    fullfile(LibPath,'cv.lib'),...
    IncPath1, IncPath2, AddiIncPath,...
    HasOpenCV,...
    '-output',OutFile);
clear IncPath1 IncPath2 LibPath HasOpenCV AddiIncPath OutFile
%% Run this cell for Debug version
IncPath1 = ['-I',fullfile(OpenCVRoot,'cxcore','include')];
IncPath2 = ['-I',fullfile(OpenCVRoot,'cv','include')];
% LibPath = ['-L',fullfile(OpenCVRoot,'lib')];
LibPath = fullfile(OpenCVRoot,'lib');
HasOpenCV = '-DHAS_OPENCV';

AddiIncPath = ['-I','..\..\src'];
OutFile = 'mx_resize';

mex('mex_main.cpp','../../src/mc_convert.cpp',...
    fullfile(LibPath,'cxcore.lib'),...
    fullfile(LibPath,'cv.lib'),...
    IncPath1, IncPath2, AddiIncPath,...
    HasOpenCV,...
    '-output',OutFile, '-g');
clear IncPath1 IncPath2 LibPath HasOpenCV AddiIncPath OutFile
%% Run main.m
% Now change Matlab current directory to simple_mex and run main.m to see 
% the result.
% Type "help mx_resize" for help.

Contact us