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

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

问题描述

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

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

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

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