C = MAT2CELL(X,M,N) breaks up the 2-D array X into a cell array of adjacent submatrices of X. X is an array of size [ROW COL], M is the vector of row sizes (must sum to ROW) and N is the vector of column sizes (must sum to COL). The elements of M and N determine the size of each cell in C by satisfying the following formula for I = 1:LENGTH(M) and J = 1:LENGTH(N),
该函数主要是将一个2维矩阵分解成几个相邻(adjacent)的子矩阵。比如: C = MAT2CELL(X,M,N),其中X就是待分解的矩阵,M是行数,N是列数,各子矩阵行数相加等于X的行数,列数也一样。
举例: X = [1 2 3 4; 5 6 7 8; 9 10 11 12]; C = mat2cell(X,[1 2],[1 3]) 其结果: C =
2×2 cell 数组
{[ 1]} {1×3 double} {2×1 double} {2×3 double}这就要说到该算法的原理了 将整个人脸划分为4*4的小区域(cell);(此处该函数起作用了),后面会对于每个cell中的一个像素,将相邻的8个像素的灰度值与其进行比较。