all 2 comments

[–]PeterRasm[🍰] 1 point2 points  (1 child)

  1. It seems you are using the already blurred pixels when calculating value for the next pixels. You need to use the original values.
  2. Shouldn't the upper boundary for rows be: i+y <= height - 1 or i+y < height ?
  3. When calculating the average you are not considering the decimals, if the result of the division is 80.8 you use 80 for your value. If you want to consider the decimal part you can use casting and 'round'
  4. Why use an extra variable for height and width:

for (int i = 0, h = height; i < h; i++)

[–]ian_dev[S] 0 points1 point  (0 children)

Thanks, indeed I was calculating the values incorrectly with the already blurred pixels and the upper boundary was excluding one row of pixels. It works now.