On Fri, 09 Mar 2007 05:31:26 +0100,  

> Quoting "Luis A. Florit" <[EMAIL PROTECTED]>:
>> http://w3.impa.br/~luis/fotos/lixo/grid_blurred.jpg
>> You can see three problems:
>> 1) The old 1-pixel-down shift.
>> 2) The two dark bands (20 lines each) at top and bottom of the image.
>> 3) Even much intriguing is the grey band right below the top one,
>>     also of 20 lines! And it is homogeneous (no likes inside)...
>> My 'solution' (change 'x1, y1,' in line 241 by 'x1, y1+1,')
>> took care of the shift, but not of the banding.
> The dark bands can be attributed to the fact that the averaged region
> near the borders is "filled out" by effectively duplicating the row or
> column at the edges. The algorithm may not be optimal, but it works as
> one should expect.
> The average is currently produced by a formula similar to:
> sum (v-2, v-1, v, v+1, v+2) / 5
> Near the borders, when there is no value "v+2" available, for example,
> you end up with:
> sum (v-2, v-1, v, v+1, v+1) / 5
> And the next pixel will be:
> sum (v-2, v-1, v, v, v) / 5
> If you wish to improve the algorithm, I would suggest that you need to
> discard terms and adjust the denominator accordingly -- the last
> example shown should produce "sum (v-2, v-1, v) / 3".
> At least, that is my recommendation. I am not a mathematician.
> _______________________________________________
> Gimp-developer mailing list
> Gimp-developer@lists.XCF.Berkeley.EDU
> https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

yes the border handling is pretty basic. YOu could look at the convolution  
filter (one of the plugins built with gimp) for different methods of  
dealing with borders.

The basic problem is that this will always be extrapolation outside the  
real data so its a guess. With a pattern like your grid this can easily be  
badly wrong.

The best simple method would be a linear extrapolation over a few points.  
This would at least prevent a black line becoming a black band as you are  
seeing here.

Another approach would be to not process areas with unknown data, ie leave  
a band unblurred and then replace this with an extrapolation of the edges  
of the reduces area containing correct data. This will provide more  
visually acceptable results in your test case although this can never be  
mathematically rigourous since you are arbitarily extrapolation outside  
known data.

This may well be an approach worth investigating throughout gimp since  
current methods seem to be somewhat rudementary.

Gimp-developer mailing list

Reply via email to