Hi Jonathan,

I've had similar issues in a case where sub-pixel accuracy was crucial.
It boils down to the way the origin is used.

First of all, I assume you consider pixels as "cells" and not grid points.

Note also that the convention of "where is the origin" can vary :
- with a gdalinfo : the physical extent indicates that the origin in GDAL corresponds to the top-left corner of the first pixel - with OTB : most of the time, the origin is handled as the center of the first pixel.

You first have to choose what convention you want to use.
If you choose the GDAL convention, you have to set the transform to a mid spacing shift (as you said : offset=(outputSpacing-inputSpacing)/2) and keep the origin value unchanged.

If you choose the OTB convention, transform should be identity but the output origin should be shifted by (outputSpacing-inputSpacing)/2) in order to keep the same footprint.

I would be interested to know if someone else has dealt with similar issues.

Regards,
Guillaume

Le 18/04/2014 14:50, Jonathan Guinet a écrit :
Dear all,

I have some remarks and questions about resampling using OTB, in particular using RigidTransformResample application scheme (which is based on a StreamingResampleImage filter).

let's show you my problem : apply a resampling of an input with a factor 10 :

otbcli_RigidTransformResample -in ~/workspace/ORFEO-TOOLBOX/src/OTB-Data/Input/QB_Toulouse_Ortho_PAN_WGS84.tif -out /media/otbnas/jguinet/REECH_OTB/QB_Toulouse_Ortho_PAN_WGS84_scale_0.1.tif -transform.type id -transform.type.id.scalex 0.1 -transform.type.id.scaley 0.1 -interpolator bco

then open input and output with gdal : we observe a shift between resampled data and input one.

Resampling is done as follow : project each pixel (integer) of output c.s to pixel position (fractional) in input c.s. interpolation is then used to approximate data.

- use output information (origin,spacing,size) to compute output information (the output grid) - create the deformation field (the distance between physical position of each point input grid and point in output space) using a trasnform set to identity. - interpolate value of input position from output one using deformation field.

using this scheme and a WGS84 input for example, each geodetic position of an output pixel is mapped with the same postion in input

for example origin of output is interpolated at origin of input. Using a 0.5 scaling and linear interpolator it gives the result depicted in the illustration "Resampling.jpg" : (resampled image is depicted with dots line, resampled data is interpolated using dashed input pixel (linear interpolator use only dashed pixel, and is nearly the same as a NN interpolator) ). Thus shift is observed.

Considering the (0,0) pixel the resampling strategy can be illustrated as "Origin_Resampling.jpeg"

if we consider that a pixel is a point convolued by a PSF, i think that an upsampling should be as illustrated in "New_Resampling.jpeg"

I wonder if the transform should be a mid spacing shift (offset=(outputSpacing-inputSpacing)/2).

using this transform offset results in resampled data exactly superimposed using gdal.

moreover using this scheme the new origin might be shifted with outputSpacing/2 (with the drawback of footprint change between output and input at origin).

What do you think about that ?

Thanks

Jonathan

--
--
Check the OTB FAQ at
http://www.orfeo-toolbox.org/FAQ.html

You received this message because you are subscribed to the Google
Groups "otb-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/otb-users?hl=en
---
You received this message because you are subscribed to the Google Groups "otb-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.


--
<www.c-s.fr>      *Guillaume PASERO*
Ingénieur d'études et développement
*Business Unit E-SPACE & Geo Information* <https://thor.si.c-s.fr/blogs/cs-blogs-business/>*- Département APPLICATIONS*

*CS Systèmes d'Information*
Parc de la Grande Plaine - 5, Rue Brindejonc des Moulinais - BP 15872
31506 Toulouse Cedex 05 - FRANCE
+33 561 17 64 21 - [email protected]

--
--
Check the OTB FAQ at
http://www.orfeo-toolbox.org/FAQ.html

You received this message because you are subscribed to the Google
Groups "otb-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/otb-users?hl=en
--- You received this message because you are subscribed to the Google Groups "otb-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

<<inline: logo_cs.png>>

Reply via email to