【问题标题】:How to plot greyscale values from 300x300 RBG images in python如何在 python 中绘制 300x300 RGB 图像的灰度值
【发布时间】:2019-04-02 02:57:55
【问题描述】:

我有一个包含 1,500 个 300x300 尺寸的 RBG 图像的文件,我想获取其灰度值,以便在直方图中绘制灰度值。一旦这些值出现在直方图中,我就可以确定哪个图像比其他图像具有更多的噪声。这是出于图像分类探索性数据分析的目的。

【问题讨论】:

    标签: python image classification rgb grayscale


    【解决方案1】:

    欢迎来到 Stackoverflow。您提出的行动是根本性的,您自己可能会找到答案。只需极少的努力即可在此处获得任何答案。

    无论如何,一个快速的开始可能是使用枕头库来阅读你的图像:

    from PIL import Image
    import numpy as np
    
    image = Image.open('path/to/an/image)
    image.show()
    image2 = image.convert('L')
    image2.show()
    

    你可能还需要 numpy 才能继续:

    image_np = np.array(image2)
    ....
    

    那么你可以用你的价值观做任何你想做的事。如果您有其他问题,您应该通过提供Minimal, Complete, and Verifiable example 提出具体问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-08-25
      • 2014-11-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-06-01
      相关资源
      最近更新 更多