summaryrefslogtreecommitdiffstats
path: root/SD-VBS/benchmarks/sift/src/c/script_sift.c
diff options
context:
space:
mode:
Diffstat (limited to 'SD-VBS/benchmarks/sift/src/c/script_sift.c')
-rw-r--r--SD-VBS/benchmarks/sift/src/c/script_sift.c80
1 files changed, 0 insertions, 80 deletions
diff --git a/SD-VBS/benchmarks/sift/src/c/script_sift.c b/SD-VBS/benchmarks/sift/src/c/script_sift.c
deleted file mode 100644
index 40b16d4..0000000
--- a/SD-VBS/benchmarks/sift/src/c/script_sift.c
+++ /dev/null
@@ -1,80 +0,0 @@
1/********************************
2Author: Sravanthi Kota Venkata
3********************************/
4
5#include <stdio.h>
6#include <stdlib.h>
7#include "sift.h"
8#include <malloc.h>
9#include "extra.h"
10#define SIFT_MEM 1<<24
11void normalizeImage(F2D* image)
12{
13 int i;
14 int rows;
15 int cols;
16
17 int tempMin = 10000, tempMax = -1;
18 rows = image->height;
19 cols = image->width;
20
21 for(i=0; i<(rows*cols); i++)
22 if(tempMin > asubsref(image,i))
23 tempMin = asubsref(image,i);
24
25 for(i=0; i<(rows*cols); i++)
26 asubsref(image,i) = asubsref(image,i) - tempMin;
27
28 for(i=0; i<(rows*cols); i++)
29 if(tempMax < asubsref(image,i))
30 tempMax = asubsref(image,i);
31
32 for(i=0; i<(rows*cols); i++)
33 asubsref(image,i) = ( asubsref(image,i) / (tempMax+0.0) );
34}
35
36int main(int argc, char* argv[])
37{
38 SET_UP
39 mallopt(M_TOP_PAD, SIFT_MEM);
40 mallopt(M_MMAP_MAX, 0);
41 I2D* im;
42 F2D *image;
43 int rows, cols, i, j;
44 F2D* frames;
45 unsigned int* startTime, *endTime, *elapsed;
46
47 char imSrc[100];
48 scanf("%s", imSrc);
49 im = readImage(imSrc);
50 image = fiDeepCopy(im);
51 rows = image->height;
52 cols = image->width;
53
54
55 for_each_job{
56 image = fiDeepCopy(im);
57 normalizeImage(image);
58 /** Extract sift features for the normalized image **/
59 frames = sift(image);
60 }
61
62#ifdef CHECK
63 {
64 int ret=0;
65 float tol = 0.2;
66#ifdef GENERATE_OUTPUT
67 fWriteMatrix(frames, argv[1]);
68#endif
69 ret = fSelfCheck(frames, "expected_C.txt", tol);
70 if (ret == -1)
71 printf("Error in SIFT\n");
72 }
73#endif
74
75 iFreeHandle(im);
76 fFreeHandle(frames);
77 WRITE_TO_FILE
78 return 0;
79}
80