質問編集履歴
3
バージョンの変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -67,5 +67,5 @@
|
|
67
67
|
|
68
68
|
### 補足情報(FW/ツールのバージョンなど)
|
69
69
|
|
70
|
-
python 3.
|
70
|
+
python 3.7.9
|
71
71
|
|
2
エラーの修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -8,7 +8,12 @@
|
|
8
8
|
### 発生している問題・エラーメッセージ
|
9
9
|
|
10
10
|
```
|
11
|
+
Traceback (most recent call last):
|
12
|
+
File "test2_simulation.py", line 34, in <module>
|
13
|
+
rl_img = restoration.richardson_lucy(obtained_img, psf, iterations)
|
14
|
+
File "/Users/.pyenv/versions/anaconda3-5.3.1/lib/python3.7/site-packages/skimage/restoration/deconvolution.py", line 367, in richardson_lucy
|
15
|
+
psf_mirror = psf[::-1, ::-1]
|
11
|
-
too many indices for array: array is 1-dimensional, but 2 were indexed
|
16
|
+
IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed
|
12
17
|
```
|
13
18
|
|
14
19
|
### 該当のソースコード
|
1
コードの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -13,9 +13,44 @@
|
|
13
13
|
|
14
14
|
### 該当のソースコード
|
15
15
|
|
16
|
+
以下の、
|
17
|
+
rl_img = restoration.richardson_lucy(obtained_img, psf, iterations)
|
16
|
-
|
18
|
+
というところでエラーが出てしまいます。
|
17
19
|
```python3
|
20
|
+
import numpy as np
|
21
|
+
import matplotlib.pyplot as plt
|
22
|
+
import matplotlib.colors as colors
|
23
|
+
import matplotlib.cm as cm
|
24
|
+
from scipy.stats import norm # おまけの項で使います
|
25
|
+
from scipy.stats import multivariate_normal
|
26
|
+
from scipy.signal import convolve
|
27
|
+
from skimage import restoration
|
28
|
+
|
29
|
+
|
30
|
+
"""シミュレーション(1次元バージョン)"""
|
31
|
+
# 真の画像
|
32
|
+
true_px = 128
|
33
|
+
true_img = np.zeros(true_px)
|
34
|
+
true_img[52] = 0.5
|
35
|
+
true_img[76] = 0.5
|
36
|
+
|
37
|
+
# PSF
|
38
|
+
psf_px = 127
|
39
|
+
mean = psf_px // 2
|
40
|
+
psf_sigma = 13
|
41
|
+
psf = norm.pdf(np.arange(psf_px), loc=mean, scale=psf_sigma)
|
42
|
+
|
43
|
+
|
44
|
+
# 真の画像をPSFで畳み込む(撮像画像)
|
45
|
+
obtained_img = convolve(true_img, psf, "same")
|
46
|
+
|
47
|
+
plt.plot(psf)
|
48
|
+
plt.plot(obtained_img)
|
49
|
+
plt.show()
|
50
|
+
|
51
|
+
# RL法
|
52
|
+
iterations = 50
|
18
|
-
restoration.richardson_lucy(obtained_img, psf, iterations)
|
53
|
+
rl_img = restoration.richardson_lucy(obtained_img, psf, iterations)
|
19
54
|
```
|
20
55
|
scikit-imageについてのHPは以下のサイトです。
|
21
56
|
https://scikit-image.org/docs/stable/api/skimage.restoration.html
|