matlab课程设j,MATLAB课程设计--GUI图像处理

这篇博客探讨了MATLAB中图像处理的功能,包括图像的互补显示、傅里叶变换以及滤波操作。在pushbutton12回调中,实现了图像的互补显示;pushbutton14回调中,通过二维傅里叶变换和Butterworth滤波器进行图像滤波;pushbutton15回调则使用了一种基于距离的滤波方法。此外,还涉及到边缘检测操作,如Canny算子的运用。
摘要由CSDN通过智能技术生成

% --- 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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值