Theory of Brighter and Bigger 3.0
1. Overview
This paper describes the color transformation that the app "Brighter and Bigger" 3.0 applies to improve the legibility of an image. The framework of this paper is a reorganization, for version 3.0, of the mathematical expressions in the appendix of the README of version 2.0 of the same app [1]. The essential point is that only the lightness is changed while the chromaticity is preserved. Because only the lightness is manipulated, the hue does not change, and only the difference between light and dark is emphasized.
1-1. Assumptions
The following are assumed throughout this paper.
- 1. White point: D65, (the defined value in the sRGB and Display P3 standards [2][3][4]). It is common to all conversions.
- 2. Observer: the CIE 1931 2° standard observer [5] (the definition of XYZ [6][7]).
- 3. Color spaces: the input and the display are each either sRGB [2] or Display P3 [3][4]. The two share the same transfer function and differ only in the primaries (§2, §3).
- 4. Quantization: 8 bits ( to ). The encoded value is treated as a real number in obtained by dividing the pixel value by .
- 5. Chromatic adaptation: since the white points of the input and the display are both D65, no chromatic adaptation transform is applied.
- 6. Lightness and chromaticity: the lightness is the of CIELUV, and the chromaticity is of the CIE 1976 UCS diagram [6][7].
1-2. Notation
- : the components of linear RGB, taken in with white equal to . : the components of XYZ ( is for white).
- : the encoded value (). : the linear value (). The chromaticity coordinates use the same letter as the linear value , but in §3 and §4 they denote chromaticity coordinates.
- : the RGB → XYZ conversion matrix. : the XYZ → RGB conversion matrix.
- : the chromaticity coordinates of the CIE 1976 UCS diagram.
- : the lightness, expressed on the scale , which is the CIE definition ( to ) divided by . Thus "" corresponds to CIE .
- The lightness at each stage is denoted as follows: for the input (the camera image), after Brighter, after Clearer, and after Brightness Reverse. In each section the lightness before the transform and the lightness after the transform are written with these symbols. When the reversal is not applied, .
- : the brightness parameter (). : the contrast parameter ().
1-3. Flow of the processing
For each pixel of the image, the processing is applied in the following order.
encoded RGB ──(§2) decoding──▶ linear RGB ──(§3) matrix──▶ XYZ ──(§4)──▶ u′v′ and L* L* ──(§5) Brighter ──▶ L*_b ──(§6) Clearer ──▶ L*_c ──(§7) Brightness Reverse ──▶ L*_r u′v′ ──(§8) Monochrome Mode: mix the u′v′ of a light and a dark color by L*_r ──▶ u′v′ (L*_r, u′, v′) ──(inverse of §4)──▶ XYZ ──(inverse of §3)──▶ linear RGB ──(encoding of §2)──▶ encoded RGB
The Tilted Angle Correction (§9) gives the correspondence between points on the screen and points on the image, independently of the color computation above.
2. Transfer functions (gamma)
The relation between the encoded value (; for 8 bits, ) and the linear value () is defined as the transfer function [8]. The sRGB function of IEC 61966-2-1 [2] is used.
Decoding (encoded value to linear value):
Encoding (linear value to encoded value):
The two expressions are continuous at (), since .
The transfer function of Display P3 is identical to that of sRGB.
Before encoding, values that have become negative outside the color gamut are replaced by (because a power of a negative number is undefined). Both the decoded and the encoded results are confined to the range to .
3. Conversion between RGB and XYZ
Let the linear RGB be the column vector , with the white point D65. The conversion matrices are derived from the chromaticities of the primaries and the white point as follows [7][8].
3-1. Derivation from the primaries and the white point
Let be the chromaticity of primary (), and define its direction vector
Let be the matrix having these vectors as columns, and let be the vector of the same form for the chromaticity of the white point. The condition that white () is mapped to , namely , determines the strength coefficients of the primaries, . The RGB → XYZ matrix is then
with which white has . The XYZ → RGB matrix is the exact inverse of .
3-2. sRGB
The chromaticities of the primaries are R, G, B, and the white point is D65 with (IEC 61966-2-1 [2]). By §3-1, the values derived in double precision are, to seven digits,
The forward matrix given in the standard [2] to four decimal places (Eq. (7)) coincides with the derived values rounded to four digits.
The inverse matrix of the standard to four digits (Eq. (8)) is the rounded inverse of the rounded forward matrix, and therefore differs from the inverse of the derived matrix above in the fourth digit.
3-3. Display P3
The chromaticities of the primaries are R, G, B, and the white point is D65 with (SMPTE EG 432-1 [3]; Apple's definition [4]). By §3-1 one obtains likewise
3-4. Exchanging color spaces
XYZ does not depend on the color space. Therefore, even when the input is sRGB and the output is Display P3, , and take the same values on XYZ, and the same color keeps the same appearance while the wide gamut of P3 can be represented.
4. XYZ and CIELUV
4-1. Chromaticity
The chromaticity of the CIE 1976 UCS diagram is given by [6][7]
In terms of the chromaticity,
For (black) the denominator vanishes, so the value of the D65 white, , is used.
4-2. Lightness
The CIE 1976 lightness (on the scale ) is given by [6][7]
Here is with , and corresponds to . This is the CIE definition divided by , and the two expressions are continuous at the boundary , where .
4-3. Inverse conversion
XYZ is obtained from the lightness after the transform, , and the chromaticity by
where .
The boundary corresponds to CIE (). Eq. (15) is the definition of and in Eq. (11) solved for and ; multiplication by changes the brightness while the chromaticity stays unchanged.
5. Brighter
The value is added to the lightness before the transform, , to give the lightness after the transform, .
A positive makes the whole image brighter and a negative makes it darker. The chromaticity is not changed.
6. Clearer
A logistic function normalized so that both ends coincide with and is applied to the lightness before the transform, , to give the lightness after the transform, .
Properties
- End points and center: at , at , and at . The curve is point-symmetric about the point . The denominator is the normalization that fits both ends to and .
- Slope: The slope at is
which is about for , for , and for . The larger is, the steeper the curve is near the center: the dark side becomes darker and the light side becomes lighter, so that the difference between light and dark is emphasized.
Inverse function: Put . Then
- Even for the map is not the identity but a gentle S-shaped curve with . The maximum deviation from the identity is , at .
- Combination with Brighter: When is added, the center of the S-shaped curve (the point where ) moves to .
- Domain: For , may extend outside . In that case may also extend outside (for example, for and , ranges from to ). The larger is, the closer to or the outlying part falls asymptotically. Clipping to the displayable range is performed at the encoding stage of §2.
Origin
This S-shaped curve was inspired by the compression of the cone response. That the CIE lightness is expressed as the cube root of the intensity is known as a fit of Stevens' power law [9]. In contrast, the compression of the cone response is expressed by the following fractional function.
This is a function of the Naka–Rushton type [10], which has also been fitted to measurements of primate cones [11]. Similar compression is used in the compression stages of the color appearance models CIECAM02 [12] and CAM16 [13] (see [14] for an exposition). Plotted against the logarithm of the intensity, the fractional function draws the same S-shaped curve as the logistic function. The logistic function was adopted because the slope can be controlled by a single parameter and because the normalization that fits both ends to and is simple.
7. Brightness Reverse
From the lightness before the transform, , the lightness after the transform, , is defined by
When the reversal is not applied, . The reversal is applied to . Since the S-shaped curve is point-symmetric about , exchanging the order of the reversal and Clearer does not change the result when . When , the result depends on the order.
8. Monochrome Mode
In Monochrome Mode, the chromaticity of the original pixel is discarded and replaced with a chromaticity obtained by mixing the of a light color and a dark color by . The light color L and the dark color D are specified by sRGB values, and their chromaticities obtained by §4-1 are denoted and .
- When L = D, the mode is one-color: the chromaticity is constant and only the brightness varies. When L ≠ D, the mode is two-color: the dark side approaches the tint of D and the light side that of L.
- The mixing is a linear interpolation on the plane, not in . The result lies on the line segment connecting the two points. Since the triangle of the color gamut is convex, the mixed chromaticity does not leave the gamut for .
- When the light or dark color is black (XYZ all zero), the chromaticity of the D65 white is used, as in §4-1.
Clipping at the gamut boundary
When is increased with the chromaticity fixed, there is a point at which the linear RGB values exceed while the chromaticity is unchanged. The excess is clipped to by the encoding, and the tint moves toward white. For a color of chromaticity , let be the largest linear RGB component per unit luminance (). Clipping begins at the luminance , that is,
This threshold depends on the color. Examples with sRGB linear RGB are given below.
| Color | RGB | Largest component at (linear) | |
|---|---|---|---|
| White (achromatic) | FFFFFF | no clipping | 1.00 |
| Yellow | FFFF00 | 0.972 | 1.08 |
| Cyan | 00FFFF | 0.912 | 1.27 |
| Green | 00FF00 | 0.878 | 1.40 |
| Sepia | 6A4A2B | 0.799 | 1.77 |
The larger the largest component per unit luminance, the lower the threshold. For example, sepia has a small largest component, but when converted to unit luminance its is large, so its threshold is as low as . In the two-color mode, the same threshold is determined for each mixed chromaticity.
9. Tilted Angle Correction (projection transform)
A sheet of paper photographed from an oblique direction is corrected to look as if viewed from directly above. The correction is represented by a single projective transformation that maps a point on the corrected screen to a point on the image.
9-1. Inverse of the perspective
The paper is assumed to be a plane whose center is crossed by the optical axis of the camera. The plane is tilted about a horizontal axis by a tilt angle (), with the upper part of the paper farther away. Taking the focal length as the unit of distance, let the distance from the camera to the center of the paper be . A point on the paper lies at in three dimensions, and its image coordinates (in units of the focal length) are
The normalized image coordinates (with the edges of the image at ) are related to these through the width and the height of the image and the focal length (in the same unit) by
Here and are the tangents of the half angles of view, and is the one in the vertical direction of the screen.
Let the normalized coordinates of the corrected screen be proportional to the coordinates on the paper, and . Substituting these into Eq. (26) and solving for and gives the map from a point of the corrected screen to a point of the image.
This is the projective transformation, in homogeneous coordinates, given by the following matrix .
Applying to gives , and . The case where the near side is the bottom side is shown. When the near side is the right, top, or left side, the matrix of the same form with the axes and signs exchanged is used.
The distance to the paper is not needed. Changing the distance only changes the overall scale of the corrected image.
The aspect ratio is preserved. The physical coordinates of the corrected screen, given the aspect ratio of the image, are . That is, the corrected image is the coordinates of the plane of the paper itself and is similar to it. Therefore ratios of lengths and angles are preserved, and a square sheet of paper is imaged as a square. This is the metric rectification of Hartley and Zisserman [15] (Section 2.7), applied to the case where the tilt is restricted to a horizontal axis.
9-2. Magnification that fills the margins
To keep the four corners of the corrected screen inside the image, the coordinates of the screen must be scaled by . From the condition that the near corners lie inside the image, , the magnification is
( is preserved as long as ). The value increases with , and part of the edge of the image falls outside the screen.
9-3. The overall transformation
The transformation from a point on the screen (with coordinates normalized to the range to ) to a point on the image is the composition of the following maps.
| Symbol | Meaning | Expression |
|---|---|---|
| screen coordinates → NDC ( to ) | ||
| inverse of zoom, pan, and horizontal flip | ||
| inverse of the magnification that fills the margins | of Eq. (30) | |
| inverse of the perspective | Eq. (29) | |
| NDC → image coordinates | a linear map (determined by the orientation of the image) |
Here is the magnification, and are the shifts, and and are the ratios that make the image fill the screen (one of them is ). The transformation from the image to the screen is given by the inverse matrix of , which is again a projective transformation.
References
[1] K. Asada, "Brighter and Bigger", README (appendix: mathematical expressions of the Brighter and Clearer theory), GitHub repository asada0/BrighterAndBigger, 2019, MIT License. https://github.com/asada0/BrighterAndBigger
[2] IEC 61966-2-1:1999, Multimedia systems and equipment — Colour measurement and management — Part 2-1: Colour management — Default RGB colour space — sRGB, International Electrotechnical Commission; and Amendment 1:2003 (published 23 January 2003).
[3] SMPTE EG 432-1:2010, Digital Source Processing — Color Processing for D-Cinema, Society of Motion Picture and Television Engineers, 10 November 2010. doi:10.5594/SMPTE.EG432-1.2010
[4] Apple Inc., "Display P3", ICC RGB Color Space Registry, International Color Consortium, version 1.0, 9 February 2022. https://registry.color.org/rgb-registry/displayp3 (accessed 22 October 2026). See also Apple Developer Documentation, CGColorSpace.displayP3, https://developer.apple.com/documentation/coregraphics/cgcolorspace/displayp3 (accessed 22 October 2026).
[5] T. Smith and J. Guild, "The C.I.E. colorimetric standards and their use", Transactions of the Optical Society, vol. 33, no. 3, pp. 73–134, 1931–32. doi:10.1088/1475-4878/33/3/301
[6] CIE 15:2004, Colorimetry, 3rd ed., Commission Internationale de l'Éclairage, 2004, ISBN 978-3-901906-33-6 (since superseded by CIE 015:2018).
[7] G. Wyszecki and W. S. Stiles, Color Science: Concepts and Methods, Quantitative Data and Formulae, 2nd ed., John Wiley & Sons, 1982, ISBN 978-0-471-02106-3.
[8] C. Poynton, Digital Video and HD: Algorithms and Interfaces, 2nd ed., Morgan Kaufmann, 2012, ISBN 978-0-12-391926-7.
[9] S. S. Stevens, "On the psychophysical law", Psychological Review, vol. 64, no. 3, pp. 153–181, 1957. doi:10.1037/h0046162
[10] K. I. Naka and W. A. H. Rushton, "S-potentials from colour units in the retina of fish (Cyprinidae)", The Journal of Physiology, vol. 185, no. 3, pp. 536–555, 1966. doi:10.1113/jphysiol.1966.sp008001
[11] J. M. Valeton and D. van Norren, "Light adaptation of primate cones: An analysis based on extracellular data", Vision Research, vol. 23, no. 12, pp. 1539–1547, 1983. doi:10.1016/0042-6989(83)90167-0
[12] CIE 159:2004, A Colour Appearance Model for Colour Management Systems: CIECAM02, Commission Internationale de l'Éclairage, 2004, ISBN 978-3-901906-29-9.
[13] C. Li, Z. Li, Z. Wang, Y. Xu, M. R. Luo, G. Cui, M. Melgosa, M. H. Brill, and M. Pointer, "Comprehensive color solutions: CAM16, CAT16, and CAM16-UCS", Color Research & Application, vol. 42, no. 6, pp. 703–718, 2017. doi:10.1002/col.22131
[14] M. D. Fairchild, Color Appearance Models, 3rd ed., John Wiley & Sons, 2013, ISBN 978-1-119-96703-3. doi:10.1002/9781118653128
[15] R. Hartley and A. Zisserman, Multiple View Geometry in Computer Vision, 2nd ed., Cambridge University Press, 2003, ISBN 978-0-521-54051-3. doi:10.1017/CBO9780511811685