java中的接口是类吗
389
2022-09-04
【图像检测】基于计算机视觉实现米粒个数检测含Matlab源码(数字图像处理实验一matlab编程基础实验)
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{:});else gui_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));%次数 end I1 = 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代码问题可私信交流。
部分理论引用网络文献,若有侵权联系博主删除。
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~