[GRASS-user] unexpected i.pansharpen results

i.pansharpen uses Python, not Bash. So it is not an integer math problem.

However, you might try changing your input maps to float or DCELL. See if that changes things.

Michael

···

On 31 January 2013 14:06, Hamish <hamish_b@yahoo.com> wrote:

(sorry for the html,top posting)

I wonder if the script is doing integer division when it should be doing floating point division?

http://trac.osgeo.org/grass/browser/grass/trunk/scripts/i.pansharpen/i.pansharpen.py


Hamish

— On Wed, 1/30/13, Eric Goddard <egoddard1010@gmail.com> wrote:


> From: Eric Goddard <egoddard1010@gmail.com>
> Subject: [GRASS-user] unexpected i.pansharpen results
> To: grass-user@lists.osgeo.org
> Date: Wednesday, January 30, 2013, 8:30 AM
>
> Hi all,
>
> I’m attempting to pansharpen some ikonos imagery using the i.pansharpen tool in Grass7 on windows 7 installed via OSGeo4W (r54756-478). The range for the sharpened red, green, and blue outputs are 0-30, which seems suspicious given the 16bit range of the input bands. The command I used was:
>
> i.pansharpen.py “sharpen=ihs” “ms3=ik_mss.4@eric” “ms2=ik_mss.3@eric” “ms1=ik_mss.2@eric” “pan=ik_pan@eric” “output_prefix=ik_ihs”
>
> The input bands are linked via r.external, would that matter?
>
> The output from my test area is below. Any assistance would be greatly appreciated.<image.png>
>
> Thanks,
>
> Eric
>
> -----Inline Attachment Follows-----
>
> _______________________________________________
> grass-user mailing list
> grass-user@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user

Thanks Michael, I’ll give that a try and see what happens.

···

On 31 January 2013 14:06, Hamish <hamish_b@yahoo.com> wrote:

(sorry for the html,top posting)

I wonder if the script is doing integer division when it should be doing floating point division?

http://trac.osgeo.org/grass/browser/grass/trunk/scripts/i.pansharpen/i.pansharpen.py


Hamish

— On Wed, 1/30/13, Eric Goddard <egoddard1010@gmail.com> wrote:


> From: Eric Goddard <egoddard1010@gmail.com>
> Subject: [GRASS-user] unexpected i.pansharpen results
> To: grass-user@lists.osgeo.org
> Date: Wednesday, January 30, 2013, 8:30 AM
>
> Hi all,
>
> I’m attempting to pansharpen some ikonos imagery using the i.pansharpen tool in Grass7 on windows 7 installed via OSGeo4W (r54756-478). The range for the sharpened red, green, and blue outputs are 0-30, which seems suspicious given the 16bit range of the input bands. The command I used was:
>
> i.pansharpen.py “sharpen=ihs” “ms3=ik_mss.4@eric” “ms2=ik_mss.3@eric” “ms1=ik_mss.2@eric” “pan=ik_pan@eric” “output_prefix=ik_ihs”
>
> The input bands are linked via r.external, would that matter?
>
> The output from my test area is below. Any assistance would be greatly appreciated.<image.png>
>
> Thanks,
>
> Eric
>
> -----Inline Attachment Follows-----
>
> _______________________________________________
> grass-user mailing list
> grass-user@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user

On Thu, Jan 31, 2013 at 7:06 PM, Michael Barton <Michael.Barton@asu.edu> wrote:

i.pansharpen uses Python, not Bash. So it is not an integer math problem.

But it calls r.mapcalc, e.g. in lines 151-153. If k is integer and not
float, r.mapcalc will do integer division. Equivalent for lines 159,
162, 165. This could be fixed by casting the numerator to double with
double().

Markus M

However, you might try changing your input maps to float or DCELL. See if that changes things.

Michael
______________________________
C. Michael Barton
Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Arizona State University
Tempe, AZ 85287-2402
USA

voice: 480-965-6262 (SHESC), 480-727-9746 (CSDC)
fax: 480-965-7671(SHESC), 480-727-0709 (CSDC)
www: http://csdc.asu.edu, http://shesc.asu.edu
http://www.public.asu.edu/~cmbarton

On Jan 31, 2013, at 2:11 AM, <grass-user-request@lists.osgeo.org>
wrote:

From: Yann Chemin <yann.chemin@gmail.com>
Subject: Re: [GRASS-user] unexpected i.pansharpen results
Date: January 31, 2013 2:11:33 AM MST
To: Hamish <hamish_b@yahoo.com>
Cc: GRASS user list <grass-user@lists.osgeo.org>

hmmm, yes that looks like an old friend to check...

On 31 January 2013 14:06, Hamish <hamish_b@yahoo.com> wrote:

(sorry for the html,top posting)

I wonder if the script is doing integer division when it should be doing floating point division?

http://trac.osgeo.org/grass/browser/grass/trunk/scripts/i.pansharpen/i.pansharpen.py

Hamish

--- On Wed, 1/30/13, Eric Goddard <egoddard1010@gmail.com> wrote:

From: Eric Goddard <egoddard1010@gmail.com>
Subject: [GRASS-user] unexpected i.pansharpen results
To: grass-user@lists.osgeo.org
Date: Wednesday, January 30, 2013, 8:30 AM

Hi all,

I'm attempting to pansharpen some ikonos imagery using the i.pansharpen tool in Grass7 on windows 7 installed via OSGeo4W (r54756-478). The range for the sharpened red, green, and blue outputs are 0-30, which seems suspicious given the 16bit range of the input bands. The command I used was:

i.pansharpen.py "sharpen=ihs" "ms3=ik_mss.4@eric" "ms2=ik_mss.3@eric" "ms1=ik_mss.2@eric" "pan=ik_pan@eric" "output_prefix=ik_ihs"

The input bands are linked via r.external, would that matter?

The output from my test area is below. Any assistance would be greatly appreciated.<image.png>

Thanks,
Eric

-----Inline Attachment Follows-----

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

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

I don’t think that is the issue. I wasn’t using serial processing, and I was using the IHS method. The only place division occurs in the IHS method is in the histmatch function, but that explicitly casts to float.

···

On Thu, Jan 31, 2013 at 1:52 PM, Markus Metz <markus.metz.giswork@gmail.com> wrote:

On Thu, Jan 31, 2013 at 7:06 PM, Michael Barton <Michael.Barton@asu.edu> wrote:

i.pansharpen uses Python, not Bash. So it is not an integer math problem.

But it calls r.mapcalc, e.g. in lines 151-153. If k is integer and not
float, r.mapcalc will do integer division. Equivalent for lines 159,
162, 165. This could be fixed by casting the numerator to double with
double().

Markus M

However, you might try changing your input maps to float or DCELL. See if that changes things.

Michael


C. Michael Barton
Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Arizona State University
Tempe, AZ 85287-2402
USA

voice: 480-965-6262 (SHESC), 480-727-9746 (CSDC)
fax: 480-965-7671(SHESC), 480-727-0709 (CSDC)
www: http://csdc.asu.edu, http://shesc.asu.edu
http://www.public.asu.edu/~cmbarton

On Jan 31, 2013, at 2:11 AM, <grass-user-request@lists.osgeo.org>
wrote:

From: Yann Chemin <yann.chemin@gmail.com>
Subject: Re: [GRASS-user] unexpected i.pansharpen results
Date: January 31, 2013 2:11:33 AM MST
To: Hamish <hamish_b@yahoo.com>
Cc: GRASS user list <grass-user@lists.osgeo.org>

hmmm, yes that looks like an old friend to check…

On 31 January 2013 14:06, Hamish <hamish_b@yahoo.com> wrote:

(sorry for the html,top posting)

I wonder if the script is doing integer division when it should be doing floating point division?

http://trac.osgeo.org/grass/browser/grass/trunk/scripts/i.pansharpen/i.pansharpen.py

Hamish

— On Wed, 1/30/13, Eric Goddard <egoddard1010@gmail.com> wrote:

From: Eric Goddard <egoddard1010@gmail.com>
Subject: [GRASS-user] unexpected i.pansharpen results
To: grass-user@lists.osgeo.org
Date: Wednesday, January 30, 2013, 8:30 AM

Hi all,

I’m attempting to pansharpen some ikonos imagery using the i.pansharpen tool in Grass7 on windows 7 installed via OSGeo4W (r54756-478). The range for the sharpened red, green, and blue outputs are 0-30, which seems suspicious given the 16bit range of the input bands. The command I used was:

i.pansharpen.py “sharpen=ihs” “ms3=ik_mss.4@eric” “ms2=ik_mss.3@eric” “ms1=ik_mss.2@eric” “pan=ik_pan@eric” “output_prefix=ik_ihs”

The input bands are linked via r.external, would that matter?

The output from my test area is below. Any assistance would be greatly appreciated.<image.png>

Thanks,
Eric

-----Inline Attachment Follows-----


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


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


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

You are right. That was what I was trying to get at but didn't do so well because I had to run to class.

Michael
______________________________
C. Michael Barton
Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Arizona State University
Tempe, AZ 85287-2402
USA

voice: 480-965-6262 (SHESC), 480-727-9746 (CSDC)
fax: 480-965-7671(SHESC), 480-727-0709 (CSDC)
www: http://csdc.asu.edu, http://shesc.asu.edu
    http://www.public.asu.edu/~cmbarton

On Jan 31, 2013, at 12:52 PM, Markus Metz <markus.metz.giswork@gmail.com>
wrote:

On Thu, Jan 31, 2013 at 7:06 PM, Michael Barton <Michael.Barton@asu.edu> wrote:

i.pansharpen uses Python, not Bash. So it is not an integer math problem.

But it calls r.mapcalc, e.g. in lines 151-153. If k is integer and not
float, r.mapcalc will do integer division. Equivalent for lines 159,
162, 165. This could be fixed by casting the numerator to double with
double().

Markus M

However, you might try changing your input maps to float or DCELL. See if that changes things.

Michael
______________________________
C. Michael Barton
Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Arizona State University
Tempe, AZ 85287-2402
USA

voice: 480-965-6262 (SHESC), 480-727-9746 (CSDC)
fax: 480-965-7671(SHESC), 480-727-0709 (CSDC)
www: http://csdc.asu.edu, http://shesc.asu.edu
http://www.public.asu.edu/~cmbarton

On Jan 31, 2013, at 2:11 AM, <grass-user-request@lists.osgeo.org>
wrote:

From: Yann Chemin <yann.chemin@gmail.com>
Subject: Re: [GRASS-user] unexpected i.pansharpen results
Date: January 31, 2013 2:11:33 AM MST
To: Hamish <hamish_b@yahoo.com>
Cc: GRASS user list <grass-user@lists.osgeo.org>

hmmm, yes that looks like an old friend to check...

On 31 January 2013 14:06, Hamish <hamish_b@yahoo.com> wrote:

(sorry for the html,top posting)

I wonder if the script is doing integer division when it should be doing floating point division?

http://trac.osgeo.org/grass/browser/grass/trunk/scripts/i.pansharpen/i.pansharpen.py

Hamish

--- On Wed, 1/30/13, Eric Goddard <egoddard1010@gmail.com> wrote:

From: Eric Goddard <egoddard1010@gmail.com>
Subject: [GRASS-user] unexpected i.pansharpen results
To: grass-user@lists.osgeo.org
Date: Wednesday, January 30, 2013, 8:30 AM

Hi all,

I'm attempting to pansharpen some ikonos imagery using the i.pansharpen tool in Grass7 on windows 7 installed via OSGeo4W (r54756-478). The range for the sharpened red, green, and blue outputs are 0-30, which seems suspicious given the 16bit range of the input bands. The command I used was:

i.pansharpen.py "sharpen=ihs" "ms3=ik_mss.4@eric" "ms2=ik_mss.3@eric" "ms1=ik_mss.2@eric" "pan=ik_pan@eric" "output_prefix=ik_ihs"

The input bands are linked via r.external, would that matter?

The output from my test area is below. Any assistance would be greatly appreciated.<image.png>

Thanks,
Eric

-----Inline Attachment Follows-----

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

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

Does it work if you convert the maps to float, though? If not, there is something else that is a problem.

Michael

···

On Thu, Jan 31, 2013 at 1:52 PM, Markus Metz <markus.metz.giswork@gmail.com> wrote:

On Thu, Jan 31, 2013 at 7:06 PM, Michael Barton <Michael.Barton@asu.edu> wrote:

i.pansharpen uses Python, not Bash. So it is not an integer math problem.

But it calls r.mapcalc, e.g. in lines 151-153. If k is integer and not
float, r.mapcalc will do integer division. Equivalent for lines 159,
162, 165. This could be fixed by casting the numerator to double with
double().

Markus M

However, you might try changing your input maps to float or DCELL. See if that changes things.

Michael


C. Michael Barton
Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Arizona State University
Tempe, AZ 85287-2402
USA

voice: 480-965-6262 (SHESC), 480-727-9746 (CSDC)
fax: 480-965-7671(SHESC), 480-727-0709 (CSDC)
www: http://csdc.asu.edu, http://shesc.asu.edu
http://www.public.asu.edu/~cmbarton

On Jan 31, 2013, at 2:11 AM, <grass-user-request@lists.osgeo.org>
wrote:

From: Yann Chemin <yann.chemin@gmail.com>
Subject: Re: [GRASS-user] unexpected i.pansharpen results
Date: January 31, 2013 2:11:33 AM MST
To: Hamish <hamish_b@yahoo.com>
Cc: GRASS user list <grass-user@lists.osgeo.org>

hmmm, yes that looks like an old friend to check…

On 31 January 2013 14:06, Hamish <hamish_b@yahoo.com> wrote:

(sorry for the html,top posting)

I wonder if the script is doing integer division when it should be doing floating point division?

http://trac.osgeo.org/grass/browser/grass/trunk/scripts/i.pansharpen/i.pansharpen.py

Hamish

— On Wed, 1/30/13, Eric Goddard <egoddard1010@gmail.com> wrote:

From: Eric Goddard <egoddard1010@gmail.com>
Subject: [GRASS-user] unexpected i.pansharpen results
To: grass-user@lists.osgeo.org
Date: Wednesday, January 30, 2013, 8:30 AM

Hi all,

I’m attempting to pansharpen some ikonos imagery using the i.pansharpen tool in Grass7 on windows 7 installed via OSGeo4W (r54756-478). The range for the sharpened red, green, and blue outputs are 0-30, which seems suspicious given the 16bit range of the input bands. The command I used was:

i.pansharpen.py “sharpen=ihs” “ms3=ik_mss.4@eric” “ms2=ik_mss.3@eric” “ms1=ik_mss.2@eric” “pan=ik_pan@eric” “output_prefix=ik_ihs”

The input bands are linked via r.external, would that matter?

The output from my test area is below. Any assistance would be greatly appreciated.<image.png>

Thanks,
Eric

-----Inline Attachment Follows-----


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


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


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

Markus Metz wrote:

But it calls r.mapcalc, e.g. in lines 151-153. If k is
integer and not float, r.mapcalc will do integer division.
Equivalent for lines 159, 162, 165. This could be fixed by
casting the numerator to double with double().

or just put * 1.0 somewhere.

is there sample data available showing the problem?

Hamish

Alright, I’m at home on my linux box running grass7, still with the same issue. I converted the inputs for my test area to float:

r.mapcalc “ik_c1r2_f.4 = float(ik_c1r2_mss.4@PERMANENT)”
r.mapcalc “ik_c1r2_f.3 = float(ik_c1r2_mss.3@PERMANENT)”
r.mapcalc “ik_c1r2_f.2 = float(ik_c1r2_mss.2@PERMANENT)”
r.mapcalc “ik_c1r2_f.p = float(ik_c1r2_pan@PERMANENT)”

and set the color table to grey for each one. (I also remembered to change region to reflect the higher resolution of the pan image). I then ran i.pansharpen:
i.pansharpen sharpen=ihs ms3=ik_c1r2_f.4@PERMANENT ms2=ik_c1r2_f.3@PERMANENT ms1=ik_c1r2_f.2@PERMANENT pan=ik_c1r2_f.p@PERMANENT output_prefix=ik_ihs_f

running r.info on the output bands from i.pansharpen shows that their range is still 0-38.

The output image is attached.

Also, there is one small bug in the output. Line 330: grass.message(_(“To visualize output, run: g.region -p rast=%s.red” % out)) – the %s.red should be %s_red.

I’ve tried using the PCA algorithm and the output looks the same, though the range is different. Later on I’ll try with different imagery and see what happens…

(attachments)

pansharpen.png

···

On Thu, Jan 31, 2013 at 3:57 PM, Hamish <hamish_b@yahoo.com> wrote:

Markus Metz wrote:

But it calls r.mapcalc, e.g. in lines 151-153. If k is
integer and not float, r.mapcalc will do integer division.
Equivalent for lines 159, 162, 165. This could be fixed by
casting the numerator to double with double().

or just put * 1.0 somewhere.

is there sample data available showing the problem?

Hamish


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

from the code in trunk:

if sproc:

serial processing

e = ‘’‘eval(k = “$ms1” + “$ms2” + “$ms3”)
“$outr” = “$ms3” * “$panmatch3” / k
“$outg” = “$ms2” * “$panmatch2” / k
“$outb” = “$ms1” * “$panmatch1” / k’‘’
grass.mapcalc(e, outr=outr, outg=outg, outb=outb,
panmatch1=panmatch1, panmatch2=panmatch2, panmatch3=panmatch3,
ms1=ms1, ms2=ms2, ms3=ms3, overwrite=True)
else:

parallel processing

pb = grass.mapcalc_start(‘%s_blue = (%s * %s) / (%s + %s + %s)’ %
(out, ms1, panmatch1, ms1, ms2, ms3),
overwrite=True)
pg = grass.mapcalc_start(‘%s_green = (%s * %s) / (%s + %s + %s)’ %
(out, ms2, panmatch2, ms1, ms2, ms3),
overwrite=True)
pr = grass.mapcalc_start(‘%s_red = (%s * %s) / (%s + %s + %s)’ %
(out, ms3, panmatch3, ms1, ms2, ms3),
overwrite=True)

It is a mapcalc process started using Python wrapper lib “grass.script”, the process comes to debug a mapcalc command as described by the expression “e” initialized at the beginning of the copied code.

Run in it mapcalc with float() casting and see if it is a problem.

···

On 31 January 2013 23:36, Michael Barton <Michael.Barton@asu.edu> wrote:

i.pansharpen uses Python, not Bash. So it is not an integer math problem.

However, you might try changing your input maps to float or DCELL. See if that changes things.

Michael


C. Michael Barton
Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Arizona State University
Tempe, AZ 85287-2402
USA

voice: 480-965-6262 (SHESC), 480-727-9746 (CSDC)
fax: 480-965-7671(SHESC), 480-727-0709 (CSDC)
www: http://csdc.asu.edu, http://shesc.asu.edu
http://www.public.asu.edu/~cmbarton

On Jan 31, 2013, at 2:11 AM, <grass-user-request@lists.osgeo.org>
wrote:

From: Yann Chemin <yann.chemin@gmail.com>

Subject: Re: [GRASS-user] unexpected i.pansharpen results

Date: January 31, 2013 2:11:33 AM MST

To: Hamish <hamish_b@yahoo.com>

Cc: GRASS user list <grass-user@lists.osgeo.org>

hmmm, yes that looks like an old friend to check…


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

Yann Chemin

Researcher@IWMI

Skype/FB: yann.chemin

On 31 January 2013 14:06, Hamish <hamish_b@yahoo.com> wrote:


(sorry for the html,top posting)

I wonder if the script is doing integer division when it should be doing floating point division?

http://trac.osgeo.org/grass/browser/grass/trunk/scripts/i.pansharpen/i.pansharpen.py


Hamish

— On Wed, 1/30/13, Eric Goddard <egoddard1010@gmail.com> wrote:



> From: Eric Goddard <egoddard1010@gmail.com>
> Subject: [GRASS-user] unexpected i.pansharpen results
> To: grass-user@lists.osgeo.org
> Date: Wednesday, January 30, 2013, 8:30 AM
>
> Hi all,
>
> I’m attempting to pansharpen some ikonos imagery using the i.pansharpen tool in Grass7 on windows 7 installed via OSGeo4W (r54756-478). The range for the sharpened red, green, and blue outputs are 0-30, which seems suspicious given the 16bit range of the input bands. The command I used was:
>
> i.pansharpen.py “sharpen=ihs” “ms3=ik_mss.4@eric” “ms2=ik_mss.3@eric” “ms1=ik_mss.2@eric” “pan=ik_pan@eric” “output_prefix=ik_ihs”
>
> The input bands are linked via r.external, would that matter?
>
> The output from my test area is below. Any assistance would be greatly appreciated.<image.png>
>
> Thanks,
>
> Eric
>
> -----Inline Attachment Follows-----
>
> _______________________________________________
> grass-user mailing list
> grass-user@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user

[Back to this old thread!]

Eric Goddard wrote:

Alright, I'm at home on my linux box running grass7, still with the same
issue. I converted the inputs for my test area to float:

r.mapcalc "ik_c1r2_f.4 = float(ik_c1r2_mss.4@PERMANENT)"
r.mapcalc "ik_c1r2_f.3 = float(ik_c1r2_mss.3@PERMANENT)"
r.mapcalc "ik_c1r2_f.2 = float(ik_c1r2_mss.2@PERMANENT)"
r.mapcalc "ik_c1r2_f.p = float(ik_c1r2_pan@PERMANENT)"

and set the color table to grey for each one. (I also remembered to change
region to reflect the higher resolution of the pan image). I then ran
i.pansharpen:
i.pansharpen sharpen=ihs ms3=ik_c1r2_f.4@PERMANENT
ms2=ik_c1r2_f.3@PERMANENTms1=ik_c1r2_f.2@PERMANENTpan=ik_c1r2_f.p@PERMANENTo
utput_prefix=ik_ihs_f

running r.info on the output bands from i.pansharpen shows that their range
is still 0-38.

The output image is attached.

Also, there is one small bug in the output. Line 330: grass.message(_("To
visualize output, run: g.region -p rast=%s.red" % out)) -- the %s.red
should be %s_red.

I've tried using the PCA algorithm and the output looks the same, though
the range is different. Later on I'll try with different imagery and see
what happens...

Is this still an issue? I get akward outputs using i.pansharpen on IKONOS
imagery.

Nikos

I gave up on that pansharpening attempt. I can test some of my imagery tomorrow and let you know if I still have issues with it.

On Jul 27, 2013 3:13 PM, “Nikos Alexandris” <nik@nikosalexandris.net> wrote:

[Back to this old thread!]

Eric Goddard wrote:

Alright, I’m at home on my linux box running grass7, still with the same
issue. I converted the inputs for my test area to float:

r.mapcalc “ik_c1r2_f.4 = float(ik_c1r2_mss.4@PERMANENT)”
r.mapcalc “ik_c1r2_f.3 = float(ik_c1r2_mss.3@PERMANENT)”
r.mapcalc “ik_c1r2_f.2 = float(ik_c1r2_mss.2@PERMANENT)”
r.mapcalc “ik_c1r2_f.p = float(ik_c1r2_pan@PERMANENT)”

and set the color table to grey for each one. (I also remembered to change
region to reflect the higher resolution of the pan image). I then ran
i.pansharpen:
i.pansharpen sharpen=ihs ms3=ik_c1r2_f.4@PERMANENT
ms2=ik_c1r2_f.3@PERMANENTms1=ik_c1r2_f.2@PERMANENTpan=ik_c1r2_f.p@PERMANENTo
utput_prefix=ik_ihs_f

running r.info on the output bands from i.pansharpen shows that their range
is still 0-38.

The output image is attached.

Also, there is one small bug in the output. Line 330: grass.message(_(“To
visualize output, run: g.region -p rast=%s.red” % out)) – the %s.red
should be %s_red.

I’ve tried using the PCA algorithm and the output looks the same, though
the range is different. Later on I’ll try with different imagery and see
what happens…

Is this still an issue? I get akward outputs using i.pansharpen on IKONOS
imagery.

Nikos

On Saturday 27 of July 2013 20:16:32 Eric Goddard wrote:

I gave up on that pansharpening attempt. I can test some of my imagery
tomorrow and let you know if I still have issues with it.

[rest deleted]

I can't get any decent looking colors, with any of the methods. I wonder if
my images are not properly "aligned" or the like. PCA seems to approach it
right -- the value ranges seem to fit the reflectance scheme (below 1.0) but
the colors are so fancy... ?

Will work on it later in the evening.

N

Eric Goddard wrote:

> I gave up on that pansharpening attempt. I can test some of my imagery
> tomorrow and let you know if I still have issues with it.

Nikos Alexandris wrote:

[rest deleted]

I can't get any decent looking colors, with any of the methods. I wonder if
my images are not properly "aligned" or the like. PCA seems to approach it
right -- the value ranges seem to fit the reflectance scheme (below 1.0)
but the colors are so fancy... ?

Will work on it later in the evening.

To-day/-night I got it to work with 11-bit images! I rescaled them to [0,
255] and that seems to work just fine. Even color rebalancing (i.e. of Blue,
Green and Red fusioned with Pan -IKONOS spectral bands) after the sharpening
appears acceptable.

A bit skeptical though since the rescaling action throws away some of the
data's details... :-?

All of my other attempts using out of [0, 255] range values, for example using
Top-of-Atmosphere Reflectances (floating point values < 1.0) or the raw
IKONOS bands that range between [0, 2047], were not successful.

So, does i.pansharpen expect only 8-bit images? Can someone confirm or
reject?

Thanks, Nikos

On Mon, July 29, 2013 01:45, Nikos Alexandris wrote:

Eric Goddard wrote:

> I gave up on that pansharpening attempt. I can test some of my imagery
> tomorrow and let you know if I still have issues with it.

Nikos Alexandris wrote:

[rest deleted]

I can't get any decent looking colors, with any of the methods. I
wonder if
my images are not properly "aligned" or the like. PCA seems to approach
it
right -- the value ranges seem to fit the reflectance scheme (below 1.0)
but the colors are so fancy... ?

Will work on it later in the evening.

To-day/-night I got it to work with 11-bit images! I rescaled them to [0,
255] and that seems to work just fine. Even color rebalancing (i.e. of
Blue,
Green and Red fusioned with Pan -IKONOS spectral bands) after the
sharpening
appears acceptable.

A bit skeptical though since the rescaling action throws away some of the
data's details... :-?

All of my other attempts using out of [0, 255] range values, for example
using
Top-of-Atmosphere Reflectances (floating point values < 1.0) or the raw
IKONOS bands that range between [0, 2047], were not successful.

So, does i.pansharpen expect only 8-bit images? Can someone confirm or
reject?

Looking at the i.pansharpen source code, I see that in all algorithms a
function for histogram matching is called and IIUC, in that function,
values seem to be limited to [0,255].

Maybe you should open a ticket on that.

Moritz

Nikos Alexandris wrote:

> So, does i.pansharpen expect only 8-bit images? Can someone confirm or
> reject?

Moritz:

Looking at the i.pansharpen source code, I see that in all algorithms a
function for histogram matching is called and IIUC, in that function,
values seem to be limited to [0,255].

Maybe you should open a ticket on that.

Done, Nikos

On Mon, July 29, 2013 01:45, Nikos Alexandris wrote:

I can't get any decent looking colors, with any of the methods. I
wonder if my images are not properly "aligned" or the like.

Getting back to this just for clarification. What do you call "decent looking colors" ? Have you looked at the example images in the man page [1]? They show quite different colors depending on the technique used. Are you trying to get them all to look like the top left ("natural color") image ?

Moritz

[1] http://grass.osgeo.org/grass70/manuals/i.pansharpen.html

Nikos Alexandris wrote:

I can’t get any decent looking colors, with any of the methods. I

wonder if my images are not properly “aligned” or the like.

Moritz Lennert wrote:

Getting back to this just for clarification. What do you call "decent

looking colors" ?

apply to my sentence “s/decent looking colors/usable images”

Have you looked at the example images in the man page [1]?

[1] http://grass.osgeo.org/grass70/manuals/i.pansharpen.html

Sure.

They show quite different colors depending on the technique used.

This is not the problem that I have. Nor is it the one Haziq described in the

Q&A at http://gis.stackexchange.com/q/39174/5256.

Are you trying to get them all to look like the top left ("natural

color") image ?

No. I simply try to get usable output from 11-bit bands fed in i.pansharpen.

The only usable output, no matter the method actually, is when rescaling the

input bands to 8-bit. Tested with my working data (IKONOS, QuickBird) as well as with some publicly available IKONOS data.

I am delivering 18 examples in which none of them appears ok to me. I guess I don’t know how to use the module. Will post images in trac, if possible, else in my wiki user-page.

I don’t provide any 8-bit examples. All of my attempts, so far, with 8-bit images work fine – they look from acceptable to really good depending on some re-balancing, be it manually playing with color-tables or using i.landsat.rgb

Nevertheless, I 'd like to see only one example using a >8-bit set of bands in which i.pansharpen works as expected. Then I know for sure that, once again I have messed-up a normal runnig process :-). I am a Great specialist doing this… :smiley:

So, here it goes.

1) We have publicly available IKONOS images:

ftp://ftp.glcf.umd.edu/glcf/China_earthquake_May_2008/IKONOS/.

Get for example the first one:

ftp://ftp.glcf.umd.edu/glcf/China_earthquake_May_2008/IKONOS/po_58204_0000000.20001116.China-Sichuan/

2) Import in GRASS’ db, convert from DN to Radiance to Reflectance. Details

in the Wiki:

http://grasswiki.osgeo.org/wiki/IKONOS#Deriving_Physical_Quantities

3) Let’s have a look at the “input” ranges:

11-bit DNs, ranging in…

min=0

max=1400

title= (po_58204_blu_0000000)

min=0

max=1654

title= (po_58204_grn_0000000)

min=0

max=1321

title= (po_58204_nir_0000000)

min=0

max=1319

title= (po_58204_pan_0000000)

min=0

max=1489

title= (po_58204_red_0000000)

Radiances

min=0

max=269.716258496062

title= (Blue_Radiance)

min=0

max=259.280160521696

title= (Green_Radiance)

min=0

max=164.2581277309

title= (NIR_Radiance)

min=0

max=203

title= (Pan_Radiance)

min=0

max=238.452890740853

title= (Red_Radiance)

Reflectances – note to self: fix r.support below!

min=0

max=0.705829413346531

title=echo Blue band (Top of Atmosphere Reflectance) (Blue_ToAR)

min=0

max=0.706357576839509

title=echo Green band (Top of Atmosphere Reflectance) (Green_ToAR)

min=0

max=0.717436479668371

title=echo NIR band (Top of Atmosphere Reflectance) (NIR_ToAR)

min=0

max=0.745578096984679

title=echo Pan band (Top of Atmosphere Reflectance) (Pan_ToAR)

min=0

max=0.774115699104528

title=echo Red band (Top of Atmosphere Reflectance) (Red_ToAR)

4) i.pansharpen – all of them, three methods – from my history

Brovey

18 31.Jul.13 [ 15:54:36 ] i.pansharpen sharpen=brovey pan=Pan_Radiance

ms1=Blue_Radiance ms2=Green_Radiance ms3=Red_Radiance

output=sharp_brovey_Radiance

19 31.Jul.13 [ 15:54:46 ] i.pansharpen sharpen=brovey pan=Pan_ToAR

ms1=Blue_ToAR

ms2=Green_ToAR ms3=Red_ToAR output=sharp_brovey_ToAR

24 31.Jul.13 [ 15:59:16 ] i.pansharpen sharpen=brovey pan=Pan_DNs

ms1=Blue_DNs

ms2=Green_DNs ms3=Red_DNs output=sharp_brovey_DNs

PCA

59 31.Jul.13 [ 16:09:53 ] i.pansharpen sharpen=pca pan=Pan_DNs

ms1=Blue_DNs

ms2=Green_DNs ms3=Red_DNs output=sharp_pca_DNs

60 31.Jul.13 [ 16:22:03 ] i.pansharpen sharpen=pca pan=Pan_Radiance

ms1=Blue_Radiance

ms2=Green_Radiance ms3=Red_Radiance output=sharp_pca_Radiance

61 31.Jul.13 [ 16:27:28 ] i.pansharpen sharpen=pca pan=Pan_ToAR

ms1=Blue_ToAR

ms2=Green_ToAR ms3=Red_ToAR output=sharp_pca_ToAR

IHS

62 31.Jul.13 [ 16:35:12 ] i.pansharpen sharpen=ihs pan=Pan_ToAR

ms1=Blue_ToAR

ms2=Green_ToAR ms3=Red_ToAR output=sharp_ihs_ToAR

63 31.Jul.13 [ 16:37:21 ] i.pansharpen sharpen=ihs pan=Pan_Radiance

ms1=Blue_Radiance

ms2=Green_Radiance ms3=Red_Radiance output=sharp_ihs_Radiance

64 31.Jul.13 [ 16:39:32 ] i.pansharpen sharpen=ihs pan=Pan_DNs

ms1=Blue_DNs

ms2=Green_DNs ms3=Red_DNs output=sharp_ihs_DNs

5) Let’s look at the numbers

for SHARP in g.mlist rast pat=sharp*; do r.info -mr ${SHARP}; done

min=36.2130177514793

max=153

title= (sharp_brovey_DNs_blue)

min=0

max=112.211538461538

title= (sharp_brovey_DNs_green)

min=0

max=107.968559837728

title= (sharp_brovey_DNs_red)

min=7.93864844473524

max=102.4232751775

title= (sharp_brovey_Radiance_blue)

min=0

max=87.5889521289036

title= (sharp_brovey_Radiance_green)

min=0

max=74.435557812593

title= (sharp_brovey_Radiance_red)

min=0

max=0.398724812575096

title= (sharp_brovey_ToAR_blue)

min=0

max=0.335289700449259

title= (sharp_brovey_ToAR_green)

min=0

max=0.476377949923749

title= (sharp_brovey_ToAR_red)

min=0

max=255

title=Image blue (sharp_ihs_DNs_blue)

min=0

max=255

title=Image green (sharp_ihs_DNs_green)

min=0

max=255

title=Image red (sharp_ihs_DNs_red)

min=0

max=255

title=Image blue (sharp_ihs_Radiance_blue)

min=0

max=254

title=Image green (sharp_ihs_Radiance_green)

min=0

max=254

title=Image red (sharp_ihs_Radiance_red)

min=0

max=2

title=Image blue (sharp_ihs_ToAR_blue)

min=0

max=2

title=Image green (sharp_ihs_ToAR_green)

min=0

max=2

title=Image red (sharp_ihs_ToAR_red)

min=177.072681268903

max=490.188522572706

title= (sharp_pca_DNs_blue)

min=174.855236596567

max=415.384343723085

title= (sharp_pca_DNs_green)

min=-71.4712772318356

max=390.53877906274

title= (sharp_pca_DNs_red)

min=38.0505369148222

max=189.658927814102

title= (sharp_pca_Radiance_blue)

min=24.8653625573439

max=215.672403116314

title= (sharp_pca_Radiance_green)

min=-13.7969488642255

max=113.557246501694

title= (sharp_pca_Radiance_red)

min=0.0506311311052859

max=0.660054986167671

title= (sharp_pca_ToAR_blue)

min=0.0146679903931977

max=0.832078269086436

title= (sharp_pca_ToAR_green)

min=-0.0646181045289202

max=0.451095521435642

title= (sharp_pca_ToAR_red)

At least for some of the above results, it is obvious that something isn’t right.

6) I use the script copy-pasted in the end of this message in G64 (…I wish I could use frames in G7 :-p) to get some overviews, without and with

“i.landsat.rgb -p”

Will upload screenshots uploaded in trac – if possible.

Summary

In almost all – actually, in all of them! – there are NULL cells introduced there where they did not exist before. I don’t use a MASK. I have set up the region before running i.pansharpen to match the extent of the Red band, for example (resolution is taken care by the module).

Nikos

### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ###

#!/bash/sh

script to draw screenshots, 3 x 3 various methods x inputs

loop over Methods and Input Types, compose RGBs

for Method_Input in “ihs DNs” “ihs Radiance” “ihs ToAR” \

“brovey DNs” “brovey Radiance” “brovey ToAR” \

“pca DNs” “pca Radiance” “pca ToAR”

do

parse “${Method_STR}” and set positional parameters

set – $Method_Input ; echo $1 $2

compose

r.composite --o \

r=sharp_“${1}”_“${2}”_red \

g=sharp_“${1}”_“${2}”_green \

b=sharp_“${1}”_“${2}”_blue \

out=rgb_sharpened_“${1}”_“${2}”

done

set wide aspect ratio (16:9, e.g. 1366 width x 768 height)

d.monsize setm=x0 setw=1366 seth=768

split in 9 frames

d.split.frame frames=9

preferred font?

d.font DroidSans

loop over composites

for FRAME in “uno ihs DNs” “dos ihs Radiance” “tres ihs ToAR” \

“cuatro brovey DNs” “cinco brovey Radiance” “seis brovey ToAR” \

“siete pca DNs” “ocho pca Radiance” “nueve pca ToAR”

do

parse “${FRAMES_STR}” and set positional parameters

set – $FRAME ; echo $1 $2 $3

select FRAME

d.frame -s “${1}”

draw the map

d.rast rgb_sharpened_“${2}”_“${3}”

draw label on the left and vertically

d.text text=“${2}, ${3}” size=8 color=50:50:50 at=10,25 rotation=90

draw legend ?

d.legend rgb_sharpened_“${2}”_“${3}” -s at=10,90,76,82

done

re-balance colors

for Method_Input in “ihs DNs” “ihs Radiance” “ihs ToAR” \

“brovey DNs” “brovey Radiance” “brovey ToAR” \

“pca DNs” “pca Radiance” “pca ToAR”

do

parse “${Method_STR}” and set positional parameters

set – $Method_Input ; echo $1 $2

re-balance, re-compose

i.landsat.rgb -p \

r=sharp_“${1}”_“${2}”_red \

g=sharp_“${1}”_“${2}”_green \

b=sharp_“${1}”_“${2}”_blue

re-compose

r.composite --o \

r=sharp_“${1}”_“${2}”_red \

g=sharp_“${1}”_“${2}”_green \

b=sharp_“${1}”_“${2}”_blue \

out=rgb_sharpened_“${1}”_“${2}”_rebalanced

done

set wide aspect ratio (16:9, e.g. 1366 width x 768 height)

d.monsize setm=x1 setw=1366 seth=768

split in 9 frames

d.split.frame frames=9

preferred font?

d.font DroidSans

loop over Re-Balanced composites

for FRAME in “uno ihs DNs” “dos ihs Radiance” “tres ihs ToAR” \

“cuatro brovey DNs” “cinco brovey Radiance” “seis brovey ToAR” \

“siete pca DNs” “ocho pca Radiance” “nueve pca ToAR”

do

parse “${FRAMES_STR}” and set positional parameters

set – $FRAME ; echo $1 $2 $3

select FRAME

d.frame -s “${1}”

draw the map

d.rast rgb_sharpened_“${2}”_“${3}”_rebalanced

draw label on the left and vertically

d.text text=“${2}, ${3}” size=8 color=50:50:50 at=10,25 rotation=90

d.text text=“Rebalanced i.landsat.rgb -p” size=6 color=50:50:50 at=14,10 rotation=90

draw legend ?

d.legend rgb_sharpened_“${2}”_“${3}”_rebalanced -s at=10,90,76,82

done

### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ###

Nikos Alexandris wrote:

[chewed up message by the “System” :D]

4) i.pansharpen – all of them, three methods – from my history

Brovey

18 31.Jul.13 [ 15:54:36 ] i.pansharpen sharpen=brovey pan=Pan_Radiance

ms1=Blue_Radiance ms2=Green_Radiance ms3=Red_Radiance

output=sharp_brovey_Radiance

19 31.Jul.13 [ 15:54:46 ] i.pansharpen sharpen=brovey pan=Pan_ToAR

ms1=Blue_ToAR

ms2=Green_ToAR ms3=Red_ToAR output=sharp_brovey_ToAR

24 31.Jul.13 [ 15:59:16 ] i.pansharpen sharpen=brovey pan=Pan_DNs

ms1=Blue_DNs

ms2=Green_DNs ms3=Red_DNs output=sharp_brovey_DNs

PCA

59 31.Jul.13 [ 16:09:53 ] i.pansharpen sharpen=pca pan=Pan_DNs

ms1=Blue_DNs

ms2=Green_DNs ms3=Red_DNs output=sharp_pca_DNs

60 31.Jul.13 [ 16:22:03 ] i.pansharpen sharpen=pca pan=Pan_Radiance

ms1=Blue_Radiance

ms2=Green_Radiance ms3=Red_Radiance output=sharp_pca_Radiance

61 31.Jul.13 [ 16:27:28 ] i.pansharpen sharpen=pca pan=Pan_ToAR

ms1=Blue_ToAR

ms2=Green_ToAR ms3=Red_ToAR output=sharp_pca_ToAR

IHS

62 31.Jul.13 [ 16:35:12 ] i.pansharpen sharpen=ihs pan=Pan_ToAR

ms1=Blue_ToAR

ms2=Green_ToAR ms3=Red_ToAR output=sharp_ihs_ToAR

63 31.Jul.13 [ 16:37:21 ] i.pansharpen sharpen=ihs pan=Pan_Radiance

ms1=Blue_Radiance

ms2=Green_Radiance ms3=Red_Radiance output=sharp_ihs_Radiance

64 31.Jul.13 [ 16:39:32 ] i.pansharpen sharpen=ihs pan=Pan_DNs

ms1=Blue_DNs

ms2=Green_DNs ms3=Red_DNs output=sharp_ihs_DNs

5) Let’s look at the numbers

for SHARP in g.mlist rast pat=sharp*; do r.info -mr ${SHARP}; done

min=36.2130177514793

max=153

title= (sharp_brovey_DNs_blue)

min=0

max=112.211538461538

title= (sharp_brovey_DNs_green)

min=0

max=107.968559837728

title= (sharp_brovey_DNs_red)

min=7.93864844473524

max=102.4232751775

title= (sharp_brovey_Radiance_blue)

min=0

max=87.5889521289036

title= (sharp_brovey_Radiance_green)

min=0

max=74.435557812593

title= (sharp_brovey_Radiance_red)

min=0

max=0.398724812575096

title= (sharp_brovey_ToAR_blue)

min=0

max=0.335289700449259

title= (sharp_brovey_ToAR_green)

min=0

max=0.476377949923749

title= (sharp_brovey_ToAR_red)

min=0

max=255

title=Image blue (sharp_ihs_DNs_blue)

min=0

max=255

title=Image green (sharp_ihs_DNs_green)

min=0

max=255

title=Image red (sharp_ihs_DNs_red)

min=0

max=255

title=Image blue (sharp_ihs_Radiance_blue)

min=0

max=254

title=Image green (sharp_ihs_Radiance_green)

min=0

max=254

title=Image red (sharp_ihs_Radiance_red)

min=0

max=2

title=Image blue (sharp_ihs_ToAR_blue)

min=0

max=2

title=Image green (sharp_ihs_ToAR_green)

min=0

max=2

title=Image red (sharp_ihs_ToAR_red)

min=177.072681268903

max=490.188522572706

title= (sharp_pca_DNs_blue)

min=174.855236596567

max=415.384343723085

title= (sharp_pca_DNs_green)

min=-71.4712772318356

max=390.53877906274

title= (sharp_pca_DNs_red)

min=38.0505369148222

max=189.658927814102

title= (sharp_pca_Radiance_blue)

min=24.8653625573439

max=215.672403116314

title= (sharp_pca_Radiance_green)

min=-13.7969488642255

max=113.557246501694

title= (sharp_pca_Radiance_red)

min=0.0506311311052859

max=0.660054986167671

title= (sharp_pca_ToAR_blue)

min=0.0146679903931977

max=0.832078269086436

title= (sharp_pca_ToAR_green)

min=-0.0646181045289202

max=0.451095521435642

title= (sharp_pca_ToAR_red)

At least for some of the above results, it is obvious that something isn’t right.

6) I use the script copy-pasted in … the next message… in G64 (…I wish I could use frames in G7 :-p) to get some overviews, without and with

“i.landsat.rgb -p”

Will upload screenshots uploaded in trac – if possible.

Summary

In almost all – actually, in all of them! – there are NULL cells introduced there where they did not exist before. I don’t use a MASK. I have set up the region before running i.pansharpen to match the extent of the Red band, for example (resolution is taken care by the module).

Nikos

Nikos Alexandris wrote:

[chewed up message by the "System" :smiley: -- apologies for re-posting!]

# 4) i.pansharpen -- all of them, three methods -- from my history

### Brovey

   18 31.Jul.13 [ 15:54:36 ] i.pansharpen sharpen=brovey pan=Pan_Radiance
ms1=Blue_Radiance ms2=Green_Radiance ms3=Red_Radiance
output=sharp_brovey_Radiance

   19 31.Jul.13 [ 15:54:46 ] i.pansharpen sharpen=brovey pan=Pan_ToAR
ms1=Blue_ToAR
ms2=Green_ToAR ms3=Red_ToAR output=sharp_brovey_ToAR

   24 31.Jul.13 [ 15:59:16 ] i.pansharpen sharpen=brovey pan=Pan_DNs
ms1=Blue_DNs
ms2=Green_DNs ms3=Red_DNs output=sharp_brovey_DNs

### PCA

   59 31.Jul.13 [ 16:09:53 ] i.pansharpen sharpen=pca pan=Pan_DNs
ms1=Blue_DNs
ms2=Green_DNs ms3=Red_DNs output=sharp_pca_DNs

   60 31.Jul.13 [ 16:22:03 ] i.pansharpen sharpen=pca pan=Pan_Radiance
ms1=Blue_Radiance
ms2=Green_Radiance ms3=Red_Radiance output=sharp_pca_Radiance

   61 31.Jul.13 [ 16:27:28 ] i.pansharpen sharpen=pca pan=Pan_ToAR
ms1=Blue_ToAR
ms2=Green_ToAR ms3=Red_ToAR output=sharp_pca_ToAR

### IHS

   62 31.Jul.13 [ 16:35:12 ] i.pansharpen sharpen=ihs pan=Pan_ToAR
ms1=Blue_ToAR
ms2=Green_ToAR ms3=Red_ToAR output=sharp_ihs_ToAR

   63 31.Jul.13 [ 16:37:21 ] i.pansharpen sharpen=ihs pan=Pan_Radiance
ms1=Blue_Radiance
ms2=Green_Radiance ms3=Red_Radiance output=sharp_ihs_Radiance

   64 31.Jul.13 [ 16:39:32 ] i.pansharpen sharpen=ihs pan=Pan_DNs
ms1=Blue_DNs
ms2=Green_DNs ms3=Red_DNs output=sharp_ihs_DNs

# 5) Let's look at the numbers

for SHARP in `g.mlist rast pat=sharp*`; do r.info -mr ${SHARP}; done

min=36.2130177514793
max=153
title= (sharp_brovey_DNs_blue)

min=0
max=112.211538461538
title= (sharp_brovey_DNs_green)

min=0
max=107.968559837728
title= (sharp_brovey_DNs_red)

min=7.93864844473524
max=102.4232751775
title= (sharp_brovey_Radiance_blue)

min=0
max=87.5889521289036
title= (sharp_brovey_Radiance_green)

min=0
max=74.435557812593
title= (sharp_brovey_Radiance_red)

min=0
max=0.398724812575096
title= (sharp_brovey_ToAR_blue)

min=0
max=0.335289700449259
title= (sharp_brovey_ToAR_green)

min=0
max=0.476377949923749
title= (sharp_brovey_ToAR_red)

min=0
max=255
title=Image blue (sharp_ihs_DNs_blue)

min=0
max=255
title=Image green (sharp_ihs_DNs_green)

min=0
max=255
title=Image red (sharp_ihs_DNs_red)

min=0
max=255
title=Image blue (sharp_ihs_Radiance_blue)

min=0
max=254
title=Image green (sharp_ihs_Radiance_green)

min=0
max=254
title=Image red (sharp_ihs_Radiance_red)

min=0
max=2
title=Image blue (sharp_ihs_ToAR_blue)

min=0
max=2
title=Image green (sharp_ihs_ToAR_green)

min=0
max=2
title=Image red (sharp_ihs_ToAR_red)

min=177.072681268903
max=490.188522572706
title= (sharp_pca_DNs_blue)

min=174.855236596567
max=415.384343723085
title= (sharp_pca_DNs_green)

min=-71.4712772318356
max=390.53877906274
title= (sharp_pca_DNs_red)

min=38.0505369148222
max=189.658927814102
title= (sharp_pca_Radiance_blue)

min=24.8653625573439
max=215.672403116314
title= (sharp_pca_Radiance_green)

min=-13.7969488642255
max=113.557246501694
title= (sharp_pca_Radiance_red)

min=0.0506311311052859
max=0.660054986167671
title= (sharp_pca_ToAR_blue)

min=0.0146679903931977
max=0.832078269086436
title= (sharp_pca_ToAR_green)

min=-0.0646181045289202
max=0.451095521435642
title= (sharp_pca_ToAR_red)

At least for some of the above results, it is obvious that something isn't
right.

# 6) I use the script copy-pasted in ... the next message... in G64 (...I
wish I could use frames in G7 :-p) to get some overviews, without and with
"i.landsat.rgb -p"

Will upload screenshots uploaded in trac -- if possible.

Summary

In almost all -- actually, in all of them! -- there are NULL cells introduced
there where they did not exist before. I don't use a MASK. I have set up the
region before running i.pansharpen to match the extent of the Red band, for
example (resolution is taken care by the module).

Nikos

Just for the records, the script to draw composite overviews of pan-sharpen
attempts, using the good old frames in G64 :wink:

Nikos

### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ###

#!/bash/sh
# script to draw screenshots, 3 x 3 various methods x inputs

# loop over Methods and Input Types, compose RGBs
for Method_Input in "ihs DNs" "ihs Radiance" "ihs ToAR" \
  "brovey DNs" "brovey Radiance" "brovey ToAR" \
  "pca DNs" "pca Radiance" "pca ToAR"

do

  # parse "${Method_STR}" and set positional parameters
  set -- $Method_Input ; echo $1 $2

  # compose
  r.composite --o \
  r=sharp_"${1}"_"${2}"_red \
  g=sharp_"${1}"_"${2}"_green \
  b=sharp_"${1}"_"${2}"_blue \
  out=rgb_sharpened_"${1}"_"${2}"

done

# set wide aspect ratio (16:9, e.g. 1366 width x 768 height)
d.monsize setm=x0 setw=1366 seth=768

# split in 9 frames
d.split.frame frames=9

# preferred font?
d.font DroidSans

# loop over composites
for FRAME in "uno ihs DNs" "dos ihs Radiance" "tres ihs ToAR" \
"cuatro brovey DNs" "cinco brovey Radiance" "seis brovey ToAR" \
"siete pca DNs" "ocho pca Radiance" "nueve pca ToAR"

do

  # parse "${FRAMES_STR}" and set positional parameters
  set -- $FRAME ; echo $1 $2 $3

  # select FRAME
  d.frame -s "${1}"

  # draw the map
  d.rast rgb_sharpened_"${2}"_"${3}"

  # draw label on the left and vertically
  d.text text="${2}, ${3}" size=8 color=50:50:50 at=10,25 rotation=90

  # draw legend ?
  d.legend rgb_sharpened_"${2}"_"${3}" -s at=10,90,76,82

done

# re-balance colors
for Method_Input in "ihs DNs" "ihs Radiance" "ihs ToAR" \
  "brovey DNs" "brovey Radiance" "brovey ToAR" \
  "pca DNs" "pca Radiance" "pca ToAR"
  
  do
  
  # parse "${Method_STR}" and set positional parameters
  set -- $Method_Input ; echo $1 $2
  
  # re-balance, re-compose
  i.landsat.rgb -p \
  r=sharp_"${1}"_"${2}"_red \
  g=sharp_"${1}"_"${2}"_green \
  b=sharp_"${1}"_"${2}"_blue

  # re-compose
  r.composite --o \
  r=sharp_"${1}"_"${2}"_red \
  g=sharp_"${1}"_"${2}"_green \
  b=sharp_"${1}"_"${2}"_blue \
  out=rgb_sharpened_"${1}"_"${2}"_rebalanced

done

# set wide aspect ratio (16:9, e.g. 1366 width x 768 height)
d.monsize setm=x1 setw=1366 seth=768

# split in 9 frames
d.split.frame frames=9

# preferred font?
d.font DroidSans

# loop over Re-Balanced composites
for FRAME in "uno ihs DNs" "dos ihs Radiance" "tres ihs ToAR" \
  "cuatro brovey DNs" "cinco brovey Radiance" "seis brovey ToAR" \
  "siete pca DNs" "ocho pca Radiance" "nueve pca ToAR"
  
  do
  
  # parse "${FRAMES_STR}" and set positional parameters
  set -- $FRAME ; echo $1 $2 $3
  
  # select FRAME
  d.frame -s "${1}"
  
  # draw the map
  d.rast rgb_sharpened_"${2}"_"${3}"_rebalanced
  
  # draw label on the left and vertically
  d.text text="${2}, ${3}" size=8 color=50:50:50 at=10,25 rotation=90
  d.text text="Rebalanced i.landsat.rgb -p" size=6 color=50:50:50 at=14,10
rotation=90
  
  # draw legend ?
  d.legend rgb_sharpened_"${2}"_"${3}"_rebalanced -s at=10,90,76,82
  
  done

### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ###