且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

算法的快速比较图像\矩阵

更新时间:2022-11-18 11:57:21

如果我正确地理解你的问题,你需要计算的第一张照片,这是从不同的点的数量所有的其他的照片,而不考虑其他的图片彼此有何不同​​?

If I understand your question correctly, you need to calculate the number of points on the first picture, which is different from all the other pictures, irrespective of how the other pictures differ from each other?

如果这个情况下,除非我失去了一些东西,你能不能简单地做一些这样的:

If this is case, unless I'm missing something, can you not simply do something like the following:

boolean[10][10] DIFFS // all values set to TRUE
int[10][10] ORIGINAL  // store first pictures color values

foreach IMAGE in [IMAGES - FIRST IMAGE] {
    int[10][10] CURRENT <- IMAGE // store the current image's color values
    for (i : 0 -> 9) {
        for (j : 0 -> 9) {
            if (DIFFS[i][j]) {
                DIFFS[i][j] = ORIGINAL[i][j] != CURRENT[i][j]
            }
        }
    }
}

然后,只剩下一个2维矩阵 DIFFS 其中每个位置表示如果在原始图像中的对应像素不同于所有其他图像

Then you are left with a 2-dimensional matrix DIFFS where each position indicates if the corresponding pixel in the original image differs from all the other pictures.