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

📄 pgm2xi.m

📁 支持向量机工具箱
💻 M
字号:
function [X,I,K,width,height]=pgm2xi(root,from,to)% [X,I,K,width,height]=pgm2xi(root,from,to)%% PGM2XI reads PGM.* images from directories numbered by %   numbers from - to. These directories are in the root %   directory. Loaded images are reshaped to the vector.%% Input:%  root [string] name of the direcory where the numbered%          direecories are placed.%  from [1x1] number coresponding to the first class - name%          of directory.%  to [1x1] number coresponding to the last class - name%          of directory.%% Output:%  X [DxN] loaded images stored as N vectors of dimension D.%  I [1xN] class labels of the vectors X which correspond to%          the direcotry names (numbers).%  K [1xC] contains numbers of vectors in each class. The C is %          number of classes.%  width [1x1] image width.%  height [1x1] image height.%% See also X2PGM, PGM2X%% Statistical Pattern Recognition Toolbox, Vojtech Franc, Vaclav Hlavac% (c) Czech Technical University Prague, http://cmp.felk.cvut.cz% Written Vojtech Franc (diploma thesis)% Modifications% 27-feb-2001 V.FrancK=zeros(1,to-from+1);X=[];I=[];for class=from:to,    cdir=dir([root '/' num2str(class)]);    for i=1:size(cdir,1),        if cdir(i).isdir == 0,            [x,width,height]=pgm2x([root '/' num2str(class) '/' cdir(i).name]);      K(class-from+1)=K(class-from+1)+1;      X=[X,x];      I=[I class];          end  end  endreturn;

⌨️ 快捷键说明

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