比较图像 [英] Comparing Images

查看:91
本文介绍了比较图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在2个不同的对象中拥有完全相同的图像。它们是bmp,当我将它们与 .Equals 进行比较时,它返回false。

I have the exact same image in 2 different objects. They are bmp and when i compare them with .Equals it returns false.

这是否有原因,如果是这样的话,应该如何比较图像?

Is there a reason for this and if so how should images be compared?

推荐答案

如果它们是两个不同的 Image 对象,则单独加载它们将具有不同的引用。

If they are two different Image objects, loaded separately they will have different references.

Image Object 继承 .Equals ,而不是覆盖它(参见 图片 在MSDN上)。

Image inherits .Equals from Object, not overriding it (see Image on MSDN).

由于 .Equals 确实引用相等,如果引用是,它将返回false到不同的图像对象。

Since .Equals does reference equality, it will return false if the references are to different Image object.

要查看图像是否相同,您必须逐像素地比较它们/逐字节。

To see if the images are identical, you will have to compare them pixel by pixel/byte by byte.

这篇关于比较图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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