about the jitter java api performance


    Mar 19 2011 | 12:56 am
    Hi,
    field is a too both visual and code-based (python, clojure, javac among others):
    The communication between field and jitter is done with a mxj objects that behaves like a python box, in the sense that we design the mxj object in field using python. When a Jitter object arrives, the code is executed and the result sent to the outlet.
    It is possible to recall Jitter objects via the Java api as shown in the tutorial:
    But we are by now trying to operate numerically the jitter matrices with operators taken from diverse java libraries like ejml:
    In order to do that, we have to do the following (one time for each plane):
    1. create a zeroed array
    2. extract the row vector from JitterMatrix with copyVectorToArrayPlanar
    3. use the constructor SimpleMatrix(rows, cols, rowMajor, double[]) to convert the array into a row SimpleMatrix
    4. use .combine method to add all the rows in this fashion
    Then we apply a transformation with the ejml java library.
    And to recover the JitterMatrix from SimpleMatrix:
    1. extractVector gets a 1-row matrix
    2. extractVector().getMatrix().getData() gets an array from a 1-row SimpleMatrix
    3. set the array as a row of JitterMatrix with copyVectorToArrayPlanar
    The problem is the performance, we could not find a way to map the jitter matrices into a java matrix class (SimpleMatrix in our example) without using row or cell descomposition which makes for example the rendering of a 320x320 image last about 3 seconds, which is not suitable for real time.
    My questions would be:
    a. is possible to optimize the performance of the methods that translate a jitter matrix into another formats (for the moment only floats and arrays)?
    b. the same for the methods that fill a jitter matrix with another formats like floats or arrays?
    c. is it feasible to build a method that transforms a jitter matrix into a java matrix class and vice versa?
    Here is the code that we are testing that makes a simple numerical transform of each plane of the Jitter matrix:
    I attach also an example of a filtered image with this technique.
    best! bodsiin
    [attachment=156863,1946]