一、简介
基于matlab图像去噪处理(低通、中值、均值和高斯滤波),图像去噪是图像处理中的一个重要环节,其目的是为了从带有噪声的图像中恢复出原始、清晰的图像。MATLAB作为一种强大的数值计算和数据处理工具,提供了丰富的图像去噪算法和函数,其中中值滤波是一种常见且有效的去噪方法。本文将详细介绍MATLAB中中值滤波图像去噪的实现过程,并通过实例验证其有效性。
二、部分源码
function Untitled_5_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global im I0;
I0 = imnoise(im,'salt & pepper');
% 加入椒盐噪声并显示
axes(handles.axes2);
imshow(I0);
h1=[handles.axes2 handles.text3];
set(h1,'visible','on');
% --------------------------------------------------------------------
function Untitled_6_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global im I0;
im1 = im2double(im);
I0 = imnoise(im1, 'gaussian');%加入高斯噪声
axes(handles.axes2);
imshow(I0);
h1=[ handles.axes2 handles.text4];
set(h1,'visible','on');
% --------------------------------------------------------------------
function Untitled_7_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function Untitled_8_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_8 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global I0 ;
[B,A] = butter(6,0.2,'low');
I= filter(B,A,double(I0));
axes(handles.axes3);%低通
imshow(I,[]);
h1=[ handles.axes3 handles.text4];
set(h1,'visible','on');
% --------------------------------------------------------------------
function Untitled_9_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_9 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global I0 ;
I= medfilt2(I0);
axes(handles.axes3);%中值
imshow(I,[]);
h1=[ handles.axes3 handles.text4];
set(h1,'visible','on');
三、运行结果
四、matlab版本
MATLAB R2019a
五、学习与交流
文中不足之处请大家多多指教,学习与交流可以联系企鹅:3752243968
文中部分源码仅供参考,若需要全部代码可以私信