From d2efee34edd7c70706864e892322872eb7af3320 Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme Date: Fri, 20 Nov 2015 13:37:48 +0100 Subject: [PATCH] [TASK] Complete implementation of piecebased contrast adaption. --- imageviewer-qt4.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/imageviewer-qt4.cpp b/imageviewer-qt4.cpp index 176b0c4..f0587e1 100644 --- a/imageviewer-qt4.cpp +++ b/imageviewer-qt4.cpp @@ -390,13 +390,13 @@ void ImageViewer::pieceLinearHistogrammAdaption() { used_space += source_histogramm[source_cursor]; source_cursor++; } + // If there is no more space, just put it to the last value used. :/ + // Otherwise, we don't know what to do with some pixels. + if(source_histogramm[source_cursor] > (free_total_space - used_space)) { + histogramm_map[source_cursor] = i; + } } - for(int i=0; i<256; i++) { - logFile << i << ": " << histogramm_map[i] << std::endl; - } - renewLogging(); - // Apply the map for each pixel. int h, s, l; for(int x=0; xgetImage()->width(); x++) {