fix: swapped r and b channels in image analyser

This commit is contained in:
2 * r + 2 * t 2026-03-19 23:09:30 +11:00
parent f637bad0d9
commit 3c819cac1b

View file

@ -191,14 +191,14 @@ void ImageAnalyser::analyse(QPromise<AnalyseResult>& promise, const QImage& imag
continue; continue;
} }
const quint32 mr = static_cast<quint32>(pixel[0] & 0xF8); const quint32 mr = static_cast<quint32>(pixel[2] & 0xF8);
const quint32 mg = static_cast<quint32>(pixel[1] & 0xF8); const quint32 mg = static_cast<quint32>(pixel[1] & 0xF8);
const quint32 mb = static_cast<quint32>(pixel[2] & 0xF8); const quint32 mb = static_cast<quint32>(pixel[0] & 0xF8);
++colours[(mr << 16) | (mg << 8) | mb]; ++colours[(mr << 16) | (mg << 8) | mb];
const qreal r = pixel[0] / 255.0; const qreal r = pixel[2] / 255.0;
const qreal g = pixel[1] / 255.0; const qreal g = pixel[1] / 255.0;
const qreal b = pixel[2] / 255.0; const qreal b = pixel[0] / 255.0;
totalLuminance += std::sqrt(0.299 * r * r + 0.587 * g * g + 0.114 * b * b); totalLuminance += std::sqrt(0.299 * r * r + 0.587 * g * g + 0.114 * b * b);
++count; ++count;
} }