Info

この質問は閉じられています。 編集または回答するには再度開いてください。

How to keep same names of images.Tiff for outputs?

1 回表示 (過去 30 日間)
reyadh Albarakat
reyadh Albarakat 2016 年 5 月 3 日
コメント済み: reyadh Albarakat 2016 年 5 月 4 日
Hi everybody,
I did mask to multiple images. TIFF then I want ton save the masked images in same name of the original images. Is that possible?
Thank you
Reyadh
Here is my code,
cd G:\marsh\new
F_read=dir('*.tif');
for i=1:2
I{i}= F_read(i).name;
I{i} = imread(I{i});
ID{i}= im2double(I{i});
Ii{i}= ID{i}(697:709,2728:2735);
Ii{i}(Ii{i}>1)=NaN;
Ii{i}(Ii{i}<0)=NaN;
Ii{i}(Ii{i}==0)=NaN;
end
for i=1:13
lt(i)=32.01-0.0833*(i-1);
end
clear i
for i=1:8
lg(i)=47.09+0.0833*(i-1);
end
clear i
cd F:\Landsat_images\All_marshes_Calssification\Alhuwaiza\Mask_Tif
M=m_shaperead('Huwaiza');
%Create a mask
x = linspace(min(lg), max(lg), 8);
y = linspace(min(lt), max(lt), 13);
[x,y] = meshgrid(x,y);
for i=1:length(M.ncst)
Ncst(i,1)=M.ncst{i}(1);
Ncst(i,2)=M.ncst{i}(2);
end
isin = inpolygon(x,y,Ncst(:,1),Ncst(:,2));
isin=flipud(isin);
isin=double(isin);
isin(isin==0)=NaN;
MASK=isin;
clear isin x y
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
cd G:\marsh\new\huTif_new
for i=1:length(Ii)
set(0,'DefaultFigureRenderer','zbuffer')
[Plg,Plt]=meshgrid(lg,lt);
LATLIMS=[30.952 32.01];
LONLIMS=[47.09 47.818];
m_proj('Equidistant Cylindrical','lon',LONLIMS,'lat',LATLIMS);
img=Ii{i}.*MASK;
map=m_pcolor(Plg,Plt,img);
a=colormap(Iraqimarsh);
% a=fliplr(a);
set(gcf,'colormap',a);
shading flat;
m_grid('linewi',2,'tickdir','out');
str=num2str(i);
saveas(map,str,'tif');
end
  2 件のコメント
reyadh Albarakat
reyadh Albarakat 2016 年 5 月 4 日
Thank you Walter Roberson. Really you are helpful person.
Reyadh

回答 (0 件)

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by