[gdal-dev] Polynomial warping ?

Nicolas MERLET admin at merletn.org
Tue Mar 11 07:26:11 EDT 2008


Maxim,

Indeed, your changes are correct (my mistake about image mirroring). But as
I'm trying to produce a fully-automated batch correction of images from a
specific infrared camera, I'll have to implemented a small script to convert
ArcGIS GCPs to GDAL GCPs...

I've uploaded my final test here, including batch script :
http://dev.merletn.org/gis/final/final.zip

Here is the result :
http://dev.merletn.org/gis/final/warp.tif

Another interesting point : whereas some users usually use gdal_translate,
then gcps2wld, and finally gdalwarp, it does produce the same result if you
just use gdal_translate to add GCPs then gdalwarp to apply them. It depends
on what is your final goal...

Thank you very much Maxim.

Yours, Nicolas
 

> -----Original Message-----
> From: Maxim Dubinin [mailto:sim at gis-lab.info] 
> Sent: Monday, March 10, 2008 6:07 PM
> To: Nicolas MERLET
> Cc: gdal-dev at lists.osgeo.org
> Subject: Re[2]: [gdal-dev] Polynomial warping ?
> 
> Nicolas,
> 
> I think the problem is the way you address Y-coords in your gcps and
> output. Try a simple example with your grid, compare this (notice the
> last point):
> gdal_translate.exe -of GTiff -gcp 0 0 100 100 -gcp 642 0 200 
> 100 -gcp 642 482 200 0 grid.jpg grid.tif
> and this
> gdal_translate.exe -of GTiff -gcp 0 0 100 100 -gcp 642 0 200 
> 100 -gcp 642 -482 200 0 grid.jpg grid.tif
> 
> You'll see, that (as you can see in your gdalwarp.jpg), your 
> file will be also
> mirrored, which means, that it is not correct to address pixel the
> same way as ArcGIS does.
> 
> As for the polynomial transformation, I modified your gcps, rounded a
> little, multiplied your Y-in coord by -1 and added 480 to Y-out coord:
> 
> gdal_translate.exe  -of GTiff -gcp 0 0 0 480 -gcp 640 480 640 0 -gcp 0
> 480  0  0  -gcp  640 220 640 220 -gcp 0 220 0 220 -gcp 340 220 340 220
> -gcp  340  480  340  0  -gcp 340 0 340 480 -gcp 640 0 640 700 grid.jpg
> grid.tif
> 
> gdalwarp.exe -order 2 grid.tif grid-warp.tif
> 
> Seems like it did the trick, see attachement.
> 
> Maxim




More information about the gdal-dev mailing list