質問編集履歴

1

文法修正

2020/10/01 05:58

投稿

Sukenosuke0221
Sukenosuke0221

スコア10

test CHANGED
File without changes
test CHANGED
@@ -2,15 +2,51 @@
2
2
 
3
3
 
4
4
 
5
- lbp = feature.local_binary_pattern(img,30,9,method='uniform')
5
+ ```ここに言語を入力
6
6
 
7
- hist ,bin_centers = exposure.histogram(lbp, nbins=256, normalize=True)
7
+ from pathlib import Path
8
8
 
9
- fig, ax = plt.subplots()
9
+ import numpy as np
10
10
 
11
- ax.bar(bin_centers, hist)
11
+ from matplotlib import pyplot as plt
12
12
 
13
+ from skimage import feature, io, exposure
14
+
15
+ import math
16
+
17
+
18
+
19
+ hists = []
20
+
21
+ for path in Path("./preprocess_images/case3/train/T1-FE").glob("*.jpg"):
22
+
23
+ # グレースケールとして読み込む。
24
+
25
+ img = io.imread(path, as_gray=True)
26
+
27
+ # LBP 特徴量を計算する。
28
+
29
+ lbp = feature.local_binary_pattern(img,8,1,method='uniform')
30
+
31
+ # ヒストグラムを計算する。
32
+
33
+ hist ,bin_centers = exposure.histogram(lbp, nbins=256, normalize=True)
34
+
35
+ #histsに各ヒストグラム配列を保存
36
+
37
+ hists.append(hist)
38
+
39
+
40
+
41
+ plt.plot(bin_centers,hist)
42
+
43
+ #fig, ax = plt.subplots()
44
+
45
+ #ax.bar(bin_centers, hist)
46
+
13
- plt.show()
47
+ plt.show()
48
+
49
+ ```
14
50
 
15
51
 
16
52
 
@@ -19,3 +55,11 @@
19
55
  uniformLBPの状態なので通常状態にすればいいだろうと思ってはいるのですがやり方がわかりません。
20
56
 
21
57
  分かる方がいらしたら教えてください。よろしくお願いします。
58
+
59
+
60
+
61
+ こちらサンプル画像です。
62
+
63
+
64
+
65
+ ![組織](6a532eb912b26e9dd0643476950428ba.jpeg)