Zoltan, With 4 GCPs, by default, gdalwarp uses a 1st-order polynomial If you provide 6 GCPs or more, it will use a 2nd-order polynomial.
You can also try specifying -tps to use the Thin Plate Spline transformer. Le Sunday 11 April 2010 13:38:21 Zoltan Szecsei, vous avez écrit : > Hi All, > Even's advice below (for cropping) was perfect for what I wanted, but now > I see that the original georeferencing of the scanned images was not that > great. > > I have pixel values for the (skew) LatLong corners, but I cant fathom out > how to use these as GCPs to re-geo-reference the scans. The following > introduces the GCPs into the image, > gdal_translate -gcp 361.125702 529.504089 20.00 -28.25 -gcp 6142.089844 > 530.520996 20.25 -28.25 -gcp 6129.833496 7090.170410 -20.25 -28.50 -gcp > 359.345825 7085.267090 20.00 -28.50 2820AC_1990_ED2_GEO.TIF > ../2820ac_gcp.tif > > but running: > gdalwarp -te 20.00 -28.50 20.25 -28.25 2820ac_gcp.tif 2820ac_warp.tif > does not give the desired results. > > > What is the correct way to improve the georeferencing of and existing > GeoTIFF, using GCPs? > > Thanks & regards, > Zoltan > > > > > Zoltan Szecsei wrote: > Hi Even, > I think I have spent too much time using older proprietary software. I > figured the image would have to be deskewed before using "te" option, but > now that you mention it, it makes sense that gdal would (should) look at > all the tfw & embedded parameters before it willy-nilly crops for the > output extents. (So yes, it should "just work") > > I'll give it a bash on one of the scans. > > Thanks & regards, > Zoltan > > Even Rouault wrote: > Zoltan, > > I'd use something like : gdalwarp -te 24.75 -34.25 25.00 -34.00 src.tif > out.tif > > In your case, you just need to be able to analyze the image name, compute > xmin, xmax, ymin, ymax, build the gdalwarp line and spawn the new process. > So I think you could use any programming/scripting language you like. I'd > personnaly use Python and the GDAL Python bindings (other well supported > binding languages are Perl, CSharp and Java). The advantage is that you > wouldn't need to make any assumption on the structure of the image name and > could get its spatial extent in a more reliable way. > > Le Sunday 11 April 2010 08:49:28 Zoltan Szecsei, vous avez écrit : > > Hi, > I'm using viewing software that cannot rotate images on the fly (see > non-zero rotation parameters in TFW below.) > > I have almost 2000 scans in GeoTIFF that I hence need to deskew and also > want to crop. > I've been looking at gdalwarp, but can't see an obvious way to > bash-script deskewing, so please can someone give me a pointer where to > start/research. > > Thanks in advance, > Zoltan > > Each image represents a quarter degree square and I can use the image > name to calculate the Lat Long values of the 4 corners. > 3424bb is: > TL: 34.00S 24.75E > TR: 34.00S 25.00E > BR: 34.25S 25.00E > BL: 34.25S 24.75E > I want to crop the image on these quarter degree boundaries, and deskew it. > <removed> as msg size exceeded 50k (was 70K) > The attached jpeg is a much-reduced sample, so you can get the idea of > what they look like. > </removed> > > I have the following information at hand: > > > ########################################################################### > ###### ls -la: > geograph geograph 5231378 2006-09-13 17:28 3424BB_1999_ED3_GEO.TIF > > ########################################################################### > ###### Pixel positions of the 4 quarter degree square corners are at: > TL 1090.489746 1226.423828 > TR 6546.639160 1220.069458 > BR 6546.430176 7770.449219 > BL 1106.605347 7776.899902 > > ########################################################################### > ###### cat 3424BB_1999_ED3_GEO.tfw > 0.0000459558 > -0.0000000502 > -0.0000000963 > -0.0000381753 > 24.6998662805 > -33.9529134036 > > ########################################################################### > ###### gdalinfo 3424BB_1999_ED3_GEO.TIF > Driver: GTiff/GeoTIFF > Files: 3424BB_1999_ED3_GEO.TIF > Size is 7796, 10629 > Coordinate System is: > GEOGCS["WGS 84", > DATUM["WGS_1984", > SPHEROID["WGS 84",6378137,298.2572235629972, > AUTHORITY["EPSG","7030"]], > AUTHORITY["EPSG","6326"]], > PRIMEM["Greenwich",0], > UNIT["degree",0.0174532925199433], > AUTHORITY["EPSG","4326"]] > GeoTransform = > 24.6998433507502, 4.595577857784442e-05, -9.634765806162092e-08 > -33.95289429083027, -5.021067810400542e-08, -3.817529052330018e-05 > Metadata: > AREA_OR_POINT=Area > TIFFTAG_XRESOLUTION=300 > TIFFTAG_YRESOLUTION=300 > TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch) > Image Structure Metadata: > COMPRESSION=LZW > INTERLEAVE=BAND > Corner Coordinates: > Upper Left ( 24.6998434, -33.9528943) ( 24d41'59.44"E, 33d57'10.42"S) > Lower Left ( 24.6988193, -34.3586595) ( 24d41'55.75"E, 34d21'31.17"S) > Upper Right ( 25.0581146, -33.9532857) ( 25d 3'29.21"E, 33d57'11.83"S) > Lower Right ( 25.0570905, -34.3590509) ( 25d 3'25.53"E, 34d21'32.58"S) > Center ( 24.8784669, -34.1559726) ( 24d52'42.48"E, 34d 9'21.50"S) > Band 1 Block=7796x1 Type=Byte, ColorInterp=Palette > Color Table (RGB with 256 entries) > 0: 106,180,131,255 > etc etc > > > > > > > > -- > > =========================================== > Zoltan Szecsei > Geograph (Pty) Ltd. > P.O. Box 7, Muizenberg 7950, South Africa. > > 65 Main Road, Muizenberg 7945 > Western Cape, South Africa. > > 34° 6'16.35"S 18°28'5.62"E > > Tel: +27-21-7884897 Mobile: +27-83-6004028 > Fax: +27-86-6115323 www.geograph.co.za > =========================================== > > _______________________________________________ > gdal-dev mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/gdal-dev _______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
