diff options
| author | dpa <dobaipatakyattila@gmail.com> | 2026-11-19 16:58:07 +0200 |
|---|---|---|
| committer | dpa <dobaipatakyattila@gmail.com> | 2026-11-19 16:58:07 +0200 |
| commit | c8d109420c38fc47238a984c82eab9da3940f093 (patch) | |
| tree | 80484cef17e433ab31dc567e10cc0c38a0c6dd68 /conv-scipy.py | |
initial commit
Diffstat (limited to 'conv-scipy.py')
| -rw-r--r-- | conv-scipy.py | 20 |
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() |
