C# 检查一个图像是否存在于另一个图像中
我不知道从哪里开始,所以一些指导会很好。我需要实现的是,检查一个大图像(例如 1280x1024)并检查其中是否存在另一个较小的图像(可能是 50x50 像素图像)。
我尝试通过比较每个像素来做到这一点,这非常慢,而且我可能需要执行 100 多次,所以它看起来不合适。我只是想知道是否有更好的方法?
谢谢
I'm not sure where to start with this so some guidance would be good. What I need to achieve is, examine a large image (say 1280x1024) and check to see if another smaller image exists within it or not (maybe a 50x50 pixel image).
I tried doing this by comparing every pixel which is really slow and I may need to do it 100+ times so it doesn't seem suitable. I'm just wondering if there is a better way?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我只是在做类似的事情,我想出的快速而肮脏的结果是使用 AForge.Net 的“ExhaustiveTemplateMatching”实现,图像大小是其大小的 1/4。全尺寸的 720p 图像需要几分钟的时间,但在我的小电脑上,1/4 尺寸的图像大约需要一秒钟。
您当然也可以只检查 tm.length > 0 是的,其中有一些不必要的划分:P
I was just working on something similar and the quick and dirty result I came up with is to use AForge.Net's implementation of "ExhaustiveTemplateMatching" with images 1/4 of their size. 720p images at full size took a couple minutes but at 1/4 size it's about a second on my puny computer.
You could also of course just check for tm.length > 0 and yes there are some unnecessary divides in there :P