Improve img2img color correction by performing a luminosity blend #5644
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
This PR attempts to solve two longstanding issues with the img2img color correction feature:
We can fix (or at least greatly improve) these issues by performing a luminosity blend after the initial histogram match.
When I say "luminosity blend" I am referring to the blending mode function that is present in PhotoShop and other photo editing software. Here's how it works:
Source: https://photoblogstop.com/photoshop/photoshop-blend-modes-explained
In this case, we are blending the color-corrected image with the original output.
Here are some quick examples I threw together:
The differences are subtle, but let me call your attention to a few areas (you may want to zoom in):
Here's an example featuring subjects of different skin tones - you shouldn't need a magnifying glass for this one:
My modified
processing.py
requires two new packages, blendmodes and aenum, which I added torequirements.txt
.