From f618466c25d43f3bae9e40920273bf77de1e1149 Mon Sep 17 00:00:00 2001 From: leochanj105 Date: Mon, 19 Oct 2020 23:09:30 -0400 Subject: initial sd-vbs initial sd-vbs add sd-vbs sd-vbs --- SD-VBS/benchmarks/stitch/src/c/extractFeatures.c | 181 +++++++++++++++++++++++ 1 file changed, 181 insertions(+) create mode 100644 SD-VBS/benchmarks/stitch/src/c/extractFeatures.c (limited to 'SD-VBS/benchmarks/stitch/src/c/extractFeatures.c') diff --git a/SD-VBS/benchmarks/stitch/src/c/extractFeatures.c b/SD-VBS/benchmarks/stitch/src/c/extractFeatures.c new file mode 100644 index 0000000..ea574e4 --- /dev/null +++ b/SD-VBS/benchmarks/stitch/src/c/extractFeatures.c @@ -0,0 +1,181 @@ +/******************************** +Author: Sravanthi Kota Venkata +********************************/ + +#include "stitch.h" +#include + +#define min(a,b) (aheight; + + vecF = fMallocHandle(n, 64); + I1 = fiDeepCopy(I); + + Iconv = ffConv2(I1, g); + fFreeHandle(I1); + I1 = ffConv2(Iconv, g); + fFreeHandle(Iconv); + Iconv = fDeepCopy(I1); + + { + int i = (Iconv->height/5); + int j = (Iconv->width/5); + Isub = fMallocHandle(i, j); + } + + for(i=0, m=0; mheight; i+=5, m++) + { + for(j=0, k=0; kwidth; j+=5, k++) + { + subsref(Isub,m,k) = subsref(Iconv,i,j); + } + } + + fFreeHandle(Iconv); + fFreeHandle(g1); + fFreeHandle(g); + fFreeHandle(I1); + + nr = Isub->height; + nc = Isub->width; + + Xsub = iMallocHandle(x->height, x->width); + Ysub = iMallocHandle(y->height, y->width); + +// printf("Sizes = %d\t%d\t%d\t%d\n", Isub->height, Isub->width, x->height, x->width); + + for(i=0; i<(x->height*x->width); i++) + { + asubsref(Xsub,i) = min( ( asubsref(x,i) /5), nc-4 ); + asubsref(Ysub,i) = min( ( asubsref(y,i) /5), nr-4 ); + } + + { + int maxX, maxY; + maxX = Xsub->height>Xsub->width?Xsub->height:Xsub->width; + maxY = Ysub->height>Ysub->width?Ysub->height:Ysub->width; + if(maxX < 6 || maxY < 10) + { + fFreeHandle(vecF); + vecF = fSetArray(n,2,0); + for(i=0; i<(x->height); i++) + { + subsref(vecF, i, 0) = asubsref(Xsub,i)*1.0; + subsref(vecF, i, 1) = asubsref(Ysub,i)*1.0; + } + + fFreeHandle(Isub); + iFreeHandle(Xsub); + iFreeHandle(Ysub); + return vecF; + } + } + + { + int newSize = 4; + if(I->height > 32 && I->width >32) + newSize = 64; + fFreeHandle(vecF); + vecF = fMallocHandle(n, newSize); + } + +// printf("Size of Isub = %d\t%d\n", Isub->height, Isub->width); + for(i=0; i= (Isub->height-4)) + asubsref(Ysub,i) = Isub->height-5; + if( asubsref(Xsub,i) >= (Isub->width-4)) + asubsref(Xsub,i) = Isub->width-5; + + m = 0; + temp = 0; +// printf("SUBS %d\t%d\n", asubsref(Ysub,i), asubsref(Xsub,i)); + + for(k= asubsref(Xsub,i)-3; k<=( asubsref(Xsub,i)+4); k++) + { + for(j= asubsref(Ysub,i)-3; j<=( asubsref(Ysub,i)+4); j++) + { +// printf("%d\t%d\n", j, k); + subsref(vecF,i,m) = subsref(Isub,j,k); + temp += subsref(vecF,i,m); + m++; + } + } + mean = temp/64.0; + + std = 0; + for(j=0; j<64; j++) + { + subsref(vecF,i,j) = subsref(vecF,i,j) - mean; + std += subsref(vecF,i,j) * subsref(vecF,i,j); + } + + std = std/64; + std = sqrt(std); + for(j=0; j<64; j++) + { + subsref(vecF,i,j) = subsref(vecF,i,j)/std; + } + } + + iFreeHandle(Xsub); + fFreeHandle(Isub); + iFreeHandle(Ysub); + return vecF; +} + + + -- cgit v1.2.2