summaryrefslogtreecommitdiffstats
path: root/SD-VBS/benchmarks/stitch/src/c/script_stitch.c
blob: 00c9a93eb9163449e19e7eb08e59eb1ed0c4ea71 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/********************************
Author: Sravanthi Kota Venkata
********************************/

#include "stitch.h"
#include <malloc.h>
#include "extra.h"
#define STITCH_MEM 1<<30
int main(int argc, char* argv[])
{
    SET_UP
    mallopt(M_TOP_PAD, STITCH_MEM);
    mallopt(M_MMAP_MAX, 0);
    int rows, cols;
    F2D *x, *y, *v, *interestPnts, *Fcur, *int1, *int2;
    I2D *Icur;
    int i, j;
    char im1[100], im2[100];
    

    printf("Input image: ");
    scanf("%s", im1);
    Icur = readImage(im1);
    rows = Icur->height;
    cols = Icur->width;
    
    printf("start\n");
    for_each_job{
        v = harris(Icur);
        interestPnts = getANMS(v, 24);
        int1 = fMallocHandle(interestPnts->height, 1);
        int2 = fSetArray(interestPnts->height, 1, 0);
        for(i=0; i<int1->height; i++)
        {
            asubsref(int1,i) = subsref(interestPnts,i,0);
            asubsref(int2,i) = subsref(interestPnts,i,1);
        }

        Fcur = extractFeatures(Icur, int1, int2);  
    }
    printf("end..\n");
    

#ifdef CHECK   
    /** Self checking - use expected.txt from data directory  **/
    {
        int ret=0;
        float tol = 0.02;
#ifdef GENERATE_OUTPUT
        fWriteMatrix(Fcur, argv[1]);
#endif
        ret = fSelfCheck(Fcur, "expected_C.txt", tol);
        if (ret == -1)
            printf("Error in Stitch\n");
    }
#endif
    iFreeHandle(Icur);
    fFreeHandle(v);
    fFreeHandle(interestPnts);
    fFreeHandle(int1);
    fFreeHandle(int2);
    fFreeHandle(Fcur);
    WRITE_TO_FILE
    return 0;
}