Input: binary matrix PEXMPL(k)[I][J]; // Exemplary seed patch for the k-th segment. integer array G[I][J][M]; // Feature description of the whole image. Output: integer vector W(k)[M]; // Etalon feature pattern: combination of features // representing the k-th segment. |
W(k) = 0; // Zeroing vector W(k). U = 0; // Zeroing number of pixels U in PEXMPL(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. | | | if (PEXMPL(k)[i][j] = = 1) // Testing: if pixel belongs to PEXMPL(k). | | | { | | | | U++; // Incrementing the number of pixels U. | | | | for (m = 0; m < M; m++) // Cycle through all features. | | | | W(k)[m] += G[i][j][m]; // Summation in the m-th element of | | | | // the vector W(k). | | | } } for (m = 0; m < M; m++) // Cycle through all features. | W(k)[m] = W(k)[m] / U; // Averaging m-th feature value of vector W(k). |