When plotting and RGB image using
rasterio, I have seen that it is necessary to normalize the values first (0-1) and the use
show. I am using the following code for that:
def norm(band): band_min, band_max = band.min(), band.max() return ((band - band_min)/(band_max - band_min)) b2 = norm(S_images.astype(numpy.float)) b3 = norm(S_images.astype(numpy.float)) b4 = norm(S_images.astype(numpy.float)) # Create RGB rgb = numpy.dstack((b4,b3,b2)) # Visualize RGB plt.imshow(rgb)
When reading the
rasterio.plot.show documentation, there is a paramter called `adjust'
adjust ('linear' | None) – If the plotted data is an RGB image, adjust the values of each band so that they fall between 0 and 1 before plotting. If ‘linear’, values will be adjusted by the min / max of each band. If None, no adjustment will be applied.
Is this parameter doing the same as my
norm function? Does it work only if I load a multi-chanel RGB image or can I use it when providing a