除了比较像素和字节之外,还有其他方法可以比较 Android 中的位图吗?
我尝试获取像素并将位图转换为字节数组,并且位图等于 100 % 或 0 % ..我需要知道两个位图之间的相似度百分比
I tried get pixels and converting bitmap to bytes array and i got either bitmaps are equal 100 % or 0 % .. I need to know the percentage of similarity between two bitmaps
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不知道是否有一个库可以实现此目的,但您可以尝试创建颜色的启发式地图并进行比较。
I don't know if there is a library for this, but you might try creating a heuristic map of the colors and comparing those.
你的问题有点模糊,你没有说你想检测什么样的差异。
有两个著名的相似性度量:SAD 和 SSD(绝对差之和和平方差之和)。为了获得百分比,您可以将这些值与参考图像可实现的最大值相关联(通过选择黑色或饱和值,无论哪个给出最大的差异)。
示例:使用SAD比较像素值45 210 56和40 220 60(8位灰度):
另一个是归一化相关分数(线性回归的相关系数)。
Your question is a bit vague, you don't say in what kind of differences you want to detect.
There are two well-known similarity metrics: SAD and SSD (sum of absolute differences and sum of squared differences). In order to get a percentage, you can relate these to the maximum achievable from the reference image (by choosing black or saturated values, whatever gives the largest difference).
Example: compare pixel values 45 210 56 and 40 220 60 (8 bits grayscale) using SAD:
Another is the normalized correlation score (the correlation coefficient of linear regression).