【问题标题】:Finding gray level which most of pixels have查找大多数像素具有的灰度级
【发布时间】:2014-07-21 20:41:12
【问题描述】:

嗨, 我有一个直方图,如上图所示。我使用imhist(I) 函数来获取这个直方图。我想找到大多数像素具有的灰度级。 有没有可能找到这个值?

【问题讨论】:

    标签: matlab image-processing histogram


    【解决方案1】:

    您可以使用imhist 的两个输出来获取灰度级和每个级别的计数。然后使用max 的第二个输出来获取计数最大的级别的索引。最后,结果是具有该索引的级别。

    [count levels] = imhist(I); %// get levels and count of each level
    [~, v] = max(count); %// v is the index corresponding to maximum count
    result = levels(v); %// the result is the level that has that index
    

    【讨论】:

      猜你喜欢
      • 2013-02-08
      • 2014-10-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-19
      • 2011-07-29
      • 1970-01-01
      相关资源
      最近更新 更多