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

 Respuesta aceptada

reyadh Albarakat
reyadh Albarakat el 24 de En. de 2018

0 votos

I did flipping to the finalndvi like:
finalndvi{K}=flipud(finalndvi{K});
Then I got final flipped images:)

Más respuestas (1)

James Tursa
James Tursa el 22 de En. de 2018

0 votos

Try this:
R = R(end:-1:1,:,:);

7 comentarios

Reyadh Albarakat
Reyadh Albarakat el 23 de En. de 2018
Hi James, I tried your answer but unfortunately it didn't work
Thank you
Reyadh
James Tursa
James Tursa el 23 de En. de 2018
Editada: James Tursa el 23 de En. de 2018
Oh, I just noticed you don't have a simple 3D image variable.
Reyadh Albarakat
Reyadh Albarakat el 23 de En. de 2018
Please James, is there a solution for this issue?
Walter Roberson
Walter Roberson el 23 de En. de 2018
Probably
R = R(end:-1:1,:,:,:);
Reyadh Albarakat
Reyadh Albarakat el 23 de En. de 2018
The size of R is [1,1]
Reyadh Albarakat
Reyadh Albarakat el 23 de En. de 2018
Hi Walter, I tried your code but still not work
Walter Roberson
Walter Roberson el 24 de En. de 2018
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.

Iniciar sesión para comentar.

Categorías

Más información sobre Image Processing Toolbox en Centro de ayuda y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by