【问题标题】:How can we get intensity histogram of image, which type of tools are using?我们如何获得图像的强度直方图,使用哪种类型的工具?
【发布时间】:2017-08-04 03:35:20
【问题描述】:

enter image description here

朋友们好, 希望你们一切都好。实际上我正在研究图像处理,我想获得所附图像显示的图像强度。图像是用元素(像素)的强度构建的。我想获得图像的强度(像素范围 0-255)直方图。我不知道该怎么做以及将使用哪种类型的工具来获取它?请帮忙....谢谢

【问题讨论】:

  • 任何图像处理库都可以创建直方图。甚至自己编码也非常容易。您所要做的就是计算每个强度值在图像中出现的频率。对于快速解决方案,您可以使用 ImageJ、Gimp、ImageMagick...

标签: image-processing computer-vision image-segmentation


【解决方案1】:

您显示的直方图与您的扫描不匹配 - 扫描中有大量不在直方图中的暗像素。

无论如何,您可以使用 ImageMagick 在命令行中非常简单地生成直方图,该工具安装在大多数 Linux 发行版上,适用于 macOS 和 Windows。

所以,从这个开始:

命令是这样的:

convert image.jpg histogram:result.png

如果你不希望它按颜色分解,你可以像这样转换成灰度:

convert image.jpg -colorspace gray histogram:intensity.png

所以,对于你的形象:

convert scan.jpg histogram:scanI.png

如果你想要白底黑字,你可以反转它并在它周围加上一个边框:

convert scanI.png -negate -bordercolor black -border 1 scanI.png

如果你想要文本格式的值,你可以使用:

convert scan.jpg -colorspace gray -format %c histogram:info:-

     4: (  0,  0,  0) #000000 gray(0)
    10: (  1,  1,  1) #010101 gray(1)
     8: (  1,  1,  1) #010101 gray(1)
    19: (  2,  2,  2) #020202 gray(2)
     9: (  2,  2,  2) #020202 gray(2)
    52: (  3,  3,  3) #030303 gray(3)
    20: (  3,  3,  3) #030303 gray(3)
   116: (  4,  4,  4) #040404 gray(4)
    42: (  4,  4,  4) #040404 gray(4)
   321: (  5,  5,  5) #050505 gray(5)
   266: (  5,  5,  5) #050505 gray(5)
     5: (  5,  5,  5) #050505 gray(5)
 12058: (  6,  6,  6) #060606 gray(6)
    79: (  6,  6,  6) #060606 gray(6)
     1: (  6,  6,  6) #060606 gray(6)
   778: (  7,  7,  7) #070707 gray(7)
    66: (  7,  7,  7) #070707 gray(7)
     1: (  7,  7,  7) #070707 gray(7)
   269: (  8,  8,  8) #080808 gray(8)
    45: (  8,  8,  8) #080808 gray(8)
   127: (  9,  9,  9) #090909 gray(9)
    34: (  9,  9,  9) #090909 gray(9)
     1: (  9,  9,  9) #090909 gray(9)
    53: ( 10, 10, 10) #0A0A0A gray(10)
    27: ( 10, 10, 10) #0A0A0A gray(10)
    28: ( 11, 11, 11) #0B0B0B gray(11)
    23: ( 11, 11, 11) #0B0B0B gray(11)
    21: ( 12, 12, 12) #0C0C0C gray(12)
    28: ( 12, 12, 12) #0C0C0C gray(12)
    ...
    ...

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-09-23
    • 1970-01-01
    • 1970-01-01
    • 2018-10-09
    • 2014-06-11
    • 2020-10-20
    • 1970-01-01
    相关资源
    最近更新 更多