summaryrefslogtreecommitdiffstats
path: root/SD-VBS/benchmarks/mser/src/c/script_mser.c
diff options
context:
space:
mode:
Diffstat (limited to 'SD-VBS/benchmarks/mser/src/c/script_mser.c')
-rw-r--r--SD-VBS/benchmarks/mser/src/c/script_mser.c117
1 files changed, 0 insertions, 117 deletions
diff --git a/SD-VBS/benchmarks/mser/src/c/script_mser.c b/SD-VBS/benchmarks/mser/src/c/script_mser.c
deleted file mode 100644
index 3e98f86..0000000
--- a/SD-VBS/benchmarks/mser/src/c/script_mser.c
+++ /dev/null
@@ -1,117 +0,0 @@
1/********************************
2Author: Sravanthi Kota Venkata
3********************************/
4
5#include "mser.h"
6#include <malloc.h>
7#include "extra.h"
8#define min(a,b) (a<b)?a:b
9#define max(a,b) (a>b)?a:b
10
11int main(int argc, char* argv[])
12{
13 SET_UP
14 int which_image;
15 int i, j, k;
16 I2D *idx;
17 I2D *I;
18 I2D *It;
19 I2D *out;
20 int rows=196, cols=98;
21 int minVal = 1000;
22 int maxVal = -1000;
23 int lev = 10;
24
25 char im1[100], im2[100];
26
27 iArray *subs_pt, *nsubs_pt, *strides_pt, *visited_pt, *dims;
28 uiArray* joins_pt;
29 ulliArray *acc_pt, *ell_pt;
30 region_t* regions_pt;
31 pair_t* pairs_pt;
32 node_t* forest_pt;
33
34 int ndims, nel, gdl, nmer;
35
36 scanf("%s", im1);
37
38 I = readImage(im1);
39
40 rows = I->height;
41 cols = I->width;
42
43 It = readImage(im1);
44
45 k = 0;
46 for(i=0; i<cols; i++)
47 {
48 for(j=0; j<rows; j++)
49 {
50 asubsref(It,k++) = subsref(I,j,i);
51 }
52 }
53
54 ndims = 2;
55 nel = It->height * It->width;
56 gdl = ndims * (ndims+1)/2 + ndims;
57 nmer = NMER_MAX;
58
59 dims = malloc(sizeof(iArray) + sizeof(int)*ndims);
60 /* allocate stuff */
61 subs_pt = malloc(sizeof(iArray) + sizeof(int)*ndims);
62 nsubs_pt = malloc(sizeof(iArray) + sizeof(int)*ndims);
63 strides_pt = malloc(sizeof(uiArray)+sizeof(unsigned int)*ndims);
64 visited_pt = malloc(sizeof(uiArray) + sizeof(unsigned int)*nel);
65 joins_pt = malloc(sizeof(uiArray) + sizeof(unsigned int)*nel);
66
67 regions_pt = (region_t*)malloc(sizeof(region_t)*nel);
68 pairs_pt = (pair_t*)malloc(sizeof(pair_t)*nel);
69 forest_pt = (node_t*)malloc(sizeof(node_t)*nel);
70
71 acc_pt = malloc(sizeof(ulliArray) + sizeof(acc_t)*nel) ;
72 ell_pt = malloc(sizeof(ulliArray) + sizeof(acc_t)*gdl*nmer) ;
73
74
75 out = iMallocHandle(1, nmer);
76 for_each_job {
77 idx = mser(It, 2, subs_pt, nsubs_pt, strides_pt, visited_pt, dims,
78 joins_pt,
79 regions_pt,
80 pairs_pt,
81 forest_pt,
82 acc_pt, ell_pt,
83 out);
84 }
85
86#ifdef CHECK
87 /** Self checking - use expected.txt from data directory **/
88 {
89 int tol, ret=0;
90 tol = 1;
91#ifdef GENERATE_OUTPUT
92 writeMatrix(idx, argv[1]);
93#endif
94 ret = selfCheck(idx, "expected_C.txt", tol);
95 if (ret == -1)
96 printf("Error in MSER\n");
97 }
98 /** Self checking done **/
99#endif
100 free(dims);
101 free( forest_pt ) ;
102 free( pairs_pt ) ;
103 free( regions_pt ) ;
104 free( visited_pt ) ;
105 free( strides_pt ) ;
106 free( nsubs_pt ) ;
107 free( subs_pt ) ;
108 free( joins_pt ) ;
109 free( acc_pt ) ;
110 free( ell_pt ) ;
111 iFreeHandle(idx);
112 iFreeHandle(I);
113 iFreeHandle(It);
114 WRITE_TO_FILE
115 return 0;
116}
117