how to store every output image in a specific folder

1 次查看(过去 30 天)
help me to store every output image in a specific folder
clc;
clear all;
close all;
X=imread('d1.jpg');
imfinfo('d1.jpg')
figure,imshow(X)
b = imresize(X,[100,100]);
si = size(b,1);
sj = size(b,2);
figure;imshow(b);
% Binarization
th = graythresh(b);
I = im2bw(b,th);
% w = 5;
% h = 5;
% c=si/w;
% r=sj/h;
kl=bwmorph(~I,'thin',inf);
figure,imshow(kl)
R(:,:)=kl(:,:);
%grid size
t1=5;
D=100;
I=1;
U1=t1;
J=1;
U2=t1;
E=1;
t2=D/t1;
%Z=1;
for i=1:t2
for j=1:t2
B(I:U1,J:U2)=R(I:U1,J:U2);
[x,y]=find(B==1);
CX=mean(x);
CY=mean(y);
CXXX(E)=CX;
CYYY(E)=CY;
CXX(i,j)=CX;
CYY(i,j)=CY;
T(I:U1,J:U2)=B(I:U1,J:U2);
J=J+t1;
U2=U2+t1;
E=E+1;
clear B x y
end
I=I+t1;
U1=U1+t1;
J=1;
U2=t1;
end
%plot and grid
figure,imshow(R)
hold on
M = size(R,1);
N = size(R,2);
a=t1;
b=t1;
for k = 1:a:M
x = [1 N];
y = [k k];
%plot(x,y,'Color','white');
%set(findobj('Tag','MyGrid'),'Visible','on')
end
for k = 1:b:N
x = [k k];
y = [1 M];
%plot(x,y,'Color','white');
%set(findobj('Tag','MyGrid'),'Visible','on')
end
plot(CYY,CXX,'*c','Markersize',5);
%line(CYY,CXX)
%CC=bwconncomp(CXX,4)
hold off
%node neighbourhoood analyssis
N1=t2;
for I2=1:N1
for J2=1:N1
%last row
if(I2>=N1)
W1=CXX(I2,J2);
W2=CXX(I2-1,J2);
W3=CYY(I2,J2);
W4=CYY(I2-1,J2);
W6=[W1,W2];
W7=[W3,W4];
line(W7,W6,'Color','r','LineWidth',2);
if(J2>=N1)
Z=CXX(I2,J2);
else
if (CXX(I2,J2+1)>1)&& ((CYY(I2,J2+1)>1))
TXX=CXX(I2,J2);
TYY=CXX(I2,J2+1);
TTX=CYY(I2,J2);
TTY=CYY(I2,J2+1);
IY=[TXX,TYY];
IIY=[TTX,TTY];
line(IIY,IY,'Color','r','LineWidth',2);
end
end
else
if(J2>=N1);
W1=CXX(I2,J2);
W2=CXX(I2+1,J2);
W3=CYY(I2,J2);
W4=CYY(I2+1,J2);
W6=[W1,W2];
W7=[W3,W4];
line(W7,W6);
else
if (CXX(I2,J2+1)>1)&& ((CYY(I2,J2+1)>1))
TXX=CXX(I2,J2);
TYY=CXX(I2,J2+1);
TTX=CYY(I2,J2);
TTY=CYY(I2,J2+1);
IY=[TXX,TYY];
IIY=[TTX,TTY];
line(IIY,IY,'Color','r','LineWidth',2);
end
if (CXX(I2+1,J2)>1)&& ((CYY(I2+1,J2)>1))
W1=CXX(I2,J2);
W2=CXX(I2+1,J2);
W3=CYY(I2,J2);
W4=CYY(I2+1,J2);
W6=[W1,W2];
W7=[W3,W4];
line(W7,W6,'Color','r','LineWidth',2);
end
end
end
end
end
i want to store tinned image and plotted image in separate folder. help me store each output image separate folder

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Images 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by