<html theme="default-light"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head><body text="#000000">Thanks Javier, but as it looks the way I did
works great. Got rid of the XY shift as well. Rotation affects the
calculations for the origin as well, of course, this is what I needed to
correct. In case of 0 vs 90 deg rotation the fix was simple. Will now
work on trig formulas that work with any rotation angle.<br>
<br>
G<br>
<br>
<span>
</span><br>
<blockquote type="cite"
cite="mid:CADRrdKu=ufLTFX98H=Y3CZg073GR+o6c+f3x8s5NO_G1roLr4g@mail.gmail.com"
style="border: 0px none ! important;">
<div xmlns="http://www.w3.org/1999/xhtml" class="__pbConvHr"
style="margin:30px 25px 10px 25px;"><div
style="width:100%;border-top:2px solid
rgba(146,154,163,0.7);padding-top:10px;"> <div
style="display:inline-block;white-space:nowrap;vertical-align:middle;width:49%;">
<a style="color:#485664
!important;padding-right:6px;font-weight:500;text-decoration:none
!important;" href="mailto:j1@jimenezshaw.com" moz-do-not-send="true">Javier
Jimenez Shaw</a></div> <div
style="display:inline-block;white-space:nowrap;vertical-align:middle;width:48%;text-align:
right;"> <font color="#909AA4"><span style="padding-left:6px">21
December 2020 14:02</span></font></div> </div></div>
<div xmlns="http://www.w3.org/1999/xhtml" class="__pbConvBody"
__pbrmquotes="true"
style="color:#909AA4;margin-left:24px;margin-right:24px;">
<meta http-equiv="content-type" content="text/html; charset=utf-8"><div
dir="ltr">I am not sure, but I guess that you have to negate also GT5: y
axis is reversed between image coordinates and "geographic"
coordinates.<br clear="all"><div><div><div><div dir="ltr"
class="gmail_signature" data-smartmail="gmail_signature">.___ ._ ..._ ..
. ._. .___ .. __ . _. . __.. ... .... ._ .__<br>Entre dos
pensamientos racionales <br>hay infinitos pensamientos irracionales.<br><br></div></div><br></div></div></div><br>
</div>
<div xmlns="http://www.w3.org/1999/xhtml" class="__pbConvHr"
style="margin:30px 25px 10px 25px;"><div
style="width:100%;border-top:2px solid
rgba(146,154,163,0.7);padding-top:10px;"> <div
style="display:inline-block;white-space:nowrap;vertical-align:middle;width:49%;">
<a style="color:#485664
!important;padding-right:6px;font-weight:500;text-decoration:none
!important;" href="mailto:hh1@posteo.de" moz-do-not-send="true">G
Seiffert</a></div> <div
style="display:inline-block;white-space:nowrap;vertical-align:middle;width:48%;text-align:
right;"> <font color="#909AA4"><span style="padding-left:6px">21
December 2020 12:57</span></font></div> </div></div>
<div xmlns="http://www.w3.org/1999/xhtml" class="__pbConvBody"
__pbrmquotes="true"
style="color:#909AA4;margin-left:24px;margin-right:24px;">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Thanks Javier. Need to confess: math is not
my strong side. I'm more the "trial and error" guy. And - shame on me -
Google.<br>
<br>
Got the rotation AND the scaling correct meanwhile, calculating the
params as described here:
<a class="moz-txt-link-freetext"
href="https://gis.stackexchange.com/questions/69715/rotating-rasters-using-gdal-geotransform-and-arcgis-desktop?noredirect=1&lq=1"
moz-do-not-send="true">https://gis.stackexchange.com/questions/69715/rotating-rasters-using-gdal-geotransform-and-arcgis-desktop?noredirect=1&lq=1</a><br>
<br>
Below a code snippet (I work in Python). However, with the exact calcs
from above website, my pics were rotated correctly but for some strange
reason mirrored vertically! Try and error: Making GT(4) negative got rid
of the mirroring. So almost happy now, just facing a weird shift of 2m
to west and 0.7m to south, working on it. <br>
<br>
# ROTATION PART Start ================================================<br>
rot_deg = 90<br>
rotation = np.deg2rad(rot_deg)<br>
<br>
GT0 = orig_x<br>
GT1 = math.cos(rotation) * image_resolution<br>
GT2 = -math.sin(rotation) * image_resolution<br>
GT3 = orig_y<br>
GT4 = <span style="font-size: 18px;"><span style="font-weight:
bold;">-</span></span>math.sin(rotation) * image_resolution<br>
GT5 = math.cos(rotation) * image_resolution<br>
<br>
geotrans = (GT0, GT1, GT2, GT3, GT4, GT5)<br>
<br>
# ROTATION PART End ================================================<br>
<br>
Thanks so far! Also Thomas and Jukka!<br>
Gerhard <br>
<span>
</span><br>
<br>
<br><fieldset class="mimeAttachmentHeader"></fieldset><br><div>_______________________________________________<br>gdal-dev
mailing list<br><a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br><a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br></div>
</div>
<div xmlns="http://www.w3.org/1999/xhtml" class="__pbConvHr"
style="margin:30px 25px 10px 25px;"><div
style="width:100%;border-top:2px solid
rgba(146,154,163,0.7);padding-top:10px;"> <div
style="display:inline-block;white-space:nowrap;vertical-align:middle;width:49%;">
<a style="color:#485664
!important;padding-right:6px;font-weight:500;text-decoration:none
!important;" href="mailto:j1@jimenezshaw.com" moz-do-not-send="true">Javier
Jimenez Shaw</a></div> <div
style="display:inline-block;white-space:nowrap;vertical-align:middle;width:48%;text-align:
right;"> <font color="#909AA4"><span style="padding-left:6px">21
December 2020 10:55</span></font></div> </div></div>
<div xmlns="http://www.w3.org/1999/xhtml" class="__pbConvBody"
__pbrmquotes="true"
style="color:#909AA4;margin-left:24px;margin-right:24px;">
<meta http-equiv="content-type" content="text/html; charset=utf-8"><div
dir="ltr"><div>Those transformation parameters can be seen as a 3x3
transformation matrix like this</div><div><span
style="font-family:monospace"><br></span></div><div><span
style="font-family:monospace">Xg GT1 GT2 GT0 Xp</span></div><div><span
style="font-family:monospace">Yg = GT4 GT5 GT3 * Yp</span></div><div><span
style="font-family:monospace"> 1 0 0 1 1<br></span></div><div><span
style="font-family:monospace"><br></span></div><div><span
style="font-family:monospace"><span style="font-family:arial,sans-serif">Where
<span style="font-family:monospace">[Xp, Yp]</span> is the coordinate
in pixels, and <span style="font-family:monospace">[Xg, Yg]</span> is
the "geographic" coordinate (whatever it means ;)</span><br></span></div><div><span
style="font-family:arial,sans-serif"><br></span></div><div><span
style="font-family:arial,sans-serif">the 2x2 top left corner of the
transformation matrix can be seen as a 2D rotation-scaling matrix: <a
href="https://en.wikipedia.org/wiki/Transformation_matrix#Examples_in_2_dimensions"
moz-do-not-send="true">https://en.wikipedia.org/wiki/Transformation_matrix#Examples_in_2_dimensions</a><br><span
style="font-family:monospace">[GT0, GT3]<span
style="font-family:arial,sans-serif"> is the "geographic" coordinate of
the pixel </span>[0, 0]<span style="font-family:arial,sans-serif">
(regardless rotation or scaling)</span><br></span></span></div><div><span
style="font-family:monospace"><br></span></div><div><span
style="font-family:monospace"><span style="font-family:arial,sans-serif">Cheers</span><br></span></div><div><div><div
dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">.___
._ ..._ .. . ._. .___ .. __ . _. . __.. ... .... ._ .__<br>Entre dos
pensamientos racionales <br>hay infinitos pensamientos irracionales.<br><br></div></div><br></div></div><br>
</div>
<div xmlns="http://www.w3.org/1999/xhtml" class="__pbConvHr"
style="margin:30px 25px 10px 25px;"><div
style="width:100%;border-top:2px solid
rgba(146,154,163,0.7);padding-top:10px;"> <div
style="display:inline-block;white-space:nowrap;vertical-align:middle;width:49%;">
<a style="color:#485664
!important;padding-right:6px;font-weight:500;text-decoration:none
!important;" href="mailto:hh1@posteo.de" moz-do-not-send="true">G
Seiffert</a></div> <div
style="display:inline-block;white-space:nowrap;vertical-align:middle;width:48%;text-align:
right;"> <font color="#909AA4"><span style="padding-left:6px">21
December 2020 10:24</span></font></div> </div></div>
<div xmlns="http://www.w3.org/1999/xhtml" class="__pbConvBody"
__pbrmquotes="true"
style="color:#909AA4;margin-left:24px;margin-right:24px;">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
Hi all from GDLA.<br>
<br>
Thanks for the opportunity to as a question. It's regarding the <span
style="font-weight: bold;">Geotransform Tutorial</span><span
style="font-weight: bold;"> </span>(<a class="moz-txt-link-freetext"
href="https://gdal.org/tutorials/geotransforms_tut.html"
moz-do-not-send="true">https://gdal.org/tutorials/geotransforms_tut.html</a>).
Tried to get info in the web but since this seems a tricky one, my
searches failed.<br>
<br>
The tutorial only deals with the ideal case of 'North up' images, for
which GT(2) and GT(4) are zero. However, my images are 'East up' and
potentially 'any direction up' (underwater photomosaic surveys by ROV).
The rotation works with '90' for GT(2, 4). But the scaling seems
completely ignored. Any hint? If it would be easy, I assume your
tutorial would give an example for how to deal with "non-N-up' images,
but ...<br>
<br>
My pics are 1920x1080, with pixel resolution of 0.0015 (yes, 0.15cm per
pixel, we're flying just 3m above the bottom).<br>
<br>
In case I rotate the images prior to geotransform (in Photoshop),
geotransform works perfect, with GT(2, 4) = 0. Scaling spot on. I can
live with that for our last survey but I'm also looking for a solution
in case our survey heading cannot be 0, 90, 180, or 270, but has to be
something like 35° (due to bottom currents etc.).<br>
<br>
Best regards, any hint qappreciated,<br>
Gerhard<br>
<br>
<br>
<br><fieldset class="mimeAttachmentHeader"></fieldset><br><div>_______________________________________________<br>gdal-dev
mailing list<br><a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br><a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br></div>
</div>
</blockquote>
<br>
</body></html>