2017-07-10 445 views
0

我想要使用Earth Mover距离(也称为Wasserstein度量)度量两个直方图之间的距离。我从图像中提取直方图。2个直方图之间的Earth Mover距离/ Wasserstein度量(MATLAB)

这是我如何提取我的图像直方图:

[N1,X1]=hist(image1,128) 
[N2,X2]=hist(image2,128) 

128表示类的直方图的数量。

,所以我发现这里的代码:https://fr.mathworks.com/matlabcentral/fileexchange/22962-the-earth-mover-s-distance?focused=5110777&tab=function

function [x, fval] = emd(F1, F2, W1, W2, Func) 
% EMD Earth Mover's Distance between two signatures 
% [X, FVAL] = EMD(F1, F2, W1, W2, FUNC) is the Earth Mover's Distance 
% between two signatures S1 = {F1, W1} and S2 = {F2, W2}. 
% F1 and F2 consists of feature vectors which describe S1 and S2, respectively. 
% Weights of these features are stored in W1 and W2. 
% FUNC is a function which computes the ground distance between two feature vectors. 

但我真的不知道怎样才能申请,在我的情况。事实上,在我的情况下F1和F2是什么?什么是重量?

谢谢!

+0

这是关于EMD不仅仅是一种编程一个相当的数学问题。这个问题不是特定于所提到的实施。考虑在https://math.stackexchange.com/上提问(并在此处将其删除)。 – m7913d

回答

0

这些特征将成为您正在查看的概率度量的概率的不同特征。如果你考虑一组人的眼睛颜色,一个特征可能是“蓝色”特征。重量将是具有该特定特征的人数。我希望这是有道理的!

我个人不是Matlab的人,但this是一个很好的博客文章,它展示了如何在Julia中计算这个距离。

数学中一个相关的问题堆栈溢出here

Wiki link here