如何计算C#中的Fréchet距离 [英] How to compute the Fréchet Distance in C#

查看:123
本文介绍了如何计算C#中的Fréchet距离的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在,我有很多离散点呈现的曲线,每条曲线都是现实世界数据的一个方面。我想用FréchetDist进行曲线匹配,我会用C#做,但我不知道怎么做。我对FréchetDistance有一点了解,但不太清楚。有没有人能给我一些非常好的材料(我见过很多,但我想我需要一步一步的教程)或者告诉我一些我可以使用C#库吗?我会很感激的。

我的英语不是很好,所以如果我在语法上犯了错误,我真的很抱歉。

Now,I have a lot of curves presented by discrete points,each curve is a aspect of real world data.And I want to do curve match using Fréchet Distance and I will do it by C#,but I don't know how to do it.I have a little knowledge about Fréchet Distance,but not so clear.Is there anyone can offer me some really good materials(I have seen a lot,but I think I need step by step tutorial) or tell me some C# libraries I can use? I'll appreciate it.
My English is not really good,so I would be really sorry if I made mistakes in grammar.

推荐答案

这不是一个简单的事情,可以在本论坛的一个或几个快速答案中解释。您可以从定义开发代码。这在此解释:

http://en.wikipedia.org/wiki/Fr %C3%A9chet_distance [ ^ ] 。



我不希望有一个现成的解决方案。但是,此搜索提供了一些有希望的链接: http://bit.ly/1c0dX8Q [ ^ ]。



您不应仅搜索C#。如果您希望找到任何语言的强大解决方案,将其翻译为C#将比从头开始编写更容易。



-SA
This is not such a simple thing which can be explained in a single or few Quick Answers in this forum. You can develop the code from the definition. This is explained here:
http://en.wikipedia.org/wiki/Fr%C3%A9chet_distance[^].

I would not expect a ready-to-use solution. However, this search gives some hopeful links: http://bit.ly/1c0dX8Q[^].

You should not search for C# only. If you can hope to find a robust solution in any language, translating it to C# would be way easier than writing if from scratch.

—SA


我把我的matlab代码放在这里。



I put my matlab code here.

function distance=FrechetDistance(p1,n,p2,m);
  tempdis(m,n)=0;
  distance=Cal(p1,p2,tempdis,m-1,n-1)
end

function tempdis=Cal(p1,p2,i,j);
if tempdis[i,j] > -1.0
    tepdis=tempdis[i,j];
end
elseif i == 0 && j == 0
        tempdis[i,j] = Dis(p1,p2,0,0);
    end
    elseif i>0&&j==0
        tempdis[i,j] = max([Cal(p1,p2,tempdis,i-1,0),Dis(p1,p2,i,0)])
        end
        elseif i==0&&j>0
            tempdis[i,j] = max([Cal(p1,p2,tempdis,0,j-1),Dis(p1,p2,0,j)])
            end
            elseif
                tempdis[i,j] = max([min([Cal(p1,p2,tempdis,i-1,j),Cal(p1,p2,tempdis,i-1,j-1),Cal(p1,p2,tempdis,i,j-1)]),Dis(p1,p2,i,j)])
                end
                else
                    tempdis[i,j] = 9999999
                    end
end

function dis=Dis(p1,p2,i,j);
  dis=Sqrt((p1[0,j]-p2[0,i])^2 + (p1[1,j]-p2[1,i])^2);
end


这篇关于如何计算C#中的Fréchet距离的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆