[FWTools] gdalwarp issue?

Brent Fraser bfraser at geoanalytic.com
Thu Dec 16 13:18:18 EST 2010


That might be more trouble than its worth.  The trick is not to 
introduce any modeling "errors" when doing the steps, so the control 
points for the image's perspective transformation would have to first be 
projected from the sphere/spheroid to an orthographic map projection (I 
think).

Best Regards,
Brent Fraser


On 12/16/2010 9:26 AM, jkenneally at cartenav.com wrote:
> Hi Brent,
>
> That's a really good suggestion, especially as the perspective angle 
> gets more extreme.
>
> I dont think I can assume low altitude, so I think I will still need 
> to attempt to correct for curvature of the earth, but I'm wonder if I 
> can get away with doing an initial perspective transformation (ie warp 
> it to a 'top down' perspective), then follow up with a second order 
> polynomial gdalwarp for curvature?
>
> Cheers!
>
> -----Original Message-----
> From: "Brent Fraser" <bfraser at geoanalytic.com>
> Sent: Thursday, December 16, 2010 11:47am
> To: jkenneally at cartenav.com
> Cc: "Frank Warmerdam" <warmerdam at pobox.com>, fwtools at lists.maptools.org
> Subject: Re: [FWTools] gdalwarp issue?
>
> Jeff,
>
>   If your aerial photography is at a low altitude, earth curvature 
> won't play much of a part.  Then a better transformation might be a 
> projective transformation 
> (http://www.leptonica.com/affine.html#RELATED-TRANSFORMS).  
> Unfortunately GDAL doesn't support the projective transformation...
> Best Regards,
> Brent Fraser
>
> On 12/16/2010 8:03 AM, jkenneally at cartenav.com wrote:
>> Thanks a lot, Frank...that definitely seemed to help.   I've never 
>> really encountered 'thin plate splines' before, and I'm going to have 
>> to do a bit of reading regarding how they work.  However, in 
>> hind-sight I should have realized that I could only do an affine 
>> transform with four control points.
>>
>> I do have just a few more questions about this if you don't mind 
>> though...
>>
>> Regarding the thin plate spline transformation, I do get the general 
>> transformed shape I was expecting, but the sides are a little more 
>> 'curved' than I was expecting, and I'm not sure how accurate they 
>> are.  Is this to be expected?  I am attaching another tiny image to 
>> demonstrate the result of my earlier warp with the '-tps'.
>>
>> Lastly, based on further reading I get the impression that a second 
>> order polynomial warp will at least incorporate a better model of 
>> earths curvature into the transformation, and that a third order 
>> would also help account for the 'perspective' of the camera when the 
>> source imagery is not taken from a 'straight down' vantage point.   
>> If this is correct, is it enough to literally just specify a few more 
>> gcp's (6 total) for a second order, or 10 for the 3rd order?   I 
>> assume it would be best to distribute these gcp's fairly evenly over 
>> the source image?
>>
>> Thanks again for your help!
>> Jeff
>>
>> -----Original Message-----
>> From: "Frank Warmerdam" <warmerdam at pobox.com>
>> Sent: Wednesday, December 15, 2010 6:55pm
>> To: jkenneally at cartenav.com
>> Cc: fwtools at lists.maptools.org
>> Subject: Re: [FWTools] gdalwarp issue?
>>
>> On 10-12-15 01:49 PM, jkenneally at cartenav.com wrote:
>> > Once that is complete I run gdal_warp with the following arguments:
>> >
>> > 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"
>> >
>> > 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. I am suspicious that maybe I should be specifying a 
>> -a_src param
>> > for the translate call?
>> >
>> > 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. Also, the 
>> final warped
>> > 'test_image_rectified.tif' seems to be rotated correctly, just not 
>> bound within
>> > the correct 'footprint' shape.
>> ...
>> > 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.
>>
>> Jeff,
>>
>> Based on the image you attached I think you want more than a first order
>> polynomial transformation. You want, essentially, piecewise warping.
>> Four GCPs are only enough to give rotation and shear in a first order
>> polynomial. But if you use thin plate splines instead with the GCPs you
>> should get a more general transformation.
>>
>> Try adding "-tps" to the gdalwarp commandline arguments.
>>
>> Best regards,
>> -- 
>> ---------------------------------------+--------------------------------------
>> I set the clouds in motion - turn up | Frank Warmerdam, 
>> warmerdam at pobox.com
>> light and sound - activate the windows | http://pobox.com/~warmerdam
>> and watch the world go round - Rush | Geospatial Programmer for Rent
>>
>>
>> _______________________________________________
>> FWTools mailing list
>> FWTools at lists.maptools.org
>> http://lists.maptools.org/mailman/listinfo/fwtools
>> http://fwtools.maptools.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/fwtools/attachments/20101216/ade4265c/attachment.htm 


More information about the FWTools mailing list