[Gdal-dev] gdalwarp/gcps and ERROR 1: Failed to compute
polynomial equations of desired order
Ethan Alpert
ealpert at digitalglobe.com
Tue Sep 14 15:56:15 EDT 2004
That -gcp -gcp was just a cut and paste error.
Here's gdalinfo from mosaic_raw.tif
-bash-2.05b$ gdalinfo mosaic_raw.tif
Driver: GTiff/GeoTIFF
Size is 859, 2172
Coordinate System is `'
GCP Projection =
GCP[ 0]: Id=1, Info=
(0,0) -> (56.7469,29.4295,0)
GCP[ 1]: Id=2, Info=
(859,0) -> (56.9821,29.4211,0)
GCP[ 2]: Id=3, Info=
(859,2171) -> (56.9677,28.9774,0)
GCP[ 3]: Id=4, Info=
(0,2171) -> (56.7382,28.9917,0)
GCP[ 4]: Id=5, Info=
(0,1363) -> (56.7391,29.1199,0)
GCP[ 5]: Id=6, Info=
(859,1363) -> (56.9706,29.1071,0)
Metadata:
TIFFTAG_DOCUMENTNAME=mosaic.tif
TIFFTAG_SOFTWARE=ImageMagick 5.5.6 04/01/03 Q16
http://www.imagemagick.org
Corner Coordinates:
Upper Left ( 0.0, 0.0)
Lower Left ( 0.0, 2172.0)
Upper Right ( 859.0, 0.0)
Lower Right ( 859.0, 2172.0)
Center ( 429.5, 1086.0)
Band 1 Block=859x4 Type=UInt16, ColorInterp=Gray
Band 2 Block=859x4 Type=UInt16, ColorInterp=Gray
Band 3 Block=859x4 Type=UInt16, ColorInterp=Gray
-----Original Message-----
From: Frank Warmerdam [mailto:warmerdam at pobox.com]
Sent: Tuesday, September 14, 2004 1:31 PM
To: Ethan Alpert
Cc: gdal-dev at xserve.flids.com
Subject: Re: [Gdal-dev] gdalwarp/gcps and ERROR 1: Failed to compute
polynomial equations of desired order
Ethan Alpert wrote:
> Greetings,
>
> This is my first post. I tried searching around for examples but
> didn't
> find much and mailman's search capability is non-existant.
>
> So what's the secret for using more than 4 gcps with gdalwarp?
>
> I have 3 pieces of imagery I'm mosaicing. I know the corners of each
> image. I created a single non-projected tif of the three separate
> images. I computed where (in pixel space) the top two corners of the
> first two images are in the resulting tif and where the bottom two
> corners of the last image are. This resulted in 6 GCP points. So I ran
> the following:
>
> gdal_translate -gcp 0 0 56.7468972222222 29.4295138888889 -gcp 859 0
> 56.9820861111111 29.4210638888889 -gcp 0 1363 56.7391 29.1199027777778
> -gcp 859 1363 56.9705611111111 29.1071416666667 -gcp 859 2171
> 56.9677027777778 28.9774388888889 -gcp -gcp 0 2171 56.7381583333333
> 28.9917333333333 mosaic.tif mosaic_raw.tif
Ethan,
I think the problem is the "-gcp -gcp 0 2171..." part. The first -gcp
is being accepted, and then atoi() is called on the second so is
effectively being treated as "-gcp 0 0 2171 56.7381583333333
28.9917333333333". That is, the gcp is all screwed up.
You might want to use gdalinfo on your output files with GCPs to verify
they look sensible.
I think you will find things work somewhat better once the GCPs are
correct. However, there some issues with the GDAL polynomial warping.
1) gdalwarp creates a forwards and a backwards transformation from the
GCPs
but creates them independently by reversing the GCPs. They aren't
true
inverses. The forward transform is used to compute output bounds,
but the
reverse transform is what is actually used in the warping. With
highly
non-linear GCP sets this can have damaging effects.
2) I don't think the higher order polynomial calculations are actually
working
right. I would discourage using anything over second order.
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
More information about the Gdal-dev
mailing list