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

1 次查看(过去 30 天)
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 个评论
Oanh La
Oanh La 2020-8-10
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

请先登录,再进行评论。

采纳的回答

KSSV
KSSV 2020-8-10

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by