diff options
| author | leochanj105 <leochanj@live.unc.edu> | 2020-10-19 23:09:30 -0400 |
|---|---|---|
| committer | leochanj105 <leochanj@live.unc.edu> | 2020-10-20 02:40:39 -0400 |
| commit | f618466c25d43f3bae9e40920273bf77de1e1149 (patch) | |
| tree | 460e739e2165b8a9c37a9c7ab1b60f5874903543 /SD-VBS/common/c | |
| parent | 47ced4e96bbb782b9e780e8f2cfc637b2c21ff44 (diff) | |
initial sd-vbs
initial sd-vbs
add sd-vbs
sd-vbs
Diffstat (limited to 'SD-VBS/common/c')
77 files changed, 3402 insertions, 0 deletions
diff --git a/SD-VBS/common/c/calcSobel_dX.c b/SD-VBS/common/c/calcSobel_dX.c new file mode 100644 index 0000000..4be5845 --- /dev/null +++ b/SD-VBS/common/c/calcSobel_dX.c | |||
| @@ -0,0 +1,77 @@ | |||
| 1 | /******************************** | ||
| 2 | Author: Sravanthi Kota Venkata | ||
| 3 | ********************************/ | ||
| 4 | |||
| 5 | #include <stdio.h> | ||
| 6 | #include <stdlib.h> | ||
| 7 | #include "sdvbs_common.h" | ||
| 8 | |||
| 9 | F2D* calcSobel_dX(F2D* imageIn) | ||
| 10 | { | ||
| 11 | int rows, cols; | ||
| 12 | F2D *kernel_1, *kernel_2; | ||
| 13 | float temp; | ||
| 14 | int kernelSize, startCol, endCol, halfKernel, startRow, endRow, i, j, kernelSum; | ||
| 15 | int k, kernelSum_1, kernelSum_2; | ||
| 16 | F2D *imageOut, *tempOut; | ||
| 17 | |||
| 18 | rows = imageIn->height; | ||
| 19 | cols = imageIn->width; | ||
| 20 | |||
| 21 | imageOut = fSetArray(rows, cols, 0); | ||
| 22 | tempOut = fSetArray(rows, cols, 0); | ||
| 23 | kernel_1 = fMallocHandle(1, 3); | ||
| 24 | kernel_2 = fMallocHandle(1, 3); | ||
| 25 | |||
| 26 | asubsref(kernel_1,0) = 1; | ||
| 27 | asubsref(kernel_1,1) = 2; | ||
| 28 | asubsref(kernel_1,2) = 1; | ||
| 29 | |||
| 30 | kernelSize = 3; | ||
| 31 | kernelSum_1 = 4; | ||
| 32 | |||
| 33 | asubsref(kernel_2,0) = 1; | ||
| 34 | asubsref(kernel_2,1) = 0; | ||
| 35 | asubsref(kernel_2,2) = -1; | ||
| 36 | |||
| 37 | kernelSum_2 = 2; | ||
| 38 | |||
| 39 | startCol = 1; | ||
| 40 | endCol = cols - 1; | ||
| 41 | halfKernel = 1; | ||
| 42 | |||
| 43 | startRow = 1; | ||
| 44 | endRow = rows - 1; | ||
| 45 | |||
| 46 | for(i=startRow; i<endRow; i++) | ||
| 47 | { | ||
| 48 | for(j=startCol; j<endCol; j++) | ||
| 49 | { | ||
| 50 | temp = 0; | ||
| 51 | for(k=-halfKernel; k<=halfKernel; k++) | ||
| 52 | { | ||
| 53 | temp += subsref(imageIn,i,j+k) * asubsref(kernel_2,k+halfKernel); | ||
| 54 | } | ||
| 55 | subsref(tempOut,i,j) = temp/kernelSum_2; | ||
| 56 | } | ||
| 57 | } | ||
| 58 | |||
| 59 | for(i=startRow; i<endRow; i++) | ||
| 60 | { | ||
| 61 | for(j=startCol; j<endCol; j++) | ||
| 62 | { | ||
| 63 | temp = 0; | ||
| 64 | for(k=-halfKernel; k<=halfKernel; k++) | ||
| 65 | { | ||
| 66 | temp += subsref(tempOut,(i+k),j) * asubsref(kernel_1,k+halfKernel); | ||
| 67 | } | ||
| 68 | subsref(imageOut,i,j) = temp/(float)kernelSum_1; | ||
| 69 | } | ||
| 70 | } | ||
| 71 | |||
| 72 | fFreeHandle(tempOut); | ||
| 73 | fFreeHandle(kernel_1); | ||
| 74 | fFreeHandle(kernel_2); | ||
| 75 | return imageOut; | ||
| 76 | |||
| 77 | } | ||
diff --git a/SD-VBS/common/c/calcSobel_dY.c b/SD-VBS/common/c/calcSobel_dY.c new file mode 100644 index 0000000..d2ed379 --- /dev/null +++ b/SD-VBS/common/c/calcSobel_dY.c | |||
| @@ -0,0 +1,79 @@ | |||
| 1 | /******************************** | ||
| 2 | Author: Sravanthi Kota Venkata | ||
| 3 | ********************************/ | ||
| 4 | |||
