diff options
| author | leochanj105 <leochanj@live.unc.edu> | 2021-10-26 13:22:32 -0400 |
|---|---|---|
| committer | leochanj105 <leochanj@live.unc.edu> | 2021-10-26 13:22:32 -0400 |
| commit | 14c854543b1a3cf344a371a5b45595657f95786b (patch) | |
| tree | 70f752880522e5e44669af365754ac0f649dce81 /SD-VBS/benchmarks/sift/src/c/imsmooth.c | |
| parent | 5e2ccfae0532ddd89bcc04bf14aad451e9c79785 (diff) | |
add deadlines and costs
Diffstat (limited to 'SD-VBS/benchmarks/sift/src/c/imsmooth.c')
| -rw-r--r-- | SD-VBS/benchmarks/sift/src/c/imsmooth.c | 104 |
1 files changed, 0 insertions, 104 deletions
diff --git a/SD-VBS/benchmarks/sift/src/c/imsmooth.c b/SD-VBS/benchmarks/sift/src/c/imsmooth.c deleted file mode 100644 index d901418..0000000 --- a/SD-VBS/benchmarks/sift/src/c/imsmooth.c +++ /dev/null | |||
| @@ -1,104 +0,0 @@ | |||
| 1 | /******************************** | ||
| 2 | Author: Sravanthi Kota Venkata | ||
| 3 | ********************************/ | ||
| 4 | |||
| 5 | #include "sift.h" | ||
| 6 | #include <math.h> | ||
| 7 | #include <assert.h> | ||
| 8 | const double win_factor = 1.5 ; | ||
| 9 | const int nbins = 36 ; | ||
| 10 | const float threshold = 0.01; | ||
| 11 | |||
| 12 | /** | ||
| 13 | This function is similar to imageBlur in common/c folder. | ||
| 14 | Here, we can specify the sigma value for the gaussian filter | ||
| 15 | function. | ||
| 16 | **/ | ||
| 17 | |||
| 18 | void imsmooth(F2D* array, float dsigma, F2D* out) | ||
| 19 | { | ||
| 20 | int M,N ; | ||
| 21 | int i,j,k; | ||
| 22 | float s ; | ||
| 23 | |||
| 24 | /* ------------------------------------------------------------------ | ||
| 25 | ** Check the arguments | ||
| 26 | ** --------------------------------------------------------------- */ | ||
| 27 | |||
| 28 | M = array->height; | ||
| 29 | N = array->width; | ||
| 30 | s = dsigma; | ||
| 31 | |||
| 32 | /* ------------------------------------------------------------------ | ||
| 33 | ** Do the job | ||
| 34 | ** --------------------------------------------------------------- */ | ||
| 35 | if(s > threshold) | ||
| 36 | { | ||
| 37 | int W = (int) ceil(4*s) ; | ||
| 38 | float temp[2*W+1]; | ||
| 39 | F2D* buffer; | ||
| 40 | float acc = 0.0; | ||
| 41 | |||
| 42 | buffer = fSetArray(M,N,0); | ||
| 43 | |||
| 44 | for(j = 0 ; j < (2*W+1) ; ++j) | ||
| 45 | { | ||
| 46 | temp[j] = (float)(expf(-0.5 * (j - W)*(j - W)/(s*s))) ; | ||
| 47 | acc += temp[j]; | ||
| 48 | } | ||
| 49 | |||
| 50 | for(j = 0 ; j < (2*W+1) ; ++j) | ||
| 51 | { | ||
| 52 | temp[j] /= acc ; | ||
| 53 | } | ||
| 54 | |||
| 55 | /* | ||
| 56 | ** Convolve along the columns | ||
| 57 | **/ | ||
| 58 | |||
| 59 | for(j = 0 ; j < M ; ++j) | ||
| 60 | { | ||
| 61 | for(i = 0 ; i < N ; ++i) | ||
| 62 | { | ||
| 63 | int startCol = MAX(i-W,0); | ||
| 64 | int endCol = MIN(i+W, N-1); | ||
| 65 | int filterStart = MAX(0, W-i); | ||
| 66 | |||
| 67 | assert(j < array->height); | ||
| 68 | assert(j < buffer->height); | ||
| 69 | assert(i < buffer->width); | ||
| 70 | for(k=startCol; k<=endCol; k++) { | ||
| 71 | assert(k < array->width); | ||
| 72 | assert(filterStart < 2*W+1); | ||
| 73 | subsref(buffer,j,i) += subsref(array, j, k) * temp[filterStart++]; | ||
| 74 | } | ||
| 75 | } | ||
| 76 | } | ||
| 77 | |||
| 78 | /* | ||
| 79 | ** Convolve along the rows | ||
| 80 | **/ | ||
| 81 | for(j = 0 ; j < M ; ++j) | ||
| 82 | { | ||
| 83 | for(i = 0 ; i < N ; ++i) | ||
| 84 | { | ||
| 85 | int startRow = MAX(j-W,0); | ||
| 86 | int endRow = MIN(j+W, M-1); | ||
| 87 | int filterStart = MAX(0, W-j); | ||
| 88 | for(k=startRow; k<=endRow; k++) | ||
| 89 | subsref(out,j,i) += subsref(buffer,k,i) * temp[filterStart++]; | ||
| 90 | } | ||
| 91 | } | ||
| 92 | |||
| 93 | fFreeHandle(buffer); | ||
| 94 | |||
| 95 | } | ||
| 96 | else | ||
| 97 | { | ||
| 98 | for(i=0;i<M*N;i++) | ||
| 99 | asubsref(out, i) = asubsref(array, i); | ||
| 100 | } | ||
| 101 | |||
| 102 | |||
| 103 | return; | ||
| 104 | } | ||
