Effacer les filtres
Effacer les filtres

how can i call parameter from one menu to another menu in GUI?

1 vue (au cours des 30 derniers jours)
munah alhatmi
munah alhatmi le 6 Avr 2016
Dears,
i need your help... i had designed gui interface composed of five menues. first menu include filters and i need to apply histogram function on filtered image from second menu and the same for other menues.
i need only to know how to call filter method in histogram menu and same for edge and sharpen filters.
i had attached the printscreen of gui interface.
any one have an idea.
with many thanks.

Réponses (1)

Walter Roberson
Walter Roberson le 6 Avr 2016
Put the important code into a function. Call the function in multiple places.
For example, if button A needs to trigger the action of button B, then put the real work of button B into buttonB_worker and have buttonB_Callback and buttonA_Callback both call buttonB_worker.
  1 commentaire
munah alhatmi
munah alhatmi le 6 Avr 2016
Modifié(e) : Walter Roberson le 6 Avr 2016
i tried to call using handle but doesn't work with me.
Please see my filter code.
function WMF_Callback(hObject, eventdata, handles)
v = get(handles.text5,'string');
m = 'Weighted Median Filtering';
set(handles.text5,'string',m);
I = handles.I;
axes(handles.axes4);
handles.I = I;
imhist(I);
c = get(handles.popupmenu2, 'value');
if (c == 1)
h = 1/100;
elseif (c == 2)
h = 2/100;
elseif (c == 3)
h = 3/100;
elseif (c == 4)
h = 4/100;
elseif (c == 5)
h = 5/100;
elseif (c == 6)
h = 6/100;
elseif (c == 7)
h = 7/100;
elseif (c == 8)
h = 8/100;
else (c == 9)
h = 9/100;
end
n = get(handles.popupmenu1, 'value');
if (n == 1)
p = 'salt & pepper';
elseif (n == 2)
p = 'speckle';
else (n == 3)
p = 'gaussian';
end
BW1=imnoise(I,p,h);
axes(handles.axes2);
handles.BW1=BW1;
imshow(BW1);
%histgrom
axes(handles.axes5);
handles.BW1=BW1;
imhist(BW1);
a = BW1;
b = a;
W= [10, 7, 6; 6, 10, 6; 6, 6, 6]/9;
[row col] = size(a);
MA=cputime;
for x = 2:1:row-1
for y = 2:1:col-1
%%To make a 3x3 weighted mask into a 1x9 mask
a1 = [W(1)*a(x-1,y-1) W(2)*a(x-1,y) W(3)*a(x-1,y+1) ...
W(4)*a(x,y-1) W(5)*a(x,y) W(6)*a(x,y+1)...
W(7)*a(x+1,y-1) W(8)*a(x+1,y) W(9)*a(x+1,y+1)];
a2 = sort(a1);
med = a2(5); % the 5th value is the weighted median
b(x,y) = med;
end
end
DA=cputime-MA;
handles.DA=DA;
set(handles.edit2,'String',DA);
de=b-I;
%%%%MSE
Er_WMF=sum(sum(de.^2))/ [row*col]
set(handles.edit1,'string',Er_WMF);
%%%%PSNR
psnr = 10*log10(255*255/Er_WMF);
set(handles.edit3,'string',psnr);
axes(handles.axes3);
handles.b=b;
imshow(b);
title('Filtered Image');
axes(handles.axes6);
handles.b=b;
imhist(b);
i need to call imhist function from another menu.so, how can i dot it.
for example, after loading the image and apply the filter from the menu and need to select the type of histogram from another menu.
Thank you in advance

Connectez-vous pour commenter.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by