implemented window function

This commit is contained in:
Damian Kowalski 2024-04-07 13:26:29 +02:00
parent d5dad0ee19
commit f8967f3893

View File

@ -159,8 +159,30 @@ math::matrix<float> Transformation::getWindow(int x, int y, int size,
Mode mode = RepeatEdge)
{
math::matrix<float> 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;
}