From 8e3070a4b481aa3e4cc7da2c94d68cd3767e4720 Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme Date: Tue, 10 Nov 2015 12:56:39 +0100 Subject: [PATCH] [TASK] Add comment to calcIntensity() --- imageviewer-qt4.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/imageviewer-qt4.cpp b/imageviewer-qt4.cpp index 94bda10..4fc8c19 100644 --- a/imageviewer-qt4.cpp +++ b/imageviewer-qt4.cpp @@ -73,6 +73,12 @@ void ImageViewer::initializeImage() { analyzeImage(); } +/** + * Uses simple weights to calculate intensity of a pixel. + * Using qRound() to reduce the error of the int cast. + * + * @brief ImageViewer::calcIntensity + */ int ImageViewer::calcIntensity(int r, int g, int b) { return (int) qRound(0.299*r + 0.587*g + 0.114*b); }