corrected caluclation for the histogram in RGB mode (bug #466189).

2007-08-13  Sven Neumann  <sven@gimp.org>

	* app/base/gimphistogram.c (gimp_histogram_get_std_dev): corrected
	caluclation for the histogram in RGB mode (bug #466189).

svn path=/trunk/; revision=23232
This commit is contained in:
Sven Neumann 2007-08-13 10:34:35 +00:00 committed by Sven Neumann
parent 5df43c2cbb
commit 2d1c0dddc5
2 changed files with 21 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2007-08-13 Sven Neumann <sven@gimp.org>
* app/base/gimphistogram.c (gimp_histogram_get_std_dev): corrected
caluclation for the histogram in RGB mode (bug #466189).
2007-08-13 Sven Neumann <sven@gimp.org>
* libgimpwidgets/gimpnumberpairentry.c: use italic font if not in

View File

@ -469,7 +469,22 @@ gimp_histogram_get_std_dev (GimpHistogram *histogram,
count = 1.0;
for (i = start; i <= end; i++)
dev += gimp_histogram_get_value (histogram, channel, i) * SQR (i - mean);
{
gdouble value;
if (channel == GIMP_HISTOGRAM_RGB)
{
value = (HISTOGRAM_VALUE (GIMP_HISTOGRAM_RED, i) +
HISTOGRAM_VALUE (GIMP_HISTOGRAM_GREEN, i) +
HISTOGRAM_VALUE (GIMP_HISTOGRAM_BLUE, i));
}
else
{
value = gimp_histogram_get_value (histogram, channel, i);
}
dev += value * SQR (i - mean);
}
return sqrt (dev / count);
}