Minor improvements

This commit is contained in:
Andras Schmelczer 2024-06-06 08:21:00 +01:00
commit 9aac55f62d
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C

View file

@ -14,6 +14,7 @@ def pdf_transfer_3d(
bin_count: int = 1000,
iterations: int = 25,
smoothness: float = 1,
should_regrain: bool = True,
):
[h, w, c] = source.shape
source_flattened = source.reshape(-1, c).transpose()
@ -43,4 +44,4 @@ def pdf_transfer_3d(
source_flattened.clip(0, 255, out=source_flattened)
result = source_flattened.astype(np.uint8).transpose().reshape(h, w, c)
return regrain(source, result, smoothness=smoothness)
return regrain(source, result, smoothness=smoothness) if should_regrain else result