我从减去两张图片中得到的这些亮黄色/红色/粉红色是什么?

问题描述 投票:0回答:1

我正在制作一个Android应用程序,其中用户拍摄两个图像,第一个是逐个像素地从第二个“减去”。

本质上,两个位图转换为2D int数组,并使用以下方法执行图像减法:

private int[][] pixelmapDifference(int[][] subtrahend, int[][] minuend) {
    int[][] diff = new int[subtrahend.length][subtrahend[0].length];
    for (int x = 0; x < diff.length; x++) {
        for (int y = 0; y < diff[0].length; y++) {
            diff[x][y] = minuend[x][y] - subtrahend[x][y];
        }
    }
    return diff;
}

然后将得到的2D阵列转换为位图。这就是3幅图像的样子(第一,第二和差异)。

enter image description here

enter image description here

enter image description here

我如何解释这个?我想在两者之间找到差异,在这种情况下只是水。

android image bitmap
1个回答
0
投票

你总是从第一个减去第二个。当第二个更亮时会发生什么?返回的值低于零。我不是百分之百肯定会发生什么,但是文件说颜色是int color = (A & 0xff) << 24 | (R & 0xff) << 16 | (G & 0xff) << 8 | (B & 0xff);所以当你在某些情况下从较暗处减去较轻的结果是这些奇怪的点。

© www.soinside.com 2019 - 2024. All rights reserved.