how to get results from and how to call functions from other functions?

1 次查看(过去 30 天)
i have try a source code, but why in work space i have only ans,
how if i nead sakita in my workspace
function [sakita]=gambar1
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
a=imread('D:\Deniel Data\SKRIPSI\APLIKASI\sel sakit\sakita.jpg');
b=a;
c=rgb2gray(b);
d=imresize(c,[100 100]);
data=d;
pathname = 'D:\Deniel Data\SKRIPSI\APLIKASI\Gambar_Grayscale\';
% mkdir(pathName);
imwrite(data,[pathname, 'grayscale','.jpg']);
mm=10;
r=d;
m=fspecial('unsharp');
x=imfilter(r,m);
data=x;
pathname = 'D:\Deniel Data\SKRIPSI\APLIKASI\Hish_Pass_Filter\';
% mkdir(pathName);
imwrite(data,[pathname, 'HPV','.jpg']);
[r,c]=size(x);
max=0;
min=0;
for j=2:r-1
for i=2:c-1
p=i-1;
q=i+1;
a=j-1;
b=j+1;
d1=abs(x(j,i)-x(j,p));
d2=x(j,i)-x(j,q);
e1=x(j,i)-x(a,i);
e2=x(j,i)-x(b,i);
f1=x(j,i)-x(a,p);
f2=x(j,i)-x(b,q);
g1=x(j,i)-x(a,q);
g2=x(j,i)-x(b,p);
if (d1 < 0)
d1=d1*(-1);
end
if (d2 < 0)
d2=d2*(-1);
end
if (e1 < 0)
e1=e1*(-1);
end
if (e2 < 0)
e2=e2*(-1);
end
if (f1 < 0)
f1=f1*(-1);
end
if (f2 < 0)
f2=f2*(-1);
end
if (g1 < 0)
g1=g1*(-1);
end
if (g2 < 0)
g2=g2*(-1);
end
if (d1 >= mm) && (d2 >= mm)
x(j,i)=255;
elseif (e1 >= mm) && (e2 >= mm)
x(j,i)=255;
elseif (f1 >= mm) && (f2 >= mm)
x(j,i)=255;
elseif (g1 >= mm) && (g2 >= mm)
x(j,i)=255;
else
x(j,i)=0;
end
end
end
e=x
data=e;
pathname = 'D:\Deniel Data\SKRIPSI\APLIKASI\Gambar_Canny\';
% mkdir(pathName);
imwrite(data,[pathname, 'Canny','.jpg']);
sakita=reshape(x,[10000 1])
data=sakita;
pathname = 'D:\Deniel Data\SKRIPSI\APLIKASI\ReShape\';
% mkdir(pathName);
imwrite(data,[pathname, 'sakita','.bmp']);
%sakita=reshape(data,[10000 1]);
very nead help

采纳的回答

Walter Roberson
Walter Roberson 2012-6-11
gamresult = gambar1();
This will store the output of gambar1 into gamresult . Change the output variable name at need.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Convert Image Type 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by