diff options
| author | Leo Chan <leochanj@live.unc.edu> | 2020-10-22 01:53:21 -0400 |
|---|---|---|
| committer | Joshua Bakita <jbakita@cs.unc.edu> | 2020-10-22 01:56:35 -0400 |
| commit | d17b33131c14864bd1eae275f49a3f148e21cf29 (patch) | |
| tree | 0d8f77922e8d193cb0f6edab83018f057aad64a0 /SD-VBS/benchmarks/stitch/src/c/matchFeatures.c | |
| parent | 601ed25a4c5b66cb75315832c15613a727db2c26 (diff) | |
Squashed commit of the sb-vbs branch.
Includes the SD-VBS benchmarks modified to:
- Use libextra to loop as realtime jobs
- Preallocate memory before starting their main computation
- Accept input via stdin instead of via argc
Does not include the SD-VBS matlab code.
Fixes libextra execution in LITMUS^RT.
Diffstat (limited to 'SD-VBS/benchmarks/stitch/src/c/matchFeatures.c')
| -rw-r--r-- | SD-VBS/benchmarks/stitch/src/c/matchFeatures.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/SD-VBS/benchmarks/stitch/src/c/matchFeatures.c b/SD-VBS/benchmarks/stitch/src/c/matchFeatures.c new file mode 100644 index 0000000..5450eb9 --- /dev/null +++ b/SD-VBS/benchmarks/stitch/src/c/matchFeatures.c | |||
| @@ -0,0 +1,55 @@ | |||
| 1 | /******************************** | ||
| 2 | Author: Sravanthi Kota Venkata | ||
| 3 | ********************************/ | ||
| 4 | |||
| 5 | #include "stitch.h" | ||
| 6 | |||
| 7 | I2D* matchFeatures(F2D* vecF1, F2D* vecF2) | ||
| 8 | { | ||
| 9 | int m, n, n1, n2, n1c, n2c, i, j; | ||
| 10 | I2D *id, *retMatch, *t; | ||
| 11 | F2D *val, *temp; | ||
| 12 | int rows, cols; | ||
| 13 | |||
| 14 | n1 = vecF1->height; | ||
| 15 | n1c = vecF1->width; | ||
| 16 | n2 = vecF2->height; | ||
| 17 | n2c = vecF2->width; | ||
| 18 | |||
| 19 | retMatch = iMallocHandle(1, 2); | ||
| 20 | |||
| 21 | for(i=0; i<n1; i++) | ||
| 22 | { | ||
| 23 | id = iMallocHandle(1, n2); | ||
| 24 | t = iMallocHandle(1, n1c); | ||
| 25 | |||
| 26 | for(j=0; j<n1c; j++) | ||
| 27 | asubsref(t,j) = subsref(vecF1,i,j); | ||
| 28 | |||
| 29 | temp = dist2(t, vecF2); | ||
| 30 | val = fSort(temp,1); | ||
| 31 | id = fSortIndices(temp,1); | ||
| 32 | |||
| 33 | free(temp); | ||
| 34 | free(t); | ||
| 35 | |||
| 36 | if( asubsref(val,1) != 0 & (( asubsref(val,0) / asubsref(val,1) ) < 0.65)) | ||
| 37 | { | ||
| 38 | t = retMatch; | ||
| 39 | rows = t->height + 1; | ||
| 40 | cols = t->width; | ||
| 41 | retMatch = iMallocHandle(rows, cols); | ||
| 42 | n = 0; | ||
| 43 | |||
| 44 | for(m=0; m<(t->height*t->width); m++) | ||
| 45 | { | ||
| 46 | asubsref(retMatch,n++) = asubsref(t,m); | ||
| 47 | } | ||
| 48 | |||
| 49 | asubsref(retMatch,n++) = i; | ||
| 50 | asubsref(retMatch,n) = asubsref(id,0); | ||
| 51 | } | ||
| 52 | } | ||
| 53 | |||
| 54 | return retMatch; | ||
| 55 | } | ||
