public void indicateCameraContributions(int[][][] colors) throws IOException { File out = new File(outputdir, "contributions.vertices"); if (out.exists()) return; Point3f[] vertices = smp.getSphere().getVertices(); int[] res = new int[vertices.length]; for (int v = 0; v < vertices.length; v++) { Point3f vertex = vertices[v]; double r = 0, g = 0, b = 0; double sum = 0; for (int a = 0; a < nAngles; a++) { Point3f xvtx = new Point3f(vertex); if (transforms[a] != null) transforms[a].transform(xvtx); float w1 = weights[CAMERA1][LEFT][a].getWeight(xvtx.x, xvtx.y, xvtx.z); float w2 = weights[CAMERA1][RIGHT][a].getWeight(xvtx.x, xvtx.y, xvtx.z); float w3 = weights[CAMERA2][LEFT][a].getWeight(xvtx.x, xvtx.y, xvtx.z); float w4 = weights[CAMERA2][RIGHT][a].getWeight(xvtx.x, xvtx.y, xvtx.z); int c1 = colors[CAMERA1][LEFT][a]; int c2 = colors[CAMERA1][RIGHT][a]; int c3 = colors[CAMERA2][LEFT][a]; int c4 = colors[CAMERA2][RIGHT][a]; int r1 = (c1 & 0xff0000) >> 16, g1 = (c1 & 0xff00) >> 8, b1 = (c1 & 0xff); int r2 = (c2 & 0xff0000) >> 16, g2 = (c2 & 0xff00) >> 8, b2 = (c2 & 0xff); int r3 = (c3 & 0xff0000) >> 16, g3 = (c3 & 0xff00) >> 8, b3 = (c3 & 0xff); int r4 = (c4 & 0xff0000) >> 16, g4 = (c4 & 0xff00) >> 8, b4 = (c4 & 0xff); double rc = w1 * r1 + w2 * r2 + w3 * r3 + w4 * r4; double gc = w1 * g1 + w2 * g2 + w3 * g3 + w4 * g4; double bc = w1 * b1 + w2 * b2 + w3 * b3 + w4 * b4; r += rc; g += gc; b += bc; sum += w1 + w2 + w3 + w4; } r /= sum; g /= sum; b /= sum; int ir = r > 255 ? 255 : (int) r; int ig = g > 255 ? 255 : (int) g; int ib = b > 255 ? 255 : (int) b; res[v] = (ir << 16) + (ig << 8) + ib; } SphericalMaxProjection.saveIntData(res, out.getAbsolutePath()); }