gpt4 book ai didi

file - bmp 文件比较?

转载 作者:行者123 更新时间:2023-12-02 15:29:37 27 4
gpt4 key购买 nike

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

  1. 比较两个文件的文件头以及信息头
  2. 将bmp文件转换为二进制,然后进行上述比较

但是,我不知道如何开始以及哪种方法更好。如果有人可以帮助我,我会很高兴!

最佳答案

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

Compare two images with C#

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)
{
...
}

关于file - bmp 文件比较?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/649720/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com