- Visual C++源码
- Visual Basic源码
- C++ Builder源码
- Java源码
- Delphi源码
- C/C++源码
- PHP源码
- Perl源码
- Python源码
- Asm源码
- Pascal源码
- Borland C++源码
- Others源码
- SQL源码
- VBScript源码
- JavaScript源码
- ASP/ASPX源码
- C#源码
- Flash/ActionScript源码
- matlab源码
- PowerBuilder源码
- LabView源码
- Flex源码
- MathCAD源码
- VBA源码
- IDL源码
- Lisp/Scheme源码
- VHDL源码
- Objective-C源码
- Fortran源码
- tcl/tk源码
- QT源码
distMATChiSquare.m
资源名称:LBPV_GM.rar [点击查看]
上传用户:kandtrade
上传日期:2009-06-26
资源大小:12k
文件大小:1k
源码类别:
图形图象
开发平台:
Matlab
- % distMATChiSquare computes the dissimilarity between training samples and a test sample
- % DV = distMATChiSquare(train, test) returns the distance vector between training samples and a test sample.
- % The input "train" is a n*d matrix, and each row of it represent one
- % training sample. The "test" is a 1*d vector.
- % Examples
- % --------
- % I1=imread('rice1.png');
- % I2=imread('rice2.png');
- % I3=imread('rice3.png');
- % mapping=getmapping(8,'u2');
- % M(1,:)=LBPV(I1,1,8,mapping); % LBPV histogram in (8,1) neighborhood using uniform patterns
- % M(2,:)=LBPV(I2,1,8,mapping);
- % S=LBPV(I3,1,8,mapping);
- % DV = distMATChiSquare(M,S);
- function DV = distMATChiSquare(trains, test)
- % Version 1.0
- % Authors: Zhenhua Guo, Lei Zhang and David Zhang
- % Copyright @ Biometrics Research Centre, the Hong Kong Polytechnic University
- [train_row, train_col] = size(trains);
- [test_row, test_col] = size(test);
- testExtend = repmat(test, train_row, 1);
- subMatrix = trains-testExtend;
- subMatrix2 = subMatrix.^2;
- addMatrix = trains+testExtend;
- idxZero = find(addMatrix==0);
- addMatrix(idxZero)=1;
- DistMat = subMatrix2./addMatrix;
- DV = sum(DistMat,2);