Hi

Entropy map created by r.texture has nonsense values.

On uniform areas where there is only one category entropy shall be 0 but is 0.127575

probably the reason is in formula used in source code:

line 567, h_measure.c

float f9_entropy(float **P, int Ng)

/* Entropy */
{
    int i, j;
    float entropy = 0;

    for (i = 0; i < Ng; ++i)
    for (j = 0; j < Ng; ++j)
        entropy += P[i][j] * log10(P[i][j] + EPSILON); //<- here

    return -entropy;
}

According to my knowledge about entropy it shall be
shall be:

 entropy += P[i][j] * ln(P[i][j] +EPSILON)/ln(2.);

J.


_______________________________________________
grass-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-dev

Reply via email to