summaryrefslogtreecommitdiffstats
path: root/SD-VBS/benchmarks/disparity/src/matlab/script_run_profile.m
blob: 6e0386da3a64a99d63c4e74640315132f81cd192 (plain) (blame)
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
function script_run_profile(dataDir, resultDir, type, common, tooldir)

path(path,common); 

tol = 2;
elapsed = [0, 0];

WIN_SZ = 8;
SHIFT = 64;

if(strcmp(type,'test'))
    WIN_SZ = 2;
    SHIFT = 1;
elseif(strcmp(type, 'sim_fast'))
    WIN_SZ = 4;
    SHIFT = 4;
elseif(strcmp(type,'sim'))
    WIN_SZ = 4;
    SHIFT = 8;
end

    outFile = [resultDir, '/', 'out', '.bmp'];

    file = [dataDir, '/1.bmp'];
    imleft = readImage(file);
    imright = readImage([dataDir, '/2.bmp']);
    [rows, cols] = size(imright);

    fprintf(1,'Input size\t\t- (%dx%d)\n', rows, cols);

    start = photonStartTiming;
    [imDispOwn, DispSAD, minSAD]=getDisparity(double(imleft), double(imright), WIN_SZ, SHIFT);
    stop = photonEndTiming;
    elapsed = photonReportTiming(start, stop);

    writeMatrix(imDispOwn, dataDir);
    imwrite(uint8(minSAD), outFile, 'bmp');

    photonPrintTiming(elapsed);