[gdal-dev] Deskewing geo-referenced scanned prints

Even Rouault even.rouault at mines-paris.org
Sun Apr 11 05:10:43 EDT 2010


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




More information about the gdal-dev mailing list