MATLAB课程设计--GUI图像处理

% --- Executes on button press in pushbutton12.

function pushbutton12_Callback(hObject, eventdata, handles) % hObject handle to pushbutton12 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) global T

axes (handles.axes2); T=getimage;

f=imcomplement(handles.img); %tí???è??′ imshow(f); handles.img=f;

guidata(hObject,handles);

% --- Executes on button press in pushbutton14.

function pushbutton14_Callback(hObject, eventdata, handles) % hObject handle to pushbutton14 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

axes(handles.axes2); y1=handles.img;

f=double(y1); % êy?Yà-Dí?a??£?MATLAB2??§3?í???μ??T??o???Díμ????? g=fft2(f); % ?μá¢ò?a??? g=fftshift(g); % ?a??êy?Y???ó [M,N]=size(g);

nn=2; % ?t???íì????1(Butterworth)μíí¨??2¨?? d0=50; %???1?μ?ê?a50 m=fix(M/2); n=fix(N/2); for i=1:M

for j=1:N

d=sqrt((i-m)^2+(j-n)^2);

h=1/(1+0.414*(d/d0)^(2*nn)); % ????μíí¨??2¨??′?μYoˉêy result(i,j)=h*g(i,j); end end

result=ifftshift(result); y2=ifft2(result); y3=uint8(real(y2));

imshow(y3); % ??ê???2¨′|àíoóμ?í???

45 / 52

% --- Executes on button press in pushbutton15.

function pushbutton15_Callback(hObject, eventdata, handles) % hObject handle to pushbutton15 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

axes(handles.axes2); x=(handles.img);

f=double(x); % êy?Yà-Dí?a?? k=fft2(f); % ?μá¢ò?a??? g=fftshift(k); % ?a??êy?Y???ó [M,N]=size(g); nn=2;

d0=25; %???1?μ?ê?a25 m=fix(M/2); n=fix(N/2); for i=1:M

for j=1:N

d=sqrt((i-m)^2+(j-n)^2); % ??????í¨??2¨??′?μYoˉêy if d<=d0 h=0; else h=1; end

result(i,j)=h*g(i,j); end end

result=ifftshift(result); y2=ifft2(result); y3=uint8(real(y2));

imshow(y3); % ??ê???2¨′|àíoóμ?í???

% --- Executes on button press in pushbutton16.

function pushbutton16_Callback(hObject, eventdata, handles) % hObject handle to pushbutton16 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) global T

axes(handles.axes2); T=getimage;

f=edge(handles.img,'canny'); imshow(f); handles.img=f;

guidata(hObject,handles);

46 / 52

% -------------------------------------------------------------------- function edit_Callback(hObject, eventdata, handles) % hObject handle to edit (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% -------------------------------------------------------------------- function tuxiangbianxing_Callback(hObject, eventdata, handles) % hObject handle to tuxiangbianxing (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% -------------------------------------------------------------------- function tianjiazaosheng_Callback(hObject, eventdata, handles) % hObject handle to tianjiazaosheng (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) set(handles.uipanel4,'Visible','on'); if strcmp(get(gcbo, 'Checked'),'on')

set(handles.uipanel4,'Visible','on'); set(gcbo, 'Checked', 'off');

set(handles.uipanel4,'Visible','off'); else

set(gcbo, 'Checked', 'on'); end

% -------------------------------------------------------------------- function lvbochuli_Callback(hObject, eventdata, handles) % hObject handle to lvbochuli (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% -------------------------------------------------------------------- function changyongchuli_Callback(hObject, eventdata, handles) % hObject handle to changyongchuli (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

47 / 52

% -------------------------------------------------------------------- function teshuchuli_Callback(hObject, eventdata, handles) % hObject handle to teshuchuli (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% -------------------------------------------------------------------- function tuxiangfanzhuan_Callback(hObject, eventdata, handles) % hObject handle to tuxiangfanzhuan (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) set(handles.uipanel7,'Visible','on'); if strcmp(get(gcbo, 'Checked'),'on')

set(handles.uipanel7,'Visible','on'); set(gcbo, 'Checked', 'off');

set(handles.uipanel7,'Visible','off'); else

set(gcbo, 'Checked', 'on'); end

% -------------------------------------------------------------------- function tuxiangxuanzhuan_Callback(hObject, eventdata, handles) % hObject handle to tuxiangxuanzhuan (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) set(handles.pushbutton3,'Visible','on'); if strcmp(get(gcbo, 'Checked'),'on')

set(handles.pushbutton3,'Visible','on'); set(gcbo, 'Checked', 'off');

set(handles.pushbutton3,'Visible','off'); else

set(gcbo, 'Checked', 'on'); end

% -------------------------------------------------------------------- function ditonglvbochuli_Callback(hObject, eventdata, handles) % hObject handle to ditonglvbochuli (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) set(handles.pushbutton14,'Visible','on'); if strcmp(get(gcbo, 'Checked'),'on')

set(handles.pushbutton14,'Visible','on'); set(gcbo, 'Checked', 'off');

48 / 52

联系客服:779662525#qq.com(#替换为@)