Using flipud Function?

조회 수: 4 (최근 30일)
Reyadh Albarakat
Reyadh Albarakat 2018년 1월 22일
댓글: Walter Roberson 2018년 1월 24일
Hi Everybody,
I am trying to save images but the outputs images were overturned (up down and down up). Therefor I used flipud but it isn't work.
Thank you in advance
Reyadh
if true
cd C:\Calculated_NDVI_Arcgis
dinfo = dir('*_B3*.tif');
nfile = length(dinfo);
filenames = {dinfo.name};
for K = 1 : nfile
b3_file{K} = filenames{K};
band_pos{K} = strfind(b3_file{K}, '_B3');
b4_file{K} = b3_file{K}; b4_file{K}(band_pos{K} + 2) = '4';
b3_data{K} = double( imread(b3_file{K}) );
b4_data{K} = double( imread(b4_file{K}) );
finalndvi{K} = (b4_data{K} - b3_data{K}) ./ (b4_data{K} + b3_data{K});
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
R = georasterref('RasterSize',size(finalndvi{K}),'LatitudeLimits',[30.95115,31.76385],'LongitudeLimits',[46.58315,47.43285]);
R= flipud(R);
geotiffwrite(sprintf('%d.tif',K),finalndvi{K},R);
end

채택된 답변

reyadh Albarakat
reyadh Albarakat 2018년 1월 24일
I did flipping to the finalndvi like:
finalndvi{K}=flipud(finalndvi{K});
Then I got final flipped images:)

추가 답변 (1개)

James Tursa
James Tursa 2018년 1월 22일
Try this:
R = R(end:-1:1,:,:);
  댓글 수: 7
Reyadh Albarakat
Reyadh Albarakat 2018년 1월 23일
Hi Walter, I tried your code but still not work
Walter Roberson
Walter Roberson 2018년 1월 24일
Ah, you cannot usefully flipud the handle of the image that is returned: you either need to change the axes YDIR property or else flipud the data that you send to be imaged.

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

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by