Box Blur (3x3)
In computer graphics you sometimes need to blur the image. Many Shader algorithms require a blur for example Bloom, SSAO, Motion Blur, Depth of Field, etc. Box blur is a simple way to blur an image although it has some problems. first it is inefficient as it has to do a lot of texture reads. Secondly it causes aliasing.the Box blur algorithm is a very simple one. you sample the color at the pixel the fragment shader is at then add the one to the left of it to it. Add the one to the right of it. Add the one above it. Add the one above and to the left. Add the one above and to the right. Add the one below. Add the one below and to the left and add the one below and to the right. basically add each of the pixels colors in a 3x3 matrix such that the current fragment is the middle of that matrix. Then divide the sum of the pixels' color by 9. and that is your resulting fragment color.
here are some examples of box Blur.
![]() |
http://codecave.org/image-processing/chap_area.html |
![]() |
http://www.jhlabs.com/ip/blurring.html |
![]() |
http://javaimageprocessingtutorial.blogspot.ca/ |
No comments:
Post a Comment