Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
isp:vibrancy [2019/05/09 00:15] – [Linear estimation] Igor Yefmov | isp:vibrancy [2023/09/05 06:22] (current) – [RGB color space] Igor Yefmov | ||
---|---|---|---|
Line 3: | Line 3: | ||
A vibrancy of a color is a perceived quality that is somewhat similar to Saturation. One could think of it as pure, bright, high chroma color. It is not an absolute measure (like Saturation) and there' | A vibrancy of a color is a perceived quality that is somewhat similar to Saturation. One could think of it as pure, bright, high chroma color. It is not an absolute measure (like Saturation) and there' | ||
- | Having said that we still want to make a distinction between " | + | Having said that we still want to make a distinction between " |
- | ===== Implementation overview (YUV color space) ===== | + | ===== RGB color space ===== |
+ | To adjust the saturation of a pixel in RGB space we will follow this general approach: | ||
+ | - create a desaturated version of the pixel by converting it to grayscale | ||
+ | - interpolate/ | ||
+ | |||
+ | FIXME | ||
+ | ===== YUV color space ===== | ||
The goal is to increase the Saturation of each pixel based on its current Saturation level, where the increase factor is inversely proportional to the current value. Given the range of values for '' | The goal is to increase the Saturation of each pixel based on its current Saturation level, where the increase factor is inversely proportional to the current value. Given the range of values for '' | ||
Line 35: | Line 41: | ||
==== Vector' | ==== Vector' | ||
- | Another way to see "how saturated is the color" would be to calculate the magnitude of the color vector, represented by its '' | + | Another way to see "how saturated is the color" would be to calculate the magnitude of the color vector, represented by its '' |
<code c++> | <code c++> | ||
// center-normalize the U and V | // center-normalize the U and V | ||
Line 58: | Line 64: | ||
===== Possible optimization ===== | ===== Possible optimization ===== | ||
- | (This is valid for CPU-type architecture and is not very applicable to FPGAs where general | + | (This is valid for CPU-type architecture and is not very applicable to FPGAs where general |
There are over 8 million pixels in a 4K image and only 65K (256*256) possible transformations to either '' | There are over 8 million pixels in a 4K image and only 65K (256*256) possible transformations to either '' | ||
Line 80: | Line 86: | ||
</ | </ | ||
- | ===== Implementation overview (HSL color space) ===== | + | ===== HSL color space ===== |
- | Moving to HSL for image processing has a wonderful advantage of " | + | Moving to HSL for image processing has a wonderful advantage of " |
As was described before the main idea of the Vibrancy is that the lowest saturated colors get the most relative boost in Saturation while highly saturated colors get progressively lower boost, up to a "no boost" for the 100% saturated colors. | As was described before the main idea of the Vibrancy is that the lowest saturated colors get the most relative boost in Saturation while highly saturated colors get progressively lower boost, up to a "no boost" for the 100% saturated colors. | ||
- | The boost multiplier therefore depends on the vibrancy factor and the pixel' | + | The scale (boost) multiplier therefore depends on the vibrancy factor and the pixel' |
+ | \[ | ||
+ | scale = 1 + \frac{100 - saturation}{100} * (vibrancy-1) \\ | ||
+ | vibrancy \in [0..1]\\ | ||
+ | saturation \in [0..100]\% | ||
+ | \] | ||
<code c++> | <code c++> | ||
- | return 1. + (100 - _s) / 100. * _vib; | + | return 1. + (100 - _s) / 100. * (_vib - 1); |
}</ | }</ | ||
- | Once the boost value is calculated - just apply it to the pixels: | + | Once the scale (boost) value is calculated - just apply it to the pixels: |
<code c++>// pseudo-code | <code c++>// pseudo-code | ||
void vibrancy(/ | void vibrancy(/ |