除了比较像素和字节之外,还有其他方法可以比较 Android 中的位图吗?

发布于 2025-01-05 12:35:12 字数 65 浏览 2 评论 0原文

我尝试获取像素并将位图转换为字节数组,并且位图等于 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

困倦 2025-01-12 12:35:12

我不知道是否有一个库可以实现此目的,但您可以尝试创建颜色的启发式地图并进行比较。

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.

我的奇迹 2025-01-12 12:35:12

你的问题有点模糊,你没有说你想检测什么样的差异。

有两个著名的相似性度量:SAD 和 SSD(绝对差之和和平方差之和)。为了获得百分比,您可以将这些值与参考图像可实现的最大值相关联(通过选择黑色或饱和值,无论哪个给出最大的差异)。

示例:使用SAD比较像素值45 210 56和40 220 60(8位灰度):

P = 1 - (|45-40| + |210-220| + |56-60|) / (|45-0| + |210-255| + |56-0|) = 87%

另一个是归一化相关分数(线性回归的相关系数)。

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:

P = 1 - (|45-40| + |210-220| + |56-60|) / (|45-0| + |210-255| + |56-0|) = 87%

Another is the normalized correlation score (the correlation coefficient of linear regression).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文