【问题标题】:histogram tile values in matlabmatlab中的直方图平铺值
【发布时间】:2013-02-02 14:52:00
【问题描述】:

我正在做一个关于“时刻保持阈值”的项目.. 在进行某些操作后,我们得到 p(p0,p1,p2,p3...) 的某些值,并且从图像的直方图中找到输出(阈值),选择阈值作为 P0-tile.. p(p0,p1,p2...) 的值是小于一的分数(比如 0.34,0.46) 我的问题是如何从直方图中找到这些分数值块的值..

PS:我在MAT实验室做这个

我是堆栈溢出的新手,所以我无法发布图像.. 谁能帮帮我..

【问题讨论】:

标签: matlab histogram threshold


【解决方案1】:

你需要使用累积分布

[n x] = hist( I(:), 1000 ); % 1000 bin histogram
density = n/sum(n);
cdf     = cumsum(density); % sums to one
% Choosing a thershold such that fraction p of the pixels are below it
thri = find( cdf >= p , 1, 'first' );  % edit here from < to >=
thr = x( thri );

【讨论】:

  • 你能告诉我你为什么在 hist 函数中使用 1000...@Shai
  • @user2081934 完全没有理由。如果您有任何其他偏好(例如 256)或者如果您知道垃圾箱的中心 (x),您可以使用它们。
  • 我已经对样本数据进行了上述过程..我得到的值是错误的..测试数据是.. a=[10 8 10 9 20 21 32 30 40 41 41 40 12 10 11 10 19 20 30 28 38 40 40 39 10 9 10 8 20 21 30 29 42 40 40 39 11 10 9 11 19 21 31 30 40 42 38 40]; >> [n x]=hist(a,48); >> d=n/sum(n); >> cdf=cumsum(d); >> thri=find(cdf> thr=x(thri); >> thr thr = 8.3542 ...而 thr 的值应该是 18.. @Shai
猜你喜欢
  • 1970-01-01
  • 2018-06-10
  • 1970-01-01
  • 1970-01-01
  • 2013-09-04
  • 2011-12-08
  • 1970-01-01
  • 1970-01-01
  • 2013-01-17
相关资源
最近更新 更多