I have some scanned tiff images. I want to georeference them. I
calculate the tie points and pixel scales, but I could not succeeded
in writing them as tiff tags. Therefore, GTIFImageToPCS always fails
when I try to read the georeference information. I am using
libgeotiff. Is there a sample code to achieve this, which tags and
keys do I have to set ?
Thanks.
This http://en.wikipedia.org/wiki/Tiff might help explain some part
of the problem. It might not be your tags that are at issue but the
data itself. TIFF isn't a single format or even a standard, its a
bucket into which several formats have been dumped, much like jpeg.
But, enough griping, If you have a pixel size and a corner coordinate
you could write a tfw file, then convert this pair to GeoTIFF.
tfw looks like this (without the text)
5.000 pixel size in x
0 rotation of rows
0 rotation of columns
-5.00 pixel size in y
xxxxxxxxx.xxx x coordinate
yyyyyyyyy.yyy y coordinate
The y pixel size is minus because the corner the coordinates refer to
is the upper left corner.
http://www.remotesensing.org/geotiff/faq.html#Does%20GeoTIFF%20imagery%20conform%20to%20the%20TIFF%20specification?
gives most of the above info in a GIS context. There are simple
programs to convert TIFF/TFW to GeoTIFF.
Hi,
If programming by yourself is not needed, you could perhaps use gdal
programs, see http://www.gdal.org/
If you have at least three tie points for an image, you can use
gdal_translate to input tie points and gdalwarp to warp the image:
gdal_translate -gcp pixel line easting northing -gcp ... scanned.tif tmp.tif
gdalwarp tmp.tif result.tif
gdal_translate can also be used to convert tif/tfw to geotiff, if that
is enough for you.