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

📄 im_measure.m

📁 The pattern recognition matlab toolbox
💻 M
字号:
%IM_MEASURE Computation by DIP_Image of feature measurements%%	F = IM_MEASURE(A,GRAY,FEATURES)%% INPUT%   A        Dataset with binary object images dataset (possibly multi-band)%   GRAY     Gray-valued images (matched with A, optional)%   FEATURES Features to be computed%% OUTPUT%   B        Dataset with computed features%% In each image of the measurement set GRAY the features given in FEATURES % are measured. In A a segmented version of GRAY has to be supplied.% When no GRAY is supplied, the binary images in A are used. Only% the largest object in each image is considered.%% The following features may be computed:%    'dimension','mean','stddev','gravity','size','center','max','min',%    'maxval','minval','feret'','inertia','ccbendingenergy'.% Note that some features like 'mean' (mean image intensity) and 'stddev'% (standard deviation of image intensity) are not useful for binary images.% Run MEASUREHELP to get some information on these measures.%% Use FEATURES = 'all' for computing all features.% Use MEASUREHELP for some description of the features.% Use IM2MEAS if more objects in an image have to be considered.%% SEE ALSO% DATASETS, DATAFILES, MEASURE, MEASUREHELP% Copyright: R.P.W. Duin, r.p.w.duin@prtools.org% Faculty EWI, Delft University of Technology% P.O. Box 5031, 2600 GA Delft, The Netherlandsfunction b = im_measure(a,gray,features)	prtrace(mfilename);	if nargin < 3 | isempty(features), features = 'dimension'; end	if nargin < 2 | isempty(gray), gray = a; end	if isdataset(a)		if ~isdataset(gray)			error('Binary and gray images should be both datasets')		end		fsize = getfeatsize(a);		if any(getfeatsize(gray) ~= fsize)			error('Image structures of binary and gray images should be identical')		end		if length(fsize) == 2, fsize = [fsize 1]; end		if size(a,1) ~= size(gray,1)			error('Same number of binary and gray images expected')		end		out = [];		binim = data2im(a);		grim = data2im(gray);		for i=1:size(a,1)			for j=1:fsize(3)				f = feval(mfilename,binim(:,:,j,i),grim(:,:,j,i),features);				if isempty(out)					out = reshape(f(:)',[size(a,1),1,fsize(3)]);				else					out(i,:,j) = f;				end			end		end		b = setdat(a,out);		b = setfeatsize(a,[length(f),fsize(3)]);	elseif isdatafile(a)		if ~isdatafile(gray)			error('Binary and gray images should be both datafiles')		end		b = dyadic(a,mfilename,gray,{features});  elseif isa(a,'double') | isa(a,'dip_image') % here we have a single image		gray = 1.0*dip_image(gray);		%labim = label(dip_image(im_select_blob(a),'bin'));		labim = label(dip_image(a,'bin'));    c = measure(labim,gray,'size',[],2);    labid = c.id;    sz = c.size;    [bb,mm] = max(sz);    labid = labid(mm);		if strcmp(features,'all')			features = {'dimension','mean','stddev','gravity',...			'size','center','max','min', 'maxval','minval',...			'feret','inertia', 'ccbendingenergy'};		end		b = measure(labim,gray,features,labid,2);    b = double(b);	end	return

⌨️ 快捷键说明

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