[GRASS-dev] Implementation of the High Pass Filter Additive Fusion technique (i.fusion.hpf)

Nick Ves vesnikos at gmail.com
Fri Nov 22 01:07:23 PST 2013


On Thu, Nov 21, 2013 at 10:20 PM, Michael Barton <Michael.Barton at asu.edu> wrote:
> I tried to implement this as an alternate way of histogram matching in
> i.pansharpen (attached as i.pansharpen3). It works and gives different
> colors, but it no longer sharpens. I’m attaching the code for you to look at
> (new method matchhist_mean_sd). I’m tied up the rest of the afternoon. So
> maybe someone else can puzzle this out.
>

Aaah nice!

I've already taken steps to implement it on my own - but I couldnt
decided if I wanted multiple threads or not... heh

I want to give it a look during the weekend and maybe I will be able
to figure why it does that

> Michael
>
>
> ____________________
> C. Michael Barton
> Director, Center for Social Dynamics & Complexity
> Professor of Anthropology, School of Human Evolution & Social Change
> Arizona State University
>
> voice:   480-965-6262 (SHESC), 480-965-8130/727-9746 (CSDC)
> fax:          480-965-7671 (SHESC),  480-727-0709 (CSDC)
> www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu
>
>
>
>
>
>
>
>
>
>
>
>
> On Nov 21, 2013, at 12:38 AM, Nikos Alexandris <nik at nikosalexandris.net>
> wrote:
>
>> Nick Ves wrote:
>>
>>>> The HPF algorithm about the histrogram matching states "Stretch the
>>>> new multispectral image to match the mean and standard deviation of
>>>> the original (input) multispectral image"
>>>> In that context why it is wrong to do:
>>
>>>> Ouput <- output/sddev(output)*sddev(input)
>>>> Output <- Output - mean(output) + mean(input)
>>
>> Moritz Lennert:
>>
>>> To give the 'new' image the same mean and stddev of the 'input' image:
>>> (new - mean(new)) / stddev(new) * stddev(input) + mean(input)
>>
>> Not entirely sure, I think it works. Taken a fragment from the publicly
>> available QuickBird2 image over Sri Lanka (the extent shown at
>>
>> <http://grasswiki.osgeo.org/wiki/File:RGB_04APR05050541-M2AS-000000186011_01_P001.jpg>),
>>
>>
>> get mean and sd for r, g and b
>>
>> # red
>> mean_red=321.375
>> sd_red=172.756
>>
>> # hpf_red
>> mean_red_hpf=321.364
>> sd_red_hpf=238.391
>>
>> # green
>> mean_green=434.033
>> sd_green=159.9
>>
>> # hpf_green
>> mean_green_hpf=434.02
>> sd_green=258.249
>>
>> # blue
>> mean_blue=285.168
>> sd_blue=75.0218
>>
>> # hpf_blue
>> mean_blue_hpf=285.161
>> sd_blue_hpf=145.395
>>
>>
>> and then
>>
>> r.mapcalc "hpf_red_histomatched = ( hpf_red - $mean_red_hpf ) /
>> $sd_red_hpf *
>> $sd_red + $mean_red" --o
>>
>> r.mapcalc "hpf_blue_histomatched = ( hpf_blue - $mean_blue_hpf ) /
>> $sd_blue_hpf * $sd_blue + $mean_blue" --o
>>
>> r.mapcalc "hpf_green_histomatched = ( hpf_green - $mean_green_hpf ) /
>> $sd_green_hpf * $sd_green + $mean_green" --o
>>
>>
>> check output stats
>>
>> # r.univar hpf_red_histomatched
>> mean: 321.375
>> standard deviation: 172.756
>>
>> # r.univar hpf_green_histomatched
>> mean: 434.033
>> standard deviation: 159.9
>>
>> # r.univar hpf_blue_histomatched
>> mean: 285.168
>> standard deviation: 75.0217
>>
>> # reset colors to match originals doesn't play exactly nice, so
>> r.colors hpf_red_histomatched color=grey -e
>> # repeat for green, blue
>>
>> # draw
>> d.rgb ...
>>
>>
>> Looks nice! Is it that?
>>
>> Nikos
>


More information about the grass-dev mailing list