# Thread: finding a weighted average using "linear weight"

1. say i have and image of 1000 pixels by 1000 pixels, and each pixel holds a value. but there are some pixels that are blocked out (ie value-less). now, i want to find a value for a value-less pixel, and how i want to do this is by finding a weighted-average from the surrounding pixels. what this means is that i will pick out the valued pixels that lie within, say, 10 pixel steps from the valueless pixel, then assign a weight to these valued pixels based on their distances away from the valueless pixel. the further away it is, the less weight is assigned.

the problem is, what kind of linear weight trend should i use? what kind of weight do i assign to a pixel of a particular distance? can i use any arbitrary assignments or is there some kind of commonly-used method?

2.

3. Perhaps this is a mathematical question rather than earth sciences?

4. oh i posted it here because it's related to satellite image processing, and not mathematical enough. should i post it there instead?

5. moved to maths

6. You could start with either the median or use Gaussian weights. I'm not sure that's exactly what you're looking for though.

7. Originally Posted by MagiMaster
You could start with either the median or use Gaussian weights. I'm not sure that's exactly what you're looking for though.
I presume it's for image enhancement - to match an unassigned pixel to surrounding pixels that already have a weighting.

The problem I foresee is trying to figure out a programme/equation that will take into account the two dimensional nature of this matter: suppose East -West (to arbitrarily assign a direction), the pixels are all pretty much the same, but North-South there's a steep gradient (if using grayscale, say, there's a big difference in tone), then any equation that takes all the surrounding pixels into account might well give it an aberrant value.

I presume, however, that there are loads of image enhancement programs around tht would take all this into acount.

bobby2009: Are you sure you want to do this from scratch?

8. The Gaussian should give a reasonably close answer in most such cases, assuming you don't make it too big. But yeah, there are probably some gradient based methods that would take such things into account more directly.

 Bookmarks
##### Bookmarks
 Posting Permissions
 You may not post new threads You may not post replies You may not post attachments You may not edit your posts   BB code is On Smilies are On [IMG] code is On [VIDEO] code is On HTML code is Off Trackbacks are Off Pingbacks are Off Refbacks are On Terms of Use Agreement