I have the binary function done for this question, but I can't get the blur function to work using arrays/matrices. Can anyone help me? This is what I have so far:
void threshold(int src[], int rows, int cols, int dest[], int thr) {
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++)
if (src[i*cols + j] > thr)
dest[i*cols + j] = 255;
else
dest[i*cols + j] = 0;
}
}
/** blur ******************************************************************
* @params - src, in any units, @pre=>0
* rows, in any units, @pre=>0, must be a whole number
* cols, in any units, @pre=>0, must be a whole number
* dest, in any units, @pre=0 or 255
* @modifies - returns the array dest
* @returns - nothing
**************************************************************************/
void blur(int src[], int rows, int cols, int dest[]) {
int count;
for (int i = 0; i<rows; i++) {
for (int j = 0; j<cols; j++)
for (int count = 4; count <= i*cols + j; count++)
int sum[i*j];
sum += src[count];
dest = sum / count;
}
}
I'm not exactly sure where I'm going wrong.
All the resources and information can be found here:
http://www.engr.mun.ca/~mpbl/content/courses/2420/postings/assign8/assign8.htm