比较 Android 中的位图图像 [英] Comparing Bitmap images in Android

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

问题描述

有没有办法检查位图是否相同?有人可以帮我吗?

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)获取颜色,见此页面

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

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