How can I create a small cell 500*500 pixel in one satellite image?

1 visualización (últimos 30 días)
I have a Landsat 8 satellite image with size of [7761, 7601].
I want to create a small cell with 500*500 pixel and calculate NDVI index for each cell and move to the next cell by using for loop.
I am a beginer . Please help!
Thanks a lot!
  1 comentario
Oanh La
Oanh La el 10 de Ag. de 2020
This is my code. Please help me!
Thanks a lot!
tiles=zeros(500,500);
for m=1:(size(layerstacking_TOA_Ref,1)/500)-1
for n=1:(size(layerstacking_TOA_Ref,2)/500)-1
r=500*m;
c=500*n;
if m==1&&n==1
tiles(i,j)= layerstacking_TOA_Ref(1:r,1:c);
elseif m==1&&n~=1
tiles(i,j)= layerstacking_TOA_Ref(1:r,c+1:c+500);
elseif m~=1&&n==1
tiles(i,j)= layerstacking_TOA_Ref(r+1:r+500,1:c);
else
tiles(i,j)= layerstacking_TOA_Ref(r+1:r+500,c+1:c+500);
end
end
end
NDVI = zeros(size(tiles,1),size(tiles,2));
y = zeros(8);
for i=1:size(tiles,1)
for j=1:size(tiles,2)
for num1=1:16
for num2=1:16
for b=1:8 % bands of the image
y(b)= tiles{num1,num2}(i,j,b);
NDVI(i,j) = (y(5)-y(4))./ (y(5)+y(4));
end
end
end
end
end

Iniciar sesión para comentar.

Respuesta aceptada

KSSV
KSSV el 10 de Ag. de 2020

Más respuestas (0)

Categorías

Más información sobre Reference Applications en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by