有没有适用于.NET的良好图像识别库?

61

我想比较从网络摄像头拍摄的图像和存储在电脑上的图像。

这个库不需要百分之百准确,因为它不会用于任何关键任务(例如警方调查),我只需要可用的东西。

我尝试了一个来自CodeProject的图像识别演示项目,但它只能处理小的图片/当我比较一个大小为120×90像素的完全相同的图像时根本无法工作(这不被认为是可行的:P)。

之前有过图像识别的成功案例吗?

如果有的话,您能否提供一个在C#或VB.NET中使用的库的链接呢?


它绝对可以处理比这更大的图像,可能是其他问题,可能是格式。 - Peter C
3个回答

80

你可以尝试这个:http://code.google.com/p/aforge/

它包含一个比较分析功能,会给出一个得分。此外还包含许多其他类型的出色图像特性。

// The class also can be used to get similarity level between two image of the same size, which can be useful to get information about how different/similar are images:
// Create template matching algorithm's instance

// Use zero similarity to make sure algorithm will provide anything
ExhaustiveTemplateMatching tm = new ExhaustiveTemplateMatching(0);

// Compare two images
TemplateMatch[] matchings = tm.ProcessImage( image1, image2 );

// Check similarity level
if (matchings[0].Similarity > 0.95)
{
    // Do something with quite similar images
}

9
它的效果非常好!与自己的图像作比较,相似度达到100%;我坐直在椅子上和向左倾斜时的相似度为91%。这正是我所期望的一切,非常感谢 :) - RodgerB
4
太棒了,我很高兴能够为您提供链接。我希望有一种方式可以回馈给最先向我提供链接的那个人。这正好是我其中一个项目所需要的。谢谢。 - mattlant
10
您总是可以相信 Stack Overflow 解决您的难题!在找不到好的库时搜索了很多,谢谢。 - StefanE
1
好的,我一直想用图像识别来实现我的假设应用程序...现在我可以动手了!谢谢mattlant!;) - ioWint
1
我搜索了很长时间,但这个答案是完美的。 - teamalpha5441
显示剩余3条评论

10

您可以使用EmguCV适用于.NET技术。


4

我很简单地完成了它。只需在此下载 EyeOpen 库。 接着,在你的 C# 类中使用它并写入以下代码:

 use eyeopen.imaging.processing

写作
ComparableImage cc;

ComparableImage pc;

int sim;

void compare(object sender, EventArgs e){

    pc = new ComparableImage(new FileInfo(files));

    cc = new ComparableImage(new FileInfo(file));

    pc.CalculateSimilarity(cc);

    sim = pc.CalculateSimilarity(cc);

    int sim2 = sim*100

    Messagebox.show(sim2 + "% similar");
}

简单易用的图像比较,我喜欢它。 - Hiram
@j0k,我猜因为答案适用于两个问题,正如上面的赞所证明的那样。 - MyDaftQuestions

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接