summaryrefslogtreecommitdiffstats
path: root/SD-VBS/common/c/imageReblur.c
diff options
context:
space:
mode:
Diffstat (limited to 'SD-VBS/common/c/imageReblur.c')
-rw-r--r--SD-VBS/common/c/imageReblur.c67
1 files changed, 67 insertions, 0 deletions
diff --git a/SD-VBS/common/c/imageReblur.c b/SD-VBS/common/c/imageReblur.c
new file mode 100644
index 0000000..1755f67
--- /dev/null
+++ b/SD-VBS/common/c/imageReblur.c
@@ -0,0 +1,67 @@
1/********************************
2Author: Sravanthi Kota Venkata
3********************************/
4
5#include "sdvbs_common.h"
6
7F2D* imageReblur(I2D* imageIn, F2D* imageOut, F2D* tempOut, I2D* kernel)
8{
9 int rows, cols;
10 //F2D *imageOut, *tempOut;
11 float temp;
12 //I2D *kernel;
13 int k, kernelSize, startCol, endCol, halfKernel, startRow, endRow, i, j, kernelSum;
14
15 rows = imageIn->height;
16 cols = imageIn->width;
17
18 fResetArray(imageOut, rows, cols, 0);
19 fResetArray(tempOut, rows, cols, 0);
20 //kernel = iMallocHandle(1, 5);
21
22 asubsref(kernel,0) = 1;
23 asubsref(kernel,1) = 4;
24 asubsref(kernel,2) = 6;
25 asubsref(kernel,3) = 4;
26 asubsref(kernel,4) = 1;
27 kernelSize = 5;
28 kernelSum = 16;
29
30 startCol = 2;
31 endCol = cols - 2;
32 halfKernel = 2;
33
34 startRow = 2;
35 endRow = rows - 2;
36
37 for(i=startRow; i<endRow; i++){
38 for(j=startCol; j<endCol; j++)
39 {
40 temp = 0;
41 for(k=-halfKernel; k<=halfKernel; k++)
42 {
43 temp += subsref(imageIn,i,j+k) * asubsref(kernel,k+halfKernel);
44 }
45 subsref(tempOut,i,j) = temp/kernelSum;
46 }
47 }
48
49 for(i=startRow; i<endRow; i++)
50 {
51 for(j=startCol; j<endCol; j++)
52 {
53 temp = 0;
54 for(k=-halfKernel; k<=halfKernel; k++)
55 {
56 temp += subsref(tempOut,(i+k),j) * asubsref(kernel,k+halfKernel);
57 }
58 subsref(imageOut,i,j) = temp/kernelSum;
59 }
60 }
61
62 //fFreeHandle(tempOut);
63 //iFreeHandle(kernel);
64 return imageOut;
65}
66
67