[GRASS-user] g.transform: forward and reverse rmse

Dear All,

I have a problem understanding how to interprete the reverse and forward
rmse returned by g.transform. I found Glynn's explanation [1], but,
shame one me, I don't quite get it. Is there anybody willing to put the
explanation some other words so maybe this gives enough clue?

I noticed that e.g. i.points displays only one rmse value, which
g.transform returns as the forward one. Looks like other GIS software
don't bother with reverse rmse either. So what is the use of this
reverse rmse information actually?

[1]http://lists.osgeo.org/pipermail/grass-dev/2006-June/024208.html

--
Maciej Sieczka
www.sieczka.org

Maciej Sieczka wrote:

I have a problem understanding how to interprete the reverse and forward
rmse returned by g.transform. I found Glynn's explanation [1], but,
shame one me, I don't quite get it. Is there anybody willing to put the
explanation some other words so maybe this gives enough clue?

First, best-fit forward and/or reverse transformations are computed
based upon the GCPs. The same algorithm is used for both forward and
reverse transforms, the only difference being that the control points
are swapped.

Note that, unless order=1, the two transformations will typically not
be exact inverses as the inverse of a polynomial containing quadratic
or higher terms is not itself a polynomial.

The RMS error for a transformation is the mean of the squares of the
distances between the transformed source point and the corresponding
destination point.

If you have a GCP pair ((sx,sy),(dx,dy)) and a transformation T, the
transformed source point is (tx,ty) = T(sx,sy). The square of the
distance is (tx-dx)^2+(ty-dy)^2. The total square error is the sum of
these values, the mean square error is the total square error divided
by the number of values, and the root mean square error is the square
root of the mean square error.

The forward and reverse RMS errors correspond to the forward and
reverse transformations.

The forward error provides an estimate of how far a forward-projected
point in the source coordinate system will be from the actual position
of that point in the destination coordinate system.

The reverse error provides an estimate of how far a reverse-projected
point in the destination coordinate system will be from the actual
position of that point in the source coordinate system.

--
Glynn Clements <glynn@gclements.plus.com>

Thanks Glynn. One question more below.

Glynn Clements pisze:

Note that, unless order=1, the two transformations will typically not
be exact inverses as the inverse of a polynomial containing quadratic
or higher terms is not itself a polynomial.

Even for order=1 I get rather huge differences between forward and reverse. Normal? Order 1-3 examples for a single GCP set, g.transform -s group=tmp format=idx,fd,rd:

# Order=1:

index forward reverse
  0 140.159347 30.366192
  1 75.549553 16.157024
  2 20.384295 4.152418
  3 88.853688 19.265900
  4 88.257880 19.471545
  5 28.997927 6.360764
  6 96.951029 21.909275
  7 98.251481 21.344657
  8 75.633328 17.289931
  9 55.503010 12.158829
  10 52.191730 11.329603
  11 121.973315 27.215642
  12 69.859427 15.239316
  13 137.981202 29.362434
Number of active points: 14
Forward:
x[13] = 127.41
y[11] = 119.24
g[0] = 140.16
RMS = 89.31
Reverse:
x[13] = 28.74
y[11] = 25.14
g[0] = 30.37
RMS = 19.52

# Order=2:

index forward reverse
  0 93.801673 19.746141
  1 56.120534 11.776122
  2 44.347503 9.766772
  3 87.236869 19.091564
  4 57.147439 12.625245
  5 41.602974 9.331447
  6 67.226825 14.996778
  7 117.409320 26.196235
  8 23.107091 5.814319
  9 68.110687 14.954173
  10 68.366499 15.039828
  11 96.381244 20.478652
  12 38.714956 8.008384
  13 91.457126 18.595213
Number of active points: 14
Forward:
x[13] = 90.45
y[7] = 96.79
g[7] = 117.41
RMS = 72.62
Reverse:
x[13] = 18.58
y[7] = 24.29
g[7] = 26.20
RMS = 15.72

# Order=3:

index forward reverse
  0 30.058621 5.273581
  1 9.214810 2.597311
  2 23.887028 5.573190
  3 43.321031 10.109480
  4 58.855332 13.138564
  5 52.926125 10.500470
  6 43.858184 11.035265
  7 81.241239 19.131565
  8 14.513041 3.562930
  9 39.791625 7.880774
  10 51.354498 12.139448
  11 44.211574 10.147233
  12 8.597234 1.926148
  13 37.500769 7.736833
Number of active points: 14
Forward:
x[7] = 35.53
y[7] = 73.06
g[7] = 81.24
RMS = 43.17
Reverse:
x[7] = 9.76
y[7] = 16.46
g[7] = 19.13
RMS = 9.74

Maciek

--
Maciej Sieczka
www.sieczka.org

Maciej Sieczka wrote:

> Note that, unless order=1, the two transformations will typically not
> be exact inverses as the inverse of a polynomial containing quadratic
> or higher terms is not itself a polynomial.

Even for order=1 I get rather huge differences between forward and
reverse. Normal? Order 1-3 examples for a single GCP set, g.transform -s
group=tmp format=idx,fd,rd:

# Order=1:

index forward reverse
  0 140.159347 30.366192
  1 75.549553 16.157024
  2 20.384295 4.152418
  3 88.853688 19.265900
  4 88.257880 19.471545
  5 28.997927 6.360764
  6 96.951029 21.909275
  7 98.251481 21.344657
  8 75.633328 17.289931
  9 55.503010 12.158829
  10 52.191730 11.329603
  11 121.973315 27.215642
  12 69.859427 15.239316
  13 137.981202 29.362434
Number of active points: 14
Forward:
x[13] = 127.41
y[11] = 119.24
g[0] = 140.16
RMS = 89.31
Reverse:
x[13] = 28.74
y[11] = 25.14
g[0] = 30.37
RMS = 19.52

Note that the forward/reverse ratio only varies between 4.37 and 4.90,
so there's a high degree of correlation between the two. Each set of
numbers is measured in the corresponding coordinate system, so if you
have e.g. pixels for the source, metres for the destination, and a
resolution of 5 metres/pixel, you would expect the forward errors (in
metres) to be roughly 5 times the reverse errors (in pixels).

The above figures would make sense for a scale factor of around 4.5.

# Order=2:

Ratio = 3.97 - 4.92

# Order=3:

Ratio = 3.55 - 5.70

For higher-order transformations, I would expect more divergence if
the "exact" transformation is noticeably non-linear, as one of the
transformations will often be a better fit to a polynomial than the
other (e.g. for y = x^2 <=> x = sqrt(y), the former can be represented
exactly while the latter can only be approximated).

--
Glynn Clements <glynn@gclements.plus.com>