<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 12 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="FR-BE" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Daniele,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">   For your first question, you should operate with a no_data value outside the range of pixel generated by interpolation.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">   So you should do a preprocessing to change no_data value outside of this range. Alternatively, if you want to keep 0 as no_data, you should
 clamp negative value to 1 (instead of 0).<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">  For your second question, it’s normal that interpolation does a kind of dissolution of your edge. If you want to keep original no_data, you should
 extract a band mask from your input, and integrate it on your result.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Nicolas<o:p></o:p></span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="FR" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">De :</span></b><span lang="FR" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> gdal-dev [mailto:gdal-dev-bounces@lists.osgeo.org]
<b>De la part de</b> Daniele Romagnoli<br>
<b>Envoyé :</b> mercredi 29 mars 2017 10:07<br>
<b>À :</b> gdal-dev@lists.osgeo.org<br>
<b>Objet :</b> [gdal-dev] Interpolation questions<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal">Hi,<o:p></o:p></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">While investigating on some rendering issues we have with java JAI based operations involving interpolations, I have found the topic of bicubic interpolation introducing values outside of the input dynamic,
 as well as negative values and overshooting.<o:p></o:p></p>
</div>
<p class="MsoNormal">The problem we had was with a grayscale GeoTIFF with noData=0.<br>
For some very dark area (pixel near to zero) the output of the interpolation was a negative value being clamped to zero (which is noData).<o:p></o:p></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">So it was introducing noData in regions where all pixels were valid.<o:p></o:p></p>
</div>
<p class="MsoNormal">Therefore I did a test with gdal_translate -r cubic and I got same result:<br>
<br>
<img width="462" height="141" id="_x0000_i1025" src="cid:image002.jpg@01D2A894.35516A80"><br>
​<o:p></o:p></p>
<div>
<p class="MsoNormal">on the left side: original image<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">on the right side: cubic interpolation <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">weird white shapes you see on the top right are zero/nodata pixels.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I got different result once using cubic spline instead.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">What is the difference between the two algorithms?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Second question:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">I did a gdal_translate -outsize 800% 800% from a small pixellated image.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">is it expected to have output pixels exceeding the original shape of the valid input pixels?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">I was thinking the interpolated image pixels should stay within the original pixel edges.<br>
<br>
Let me provide an image to clarify:<br>
<img width="462" height="118" id="_x0000_i1026" src="cid:image004.jpg@01D2A894.35516A80"><br>
​<br>
​<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Left image: original<br>
Right image: cubic spline.<br>
See how the 2 edges are different, having the cubic spline producing some kind of buffering on the edge (note the white-missing pixels on the borders are nodata).<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Please, let me know.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Best Regards,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Daniele<o:p></o:p></p>
</div>
<p class="MsoNormal"><br>
<br clear="all">
<br>
-- <o:p></o:p></p>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt">==</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt">GeoServer Professional Services from the experts! Visit<br>
</span><a href="http://goo.gl/it488V" target="_blank"><span style="font-size:9.5pt;color:#1155CC">http://goo.gl/it488V</span></a><span style="font-size:9.5pt"> for more information.</span><br>
==<br>
<br>
Ing. Daniele Romagnoli<br>
Senior Software Engineer<br>
<br>
GeoSolutions S.A.S.<br>
<span style="font-size:9.5pt">Via di Montramito 3/A</span><br>
55054  Massarosa (LU)<br>
Italy<br>
phone: +39 0584 962313<br>
fax:      +39 0584 1660272<br>
<br>
<a href="http://www.geo-solutions.it" target="_blank">http://www.geo-solutions.it</a><br>
<a href="http://twitter.com/geosolutions_it" target="_blank">http://twitter.com/geosolutions_it</a><br>
<br>
-------------------------------------------------------<o:p></o:p></p>
<p><b><span lang="IT" style="font-size:7.5pt">AVVERTENZE AI SENSI DEL D.Lgs. 196/2003</span></b><o:p></o:p></p>
<p><span lang="IT" style="font-size:7.5pt">Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio,
 per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema.
 Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.</span><o:p></o:p></p>
<p><span lang="IT" style="font-size:7.5pt"> </span><o:p></o:p></p>
<p><span style="font-size:7.5pt">The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative
 Decree June, 30 2003, no.196 - Italy's New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval
 of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept
 liability as the content, accuracy or completeness of sent messages and accepts no responsibility  for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.</span><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>