public static BufferedImage toImage ( INDArray matrix ) { BufferedImage img = new BufferedImage ( matrix . rows ( ) , matrix . columns ( ) , BufferedImage . TYPE_INT_ARGB ) ; WritableRaster r = img . getRaster ( ) ; int [ ] equiv = new int [ ( int ) matrix . length ( ) ] ; for ( int i = 0 ; i < equiv . length ; i ++ ) { equiv [ i ] = ( int ) matrix . getDouble ( i ) ; } r . setDataElements ( 0 , 0 , matrix . rows ( ) , matrix . columns ( ) , equiv ) ; return img ; }
Convert a matrix in to a buffereed image