⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 image_blur.m

📁 matlab处理图像的一些基本方法。其中有一部分mex程序需要安装编译
💻 M
字号:
function image_blur(command)%IMAGE_BLUR - Compute the Blur filter of the current image%%		IMAGE_BLUR(COMMAND)%%			COMMAND - valid commands:%%				START  - set up the button frame and initialize%				DOIT   - do the actual filtering%				UNDO   - undo the filtering%%	Claudio  28 Sept. 1995%%% Copyright (c) 1995 by Claudio Rivetti and Mark Young% claudio@alice.uoregon.edu,    mark@alice.uoregon.edu%global I Handlefig Uibgcolor B_frame method_pop Undofun undo_bt exe_btif isempty(I)  return;endif nargin==0  command='START';endfigure(Handlefig);% Position variables-------------------------------------pos=get(B_frame, 'Position');uiwidth=0.12;uithick=0.035;middle=pos(1)+(pos(3)-uiwidth)/2;%--------------------------------------------------------% Positions of buttons ----------------------------------undo_pos = [middle pos(2)+0.35 uiwidth, uithick];exec_pos = [middle pos(2)+0.45 uiwidth, uithick];mp_pos = [middle pos(2)+.55 uiwidth uithick];mt_pos = [middle-.005 pos(2)+.59 uiwidth+.005 uithick];%--------------------------------------------------------%  Callbacks for the buttons  ---------------------------exec_cbk = 'image_blur(''DOIT'');'; undo_cbk = 'image_blur(''UNDO'');';%--------------------------------------------------------if strcmp(command,'START')	if ~isimage  		setviewmode('TOPVIEW');  		showimage;	end	initbuttons('Blur Filter', 'Done');	exe_bt = uicontrol(gcf,'Style','push',...		'String', 'Execute',...		'Units', 'normalized', ...		'Position', exec_pos,...		'CallBack',exec_cbk);	undo_bt = uicontrol(gcf,'Style','push',...		'String','Undo',...		'Units', 'normalized', ...		'Enable', 'off',...		'Position', undo_pos,...		'CallBack',undo_cbk);	uicontrol(gcf,'Style','text',...		'String','Neighborhood',...		'Units','normalized',...		'Horiz', 'center',...		'BackgroundColor', Uibgcolor,...		'Position',mt_pos);	method_pop=uicontrol(gcf, 'Style', 'popup',...		'Units', 'normalized',...		'position', mp_pos,...		'String', '3x3|5x5|7x7',...		'Value', 1);end	% STARTif strcmp(command,'DOIT')	f=watchon;	statusbar('Filtering image...');    v=get(method_pop, 'value');	nn=[2*v+1 2*v+1];		h = fspecial('gaussian',nn);	setimage(filter2(h,I));    set(undo_bt, 'Enable', 'on');	set(exe_bt, 'String', 'Re-Execute');	clearstatusbar;	watchoff(f);end	% DOITif strcmp(command,'UNDO')	undo;	set(undo_bt, 'Enable', 'off');end	% UNDOreturn

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -