比较位图图像中的Andr​​oid位图、图像、oid、Andr

2023-09-12 06:49:07 作者:言不由衷你懂吗/

有没有办法为检查,如果位图是一样的?有人可以帮我吗?

Is there any way to check if bitmaps are the same? can someone help me out?

推荐答案

根据你如何定义相同。如果你的意思的完全相同的文件的,你可以做的文件了md5sum。这将是相同的每个类型的文件我想

Depending on how you define the same. If you mean the exact same file, you can do an md5sum of the files. That will be the same for every type of file I guess.

由于您特别进行区分的位图文件,你可能会感兴趣的是不同大小的文件。这是一个有点困难。如果它们的大小相同,但不完全一样(不过看起来真的很像海誓山盟),您可以比较每个单独的像素,并且有足够的像素(阈值1)足够接近对方的颜色(阈值2)你可以声明它们视为相同。

Because you specifically make the distinction for bitmap files, you might be interested in files that differ in size. That's a bit harder. If they are the same size, but not completely the same (but look really much like eachother) you can compare each separate pixel, and if enough pixels (threshold 1) are close enough to each other in color (threshold 2) you can declare them as being the same.

您可以与getPixel(INT,INT)来获取颜色,看的这个页面

You can getPixel(int,int) to get the color, see this page