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

조회 수: 1 (최근 30일)
Oanh La
Oanh La 2020년 8월 10일
댓글: Oanh La 2020년 8월 10일
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개)

카테고리

Help CenterFile Exchange에서 Reference Applications에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by