<font face="arial" size="2"><font face="arial" size="2"><font face="arial" size="2">Hi Frank and David,<br><br>Frank, what you
are describing is indeed what I am hoping to achieve.&nbsp; I'm not sure
what the standard practice is for sharing larger files on a mailing
list, but I can send along the example image I am working from if that
would help.&nbsp; The source image is actually just a screen-shot taken from
google earth with known geographic corner coordinates. <br><br>For
this test I also intentionally took a very oblique-angle screen-shot to
exaggerate the trapezoidal shape I would expect to see in the final
rectified image. It is very possible that I'm missing (or incorrectly
specifying) a param and causing the problem, so hopefully something
will jump out at you from the command arguments I am using.<br><br>Starting from a raw aerial photo, I run gdal_translate on my source image with the following arguments:<br><br>gdal_translate.exe
-ot Byte -of Gtiff -a_nodata 0 -gcp 0 0 -63.649972 44.706803 -gcp 1663
0 -63.500156 44.662205 -gcp 0 1093 -63.647813 44.620151 -gcp 1663 1093
-63.584518 44.602052 "C:\Projects\example_test_4\test_image.tif"
"C:\Projects\example_test_4\test_image_referenced.tif"<br><br>Once that is complete I run gdal_warp with the following arguments:<br><br>gdalwarp.exe
-t_srs EPSG:4326 -wt Byte -r bilinear -of GTiff -srcnodata "0 0 0 0"
-dstnodata "0 0 0 0"
"C:\Projects\example_test_4\test_image_referenced.tif"
"C:\Projects\example_test_4\test_image_rectified.tif"<br><br>I have
tried different combinations of input params on both commands with no
success so far, but the above are the current 'best guess' at what I
should be specifying.&nbsp; I am suspicious that maybe I should be
specifying a -a_src param for the translate call?<br><br>As I mentioned
in my previous post, if I load 'test_image_referenced.tif' into Global
Mapper after the gdal_translate call it appears as expected, so I don't
think it is as simple as my corner coords being wrong.&nbsp; Also, the final
warped 'test_image_rectified.tif' seems to be rotated correctly, just
not bound within the correct 'footprint' shape.<br><br>Thanks very much
for offering to share your related work, David.&nbsp; If this doesn't
quickly settle out (i.e. I'm still hoping I'm just missing something
obvious, like needing to specify a projection when originally
georeferencing the image) I would definitely take you up on it.&nbsp; From
googling around I get the impression this has been done in various
shapes and forms before, so I assume it should be possible (accepting
the error introduced by not properly orthorectifying the source data
first).<br><br>I am attaching a teeny file comparing the final image
loaded into global mapper and OpenEv to show more clearly what I am
seeing with the results.&nbsp; <br><br>Thanks again,<br>Jeff</font></font><br><br>-----Original Message-----<br>From: "Frank Warmerdam" &lt;warmerdam@pobox.com&gt;<br>Sent: Wednesday, December 15, 2010 12:18pm<br>To: fwtools@lists.maptools.org<br>Subject: Re: [FWTools] gdalwarp issue?<br><br>On 10-12-15 09:04 AM, jkenneally@cartenav.com wrote:<br>&gt; Hello,<br>&gt;<br>&gt; I'm having an issue using gdalwarp, and I'm not sure if I'm using the utility<br>&gt; incorrectly, or if I'm just trying to make it do something it can't do.<br>&gt;<br>&gt; I'm trying to perform a crude geo-rectification on a set of aerial photo's. For<br>&gt; the test case I am just assigning four gcps to the source image corners using<br>&gt; gdal_translate. This stage seems to work fine. I am then intending to use<br>&gt; gdal_warp to produce an output image that has been transformed based on the<br>&gt; assigned gcps. However, no matter what I assign as the image corner<br>&gt; coordinates, gdal_warp still seems to produce a 'square' final image.<br>&gt;<br>&gt; The easiest way to demonstrate the issue is in cases where the camera was not<br>&gt; pointed straight down when the aerial photo was taken. This creates a source<br>&gt; image where the bottom (near) corners are geographically closer to each other<br>&gt; than the top (far) corners are. In this case I am expecting the warped output<br>&gt; image to contain a trapezoid-ish shape of aerial imagery with no data (ie<br>&gt; white) pixels around the outside.<br>&gt;<br>&gt; However, while gdal warp does seem to rotate the source images to correctly<br>&gt; align with lat/lon lines, it doesnt seem to distort the image into the<br>&gt; trapezoid shape.<br>&gt;<br>&gt; If I load the image that was georeferenced through gdal_translate into Global<br>&gt; Mapper it does appear properly (ie trapezoidal), and can be saved back to disk<br>&gt; in that 'warped' form, but I'm really hoping to be able to do this through<br>&gt; fw_tools/gdal.<br>&gt;<br>&gt; Am I missing something obvious or is this not possible with gdal_warp?<br><br>Jeff,<br><br>gdalwarp should be able to build a first order polynomial model from 4 gcps<br>and warp based on that giving you a trapazoidal result (with missing data<br>usually set to black).   Could you make the file you are using, and the<br>commands, available so I/we can more closely examine what is going wrong?<br><br>Normally gdalwarp should use the GCPs from your source image automatically.<br>Possibly you also have a geotransform set on the source image that is wrong<br>and this is being used in preference to the gcps?<br><br>PS. as Rengifo mentions, OSSIM is great if you want to do rigerous<br>orthorectification - I'll assume you want to do a simple polynomial warp<br>based on gcps.<br><br>Best regards,<br>-- <br>---------------------------------------+--------------------------------------<br>I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam@pobox.com<br>light and sound - activate the windows | http://pobox.com/~warmerdam<br>and watch the world go round - Rush    | Geospatial Programmer for Rent<br><br>_______________________________________________<br>FWTools mailing list<br>FWTools@lists.maptools.org<br>http://lists.maptools.org/mailman/listinfo/fwtools<br>http://fwtools.maptools.org/<br></font>