|
Krita Source Code Documentation
|
This namespace contains functions to compute the levels adjustment parameters automatically from a histogram. More...
Classes | |
| struct | ChannelHistogram |
| Convenience class that associates a KisHistogram and a channel index. This is useful because setting a channel on the histogram mutates it. This way the functions can change the histogram channel by looking at the "channel" field. More... | |
Enumerations | |
| enum | MidtonesAdjustmentMethod { MidtonesAdjustmentMethod_None , MidtonesAdjustmentMethod_UseMedian , MidtonesAdjustmentMethod_UseMean } |
| The different methods to enhance the mid tones. More... | |
| enum | ShadowsAndHighlightsAdjustmentMethod { ShadowsAndHighlightsAdjustmentMethod_MonochromaticContrast , ShadowsAndHighlightsAdjustmentMethod_PerChannelContrast } |
| The different methods to enhance the contrast. More... | |
Functions | |
| QVector< KisLevelsCurve > | adjustMonochromaticContrast (ChannelHistogram lightnessHistogram, QVector< ChannelHistogram > &channelsHistograms, qreal shadowsClipping, qreal highlightsClipping, qreal maximumInputBlackAndWhiteOffset, MidtonesAdjustmentMethod midtonesAdjustmentMethod, qreal midtonesAdjustmentAmount, const QVector< qreal > &outputBlackPoints, const QVector< qreal > &outputWhitePoints, const QVector< qreal > &outputMidtones) |
| Creates a KisLevelsCurve for every channel in "channelsHistograms". Computes the input black and white points from the intensity histogram. Computes the gamma from each channels histogram and "outputMidtones" if the method is not "None". The output black and white points are computed from "outputBlackPoints" and "outputWhitePoints". | |
| QVector< KisLevelsCurve > | adjustPerChannelContrast (QVector< ChannelHistogram > &channelsHistograms, qreal shadowsClipping, qreal highlightsClipping, qreal maximumInputBlackAndWhiteOffset, MidtonesAdjustmentMethod midtonesAdjustmentMethod, qreal midtonesAdjustmentAmount, const QVector< qreal > &outputBlackPoints, const QVector< qreal > &outputWhitePoints, const QVector< qreal > &outputMidtones) |
| Creates a KisLevelsCurve for every channel in "channelsHistograms". Computes the input black and white points from each channels histogram separately. Computes the gamma from each channels histogram and "outputMidtones" if the method is not "None". The output black and white points are computed from "outputBlackPoints" and "outputWhitePoints". | |
| QPair< KoColor, KoColor > | getDarkestAndWhitestColors (const KisPaintDeviceSP device, qreal shadowsClipping, qreal highlightsClipping) |
| Finds the darkest and whitest colors in the device having into account the clipping. | |
| qreal | getGamma (qreal blackPoint, qreal whitePoint, qreal inputIntensity, qreal outputIntensity) |
| Computes a gamma value that "moves" the input midpoint towards the output midpoint. | |
| QPair< qreal, qreal > | getInputBlackAndWhitePoints (ChannelHistogram histogram, qreal shadowsClipping, qreal highlightsClipping) |
| Takes a reference histogram (luma, lightness) and computes the black and white points to maximize the contrast having into account the clipping. | |
| QPair< qreal, qreal > | getMeanAndMedian (ChannelHistogram histogram, qreal begin, qreal end) |
This namespace contains functions to compute the levels adjustment parameters automatically from a histogram.
The different methods to enhance the mid tones.
| Enumerator | |
|---|---|
| MidtonesAdjustmentMethod_None | |
| MidtonesAdjustmentMethod_UseMedian | |
| MidtonesAdjustmentMethod_UseMean | |
Definition at line 39 of file KisAutoLevels.h.
The different methods to enhance the contrast.
| Enumerator | |
|---|---|
| ShadowsAndHighlightsAdjustmentMethod_MonochromaticContrast | |
| ShadowsAndHighlightsAdjustmentMethod_PerChannelContrast | |
Definition at line 31 of file KisAutoLevels.h.
| QVector< KisLevelsCurve > KRITAIMAGE_EXPORT KisAutoLevels::adjustMonochromaticContrast | ( | ChannelHistogram | lightnessHistogram, |
| QVector< ChannelHistogram > & | channelsHistograms, | ||
| qreal | shadowsClipping, | ||
| qreal | highlightsClipping, | ||
| qreal | maximumInputBlackAndWhiteOffset, | ||
| MidtonesAdjustmentMethod | midtonesAdjustmentMethod, | ||
| qreal | midtonesAdjustmentAmount, | ||
| const QVector< qreal > & | outputBlackPoints, | ||
| const QVector< qreal > & | outputWhitePoints, | ||
| const QVector< qreal > & | outputMidtones ) |
Creates a KisLevelsCurve for every channel in "channelsHistograms". Computes the input black and white points from the intensity histogram. Computes the gamma from each channels histogram and "outputMidtones" if the method is not "None". The output black and white points are computed from "outputBlackPoints" and "outputWhitePoints".
| lightnessHistogram | histogram to compute the input black and white points from |
| channelsHistograms | list of histograms to compute the gammas from. This is also used to know the number of output levels infos |
| shadowsClipping | A normalized percentage that is used to know how many samples should be clipped on the shadows side of the histogram by the input black point |
| highlightsClipping | A normalized percentage that is used to know how many samples should be clipped on the highlights side of the histogram by the input white point |
| maximumInputBlackAndWhiteOffset | A maximum value for the input black and white points. The black point won't be greater than this, and the white point won't be lesser than 1 - this |
| midtonesAdjustmentMethod | The method used to get the gamma |
| midtonesAdjustmentAmount | The strength of the midtone adjustment |
| outputBlackPoints | The output black points used in each levels info |
| outputWhitePoints | The output white points used in each levels info |
| outputMidtones | The desired output midtone values for the gamma adjustment |
Definition at line 138 of file KisAutoLevels.cpp.
References KisAutoLevels::ChannelHistogram::channel, KoHistogramProducer::channels(), getGamma(), getInputBlackAndWhitePoints(), getMeanAndMedian(), KisAutoLevels::ChannelHistogram::histogram, MidtonesAdjustmentMethod_None, MidtonesAdjustmentMethod_UseMean, and KisHistogram::producer().
| QVector< KisLevelsCurve > KRITAIMAGE_EXPORT KisAutoLevels::adjustPerChannelContrast | ( | QVector< ChannelHistogram > & | channelsHistograms, |
| qreal | shadowsClipping, | ||
| qreal | highlightsClipping, | ||
| qreal | maximumInputBlackAndWhiteOffset, | ||
| MidtonesAdjustmentMethod | midtonesAdjustmentMethod, | ||
| qreal | midtonesAdjustmentAmount, | ||
| const QVector< qreal > & | outputBlackPoints, | ||
| const QVector< qreal > & | outputWhitePoints, | ||
| const QVector< qreal > & | outputMidtones ) |
Creates a KisLevelsCurve for every channel in "channelsHistograms". Computes the input black and white points from each channels histogram separately. Computes the gamma from each channels histogram and "outputMidtones" if the method is not "None". The output black and white points are computed from "outputBlackPoints" and "outputWhitePoints".
| channelsHistograms | list of histograms to compute the gammas from. This is also used to know the number of output levels infos |
| shadowsClipping | A normalized percentage that is used to know how many samples should be clipped on the shadows side of the histogram by the input black point |
| highlightsClipping | A normalized percentage that is used to know how many samples should be clipped on the highlights side of the histogram by the input white point |
| maximumInputBlackAndWhiteOffset | A maximum value for the input black and white points. The black point won't be greater than this, and the white point won't be lesser than 1 - this |
| midtonesAdjustmentMethod | The method used to get the gamma |
| midtonesAdjustmentAmount | The strength of the midtone adjustment |
| outputBlackPoints | The output black points used in each levels info |
| outputWhitePoints | The output white points used in each levels info |
| outputMidtones | The desired output midtone values for the gamma adjustment |
Definition at line 200 of file KisAutoLevels.cpp.
References adjustMonochromaticContrast().
| QPair< KoColor, KoColor > KRITAIMAGE_EXPORT KisAutoLevels::getDarkestAndWhitestColors | ( | const KisPaintDeviceSP | device, |
| qreal | shadowsClipping, | ||
| qreal | highlightsClipping ) |
Finds the darkest and whitest colors in the device having into account the clipping.
| qreal KRITAIMAGE_EXPORT KisAutoLevels::getGamma | ( | qreal | blackPoint, |
| qreal | whitePoint, | ||
| qreal | inputIntensity, | ||
| qreal | outputIntensity ) |
Computes a gamma value that "moves" the input midpoint towards the output midpoint.
| blackPoint | If this gamma value will be part of a more complex levels adjustment, set its black point here. Set it to 0 otherwise. Since the gamma correction is applied after the linear mapping given by the black and white points in a levels adjustment, you have to provide those here to get the correct gamma |
| whitePoint | same as with blackPoint but for the white point |
| inputIntensity | This is the intensity value that we want to map to the output value. Sensible values are the mean and the median |
| outputIntensity | This is the intensity value to which the input value will be mapped to after the gamma correction. Use 0.5 to neutralize the midtones |
Definition at line 119 of file KisAutoLevels.cpp.
References qFuzzyCompare(), and qFuzzyIsNull().
| QPair< qreal, qreal > KRITAIMAGE_EXPORT KisAutoLevels::getInputBlackAndWhitePoints | ( | ChannelHistogram | histogram, |
| qreal | shadowsClipping, | ||
| qreal | highlightsClipping ) |
Takes a reference histogram (luma, lightness) and computes the black and white points to maximize the contrast having into account the clipping.
Definition at line 54 of file KisAutoLevels.cpp.
References KisAutoLevels::ChannelHistogram::channel, KoHistogramProducer::channels(), KoHistogramProducer::count(), KisHistogram::getValue(), KisAutoLevels::ChannelHistogram::histogram, KoHistogramProducer::numberOfBins(), KisHistogram::producer(), and KisHistogram::setChannel().
| QPair< qreal, qreal > KisAutoLevels::getMeanAndMedian | ( | ChannelHistogram | histogram, |
| qreal | begin, | ||
| qreal | end ) |
Definition at line 18 of file KisAutoLevels.cpp.
References KisAutoLevels::ChannelHistogram::channel, KoHistogramProducer::channels(), KisHistogram::getValue(), KisAutoLevels::ChannelHistogram::histogram, KoHistogramProducer::numberOfBins(), KisHistogram::producer(), and KisHistogram::setChannel().