summaryrefslogtreecommitdiff
path: root/conv-scipy.py
diff options
context:
space:
mode:
authordpa <dobaipatakyattila@gmail.com>2026-11-19 16:58:07 +0200
committerdpa <dobaipatakyattila@gmail.com>2026-11-19 16:58:07 +0200
commitc8d109420c38fc47238a984c82eab9da3940f093 (patch)
tree80484cef17e433ab31dc567e10cc0c38a0c6dd68 /conv-scipy.py
initial commit
Diffstat (limited to 'conv-scipy.py')
-rw-r--r--conv-scipy.py20
1 files changed, 20 insertions, 0 deletions
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()