[英]Bin centers from recommended histogram function - Matlab
Matlab現在建議使用直方圖代替hist,但是沒有像以前的函數那樣顯示一種查找bin中心的明顯方法。
我當前的代碼可以與hist函數正常工作:
數字
[counts171,position171] = hist(image171_reshaped,200);
圖(position171,日志(counts171));
我如何能夠轉換這段代碼,以結合推薦的功能(例如“直方圖”或“ histcounts”)代替“ hist”,同時仍然獲得bin中心?
histcounts
返回邊緣而不是bin中心,並且bin中心是邊緣的連續元素之間的中點。 因此,使用diff
函數可以得到bin中心:
[counts171,edges171] = histcounts(image171_reshaped,200);
position171 = edges171(1:end-1) + diff(edges171) / 2;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.