slides-alpha: Adapt some values based on resolution

When I rendered some slides in 4k, some of the values/radius where
not appropriate. So make those scale with the image resolution

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
This commit is contained in:
Sylvain Munaut 2023-03-02 20:41:26 +01:00
parent 19496a7183
commit 6cea27d3f2
1 changed files with 5 additions and 3 deletions

View File

@ -69,11 +69,13 @@ def slide_process_single(in_file, out_file, opts):
y[-opts.bottom_border:, :] = np.zeros([opts.bottom_border, y.shape[1]], dtype=np.float32)
# Expand outward
ye = scipy.signal.convolve2d(y, np.ones([5,5]), mode='same', boundary='fill', fillvalue=0)
r = np.max(y.shape) // 384
ye = scipy.signal.convolve2d(y, np.ones([r,r]), mode='same', boundary='fill', fillvalue=0)
ye = ye.clip(0.0, 1.0)
# Blue it
ye = scipy.ndimage.gaussian_filter(ye, 1.5, mode='nearest')
# Blur it
r = np.max(y.shape) / 1280
ye = scipy.ndimage.gaussian_filter(ye, r, mode='nearest')
# Recombine
y = (y + ye).clip(0.0, 1.0)