如何比较两个图像和 识别图像中的图案?

发布于 2024-07-09 07:50:47 字数 73 浏览 19 评论 0原文

如何比较两个图像和 识别图像中的图案,无论其大小和图案大小如何,并使用 .Net C#? 另外,图像处理使用哪些算法来执行此操作?

How do I compare two images & recognize the pattern in an image irrespective of its size and pattern size, and using .Net C#? Also, which algorithms are used for doing so from Image Processing?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

有深☉意 2024-07-16 07:50:47

请参阅尺度不变特征变换模板匹配,以及霍夫变换。 快速但不准确的猜测可能是制作颜色直方图并进行比较。 如果图像足够复杂,您也许能够区分多组图像。

为了简单起见,假设我们有 R、G 和 B 三个存储桶。全白图像的 (R、G、B) 为 (100%、100%、100%)。 完全红色的图像将具有 (100%, 0%, 0%)。 复杂的图像可能有类似 (23%, 53%, 34%) 的内容。 如果您计算该(R,G,B)空间中的点之间的距离,您可以比较哪一个“更近”。

See Scale-invariant feature transform, template matching, and Hough transform. A quick and inaccurate guess may be to make a histogram of color and compare it. If the image is complicated enough, you might be able to distinguish between several sets of images.

To make the matter simple, assume we have three buckets for R, G, and B. A completely white image would have (100%, 100%, 100%) for (R, G, B). A completely red image would have (100%, 0%, 0%). A complicated image might have something like (23%, 53%, 34%). If you take the distance between the points in that (R, G, B) space, you can compare which one is "closer".

放赐 2024-07-16 07:50:47

查找模式识别。 除了名字之外,我对它知之甚少。

警告:如果这就是您想要的,那么它是已知的最难的“现实世界”编程问题之一。

look up pattern recognition. I known very little about it other than the name.

Warning: If that is what you want, it is one of the hardest "real world" programming problems known.

格子衫的從容 2024-07-16 07:50:47

我不是图像识别方面的专家,因为我曾经偶然发现了 AForge 库,该库是用C# 并进行图像识别。 也许它可以帮助...

I am no expert in image recognition by I once stummbeled upon the AForge library which is written in C# and does image recognition. Maybe it can help...

冧九 2024-07-16 07:50:47

图像匹配和图像识别的技术可能有很大不同。 对于第一个任务,您可以使用 SIFT 或基于 RGB 或其他方式手工制作自己的距离函数。 对于识别,有大量的机器学习技术可以使用,比较流行的技术包括 Adaboost、SVM 和其他混合神经网络方法。 该领域不乏相关研究论文。 谷歌是你的朋友。

Techniques for image matching and image recognition can be very different. For the first task, you may make use of SIFT or hand craft your own distance function, based on RGB or otherwise. For recognition, there a vast amount of machine learning techniques that you can use, more popular techniques involves Adaboost, SVM and other hybrid neural networks method. There are no lack of related research papers in this field. Google is your friend.

猫卆 2024-07-16 07:50:47

Jinmala,你在这里问了一个非常广泛的问题。 关于这些主题的文献实际上有数千篇论文。 没有正确的答案,并且在图像比较中有许多未解决的问题,所以你真的可能不能指望有一个简单的解决方案就可以工作(除非你的情况非常简单且受到限制)

如果你缩小范围,我或许能帮上忙。

Jinmala, you've asked a question here that is extremely broad. There are literally thousands of papers in the literature about these topics. There is no correct answer, and there are many unsolved issues in the comparison of images, so you really probably can't hope for a simple solution that just works (unless your situation is quite simple and constrained)

If you narrow things down, I might be able to help.

拥抱影子 2024-07-16 07:50:47

您可能正在寻找这个

System.Drawing.Bitmap sourceImage = (Bitmap)Bitmap.FromFile(@"C:\SavedBMPs\1.jpg");
System.Drawing.Bitmap 模板 = (Bitmap)Bitmap.FromFile(@"C:\SavedBMPs\2.jpg");
// 创建模板匹配算法的实例
//(将相似度阈值设置为 92.5%)

       ExhaustiveTemplateMatching tm = new ExhaustiveTemplateMatching(0.921f);
            // find all matchings with specified above similarity

            TemplateMatch[] matchings = tm.ProcessImage(sourceImage, template);
            // highlight found matchings

       BitmapData data = sourceImage.LockBits(
            new Rectangle(0, 0, sourceImage.Width, sourceImage.Height),
            ImageLockMode.ReadWrite, sourceImage.PixelFormat);
        foreach (TemplateMatch m in matchings)
        {

                Drawing.Rectangle(data, m.Rectangle, Color.White);

            MessageBox.Show(m.Rectangle.Location.ToString());
            // do something else with matching
        }
        sourceImage.UnlockBits(data);

我警告您,处理 50x50 大小的 1024x768 图像需要大约 6 秒的时间。在此处输入代码

You might be looking for this

System.Drawing.Bitmap sourceImage = (Bitmap)Bitmap.FromFile(@"C:\SavedBMPs\1.jpg");
System.Drawing.Bitmap template = (Bitmap)Bitmap.FromFile(@"C:\SavedBMPs\2.jpg");
// create template matching algorithm's instance
// (set similarity threshold to 92.5%)

       ExhaustiveTemplateMatching tm = new ExhaustiveTemplateMatching(0.921f);
            // find all matchings with specified above similarity

            TemplateMatch[] matchings = tm.ProcessImage(sourceImage, template);
            // highlight found matchings

       BitmapData data = sourceImage.LockBits(
            new Rectangle(0, 0, sourceImage.Width, sourceImage.Height),
            ImageLockMode.ReadWrite, sourceImage.PixelFormat);
        foreach (TemplateMatch m in matchings)
        {

                Drawing.Rectangle(data, m.Rectangle, Color.White);

            MessageBox.Show(m.Rectangle.Location.ToString());
            // do something else with matching
        }
        sourceImage.UnlockBits(data);

I warn you it is quite slow takes around 6 seconds to process image of 1024x768 finding in it pciture with the size of 50x50.enter code here

唱一曲作罢 2024-07-16 07:50:47

模板匹配,您可以使用 EmguCV 、OpendotnetCV、Aforge.net 来完成此操作

template matching, you can do this with EmguCV ,OpendotnetCV,Aforge.net

我不是你的备胎 2024-07-16 07:50:47

尺度不变特征变换 (SIFT) 可能就是您正在寻找的。 然而,理解或实施并不简单。

Scale-invariant feature transform (SIFT) might be what you're looking for. It's not simple to understand or implement, however.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文