Plot true color Sentinel-2A image

조회 수: 2 (최근 30일)
Chris L'Esperance
Chris L'Esperance 2019년 5월 29일
편집: Iskander Benhadj 2020년 3월 23일
Through a combination of non-matlab/non-native tools (GDAL) as well as native tools (geoimread) I can ingest Sentinel-2A data either a indiviual bands or as an RGB image having employed gdal merge. I'm stuck at a point where using
imshow(I, [])
Produces a black image, with apparently no signal. The range of intensity values in the image are 271 - 4349. I know that there is a good signal in the image because when I do
bit_depth = 2^15;
I = swapbytes(I);
[I_indexed, color_map] = rgb2ind(I, bit_depth);
I_double = im2double(I_indexed, 'indexed');
ax1 = figure;
colormap(ax1, color_map);
image(I_double)
and index the image, collecting a colormap, I get a likeness of the region I'm exploring (albeit very strangely colored)
I'm currently considering whether I should try:
  1. Find a low-level description of Sentinel-2A data, implement the scaling/correction
  2. Use a toolbox, possibly this one.
  3. Possibly adjust ouput settings in one of the earlier steps involving GDAL
Comments or suggestions are greatly appreciated.
  댓글 수: 2
Matthew Cooper
Matthew Cooper 2019년 7월 27일
You might try pcolor or even something simple like contourf just to make sure the values are there (you would need to define x and y (lon and lat) vectors as well). You might also try geotiffread (if the data are saved as a .tif file) to ingest the data which would provide a MapCellsReference object which woudl allow you to use the in-built Matlab geospatial plotting functions, or if the data are not saved as geotiff go ahead and use geoimread and create a georeference object yourself and then try geoshow(I,R,'DisplayType','Surface') or one of the other display type options. Finally, if you post your Sentinel data file, I will have a look and figure it out for you.
Iskander Benhadj
Iskander Benhadj 2020년 3월 23일
편집: Iskander Benhadj 2020년 3월 23일
dear,
to show the image using the imshow, you need to scale the image between 0 and 1
bit_depth = 2^15;
I = swapbytes(I);
[I_indexed, color_map] = rgb2ind(I, bit_depth);
I_double = im2double(I_indexed, 'indexed');
max_I = max(max(I_double));
min_I = min(min(I_double));
I_temp = (I_double - min_I)./(max_I - min_I);
imshow(I_temp);
Best,
Iskander

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Import and Export에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by