From c8d109420c38fc47238a984c82eab9da3940f093 Mon Sep 17 00:00:00 2001 From: dpa Date: Thu, 19 Nov 2026 16:58:07 +0200 Subject: initial commit --- conv-scipy.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 conv-scipy.py (limited to 'conv-scipy.py') diff --git a/conv-scipy.py b/conv-scipy.py new file mode 100644 index 0000000..cdc0e87 --- /dev/null +++ b/conv-scipy.py @@ -0,0 +1,20 @@ +import numpy as np +import matplotlib.pyplot as plt +from scipy import ndimage +import imageio.v3 as iio + + +img = iio.imread("./cameraman.png") +print(img.shape, img.dtype) + +plt.imshow(img, cmap='gray') +plt.show() + +kernel = np.array([[1, 0, -1], + [2, 0, -2], + [1, 0, -1]], dtype=np.float64) + +conv_result = ndimage.convolve(img.astype(np.float64), kernel, mode='reflect') + +plt.imshow(conv_result, cmap='gray') +plt.show() -- cgit v1.2.3