data2im.m

来自「matlab 模式识别工具包 希望能对你们有用」· M 代码 · 共 39 行

M
39
字号
%DATA2IM Convert PRTools dataset to image%%	IM = data2im(A)%% An image, or a set of images stored in the objects or features% of the dataset A are retrieved and returned as a 3D matrix IM.%% See datasets, im2obj, im2feat% Copyright: R.P.W. Duin, duin@ph.tn.tudelft.nl% Faculty of Applied Physics, Delft University of Technology% P.O. Box 5046, 2600 GA Delft, The Netherlandsfunction im = data2im(a)if ~isa(a,'dataset')	error('Input should be dataset')endas = struct(a);[m,k] = size(a);[y,x] = dataimsize(a);if isfeatim(a)	im = zeros(y,x,k);	for j=1:k		% walk around Matlab bug		aa = +subsref(a,struct('type',{'()'},'subs',{{':' [j]}}));		im(:,:,j) = reshape(aa,y,x);	endelseif isobjim(a)	im = zeros(y,x,m);	for j=1:m		% walk around Matlab bug		aa = +subsref(a,struct('type',{'()'},'subs',{{[j] ':'}}));		im(:,:,j) = reshape(aa,y,x);	endelse	error('No regular image stored')end	

⌨️ 快捷键说明

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