[gdal-dev] GCP reprojection

Fabian Schindler fabian.schindler at eox.at
Fri Dec 21 05:55:15 PST 2012


Hi devs,

Sorry for the noise, I figured it out. Seems like it worked all along 
with order 1, but I was just to blind to see.

Regards,
Fabian

On 12/18/2012 04:12 PM, Fabian Schindler wrote:
> Sorry for the traffic, just forgot to say that with the command line 
> utilities it works as expected:
>
> gdal_translate -gcp 0 0 16.1 48.5 -gcp 604 0 16.168 48.5033 -gcp 604 
> 297 16.168035 48.4835 -gcp 604 594 16.16804 48.4636 -gcp 0 594 16.1001 
> 48.46 -gcp 0 297 16.1 48.48 input.jpg tmp.tif
> gdalwarp -order 1 tmp.tif output.tif
>
> Thanks,
> Fabian
>
> On 12/18/2012 04:06 PM, Fabian Schindler wrote:
>> Hey devs,
>>
>> I've spent a full day to find a solution to this, but unfortunately 
>> was not able to solve it, so you are my last hope :)
>>
>> I'm trying to reproject an image with GCPs to a CRS specified by WKT.
>>
>> I used  `gdal.AutoCreateWarpedVRT` to retrieve the output image size 
>> + geotransform in conjunction with `gdal.ReprojectImage` to reproject 
>> the image. This worked well unless I have really few GCPs at my 
>> disposal (i.e: 6), then I just get the error "Failed to compute GCP 
>> transform: Transform is not solvable". (Funnily it works with only 4 
>> GCPs).
>>
>> I created a small C function to get the size and geotransform from an 
>> image with few GCPs (basically a small, Python callable wrapper for 
>> GDALSuggestedWarpOutput) with `order = 1` which helped me around the 
>> `gdal.AutoCreateWarpedVRT` error. But now I'm stuck with the 
>> `gdal.ReprojectImage`, which gives me the exact same error as above. 
>> ("Failed to compute GCP transform: Transform is not solvable"). I've 
>> also tried to create a wrapper here to use `order=1` but this time it 
>> did not help and the error stayed.
>>
>> My raster image size is 605x595 and I want to apply the following GCPs:
>>
>> pixel      line          lon       lat
>>
>> 0.000000   0.000000   -> 16.100000 48.500000
>>
>> 604.000000 0.000000   -> 16.168000 48.503300
>>
>> 604.000000 297.000000 -> 16.168035 48.483500
>>
>> 604.000000 594.000000 -> 16.168040 48.463600
>>
>> 0.000000   594.000000 -> 16.100100 48.460000
>>
>> 0.000000   297.000000 -> 16.100000 48.480000
>>
>> 0.000000   0.000000   -> 16.100000 48.500000
>>
>>
>> Is there any (C) function I can use instead? Or any other method to 
>> reproject images with few GCPs?
>>
>> Thanks,
>> Fabian
>>
>> P.S: I'm using GDAL 1.9.1 on CentOS 6.
>> _______________________________________________
>> 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



More information about the gdal-dev mailing list