1

I am trying to process .jp2 files using Python. Data came from sentinel-2 as it is written in MTD_MSIL1C.xml file.

When I read files using rasterio library I receive numpy arrays with values greater than 20k.

img = rasterio.open('some_band.jp2', driver='JP2OpenJPEG').read(1)

for the following command img.max() I have got such value 23526

GDAL version == 3.0.2 Rasterio version == 1.2.6

You can only post once every 90 minutes.

I would like to visualize .jp2 files. For that I need values in range 0 and 255. Simple normalization and multiplying by 255 result in dark image.

I tried to divide image by 3000 and pass it to matplotlib. Resultant image looks well, but why it is so?

Also I tried this command which produced results in range of 0 and 255 gdal_translate -scale 0 3000 0 255 -ot Byte

0 Answers0