Gamma correction
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Feature
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- julia
- Domain
- computer-graphics
Research direction
Start by tracing the existing srgb_compand implementation and the RGB-to-other-space conversion paths mentioned in the issue; no file or test names are provided. Review the gamma-handling alternatives and determine the intended policy and interface before defining tests that establish the chosen behavior.
Written by the indexing model from the issue text.
Description
In view of @timholy's recent pull request, I thought I'd better raise the topic of Gamma, since we are concerned with being as correct as possible.
In brief, gamma correction is a nonlinear mapping applied to digital images at both capture and display, with the result that images are displayed in linear light. (In TV, this is largely an artefact of backwards compatible standards since the time of PAL/NTSC and not forcing everyone to buy new tellies.) The upshot for this package is that some* images do not record linear light (in a particular channel) rather, the sensor records linear light, then a process in the camera maps it to a non-linear space.
The bad news is that few (TV) camera manufacturers follow the standards precisely, opting instead for a particular "look" which is close to the standard, but not exact. Again, I can't say with certainty what happens with digital stills cameras. But unless the operating system is doing some very complicated pixel-wise gamma in the display, almost all digital image formats come with gamma-encoded pixels.
Having a brief look through the code, some support for this is already in place. Converting XYZ to RGB applies gamma (the function srgb_compand), but I can't see any of the conversions from RGB to other spaces undoing the gamma first.
Some possible solutions:
- Do nothing. This is how gamma is dealt with in most computer vision applications.
- Square RGB values to approximately convert to linear light before processing. This suggestion courtesy of Tim Borer, one of the authors of the paper mentioned here[1].
- Apply the sRGB/Rec709 gamma correction to RGB images, with an external interface to allow the user to specify their own function or look-up table for other colour spaces.
I imagine that the best solution will be very application specific. The errors introduced by doing nothing are usually very small, which is why most applications ignore them. But in feature film production, and some graphics applications they are treated more carefully. Currently, I handle gamma by creating custom image reading functions which first call imread, then apply whatever correction I choose before returning the image.
*I'm afraid I have no idea how widespread this is. TV cameras encodes gamma-corrected pixels. Digital film cameras do various manufacturer-specific things in an attempt to mimic the dynamic response of film to illumination, and the development process, which also involve non-linear encodings. The wikipedia[2] seems to suggest that digital stills cameras also encode gamma-corrected pixels. A remark @stevengj made about how MIME types work suggests that modern operating systems do not necessarily apply the same gamma correction to all images, but my anecdotal experience of looking at lots of images that I've de-gammaed doesn't support this. I'd be interested to learn more.
[1]http://www.ibc.org/page.cfm/action=library/libID=14/libEntryID=106/listID=2
[2] https://en.wikipedia.org/wiki/Gamma_correction
(edits for markdown formatting)
- Dominant language
- Julia
- Stars
- 225
- Forks
- 53
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 8
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from JuliaGraphics/Colors.jl
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
JuliaGraphics/Colors.jl#590 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
JuliaGraphics/Colors.jl#587 · 2 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
JuliaGraphics/Colors.jl#573 ·
-
wontfix
Difficulty 4/5 3-5 days Newbie friendliness 35/100
JuliaGraphics/Colors.jl#567 · 2 comments ·
-
Linear RGB typeOpenenhancement
Difficulty 3/5 1-2 days Newbie friendliness 68/100
JuliaGraphics/Colors.jl#564 · 1 comment · 1 reaction ·
All issues in JuliaGraphics/Colors.jl
Similar issues
-
add-on doc enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
JuliaGraphics/ColorTypes.jl#344 · 1 comment ·
Maintainers usually reply within 1 day
-
`enzymexla.linalg.lu` lowering fails for a tall matrix: the permutation is built with the pivot typeOpen
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
EnzymeAD/Enzyme-JAX#3286 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
SciML/LinearSolve.jl#1359 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
EnzymeAD/ReactantNitro.jl#13 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
epiforecasts/BVDOutbreakSize#1009 ·
Maintainers usually reply within 1 day