2

This is happening because your loop is summing values from neighbors to the left and up of the current pixel that have already been blurred by previous iterations of the same loop. You need to modify a copy of image[][], not image[][] itself. memcpy can help you copy the data from image[][] into another two dimensional array. Otherwise, your function seems ...


2

Please note I haven't validated this with testing and have only glanced at your code, but one thing that stands out to me: round((float) (sum_blue / pixel_type)) Remember operator precedence here: the division will be performed first (as it is inside parentheses). At this point both values are integers so integer division will be performed and the remainder ...


1

Just get rid of int x=0; and replace x+i-1 with int x = i - 1. Likewise for the variable y. You can put any expression or declaration in the first section of the for loop. https://en.cppreference.com/w/c/language/for If this answers your question, please click on the check mark to accept. Don't be shy to ask another question the next time you have an issue!


1

I solved it! There was an unnecessary for loop incrementing z and the absence of a copy of the image to work on.


Only top voted, non community-wiki answers of a minimum length are eligible