比较bmp文件? [英] Comparison of bmp files?

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

问题描述

我要比较两个bmp文件。我想到了两种方法:

I want to compare two bmp files. I thought of two approaches:


  1. 比较两个文件的标题和信息标题

  2. 将bmp文件转换为二进制文件,然后执行以上比较

但是,我不知道如何开始,将是一个更好的方法。如果有人能帮助我,我会很高兴。

But, I don't know how to start and which will be a better approach. I would be glad if someone could please help me!

推荐答案

我不知道在哪个平台上实现这个,但这里有一些代码段可能是有用的:

I don't know on which platform you want to implement this, but here are some code snippets which could be useful:

使用C#比较两个图片


这是一个片段,用于比较2张图片
他们是一样的。这个
方法首先将每个Bitmap转换为
字节数组,然后获取每个
数组的哈希值。

This is a snippet to compare 2 images to see if they are the same. This method first converts each Bitmap to a byte array, then gets the hash of each array. We then loop through each in the hash to see if they match.



/// <summary>
/// method for comparing 2 images to see if they are the same. First
/// we convert both images to a byte array, we then get their hash (their
/// hash should match if the images are the same), we then loop through
/// each item in the hash comparing with the 2nd Bitmap
/// </summary>
/// <param name="bmp1"></param>
/// <param name="bmp2"></param>
/// <returns></returns>
public bool doImagesMatch(ref Bitmap bmp1, ref Bitmap bmp2)
{
  ...
}

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

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