Summary: | Auto-exposure result is different from the preview | ||
---|---|---|---|
Product: | [Applications] digikam | Reporter: | Frédéric COIFFIER <frederic.coiffier> |
Component: | Plugin-Editor-AutoColors | Assignee: | Digikam Developers <digikam-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | caulier.gilles |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Gentoo Packages | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | 0.9.2 | |
Sentry Crash Report: |
Description
Frédéric COIFFIER
2007-03-05 22:20:12 UTC
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 SVN commit 641661 by cgilles: digikam from trunk : fix auto exposure computation algorithm. Patch from Joerg Kuehne. BUG: 142571 M +4 -13 whitebalance.cpp --- trunk/extragear/graphics/digikam/libs/whitebalance/whitebalance.cpp #641660:641661 @@ -179,18 +179,13 @@ // Calculate optimal exposition and black level - int stop, i, scale, w, h; - double sum; + int i; + double sum, stop; 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; 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); |