1 简介



2 部分代码
function varargout = mygui(varargin)% Begin initialization code - DO NOT EDITgui_Singleton = 1;global im;gui_State = struct('gui_Name', mfilename, ...'gui_Singleton', gui_Singleton, ...'gui_OpeningFcn', @mygui_OpeningFcn, ...'gui_OutputFcn', @mygui_OutputFcn, ...'gui_LayoutFcn', [] , ...'gui_Callback', []);if nargin && ischar(varargin{1})gui_State.gui_Callback = str2func(varargin{1});endif nargout[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});elsegui_mainfcn(gui_State, varargin{:});end% End initialization code - DO NOT EDIT% --- Executes just before mygui is made visible.function mygui_OpeningFcn(hObject, eventdata, handles, varargin)% This function has no output args, see OutputFcn.% hObject handle to figure% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% varargin command line arguments to mygui (see VARARGIN)% Choose default command line output for myguihandles.output = hObject;% Update handles structureguidata(hObject, handles);% UIWAIT makes mygui wait for user response (see UIRESUME)% uiwait(handles.figure1);% --- Outputs from this function are returned to the command line.function varargout = mygui_OutputFcn(hObject, eventdata, handles)% varargout cell array for returning output args (see VARARGOUT);% hObject handle to figure% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Get default command line output from handles structurevarargout{1} = handles.output;% --- Executes on button press in open_pushbutton.function open_pushbutton_Callback(hObject, eventdata, handles)% hObject handle to open_pushbutton (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)global im;[filename,pathname]=...uigetfile({'*.*';'*.bmp';'*.tif';'*.png';'*.gif';'*.jpg'},'select picture'); %选择图片路径str = [pathname filename]; %合成路径+文件名im = imread(str); %读取图片axes(handles.axes1); %使用第一个axesimshow(im); %显示图片title('原图像');% --- Executes on button press in blpf_pushbutton.function blpf_pushbutton_Callback(hObject, eventdata, handles)% hObject handle to blpf_pushbutton (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)global im;button_state = get(hObject,'Value');if button_state == get(hObject,'Max')I0 = im;% I0 = imread('beauty.jpg');% subplot(2,2,1),imshow(I0);title('原图');str={'半径D0大小:','阶数n:'}; %输入相关参数:高斯模板大小、方差、二值化阈值sData=InputDlg(str,'输入参数',1);if ~isempty(sData)d0=str2double(sData(1));%模板大小n=str2double(sData(2));%次数endI1 = imnoise(I0,'gaussian'); %对原图像加噪声% subplot(2,2,2),imshow(I1);title('加入噪声后图像')%将灰度图像的二维不连续Fourier 变换的零频率成分移到频谱的中心s=fftshift(fft2(I1));[M,N]=size(s); %分别返回s的行数到M中,列数到N中n1=floor(M/2); %对M/2进行取整
3 仿真结果

4 参考文献
[1]洪华庆. 基于计算机视觉的米粒质量检测系统[D]. 浙江工商大学.
博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。
部分理论引用网络文献,若有侵权联系博主删除。
基于Matlab的图像处理与滤波:智能优化算法应用
本文介绍了一个使用Matlab实现的图像处理GUI,包含文件选择、图像读取、高斯滤波功能。通过实例演示了如何选择图片并进行半径D0和阶数n的参数调整,展示了从原始图像到处理后的结果。作者还分享了其在计算机视觉领域的经验,适合Matlab图像处理爱好者和研究人员。
2861

被折叠的 条评论
为什么被折叠?



