<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thanks for that explanation, Even. Is this to say, if i have a panchromatic band that spans coastal-blue-green-red-rededge1-rededge2-rededge2-nir, and I only have blue-green-red-NIR, that pansharpening is invalid? The math works out, but it may not be a spectrally
 consistent result.</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I'm able to calculate the weights for the full band set given a data provider's RSR data. But sometimes we do not get the full multispectral product due to ordering specifics. The pseudo-code suggests that I'd be producing a pseudo-panchromatic value using
 the bands I provide, regardless of if I have the full multispectral band set or not. This works out math-wise, but in terms of image interpretation, it would be preferable to use the full multispectral band set. In the event that I do not, such as having a
 4-band subset that is still within the spectral bandwidth of the panchromatic band, it seems the pansharpening operation should still hold. Or am I misreading something? Please advise.</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thanks for your help!</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Joe</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Even Rouault <even.rouault@spatialys.com><br>
<b>Sent:</b> Thursday, January 9, 2025 14:49<br>
<b>To:</b> Joe McGlinchy <joe@aidash.com>; Barry DeZonia <bdezonia@gmail.com><br>
<b>Cc:</b> gdal-dev@lists.osgeo.org <gdal-dev@lists.osgeo.org><br>
<b>Subject:</b> Re: [gdal-dev] pansharpen subset of multispectral bands</font>
<div> </div>
</div>
<div>
<p style="text-align:justify"><span style="color:#ff0000">EXTERNAL SENDER. DO NOT click links, or open attachments, if the sender is unknown, or the message seems suspicious in any way. DO NOT provide your user ID or Password.</span></p>
<p style="text-align:justify"> </p>
<p style="text-align:justify"> </p>
<div>
<p>> in the event that we are provided only 4 bands, but from an 8-band system, will this still hold? It is what we have to work with, unfortunately or not.
<br>
</p>
<p>Yes, obviously, the example generalizes to other number of bands.</p>
<blockquote type="cite">
<div class="x_elementToProof" style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
So, providing either <code>band_nums=[1,2,3,4]</code> along with weights and extracting bands 1 and 4 after-the-fact, or
<code>band_nums=[1,4] and </code><code style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif">providing the corresponding weights for those bands, in my mind should produce something similar? I haven't tried it just yet.</code></div>
</blockquote>
<p>No.</p>
<p>Let's consider the minimum example:</p>
<p>A = 10, weightA = 0.7</p>
<p>B = 20, weightB = 0.3</p>
<p>P = 30</p>
<p>PseudoPanchro = 10 * 0.7 + 20 * 0.3 = 13</p>
<p>then A_pansharpened = A / PseudoPanchro * Panchro = 10. / 13 * 30 = 23.08</p>
<p>and  B_pansharpened= B / PseudoPanchro * Panchro = 20. / 13 * 30 = 46.15</p>
<p>If you ignore B, than A_pansharpened = 10. / (10 * 0.7) * 30 = 42.85</p>
<p>And, even if you rebalance the reduced set of weights so its sum is still 1, which makes much more sense, that still won't work, because that would in that example just give the value of P.</p>
<p><a class="x_moz-txt-link-freetext" href="https://github.com/mapbox/rio-pansharpen/blob/master/docs/pansharpening_methods.rst#brovey">https://github.com/mapbox/rio-pansharpen/blob/master/docs/pansharpening_methods.rst#brovey</a> : "It assumes that the spectral
 range spanned by the panchromatic image is the same as that covered by the multispectral channels."   If you ignore multispectral channels in the computation of the pseudo panchro value, then the assumption no longer holds true. Or you need some magic to generate
 a reference panchromatic image that only takes into account the subset of bands you are interested in.</p>
<pre class="x_moz-signature" cols="72">-- 
<a class="x_moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.
Butcher of all kinds of standards, open or closed formats. At the end, this is just about bytes.</pre>
</div>
</div>
</body>
</html>