[TASK] Fixed it, it was the wrong histogramm >.>

This commit is contained in:
Jan Philipp Timme 2015-12-04 14:21:26 +01:00
parent 662f990877
commit 6514501d1a
1 changed files with 3 additions and 1 deletions

View File

@ -402,12 +402,14 @@ void ImageViewer::partialLinearHistogrammAdaption() {
} }
} }
double* original_histogramm = original->getRelativeCumulativeIntensityHistogramm();
// Build up the brightness map to apply on the image // Build up the brightness map to apply on the image
// (basically inversing the histogramm map) // (basically inversing the histogramm map)
int* brightness_map = (int*) malloc(256*sizeof(int)); int* brightness_map = (int*) malloc(256*sizeof(int));
int j=0; int j=0;
for(int i=0; i<256; i++) { for(int i=0; i<256; i++) {
double old_cumulative_brightness = reference_histogramm[i]; double old_cumulative_brightness = original_histogramm[i];
while(old_cumulative_brightness > histogramm_map[j]) j++; while(old_cumulative_brightness > histogramm_map[j]) j++;
if(j > 255) j = 255; if(j > 255) j = 255;
brightness_map[i] = j; brightness_map[i] = j;