updates blend to merge different size imgs

This commit is contained in:
EllangoK
2023-04-03 15:47:11 -04:00
parent d0e69db667
commit 08a83e3d51
2 changed files with 28 additions and 1 deletions
+1 -1
View File
@@ -31,7 +31,7 @@ class Blur:
CATEGORY = "postprocessing"
def gaussian_kernel(self, kernel_size: int, sigma: float):
x, y = torch.meshgrid(torch.linspace(-1, 1, kernel_size), torch.linspace(-1, 1, kernel_size))
x, y = torch.meshgrid(torch.linspace(-1, 1, kernel_size), torch.linspace(-1, 1, kernel_size), indexing="ij")
d = torch.sqrt(x * x + y * y)
g = torch.exp(-(d * d) / (2.0 * sigma * sigma))
return g / g.sum()