473,386 Members | 1,908 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Smoothing an image multiple times fast

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
Expand|Select|Wrap|Line Numbers
  1. for(int i=1;i<height-1;i++)
  2. {
  3.    for(int j=1;j<width-1;j++)
  4.    {
  5.       int n1 = image[j,i-1].R;
  6.       int n2 = image[j,i+1].R;
  7.       int n3 = image[j-1,i].R;
  8.       int n4 = image[j + 1, i].R;
  9.       int n5 = image[j,i].R;
  10.       image[j,i].R = (n1+n2+n3+n4+n5)/5;
  11.    }
  12. }
  13.  
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 :)
Jan 5 '12 #1
1 1575
Rabbit
12,516 Expert Mod 8TB
Well, one improvement is to stop recreating the variables in the loop and just do this:
Expand|Select|Wrap|Line Numbers
  1. image[j,i].R = (image[j,i-1].R + image[j,i+1].R + image[j-1,i].R + image[j+1,i].R + image[j,i].R)/5
And if speed is more important than quality, you can probably skip every other pixel.
Jan 5 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: chinagirl | last post by:
I have a javascript that displays couple of buttons, which are directional (e.g., click button it goes to a particular page). I need to have these buttons shows up multiple times in same page,...
3
by: wxbuff | last post by:
I have a report based on our product names that consists of two parts. Both insert data into a temporary table. 1. A single grouped set of results based on all products 2. Multiple tables based...
2
by: Larry Marburger | last post by:
I've built and XSLT that is used to generate a simple TreeView-type, web-based control (ASP.NET / C#). When the tree is fully transformed (client-side, JavaScript transformation), there are about...
1
by: Luther Miller | last post by:
I've created a web setup project that works great for installing an ASP.NET application to a virtual directory on a server. I'd like to be able to use the same setup program to install multiple...
0
by: Jonathan Duke | last post by:
I have written a custom session state provider that stores session data in XML in a SQL database , and I was running the SQL profiler to verify that all of my stored procedures were called in the...
22
by: Brett Romero | last post by:
If my UI app uses three DLLs and two of those DLLs reference something named utilities.dll, does the UI app load utilities.dll twice or does the compiler recognize what is going on and load...
2
by: Alan Foxmore | last post by:
Hi Everyone, I'm new to ASP.NET so maybe this is easy. I'm using ASP.NET 2.0. I'm finding that the Application object (the HttpApplicationState object) is allowing me to add the same key...
6
by: yk | last post by:
Hi, Is it a technique available in html/javascript in order to display same image many many times on a same page? Because of a large page loading I am looking for a way not to have same...
5
by: billa856 | last post by:
Hi, My project is in MS Access 2002. In that I want to open one form multiple times. I put one button on my main form. Now whenever I click on that button than form will be open. Now when I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.