QGIS如何预处理图像,为什么它们看起来这么漂亮?

问题描述

刚接触卫星图像,发现了一些奇怪的东西。 光栅打开的卫星图像(仅 3 个通道,rgb)如下所示。

enter image description here

但是我用QGIS打开的图片(只是拖放,不设置任何参数)看起来是这样的。

Beautiful image

幕后的算法是什么?是否可以直接使用 QGIS 对图像进行批处理?并在图像上应用“使用当前范围拉伸”。

谢谢

解决方法

找出我认为的答案,就是最小-最大拉伸+百分位数

def stretch_to_min_max(img):
    min_percent = 2   # Low percentile
    max_percent = 98  # High percentile
    lo,hi = np.percentile(img,(min_percent,max_percent))

    res_img = (img.astype(float) - lo) / (hi-lo)
    
    return np.maximum(np.minimum(res_img*255,255),0).astype(np.uint8)

enter image description here

看看这个小部件后弄清楚这一点

enter image description here