mirror of
https://github.com/iperov/DeepFaceLab.git
synced 2025-08-22 14:24:40 -07:00
Fix clipping/scaling
This commit is contained in:
parent
413f75d20a
commit
c2a55d05c6
1 changed files with 4 additions and 8 deletions
|
@ -76,17 +76,13 @@ def reinhard_color_transfer(target, source, clip=False, preserve_paper=False, ta
|
|||
a += aMeanSrc
|
||||
b += bMeanSrc
|
||||
|
||||
# clip/scale the pixel intensities to [0, 1] if they fall
|
||||
# outside this range
|
||||
# l = _scale_array(l, clip=clip)
|
||||
# a = _scale_array(a, clip=clip)
|
||||
# b = _scale_array(b, clip=clip)
|
||||
|
||||
# merge the channels together and convert back to the RGB color
|
||||
# space
|
||||
transfer = cv2.merge([l, a, b])
|
||||
transfer = cv2.cvtColor(transfer, cv2.COLOR_LAB2BGR)
|
||||
np.clip(transfer, 0, 1, out=transfer)
|
||||
if clip:
|
||||
np.clip(transfer, 0, 1, out=transfer)
|
||||
else:
|
||||
transfer = (transfer - np.min(transfer)) / np.ptp(transfer)
|
||||
|
||||
# return the color transferred image
|
||||
return transfer
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue