I need a fast way to smooth an image multiple times fast.
The way that i am currently using works like this(written in c#)
NOTE i am only smoothing the R value of the RGB color
Expand|Select|Wrap|Line Numbers
- for(int i=1;i<height-1;i++)
- {
- for(int j=1;j<width-1;j++)
- {
- int n1 = image[j,i-1].R;
- int n2 = image[j,i+1].R;
- int n3 = image[j-1,i].R;
- int n4 = image[j + 1, i].R;
- int n5 = image[j,i].R;
- image[j,i].R = (n1+n2+n3+n4+n5)/5;
- }
- }
my current implementation can handle 1 image, the frame rate is over 30fps but with 5 images it drops below 10fps
NOTE when i say image, it doesn't mean that it has to be an image or a bitmap it can be a two dimensional integer array or even a 1 dimensional representation of a two dimensional integer array
NOTE2 i need a way to do it a lot faster so it doesn't have to be as precise as my algorithm
basically what i need is a fast way to smooth an image so it looks similar to the image that has been smoothed 5 times by my algorithm(since i am smoothing it each frame)
thx in advance :)