Input: integer array G[I][J][M], // Feature description of the whole image. integer vector W(k)[M]; // Etalon feature pattern: combination of features // representing the k-th segment. Output: integer matrix E(k)[I][J]; // Degree of similarity between feature patterns // of texture windows and etalon feature pattern. |
E(k) = 0; // Zeroing the matrix E(k). for (i = 0; i < I; i++) // Cycle through X coordinates of image. | for (j = 0; j < J; j++) // Cycle through Y coordinates of image. | | for (m = 0; m < M; m++) // Cycle through all M features. | | | { // Finding max and min between G[i][j][m] | | | | // and W(k)[m]. | | | | if (G[i][j][m] > = W(k)[m]) | | | | | { | | | | | | max = G[i][j][m]; // Calculation of the maximum value. | | | | | | min = W(k)[m]; // Calculation of the minimum value. | | | | | } | | | | else | | | | | { | | | | | | min = G[i][j][m]; // Calculation of the minimum value. | | | | | | max = W(k)[m]; // Calculation of the maximum value. | | | | | } | | | | E(k)[i][j] + = min / max; // Calculating similarity of m-th feature. | | | } |