ヒストグラムのビンを固定にすることはできますか?

14 Ansichten (letzte 30 Tage)
Imayan
Imayan am 9 Jan. 2018
Kommentiert: Imayan am 9 Jan. 2018
histcountsを使って、ヒストグラムのデータを作ります。
A=imread(fname);
[Z,edges]=histcounts(A,255);
データはグレースケールの画像で、値は0〜255までありますが、中央付近のデータしかない時、画像データに含まれているmin/maxの値を等分割されているような結果になります。(Edgesの値で確認) これを0~255で固定にしたい。つまり、ビンエッジを1,2,3,4・・・としたい。
多分できると思うのですが、指定の仕方がわかりません。
Pythonでは、下のようにしてやっていました。
img = cv2.imread('sample.bmp',0);
n,bins,patches = plt.hist(img.ravel(),255,[0,255]);

Akzeptierte Antwort

michio
michio am 9 Jan. 2018
'BinLimits' オプションで可能かと思いますので、試していただけますか?
例:
A=imread(fname);
[Z,edges]=histcounts(A,255,'BinLimits',[0,255]);
  1 Kommentar
Imayan
Imayan am 9 Jan. 2018
ありがとうございます。 期待通りの結果になりました。

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!