unexpected i.pansharpen results

classic Classic list List threaded Threaded
25 messages Options
12
Reply | Threaded
Open this post in threaded view
|

unexpected i.pansharpen results

Eric Goddard
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.Inline image 3


Thanks,
Eric

_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: unexpected i.pansharpen results

hamish-2
(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 <[hidden email]> wrote:

From: Eric Goddard <[hidden email]>
Subject: [GRASS-user] unexpected i.pansharpen results
To: [hidden email]
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.Inline image 3


Thanks,
Eric

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

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

_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: unexpected i.pansharpen results

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


On 31 January 2013 14:06, Hamish <[hidden email]> 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 <[hidden email]> wrote:

From: Eric Goddard <[hidden email]>
Subject: [GRASS-user] unexpected i.pansharpen results
To: [hidden email]
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.Inline image 3


Thanks,
Eric

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

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

_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user




--
Yann Chemin
Researcher@IWMI
Skype/FB: yann.chemin


_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: unexpected i.pansharpen results

Michael Barton
In reply to this post by Eric Goddard
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)

On Jan 31, 2013, at 2:11 AM, <[hidden email]>
 wrote:

From: Yann Chemin <[hidden email]>
Subject: Re: [GRASS-user] unexpected i.pansharpen results
Date: January 31, 2013 2:11:33 AM MST
To: Hamish <[hidden email]>
Cc: GRASS user list <[hidden email]>


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


On 31 January 2013 14:06, Hamish <[hidden email]> 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 <[hidden email]> wrote:

From: Eric Goddard <[hidden email]>
Subject: [GRASS-user] unexpected i.pansharpen results
To: [hidden email]
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@...
http://lists.osgeo.org/mailman/listinfo/grass-user


_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: unexpected i.pansharpen results

Eric Goddard

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

On Jan 31, 2013 12:16 PM, "Michael Barton" <[hidden email]> 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:  <a href="tel:480-965-6262" value="+14809656262" target="_blank">480-965-6262 (SHESC), <a href="tel:480-727-9746" value="+14807279746" target="_blank">480-727-9746 (CSDC)
fax:          <a href="tel:480-965-7671" value="+14809657671" target="_blank">480-965-7671(SHESC), <a href="tel:480-727-0709" value="+14807270709" target="_blank">480-727-0709 (CSDC)

On Jan 31, 2013, at 2:11 AM, <[hidden email]>
 wrote:

From: Yann Chemin <[hidden email]>
Subject: Re: [GRASS-user] unexpected i.pansharpen results
Date: January 31, 2013 2:11:33 AM MST
To: Hamish <[hidden email]>
Cc: GRASS user list <[hidden email]>


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


On 31 January 2013 14:06, Hamish <[hidden email]> 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 <[hidden email]> wrote:

From: Eric Goddard <[hidden email]>
Subject: [GRASS-user] unexpected i.pansharpen results
To: [hidden email]
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@...
http://lists.osgeo.org/mailman/listinfo/grass-user


_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user


_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: unexpected i.pansharpen results

Markus Metz-3
In reply to this post by Michael Barton
On Thu, Jan 31, 2013 at 7:06 PM, Michael Barton <[hidden email]> 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, <[hidden email]>
>  wrote:
>
> From: Yann Chemin <[hidden email]>
> Subject: Re: [GRASS-user] unexpected i.pansharpen results
> Date: January 31, 2013 2:11:33 AM MST
> To: Hamish <[hidden email]>
> Cc: GRASS user list <[hidden email]>
>
>
> hmmm, yes that looks like an old friend to check...
>
>
> On 31 January 2013 14:06, Hamish <[hidden email]> 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 <[hidden email]> wrote:
>>
>>
>> From: Eric Goddard <[hidden email]>
>> Subject: [GRASS-user] unexpected i.pansharpen results
>> To: [hidden email]
>> 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
>> [hidden email]
>> http://lists.osgeo.org/mailman/listinfo/grass-user
>
>
>
> _______________________________________________
> grass-user mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/grass-user
>
_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: unexpected i.pansharpen results

Eric Goddard
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 <[hidden email]> wrote:
On Thu, Jan 31, 2013 at 7:06 PM, Michael Barton <[hidden email]> 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:  <a href="tel:480-965-6262" value="+14809656262">480-965-6262 (SHESC), <a href="tel:480-727-9746" value="+14807279746">480-727-9746 (CSDC)
> fax:          <a href="tel:480-965-7671" value="+14809657671">480-965-7671(SHESC), <a href="tel:480-727-0709" value="+14807270709">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, <[hidden email]>
>  wrote:
>
> From: Yann Chemin <[hidden email]>
> Subject: Re: [GRASS-user] unexpected i.pansharpen results
> Date: January 31, 2013 2:11:33 AM MST
> To: Hamish <[hidden email]>
> Cc: GRASS user list <[hidden email]>
>
>
> hmmm, yes that looks like an old friend to check...
>
>
> On 31 January 2013 14:06, Hamish <[hidden email]> 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 <[hidden email]> wrote:
>>
>>
>> From: Eric Goddard <[hidden email]>
>> Subject: [GRASS-user] unexpected i.pansharpen results
>> To: [hidden email]
>> 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
>> [hidden email]
>> http://lists.osgeo.org/mailman/listinfo/grass-user
>
>
>
> _______________________________________________
> grass-user mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/grass-user
>
_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user


_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: unexpected i.pansharpen results

Michael Barton
In reply to this post by Markus Metz-3
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 <[hidden email]>
 wrote:

> On Thu, Jan 31, 2013 at 7:06 PM, Michael Barton <[hidden email]> 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, <[hidden email]>
>> wrote:
>>
>> From: Yann Chemin <[hidden email]>
>> Subject: Re: [GRASS-user] unexpected i.pansharpen results
>> Date: January 31, 2013 2:11:33 AM MST
>> To: Hamish <[hidden email]>
>> Cc: GRASS user list <[hidden email]>
>>
>>
>> hmmm, yes that looks like an old friend to check...
>>
>>
>> On 31 January 2013 14:06, Hamish <[hidden email]> 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 <[hidden email]> wrote:
>>>
>>>
>>> From: Eric Goddard <[hidden email]>
>>> Subject: [GRASS-user] unexpected i.pansharpen results
>>> To: [hidden email]
>>> 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
>>> [hidden email]
>>> http://lists.osgeo.org/mailman/listinfo/grass-user
>>
>>
>>
>> _______________________________________________
>> grass-user mailing list
>> [hidden email]
>> http://lists.osgeo.org/mailman/listinfo/grass-user
>>

_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: unexpected i.pansharpen results

Michael Barton
In reply to this post by Eric Goddard
Does it work if you convert the maps to float, though? If not, there is something else that is a problem.

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)

On Jan 31, 2013, at 1:31 PM, Eric Goddard <[hidden email]>
 wrote:

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 <[hidden email]> wrote:
On Thu, Jan 31, 2013 at 7:06 PM, Michael Barton <[hidden email]> 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:  <a href="tel:480-965-6262" value="&#43;14809656262">480-965-6262 (SHESC), <a href="tel:480-727-9746" value="&#43;14807279746">480-727-9746 (CSDC)
> fax:          <a href="tel:480-965-7671" value="&#43;14809657671">480-965-7671(SHESC), <a href="tel:480-727-0709" value="&#43;14807270709">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, <[hidden email]>
>  wrote:
>
> From: Yann Chemin <[hidden email]>
> Subject: Re: [GRASS-user] unexpected i.pansharpen results
> Date: January 31, 2013 2:11:33 AM MST
> To: Hamish <[hidden email]>
> Cc: GRASS user list <[hidden email]>
>
>
> hmmm, yes that looks like an old friend to check...
>
>
> On 31 January 2013 14:06, Hamish <[hidden email]> 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 <[hidden email]> wrote:
>>
>>
>> From: Eric Goddard <[hidden email]>
>> Subject: [GRASS-user] unexpected i.pansharpen results
>> To: [hidden email]
>> 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
>> [hidden email]
>> http://lists.osgeo.org/mailman/listinfo/grass-user
>
>
>
> _______________________________________________
> grass-user mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/grass-user
>
_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user



_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: unexpected i.pansharpen results

hamish-2
In reply to this post by Markus Metz-3
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
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: unexpected i.pansharpen results

Eric Goddard
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...



On Thu, Jan 31, 2013 at 3:57 PM, Hamish <[hidden email]> 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
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user


_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user

pansharpen.png (350K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: unexpected i.pansharpen results

hamish-2
In reply to this post by Eric Goddard
Eric wrote:
> and set the color table to grey for each one.

tip: you might try the grey255 color rules to make sure they are
consistent between bands.


Hamish
_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: unexpected i.pansharpen results

ychemin
In reply to this post by Michael Barton
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 <[hidden email]> 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:  <a href="tel:480-965-6262" value="+14809656262" target="_blank">480-965-6262 (SHESC), <a href="tel:480-727-9746" value="+14807279746" target="_blank">480-727-9746 (CSDC)
fax:          <a href="tel:480-965-7671" value="+14809657671" target="_blank">480-965-7671(SHESC), <a href="tel:480-727-0709" value="+14807270709" target="_blank">480-727-0709 (CSDC)

On Jan 31, 2013, at 2:11 AM, <[hidden email]>
 wrote:

From: Yann Chemin <[hidden email]>
Subject: Re: [GRASS-user] unexpected i.pansharpen results
Date: January 31, 2013 2:11:33 AM MST
To: Hamish <[hidden email]>
Cc: GRASS user list <[hidden email]>


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


On 31 January 2013 14:06, Hamish <[hidden email]> 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 <[hidden email]> wrote:

From: Eric Goddard <[hidden email]>
Subject: [GRASS-user] unexpected i.pansharpen results
To: [hidden email]
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@...
http://lists.osgeo.org/mailman/listinfo/grass-user


_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user




--
Yann Chemin
Researcher@IWMI
Skype/FB: yann.chemin


_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: unexpected i.pansharpen results

Michael Barton
In reply to this post by Eric Goddard
I can transform maps to float or DCELL with both the Brovey and PCA methods. However, this doesn't seem possible with the IHS method. i.rgb.ihs outputs CELL maps even if the inputs are float. Any suggestions?

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-727-9746 (CSDC)
fax:          480-965-7671 (SHESC),  480-727-0709 (CSDC)











On Jan 31, 2013, at 1:31 PM, Eric Goddard <[hidden email]> wrote:

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 <[hidden email]> wrote:
On Thu, Jan 31, 2013 at 7:06 PM, Michael Barton <[hidden email]> 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:  <a href="tel:480-965-6262" value="&#43;14809656262">480-965-6262 (SHESC), <a href="tel:480-727-9746" value="&#43;14807279746">480-727-9746 (CSDC)
> fax:          <a href="tel:480-965-7671" value="&#43;14809657671">480-965-7671(SHESC), <a href="tel:480-727-0709" value="&#43;14807270709">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, <[hidden email]>
>  wrote:
>
> From: Yann Chemin <[hidden email]>
> Subject: Re: [GRASS-user] unexpected i.pansharpen results
> Date: January 31, 2013 2:11:33 AM MST
> To: Hamish <[hidden email]>
> Cc: GRASS user list <[hidden email]>
>
>
> hmmm, yes that looks like an old friend to check...
>
>
> On 31 January 2013 14:06, Hamish <[hidden email]> 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 <[hidden email]> wrote:
>>
>>
>> From: Eric Goddard <[hidden email]>
>> Subject: [GRASS-user] unexpected i.pansharpen results
>> To: [hidden email]
>> 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
>> [hidden email]
>> http://lists.osgeo.org/mailman/listinfo/grass-user
>
>
>
> _______________________________________________
> grass-user mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/grass-user
>
_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user



_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: unexpected i.pansharpen results

NikosAlexandris
In reply to this post by Eric Goddard
[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
_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: unexpected i.pansharpen results

Eric Goddard

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" <[hidden email]> 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

_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: unexpected i.pansharpen results

NikosAlexandris
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

_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: unexpected i.pansharpen results

NikosAlexandris
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
_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: unexpected i.pansharpen results

Moritz Lennert
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

_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: unexpected i.pansharpen results

NikosAlexandris
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
_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
12