回答編集履歴
1
コードの修正
answer
CHANGED
@@ -22,8 +22,7 @@
|
|
22
22
|
# PSFをfft
|
23
23
|
f = np.fft.fft2(np.fft.fftshift(blur))
|
24
24
|
blur_fshift = np.fft.fftshift(f)
|
25
|
-
abs_blur_fshift = np.abs(blur_fshift)
|
26
|
-
magnitude_spectrum1 = np.log(
|
25
|
+
magnitude_spectrum1 = np.log(np.abs(blur_fshift))
|
27
26
|
plt.imshow(blur, cmap = 'gray')
|
28
27
|
plt.title('blur PSF'), plt.xticks([]), plt.yticks([])
|
29
28
|
plt.show()
|
@@ -38,8 +37,7 @@
|
|
38
37
|
print(imput_img.shape)
|
39
38
|
imput_fshift = np.fft.fft2(imput_img)
|
40
39
|
imput_fshift = np.fft.fftshift(imput_fshift)
|
41
|
-
abs_imput_fshift = np.abs(imput_fshift)
|
42
|
-
magnitude_spectrum2 = np.log(
|
40
|
+
magnitude_spectrum2 = np.log(np.abs(imput_fshift))
|
43
41
|
plt.imshow(imput_img, cmap = 'gray')
|
44
42
|
plt.title('Input image'), plt.xticks([]), plt.yticks([])
|
45
43
|
plt.show()
|
@@ -53,8 +51,7 @@
|
|
53
51
|
imput_fshift = np.fft.ifftshift(imput_fshift)
|
54
52
|
blur_fshift = np.fft.fftshift(blur_fshift)
|
55
53
|
rekka_f = np.fft.fftshift(imput_fshift*blur_fshift)
|
56
|
-
abs_rekka_f = np.abs(rekka_f)
|
57
|
-
magnitude_spectrum12 = np.log(
|
54
|
+
magnitude_spectrum12 = np.log(np.abs(rekka_f))
|
58
55
|
rekka_img = np.fft.ifft2(imput_fshift*blur_fshift).real
|
59
56
|
plt.imshow(magnitude_spectrum12, cmap = 'gray')
|
60
57
|
plt.title('rekka magnitude_spectrum'), plt.xticks([]), plt.yticks([])
|