[Qgis-developer] Affine transformation code in Georeferencer -- incomplete?

Benjamin Ducke benducke at fastmail.fm
Tue May 5 02:41:01 PDT 2015


On 05/05/15 11:20, Olivier Dalang wrote:
> Hi,
> 
> If I'm correct, the QgsLeastSquares::affine() method is used when
> creating a worldfile, and it seems it does not account for rotation (at
> least the generated worldfiles don't).

Ok, that explains a lot.

> 
> Not really sure of what you're trying to do,

I am trying to extract the transformation methods
to plain C. I find that they are nicely designed and
compact, with GNU Scientific Library (also a plain C
lib) being the only dependency. I am not aware of any
other simple C lib for such transformations and I would
like to make the excellent QGIS implementations of
Helmert and projective transformations available to
C and Java (via JNI bindings) programmers. Granted,
affine transformations are usually easier to find,
but for the sake of completeness...

> but just in case, here's my
> implementation to compute worldfile parameters with rotation too (I had
> no time to port to core yet) : 
> 
> https://gist.github.com/olivierdalang/ba97fc986ade4545068d
> 

Thanks! I will take a look. Maybe this already contains
all I am searching for.

Cheers,

Ben

> Best,
> 
> Olivier
> 
> 
> 
> 
> 2015-05-04 10:35 GMT+02:00 Benjamin Ducke <benducke at fastmail.fm
> <mailto:benducke at fastmail.fm>>:
> 
>     Dear Devs --
> 
>     I am currently converting the transformation methods
>     in the QGIS Georeferencer to plain C.
>     So far, I have been able to extract and convert the
>     projective and Helmert transformations.
> 
>     However, the code for the affine transformation seems
>     incomplete.
> 
>     Looking here:
> 
>     https://github.com/qgis/QGIS/trunk/src/plugins/georeferencer/qgsleastsquares.cpp
> 
>     I find this method:
> 
>     void QgsLeastSquares::affine()
> 
>     It computes a 6x6 transformation matrix but stops there.
>     In analogy to "QgsLeastSquares::helmert()", I _think_
>     the next step should be to extract the rotation, scaling,
>     translation and shearing vectors using "gsl_vector_get()".
> 
>     It seems to me that "QgsLeastSquares::affine()" has been
>     abandoned code for a while and that the affine transformation
>     is now delegated to gdal_warp(?).
> 
>     Does anyone here still remember how to extract the affine
>     components from the 6x6 matrix? I have done some extensive
>     searching on the web but came up empty. Any pointers would
>     be greatly appreciated.
> 
>     Cheers,
> 
>     Ben
>     _______________________________________________
>     Qgis-developer mailing list
>     Qgis-developer at lists.osgeo.org <mailto:Qgis-developer at lists.osgeo.org>
>     http://lists.osgeo.org/mailman/listinfo/qgis-developer
> 
> 



-- 
Dr. Benjamin Ducke
{*} Geospatial Consultant
{*} GIS Developer

Spatial technology for the masses, not the classes:
experience free and open source GIS at http://gvsigce.org


More information about the Qgis-developer mailing list