[gdal-dev] Re: Thin Plate Spline

Even Rouault even.rouault at mines-paris.org
Tue May 4 15:09:33 EDT 2010


Jan,

you'll need to provide the exact source data and command line you use because 
I can't reproduce any problem.

I've generated a 1000x1000 artificial dataset with the following features :
* background is black
* a white grid made of horizontal lines and vertical lines spaced with 100 
pixels
* 5 GCPs :
	- red square at (150, 150). Target coords are (500000 + 100, 4500000 - 100)
	- green square at (250,450). Target coords are (500000 + 100, 4500000 - 500)
	- yellow square at (50, 850). Target coords are (500000 + 100, 4500000 - 900)
	- cyan square at (950, 50). Target coords are (500000 + 900, 4500000 - 100)
	- magenta square at (850, 950). Target coords are (500000 + 900, 4500000 - 
900)

So the expected result is a warped grid, but such as the red,yellow,cyan and 
magenta points form a perfect square (and the green square is in the middle 
of the red-yellow segment). And that's exactly what I get. With a precision 
of sub-pixel.

Attached a ZIP with the source image and C source code used to generate it.

Command line used to warp : gdalwarp -tps src_grid.tif dst_grid.tif 

Best regards,

Even



Le Tuesday 04 May 2010 15:14:34 Jan Hartmann, vous avez écrit :
> Thanks, Jukka, that's exactly what I did. I used QGIS to test the
> coordinates in both images.
>
> Jan
>
> On 05/04/10 15:08, Jukka Rahkonen wrote:
> > Jan Hartmann<j.l.h.hartmann<at>  uva.nl>  writes:
> >> you can see a screenshot of the original image (right) and the
> >> georeferenced one (left, rotated almost 90 degrees). The red markers
> >> with the number 3 inside them show one of the control points: to the
> >> right the scan pixel  (5023/3421), to the left the targeted
> >> georeferenced coordinate in EPSG:28992 (121527/487174). As you see, the
> >> georeferenced point is not exactly on the border of parcel 7, as I
> >> expected. Above the map you see the four coordinates I used as control
> >> points; I added four extra points half way the original ones, so the
> >> complete warp was done with 8 control points.
> >
> > Hi,
> >
> > I can try to repeat your test some day. Is this your workflow:
> >
> > 1. gdal_translate -of VRT -gcp p1 l1 e1 n1 -gcp p2 l2 e2 n2 -gcp p3 l3 e3
> > n3 -gcp p4 l4 e4 n4 -gcp p5 l5 e5 n5 input.tif temp_with_gcp.vrt
> >
> > 2. gdalwarp -s_srs EPSG:28992 -t_srs EPSG:28992 -tps temp_with_gcp.vrt
> > warped.tif
> >
> > 3. Measure the coordinates of the ground control points from warped.tif
> >     with some GIS software like QGis and find out disappointed that
> >     they have shifted.
> >
> > -Jukka Rahkonen-
> >
> >
> >
> > _______________________________________________
> > gdal-dev mailing list
> > gdal-dev at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev


-------------- next part --------------
A non-text attachment was scrubbed...
Name: makegrid.c
Type: text/x-csrc
Size: 3462 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/gdal-dev/attachments/20100504/908203a1/makegrid-0001.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: src_grid.tif.zip
Type: application/x-zip
Size: 21379 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/gdal-dev/attachments/20100504/908203a1/src_grid.tif-0001.bin


More information about the gdal-dev mailing list