2

I have Python code that will automatically georeference drone images regardless of overlap and without SfM software. The code runs without error when I set my transformation type to a first order polynomial but I am unhappy with the georeferencing. I can alter my code to use a thin plate spline transformation and this also runs without error. I would like to test the output of a second order polynomial. When I change the arguments to gdal_warp to apply a second order polynomial I get the following error:

Error Info:
Failed to compute GCP transform: Transform is not solvable

Here is the relevant code for the working TPS transformation:

kwargs = {'format': 'GTiff', 'tps': True, 'dstSRS':'EPSG:4326'}

and here is the relevant code for the working first order polynomial transformation:

kwargs = {'format': 'GTiff', 'polynomialOrder':1,'dstSRS':'EPSG:4326'}
   

And here is the relevant code for the failed second order transformation:

kwargs = {'format': 'GTiff', 'polynomialOrder':2,'dstSRS':'EPSG:4326'}
    

If I try a second order transformation in QGIS with less than 6 GCPs QGIS complains and returns an error message that I need 6 GCPs for this transformation. I am feeding 6 GCP into GDAL. See this link for some past trouble shooting issues and details on the project.

Why is GDAL/Python not allowing me to do a second order polynomial transformation?

2
  • Can you use second order if you add your ground control points into GeoTIFF manually with gdal_translate and then run gdalwarp with -order 2?
    – user30184
    Sep 16, 2021 at 6:53
  • Yes, that is how I am doing it. I write the GCPs to a list, then iterate the list ap add gdal.GCP. After the GCP are added to the geoTiff I use gdal.Warp with my transformations.
    – GBG
    Nov 1, 2021 at 22:41

1 Answer 1

1

As per the suggestion from @user30184 feeding 8 gcps into the process solved the issue and allowed me to do a second order transformation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.