[gdal-dev] Interpolation questions

SIMON Nicolas nicolas.simon at spw.wallonie.be
Wed Mar 29 04:58:27 PDT 2017


Daniele,
   For your first question, you should operate with a no_data value outside the range of pixel generated by interpolation.
   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).
  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.

Nicolas
De : gdal-dev [mailto:gdal-dev-bounces at lists.osgeo.org] De la part de Daniele Romagnoli
Envoyé : mercredi 29 mars 2017 10:07
À : gdal-dev at lists.osgeo.org
Objet : [gdal-dev] Interpolation questions

Hi,
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.
The problem we had was with a grayscale GeoTIFF with noData=0.
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).
So it was introducing noData in regions where all pixels were valid.
Therefore I did a test with gdal_translate -r cubic and I got same result:

[cid:image002.jpg at 01D2A894.35516A80]
​
on the left side: original image
on the right side: cubic interpolation
weird white shapes you see on the top right are zero/nodata pixels.

I got different result once using cubic spline instead.
What is the difference between the two algorithms?
Second question:
I did a gdal_translate -outsize 800% 800% from a small pixellated image.
is it expected to have output pixels exceeding the original shape of the valid input pixels?
I was thinking the interpolated image pixels should stay within the original pixel edges.

Let me provide an image to clarify:
[cid:image004.jpg at 01D2A894.35516A80]
​
​
Left image: original
Right image: cubic spline.
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).

Please, let me know.
Best Regards,
Daniele



--
==
GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.
==

Ing. Daniele Romagnoli
Senior Software Engineer

GeoSolutions S.A.S.
Via di Montramito 3/A
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax:      +39 0584 1660272

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------

AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

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.



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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20170329/a5bf2143/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.jpg
Type: image/jpeg
Size: 7672 bytes
Desc: image002.jpg
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20170329/a5bf2143/attachment-0002.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image004.jpg
Type: image/jpeg
Size: 3700 bytes
Desc: image004.jpg
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20170329/a5bf2143/attachment-0003.jpg>


More information about the gdal-dev mailing list