diff --git a/src/core/transformations/transformation.cpp b/src/core/transformations/transformation.cpp index 8cd9104..caf8b86 100644 --- a/src/core/transformations/transformation.cpp +++ b/src/core/transformations/transformation.cpp @@ -158,9 +158,31 @@ math::matrix Transformation::getWindow(int x, int y, int size, Channel channel, Mode mode = RepeatEdge) { - math::matrix window(size,size); + math::matrix window(size, size); + int center = size / 2; - qDebug() << Q_FUNC_INFO << "Not implemented yet!"; + for (int i = 0; i < size; i++) + { + for (int j = 0; j < size; j++) + { + QRgb p = getPixel(x - center + i, y - center + j, mode); + switch (channel) + { + case RChannel: + window[i][j] = qRed(p); + break; + case GChannel: + window[i][j] = qGreen(p); + break; + case BChannel: + window[i][j] = qBlue(p); + break; + case LChannel: + window[i][j] = qGray(p); + break; + } + } + } return window; }