-
Notifications
You must be signed in to change notification settings - Fork 5
/
InstallRevas.m
77 lines (67 loc) · 2.26 KB
/
InstallRevas.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
function InstallRevas
% add paths
try
% OS dependent separator
if isunix
separator = ':';
else
separator = ';';
end
paths = regexp(genpath(pwd),separator,'split');
% remove git folders
paths(contains(paths,'git')) = [];
% remove the last empty cell
paths(end) = [];
% make it a single char array
p = [];
for i=1:length(paths)
p = [p paths{i} separator];
end
% add and save the path
addpath(p);
savepath;
disp('ReVAS is added to path successfully.');
catch
disp('Adding ReVAS to path failed.');
end
%% compile template matching functions from source codes
% openCV template matching CPU
cd('third_party/visionopencv/TemplateMatching');
fprintf('\nAttempting to compile CPU version:\n');
try
mexOpenCV matchTemplateOCV.cpp;
catch
disp('matchTemplateOCV compilation failed.');
disp(['Make sure you have the Computer Vision Toolbox ' ...
'<a href="https://www.mathworks.com/matlabcentral/fileexchange/'...
'47953-computer-vision-toolbox-opencv-interface">OpenCV Interface.</a>'])
end
% openCV template matching GPU
cd('../TemplateMatchingGPU');
try
if isunix
fprintf('\nAttempting to compile GPU Linux/Mac version:\n');
mexOpenCV matchTemplateOCV_GPU.cpp -lmwgpu -lmwocvgpumex -largeArrayDims;
else
fprintf('\nAttempting to compile GPU PC version:\n');
mexOpenCV matchTemplateOCV_GPU.cpp -lgpu -lmwocvgpumex -largeArrayDims;
end
catch
disp('matchTemplateOCV_GPU compilation failed.')
disp(['Make sure you have the Computer Vision Toolbox ' ...
'<a href="https://www.mathworks.com/matlabcentral/fileexchange/'...
'47953-computer-vision-toolbox-opencv-interface">OpenCV Interface.</a>'])
end
% template matching using CUDA
cd('../../cuda');
fprintf('\nAttempting to compile CUDA implementation.:\n');
try
mexcuda -lcufft cuda_match.cpp helper/convolutionFFT2D.cu helper/cuda_utils.cu;
catch
disp('Compilation of CUDA code failed.');
disp(['Make sure you have the ' ...
'<a href="https://developer.nvidia.com/cuda-toolkit-archive">'...
'CUDA Toolkit</a> installed '...
'(must match the version returned by gpuDevice command. '])
end
cd('../../')