-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompile.m
51 lines (42 loc) · 1.98 KB
/
compile.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
% compile hog and segmetation mex files
% before compiling set the following variables to the correct paths:
% opencv_include and opencv_libpath
current_folder = pwd;
mkdir('mex');
cd(['mex_src' filesep 'hog']);
mex -DMX_COMPAT_32 -O gradientMex.cpp
movefile('*.mex*', [current_folder filesep 'mex'])
cd(current_folder);
if ispc % Windows machine
% set opencv include path
opencv_include = 'E:\development\opencv-2.4.12\opencv\build\include\';
% set opencv lib path
opencv_libpath = 'E:\development\opencv-2.4.12\opencv\build\x64\vc11\lib\';
files = dir([opencv_libpath '*opencv*.lib']);
lib = [];
for i = 1:length(files),
lib = [lib ' -l' files(i).name(1:end-4)];
end
cd(['mex_src' filesep 'segmentation']);
eval(['mex mex_extractforeground.cpp src\segment.cpp -Isrc\ -I' opencv_include ' -L' opencv_libpath ' ' lib]);
eval(['mex mex_extractbackground.cpp src\segment.cpp -Isrc\ -I' opencv_include ' -L' opencv_libpath ' ' lib]);
eval(['mex mex_segment.cpp src\segment.cpp -Isrc\ -I' opencv_include ' -L' opencv_libpath ' ' lib]);
movefile('*.mex*', [current_folder filesep 'mex'])
cd(current_folder);
elseif isunix % Unix machine
% set opencv include path
opencv_include = '/usr/local/opencv/include/';
% set opencv lib path
opencv_libpath = '/usr/local/opencv/lib/';
lib = [];
files = dir([opencv_libpath '*opencv*.so']);
for i = 1:length(files)
lib = [lib ' -l' files(i).name(4:end-3)];
end
cd(['mex_src' filesep 'segmentation']);
eval(['mex -DMX_COMPAT_32 -O mex_extractforeground.cpp src/segment.cpp -Isrc/ -I' opencv_include ' -L' opencv_libpath ' ' lib]);
eval(['mex -DMX_COMPAT_32 -O mex_extractbackground.cpp src/segment.cpp -Isrc/ -I' opencv_include ' -L' opencv_libpath ' ' lib]);
eval(['mex -DMX_COMPAT_32 -O mex_segment.cpp src/segment.cpp -Isrc/ -I' opencv_include ' -L' opencv_libpath ' ' lib]);
movefile('*.mex*', [current_folder filesep 'mex'])
cd(current_folder);
end