how to use mahalanobis.m to calculate mahalanobis distance of an image
    13 次查看(过去 30 天)
  
       显示 更早的评论
    
I have a homework ask me using mahalanobis.m to calculate the mahalanobis distance of a color in an image. themahalanobis.m comes from DIPUM(gonzalez), it is easy to find on google.
the homework is i have a color and know its rgb(like: [150 97 210]), now i need to calculate its mahalanobis distance of a rgb image. the professor give us a matlab function: mahalanobis.m and this is part of the code and easy to find on google.
function d = mahalanobis(varargin)
%  MAHALANOBIS Computes the Mahalanobis distance.
%   D = MAHALANOBIS(Y, X) computes the Mahalanobis distance between
%   each vector in Y to the mean (centroid) of the vectors in X, and
%   outputs the result in vector D, whose length is size(Y, 1).  The
%   vectors in X and Y are assumed to be organized as rows.  The
%   input data can be real or complex. The outputs are real
%   quantities.
%
%   D = MAHALANOBIS(Y, CX, MX) computes the Mahalanobis distance
%   between each vector in Y and the given mean vector, MX. The
%   results are output in vector D, whose length is size(Y, 1).  The
%   vectors in Y are assumed to be organized as the rows of this
%   array. The input data can be real or complex. The outputs are
%   real quantities. In addition to the mean vector MX, the
%   covariance matrix CX of a population of vectors X also must be
%   provided. Use function COVMATRIX (Section 11.5) to compute MX and
%   CX.
%   Copyright 2002-2004 R. C. Gonzalez, R. E. Woods, & S. L. Eddins
%   Digital Image Processing Using MATLAB, Prentice-Hall, 2004
%   $Revision: 1.6 $  $Date: 2005/01/18 13:44:47 $
the problem is I don't know how to use this function. I don't know what is X and Y, how to use my image and the color to find X and Y
1 个评论
  Alvindra Pratama
 2016-5-24
				are you have found the solution of the problem? because I also have the same problem with yyou, so I also needed a solution too, please help me
回答(2 个)
另请参阅
类别
				在 Help Center 和 File Exchange 中查找有关 Image Processing Toolbox 的更多信息
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



