LBP法で256諧調のグレースケールでヒストグラムを表現したいのですが、
from pathlib import Path import numpy as np from matplotlib import pyplot as plt from skimage import feature, io, exposure import math hists = [] for path in Path("./preprocess_images/case3/train/T1-FE").glob("*.jpg"): # グレースケールとして読み込む。 img = io.imread(path, as_gray=True) # LBP 特徴量を計算する。 lbp = feature.local_binary_pattern(img,8,1,method='uniform') # ヒストグラムを計算する。 hist ,bin_centers = exposure.histogram(lbp, nbins=256, normalize=True) #histsに各ヒストグラム配列を保存 hists.append(hist) plt.plot(bin_centers,hist) #fig, ax = plt.subplots() #ax.bar(bin_centers, hist) plt.show()
では横軸が256諧調の表示になりません。
uniformLBPの状態なので通常状態にすればいいだろうと思ってはいるのですがやり方がわかりません。
分かる方がいらしたら教えてください。よろしくお願いします。
こちらサンプル画像です。
回答1件
あなたの回答
tips
プレビュー