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

3 Ansichten (letzte 30 Tage)
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

Akzeptierte Antwort

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

Weitere Antworten (0)

Kategorien

Mehr zu Data Type Identification finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by