[Digikam-devel] [Bug 142571] Auto-exposure result is different from the preview
Jörg Kühne
joerg.kuehne at lycos.de
Thu Mar 8 21:34:03 GMT 2007
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.kde.org/show_bug.cgi?id=142571
------- Additional Comments From joerg.kuehne lycos de 2007-03-08 22:34 -------
The Auto-exposure values calculated from prewiew picture are different from the values of the original picture (black/white point).
Try the following patch. It works fine for me.
----------------------------------------------------
Index: libs/whitebalance/whitebalance.cpp
===================================================================
--- libs/whitebalance/whitebalance.cpp (revision 640698)
+++ libs/whitebalance/whitebalance.cpp (working copy)
@ -179,18 +179,13 @
// Calculate optimal exposition and black level
- int stop, i, scale, w, h;
- double sum;
+ double sum, stop;
+ int i;
uint rgbMax = sb ? 65536 : 256;
- w = width / 400;
- h = height / 400;
- scale = QMAX(w, h);
- scale = QMAX(1, scale);
-
// Cutoff at 0.5% of the histogram.
- stop = ((uint)(width / scale)*(uint)(height / scale)) / 200;
+ stop = width * height / 200.0;
for (i = rgbMax, sum = 0; (i >= 0) && (sum < stop); i--)
sum += histogram->getValue(Digikam::ImageHistogram::ValueChannel, i);
@ -198,10 +193,6 @
expo = -log((float)(i+1) / rgbMax) / log(2);
DDebug() << "White level at:" << i << endl;
- // Cutoff at 0.5% of the histogram.
-
- stop = ((uint)(width / scale)*(uint)(height / scale)) / 200;
-
for (i = 1, sum = 0; (i < (int)rgbMax) && (sum < stop); i++)
sum += histogram->getValue(Digikam::ImageHistogram::ValueChannel, i);
--------------------------------------------------
Jörg
More information about the Digikam-devel
mailing list