I took a look at the i.pansharpen code. The method matchhist does the histogram 
matching. It creates cumulative distribution functions (CDF) of the source and 
target histograms and then finds the closest values to match at each point on 
the CDF. It is pretty thoroughly documented in the code. There are other 
methods of histogram matching, but IIRC, this was the most basic and 
widespread. As some others have commented, it assumes that images have 256 
integer grey values. A more sophisticated histogram matching algorithm could 
utilize floating point values and a wider range of values. Hope this helps

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 15, 2013, at 3:20 AM, Moritz Lennert <mlenn...@club.worldonline.be> 
wrote:

> On 15/11/13 10:50, Nikos Alexandris wrote:
>> Nikos Alexandris wrote:
>> 
>>>> together with Nikos Ves, we share the "i.fusion.hpf" idea/proof of
>> 
>>>> concept. At the moment, we have a custom shell script named
>> 
>>>> `i.fusion.hpf` (an attempt for a proper GRASS add-on), which implements
>> 
>>>> the High Pass Filter Additive (HPFA) Fusion Technique for
>> Pan-Sharpening
>> 
>>>> [*]. Nikos V started already porting to Python. How can we proceed in
>> 
>>>> sharing it?
>> 
>>> 
>> 
>>> [...]
>> 
>>> 
>> 
>>>> Two questions
>> 
>>>> 
>> 
>>>> ? Can someone confirm that the part of the existing "i.pansharpen" code
>> 
>>>> that performs histogram matching (code lines 348 - 431), do so as
>> 
>>>> "linearly stretching an image to match another image's Mean and
>> StdDev"?
>> 
>> Moritz Lennert:
>> 
>>> AFAICT, it applies the method described in [1].
>> 
>> Is that a reference also indicated in i.pansharpen's manual?
> 
> It's not in the manual, but there's a long list of other references. But 
> Michael is the one who knows where the inspiration came from. AFAIK, 
> this is the classical, generic method of histogram matching.
> 
>> 
>>> I don't know (and don't have the time to think about) what this
>> method does
>> 
>>> in terms of mean and stddev.
>> 
>> My guess was/is that it is not the same, i.e. it does not match Mean and
>> StdDev. As a quick test, I tried the identical (me thinks) tool in
>> WhiteboxGIS "Histogram Matching (Two Images)", does not give identical
>> Means and StdDevs after the operation -- which is the case with
>> i.pansharpen too if I am not wrong.
>> 
> 
> I just did a quick test:
> 
> pan in:
> 
> mean: 31.813
> standard deviation: 3.75447
> 
> ms in:
> 
> mean: 15.2307
> standard deviation: 3.55858
> 
> pan out:
> 
> mean: 15.6117
> standard deviation: 3.23408
> 
> So for this example, mean seems to have been adjusted, but stddev not.
> 
>>>> ? Would it be desired to get the HPFA algorithm integrated in
>> 
>>>> i.pansharpen?
>> 
>>> 
>> 
>>> Yes. I think that if we have a generic module such as i.pansharpen, it
>> 
>>> would be preferable to have all pansharpening methods in that one module.
>> 
>> There is one "difference" in that HPFA treats all bands to be sharpened
>> separately. And, in this manner, it can be (mis-)used to sharpen any
>> low-res band. For example, WorldView-2 products have 8 multi-spectral
>> bands. Hence the "not red= green= blue=" design so far from my side.
> 
> i.pansharpen does not imply rgb either (although the description of the 
> ms* parameters does suggest that. You can obviously use any ms bands you 
> want.
> 
> Moritz

_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Reply via email to