Opened 13 years ago
Closed 5 years ago
#4278 closed defect (wontfix)
VizGeorefSpline2D::solve result not checked
Reported by: | yavorr | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | closed_because_of_github_migration |
Component: | Algorithms | Version: | 1.8.1 |
Severity: | normal | Keywords: | thin plate spline |
Cc: |
Description
The result of VizGeorefSpline2D::solve is not checked in GDALCreateTPSTransformer.
If VizGeorefSpline2D::solve fails the function still returns a not NULL result and the transformation becomes unpredictable.
The problem comes in solve:
// Invert the matrix int status = matrixInvert( _nof_eqs, _AA, _Ainv ); if ( !status ) { fprintf(stderr, " There is a problem to invert the interpolation matrix\n"); return 0; }
while calculating matrixInvert:
ftemp = temp[ k*2*N + k ]; if ( ftemp == 0.0f ) // matrix cannot be inverted
I think there should be something like this in GDALCreateTPSTransformer:
if ( psInfo->poForward->solve() == 0 || psInfo->poReverse->solve() == 0 ) { GDALDestroyTPSTransformer(psInfo); return NULL; }
Change History (4)
follow-up: 2 comment:1 by , 13 years ago
comment:2 by , 13 years ago
Replying to rouault:
I got the problem because of an error in my source - the GCPs were added twice. I don't know the maths behind TPS and why duplicate points are a problem. In that case both solve() return 0.
In my case - i need to do some forward transformations and then the warp so it will be a problem if only one of the directions is available.
comment:3 by , 9 years ago
Is this something that could be tested with a GeoTIFF that has duplicate GCPs? If it is, such a file would be nice to have as an annex.
comment:4 by , 5 years ago
Milestone: | → closed_because_of_github_migration |
---|---|
Resolution: | → wontfix |
Status: | new → closed |
This ticket has been automatically closed because Trac is no longer used for GDAL bug tracking, since the project has migrated to GitHub. If you believe this ticket is still valid, you may file it to https://github.com/OSGeo/gdal/issues if it is not already reported there.
Suggested fix looks straightforward at first sight, but I'm wondering if there are not situations where one way can be solved successfully, ant the reverse one not, and that we should still want to be able to use the transformer in the way where it is valid. I have no solid facts to bring in however to tell if it justs one metaphysical worry or a practical one.
If both forward and reverse can't be solved, then obviously, no point into returning a transformer. If forward->solve() returns 0, maybe we could just nullify forward and when it is used later (only one place), returns an error. The same for reverse.