<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size: 10pt; color: rgb(0, 51, 102); font-family: Tahoma, Geneva, sans-serif, "EmojiFont", "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;" dir="ltr">
<p><span style="font-size:10pt;" dir="ltr" id="divtagdefaultwrapper"></span></p>
<div style="margin-top:0;margin-bottom:0;">Hi,<br>
</div>
<div style="margin-top:0;margin-bottom:0;"><br>
</div>
<div style="margin-top:0;margin-bottom:0;"><br>
@Andrew</div>
<div style="margin-top:0;margin-bottom:0;"><br>
</div>
<div>> Have you noticed whether the output image has no-data pixels at the<br>
> edges, or crops the original ? I would expect it to do a little of each.</div>
<div><br>
</div>
<div style="margin-top:0;margin-bottom:0;">The output image has no-data values - it does not crop the image - which is inline with the description by Even (see below).<br>
</div>
<div style="margin-top:0;margin-bottom:0;"><br>
</div>
<div style="margin-top:0;margin-bottom:0;"><br>
@Even<br>
</div>
<div style="margin-top:0;margin-bottom:0;"><br>
</div>
<div style="margin-top:0;margin-bottom:0;">> When creating an output file from scatch (either it doesn't exist, or -overwrite is used),
<br>
</div>
<div style="margin-top:0;margin-bottom:0;">> gdalwarp will always produce a "north-up" image in the target CRS.</div>
<div style="margin-top:0;margin-bottom:0;">> ...</div>
<div style="margin-top:0;margin-bottom:0;">> How gdalwarp rectifies depends on content of the source dataset (GCP, geolocation arrays, RPCs),</div>
<div style="margin-top:0;margin-bottom:0;">> user switches and default behaviours. For a source dataset with GCPs, if you have < 6 GCPs,</div>
<div style="margin-top:0;margin-bottom:0;">> a linear fit will be used by default. For >= 6 GCPs, a 2nd order polynomial fit will be used.
<br>
</div>
<div style="margin-top:0;margin-bottom:0;"><br>
</div>
<div style="margin-top:0;margin-bottom:0;">Thank you for clarifying this - this explains the results I'm observing.</div>
<div style="margin-top:0;margin-bottom:0;"><br>
Is it possible access the transformation used to rectify the images during the gdalwarp call?</div>
<div style="margin-top:0;margin-bottom:0;">At the moment, I feel that gdalwarp acts (w.r.t. the rectification) like a black box.
<br>
</div>
<div style="margin-top:0;margin-bottom:0;">Maybe it would be reasonable to (optionally) provide some information about the rectification process?<br>
</div>
<div style="margin-top:0;margin-bottom:0;"><br>
</div>
<div style="margin-top:0;margin-bottom:0;">If it is not possible to get this information, could you point out the code snippet that performs the rectification step?</div>
<div style="margin-top:0;margin-bottom:0;">Since GDAL's code base is quite large, it is not easy to find the appropriate location.<br>
</div>
<div style="margin-top:0;margin-bottom:0;"><br>
</div>
<div style="margin-top:0;margin-bottom:0;">Thank you for your help - and sorry for the noise.<br>
</div>
<div style="margin-top:0;margin-bottom:0;"><br>
</div>
<div style="margin-top:0;margin-bottom:0;"><br>
</div>
<div style="margin-top:0;margin-bottom:0;">Best regards,</div>
<div style="margin-top:0;margin-bottom:0;">Sebastian</div>
<br>
<p></p>
<p><br>
</p>
<div id="Signature">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px"><font face="Tahoma" color="003366"><span lang="de">
<div style="margin:0"><font face="Tahoma" color="003366"><span lang="de"><font size="2"><span style="font-size:11pt"><span lang="en-US"><span lang="de"><font size="2" face="Calibri,sans-serif"><span style="font-size:11pt"><span lang="en-US">--</span></span></font></span></span></span></font></span></font><br>
<font size="2"><span style="font-size:11pt"><span lang="en-US">Dr. Sebastian Bullinger<br>
</span></span></font></div>
<div style="margin:0"><font size="2"><span style="font-size:11pt"><span lang="en-US">Department Object Recognition</span></span></font></div>
<div style="margin:0"><font size="2"><span style="font-size:11pt"><span lang="en-US">Fraunhofer Institute of
</span></span></font></div>
<div style="margin:0"><font size="2"><span style="font-size:11pt"><span lang="en-US">Optronics, Sytem Technologies and Image Exploitation IOSB</span></span></font></div>
<div style="margin:0"><font size="2"><span style="font-size:11pt">Gutleuthausstr. 1, 76275 Ettlingen, Germany</span></font></div>
<div style="margin:0"><font size="2"><span style="font-size:11pt">Phone +49 7243 992-197</span></font></div>
<div style="margin:0"><font size="2"><span style="font-size:11pt"><a href="mailto:sebastian.bullinger@iosb.fraunhofer.de" id="LPNoLP">sebastian.bullinger@iosb.fraunhofer.de</a><br>
</span></font></div>
<div style="margin:0"><font size="2"><span style="font-size:11pt"><a href="https://webmail.iosb.fraunhofer.de/owa/redir.aspx?C=GM65JhP8Gk6mqlokIktWtqcWz_hm-dIIiaYxp7LDE5w39h4r54rwzTEQR1dXSKQtdNkO601Flpk.&URL=http%3a%2f%2fwww.iosb.fraunhofer.de%2f" target="_blank" id="LPNoLP">www.iosb.fraunhofer.de</a></span></font></div>
</span></font></div>
</div>
</div>
</div>
</div>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> Even Rouault <even.rouault@spatialys.com><br>
<b>Sent:</b> Thursday, March 25, 2021 5:08 PM<br>
<b>To:</b> Bullinger, Sebastian; gdal-dev@lists.osgeo.org<br>
<b>Subject:</b> Re: [gdal-dev] Computing a geo-transform with gdalwarp from a set of GCPs also rectifies the input images</font>
<div> </div>
</div>
<div>
<p>Hi,</p>
<p>When creating an output file from scatch (either it doesn't exist, or -overwrite is used), gdalwarp will always produce a "north-up" image in the target CRS. This is by design of the utility. If you just want to subset, preserving the original orientation,
use gdal_translate. In update mode of an existing target dataset however, gdalwarp will use the georeferencing attached to the target (so potentially not north-up).</p>
<p>How gdalwarp rectifies depends on content of the source dataset (GCP, geolocation arrays, RPCs), user switches and default behaviours. For a source dataset with GCPs, if you have < 6 GCPs, a linear fit will be used by default. For >= 6 GCPs, a 2nd order
polynomial fit will be used. You may also use the -tps switch to ask for thin plate splines. The -to switch can also be used for finer control: see link pointed by
<a class="moz-txt-link-freetext" href="https://gdal.org/programs/gdalwarp.html#cmdoption-gdalwarp-to">
https://gdal.org/programs/gdalwarp.html#cmdoption-gdalwarp-to</a></p>
<p>Even<br>
</p>
<div class="moz-cite-prefix">Le 23/03/2021 à 18:47, Bullinger, Sebastian a écrit :<br>
</div>
<blockquote type="cite">
<div id="divtagdefaultwrapper" dir="ltr">
<div>Dear gdal community,<br>
<br>
I'm currently working with a set of satellite images that are geo-registered with a set of GCPs. To compute a geo-transform from the GCPs, I've been using gdalwarp with:<br>
<br>
gdalwarp -of GTiff path/to/original/file path/to/warped/file<br>
<br>
While "gdalwarp" correctly computes a transformation from the GCPs, at the same it also performs some kind of rectification / north-up image transformation. I'm not sure about the applied operation.<br>
<br>
Presumably, the reason for this is that the original GCPs reflect a transformation with skew factors.<br>
See the following transformations of the original and the warped image. <br>
<br>
>>> import gdal<br>
>>> dataset = gdal.Open("path/to/original/file")<br>
>>> print(gdal.GCPsToGeoTransform(dataset.GetGCPs()))<br>
(-58.57294039342205, -3.991598267026281e-06, 0.0, -34.451175177186684, -3.6492767328575985e-07, 3.1987810722132996e-06)<br>
<br>
>>> import gdal<br>
>>> dataset = gdal.Open("path/to/warped/file")<br>
>>> print(dataset.GetGeoTransform())<br>
(-58.577917916461026, 3.435846284510554e-06, 0.0, -34.44693359348493, 0.0, -3.435846284510554e-06)<br>
<br>
The "rectification" result is very convenient, since it allows to use the images with an existing satellite image segmentation pipeline (which tiles the satellite images using geo-tiles)<br>
However, in order to overlay the segmentations (performed on the "rectified" images) with the original images, I need some information about the transformation applied during "gdalwarp".<br>
<br>
I've searched the documentation for more information - unfortunately without success.
<br>
For example, parameters like "-novshiftgrid" do not affect this transformation.<br>
<br>
<span></span>It would be very helpful, if someone could shed some light on the used "rectification".<br>
What kind of operation is applied? What would be the correct term to search for?<br>
Is it "only" a decomposition of the transform? Or does <span>"gdalwarp</span>" something else too?<br>
Is there a possibility to access this information, while using<span> "gdalwarp</span>"? (Or can this operation also be done by hand?)<br>
Does GDAL contain any functions to invert this "rectification" step - given the corresponding transformation used by "gdalwarp"?<br>
<br>
Best regards,<br>
Sebastian</div>
<br>
<p><br>
</p>
<div id="Signature">
<div>
<div>
<div>
<div><span lang="de">
<div><span lang="de"><span><span lang="en-US"><span lang="de"><span><span lang="en-US">--</span></span></span></span></span></span><br>
<span><span lang="en-US">Dr. Sebastian Bullinger<br>
</span></span></div>
<div><span><span lang="en-US">Department Object Recognition</span></span></div>
<div><span><span lang="en-US">Fraunhofer Institute of </span></span></div>
<div><span><span lang="en-US">Optronics, Sytem Technologies and Image Exploitation IOSB</span></span></div>
<div><span>Gutleuthausstr. 1, 76275 Ettlingen, Germany</span></div>
<div><span>Phone +49 7243 992-197</span></div>
<div><span><a href="mailto:sebastian.bullinger@iosb.fraunhofer.de" id="LPNoLP">sebastian.bullinger@iosb.fraunhofer.de</a><br>
</span></div>
<div><span><a href="https://webmail.iosb.fraunhofer.de/owa/redir.aspx?C=GM65JhP8Gk6mqlokIktWtqcWz_hm-dIIiaYxp7LDE5w39h4r54rwzTEQR1dXSKQtdNkO601Flpk.&URL=http%3a%2f%2fwww.iosb.fraunhofer.de%2f" target="_blank" id="LPNoLP">www.iosb.fraunhofer.de</a></span></div>
</span></div>
</div>
</div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre">_______________________________________________
gdal-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a>
</pre>
</blockquote>
<pre class="moz-signature" cols="72">--
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
</div>
</div>
</div>
</body>
</html>