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

📄 iroi.m

📁 这是一个基于MATLAB的机器视觉工具箱,里面用很多非常有价值的的程序
💻 M
字号:
%IROI	Extract region of interest from current image figure%%	si = IROI(image)%	[si,region] = IROI(image)%%	si = IROI(image,region)%%	The first two forms display the image and a rubber band box to%	allow selection of the region of interest.%	The selected subimage s output and optionally the coordinates of %	the region selected which is of the form [top bottom; left right].%%	The last form uses a previously created region matrix and outputs the%	corresponding subimage.  Useful for chopping the same region out of%	a different image.%%% SEE ALSO:	image, idisp%%	Copyright (c) Peter Corke, 1999  Machine Vision Toolbox for Matlab% 1995 Peter Corkefunction [im, region] = iroi(image, reg)	if nargin == 2,		im = image(reg(1,1):reg(2,1),reg(1,2):reg(2,2));	else		% save old event handlers, otherwise may interfere with		% other tools operating on the figure, eg. idisp()		upfunc = get(gcf, 'WindowButtonUpFcn');		downfunc = get(gcf, 'WindowButtonDownFcn');		set(gcf, 'WindowButtonUpFcn', '');		set(gcf, 'WindowButtonDownFcn', '');		% get the rubber band box		waitforbuttonpress		f = gcf;		cp0 = get(gcf, 'CurrentPoint');		c0 = floor( get(gca, 'CurrentPoint') );		% top left		rect = [cp0 16 16];		rbbox(rect, cp0);			% return on up click		%disp('rbbox done, restore handlers');		% restore event handlers		set(gcf, 'WindowButtonUpFcn', upfunc);		set(gcf, 'WindowButtonDownFcn', downfunc);		c1 = floor( get(gca, 'CurrentPoint') );		% bottom right		ax = get(gca, 'Children');		img = get(ax, 'CData');			% get the current image		top = c0(1,2);		left = c0(1,1);		bot = c1(1,2);		right = c1(1,1);		im = img(top:bot,left:right);		if nargout == 2,			region = [top left; bot right];		end	end

⌨️ 快捷键说明

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