To fix the issue you can do Such problem may be solved by expanding an image to required size and then applying the kernel to ROI. For example, to apply 5*5 kernel to 100*100 image, you can expand the image to 102*102 size by duplicating an edge pixels, and then apply the kernel to the 100*100 ROI in the center.
I hope this helps . I still don't know what caused the problem, but I found a workaround. Since I wanted to blur the image more either way, I just scaled the bitmap down, before blurring it. Afterwards I scaled it up again. The rescaling seems to solve my problem somehow.