how to use mahalanobis.m to calculate mahalanobis distance of an image

13 visualizzazioni (ultimi 30 giorni)
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 Commento
Alvindra Pratama
Alvindra Pratama il 24 Mag 2016
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

Accedi per commentare.

Risposte (2)

Arnab Sen
Arnab Sen il 28 Apr 2016

AJITH B
AJITH B il 8 Set 2018
Modificato: Image Analyst il 8 Set 2018

Categorie

Scopri di più su Biomedical Imaging in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by