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

조회 수: 10 (최근 30일)
junfei li
junfei li 2016년 4월 24일
편집: Image Analyst 2018년 9월 8일
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
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개)

Arnab Sen
Arnab Sen 2016년 4월 28일

AJITH B
AJITH B 2018년 9월 8일
편집: Image Analyst 2018년 9월 8일

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by