Summary: | Offer a "stretch histogram" functionality to automatically adjust brightness & gamma | ||
---|---|---|---|
Product: | [Applications] digikam | Reporter: | Alain Knaff <kde> |
Component: | Plugin-Editor-BCG | Assignee: | Digikam Developers <digikam-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | CC: | caulier.gilles, sven.burmeister |
Priority: | NOR | ||
Version: | 1.4.0 | ||
Target Milestone: | --- | ||
Platform: | Ubuntu | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | 6.1.0 | |
Sentry Crash Report: |
Description
Alain Knaff
2012-08-08 17:56:14 UTC
We need an algorithm to adjust BCG settings automatically... Any proposal, link, url ? Gilles Caulier I dunno... the histogram is displayed, so at some point it's probably stored somewhere. Assuming the histogram x axis goes from 0 to 99, maybe we could do something as follows: int min=-1; int max=-1; int i; for(i=0; i<=99; i++) { if(histogram[i] != 0) { min=i; break; } } for(i=99; i>=0; i++) { if(histogram[i] != 0) { max=i; break; } } brightnessCorrection = 100-(min+max); contrastCorrection = 100-(max-min); I don't really know the digikam code that much, so maybe the numbers (bounds) probably need adjustment and/or scaling to make everything fit. The goal here is to tweak contrast/brightness such that the black part of the histogram stretches enough to fill the available space, without any black part being "cut" off, and without any part where y is 0 (or very small) left over near the bounds. Reminds me of levels adjust, with some automatic determination of input range? Possibly... but it'd need a simpler UI Doesn't the auto-correction in the colours menu do that already? Unfortunately not (see my first comment) auto correction (I think the last option in it) does what levels adjust can be used for and hence imho what is needed to lighten up images that do not use the full spectrum/range. Just for info, AutoLevels code is in this dir, if you want to take a look to improve it : https://projects.kde.org/projects/extragear/graphics/digikam/repository/revisions/master/show/libs/dimg/filters/levels Gilles Caulier As S. Burmeister said in comment #5, stretch histogram feature is already implemented in Colors/Auto-color correction tool (available in BQM and Image Editor). I close this file now. Gilles Caulier |