Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
S
stable-diffusion-webui
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
stable-diffusion-webui
Commits
2e8b5418
Unverified
Commit
2e8b5418
authored
Dec 11, 2022
by
ThereforeGames
Committed by
GitHub
Dec 11, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve color correction with luminosity blend
parent
00ca6a6d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
processing.py
modules/processing.py
+6
-3
No files found.
modules/processing.py
View file @
2e8b5418
...
@@ -27,6 +27,7 @@ from ldm.data.util import AddMiDaS
...
@@ -27,6 +27,7 @@ from ldm.data.util import AddMiDaS
from
ldm.models.diffusion.ddpm
import
LatentDepth2ImageDiffusion
from
ldm.models.diffusion.ddpm
import
LatentDepth2ImageDiffusion
from
einops
import
repeat
,
rearrange
from
einops
import
repeat
,
rearrange
from
blendmodes.blend
import
blendLayers
,
BlendType
# some of those options should not be changed at all because they would break the model, so I removed them from options.
# some of those options should not be changed at all because they would break the model, so I removed them from options.
opt_C
=
4
opt_C
=
4
...
@@ -39,17 +40,19 @@ def setup_color_correction(image):
...
@@ -39,17 +40,19 @@ def setup_color_correction(image):
return
correction_target
return
correction_target
def
apply_color_correction
(
correction
,
image
):
def
apply_color_correction
(
correction
,
original_
image
):
logging
.
info
(
"Applying color correction."
)
logging
.
info
(
"Applying color correction."
)
image
=
Image
.
fromarray
(
cv2
.
cvtColor
(
exposure
.
match_histograms
(
image
=
Image
.
fromarray
(
cv2
.
cvtColor
(
exposure
.
match_histograms
(
cv2
.
cvtColor
(
cv2
.
cvtColor
(
np
.
asarray
(
image
),
np
.
asarray
(
original_
image
),
cv2
.
COLOR_RGB2LAB
cv2
.
COLOR_RGB2LAB
),
),
correction
,
correction
,
channel_axis
=
2
channel_axis
=
2
),
cv2
.
COLOR_LAB2RGB
)
.
astype
(
"uint8"
))
),
cv2
.
COLOR_LAB2RGB
)
.
astype
(
"uint8"
))
image
=
blendLayers
(
image
,
original_image
,
BlendType
.
LUMINOSITY
)
return
image
return
image
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment