Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Java Mat.Put Not Working?

I have the following snippet which successfully gets a matrix element's value(s).

However, the values I try to put back, never actually update the matrix object.

Any ideas?

        float[] floats = new float[imgDescriptor.channels()];
        imgDescriptor.get(1, trainIdx, floats);
        // Just in case, we loop through the whole array
        for (int j = 0; j < floats.length; j++) {
            floats[j] = floats[j] + 1.0f;
        }
        imgDescriptor.put(1, trainIdx, floats);