Provides a function named as “mex_opencv(src)”
function mex_opencv(src)
ARC = 'x64';
BIN_PATH = ['D:libscv.4.10', ARC ,'c12.0in'];
INC_OPT = '-ID:libscv.4.10includeopencv ';
INC_OPT = [INC_OPT, '-ID:libscv.4.10include '];
LIB_PATH = ['D:libscv.4.10', ARC ,'c12.0lib'];
LIBS = ' ';
LIBS_ORG = dir([LIB_PATH, '*.lib']);
for i = 1:numel(LIBS_ORG)
CUR_LIB = strtrim(LIBS_ORG(i).name);
if (CUR_LIB(end-4)~='d')
LIBS = [LIBS, '-l', CUR_LIB, ' '];
end
end
LIB_OPT = ['-L', LIB_PATH, ' ', LIBS];
% Add boost support
INC_OPT = [INC_OPT, ' ', '-ID:libsoost.57.0 '];
LIB_OPT = [LIB_OPT, ' ', '-LD:libsoost.57.0stages12.0', ARC, ' '];
compile_cmd = ['mex -v -O ', INC_OPT, LIB_OPT, src];
eval(compile_cmd);
PATH_STR = getenv('PATH');
if (numel(strfind(PATH_STR, 'cv'))==0)
setenv('PATH', [BIN_PATH, ';', PATH_STR]);
end
end