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/tracking/src/c/calcAreaSum.c | 81 ++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 SD-VBS/benchmarks/tracking/src/c/calcAreaSum.c (limited to 'SD-VBS/benchmarks/tracking/src/c/calcAreaSum.c') diff --git a/SD-VBS/benchmarks/tracking/src/c/calcAreaSum.c b/SD-VBS/benchmarks/tracking/src/c/calcAreaSum.c new file mode 100644 index 0000000..40f03dc --- /dev/null +++ b/SD-VBS/benchmarks/tracking/src/c/calcAreaSum.c @@ -0,0 +1,81 @@ +/******************************** +Author: Sravanthi Kota Venkata +********************************/ + +#include "tracking.h" + +/** Compute the sum of pixels over pixel neighborhood. + Neighborhood = winSize*winSize + This will be useful when we compute the displacement + of the neighborhood across frames instead of tracking each pixel. + + Input: src Image + # rows, cols, size of window + Output: windowed-sum image, ret. + + Example: + + winSize = 4, cols = 8, rows = 16 + nave_half = 2, nave = 4 + Say, the first row of the image is: + 3 8 6 2 4 8 9 5 + a1 = 0 0 3 8 6 2 4 8 9 5 0 0 (append nave_half zeros to left and right border) + asum = (sum the first nave # pixels - 0 0 3 8 ) = 11 + ret(0,0) = 11 + For ret(0,1), we need to move the window to the right by one pixel and subtract + from a1sum the leftmost pixel. So, we add value 6 and subtract value at a1(0,0), = 0 here. + ret(0,1) = 17 = a1sum + For ret(0,2), a1sum - a1(0,1) + a1(2+nave) = 17 - 0 + 2 = 19 = a1sum + For ret(0,3), a1sum - a1(0,2) + a1(3+nave) = 19 - 3 + 4 = 20 = a1sum + + We proceed this way for all the rows and then perform summantion across all cols. +**/ +F2D* calcAreaSum(F2D* src, int cols, int rows, int winSize) +{ + int nave, nave_half, i, j, k; + F2D *ret, *a1; + float a1sum; + + nave = winSize; + nave_half = floor((nave+1)/2); + + ret = fMallocHandle(rows, cols); + a1 = fSetArray(1, cols+nave,0); + + for(i=0; i