Hi,
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
the problem is that i need to do it 150 times a second(5 times per frame, 30fps) and i need to be able to do it for 10-20 images(the images are small... around 6500 pixels total)
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 :)
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
Code:
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 :)
Comment