public static double [ ] vectorizeDoubleMatrix ( RenderedImage input ) { double [ ] U = new double [ input . getWidth ( ) * input . getHeight ( ) ] ; RandomIter inputRandomIter = RandomIterFactory . create ( input , null ) ; int j = 0 ; for ( int i = 0 ; i < input . getHeight ( ) * input . getWidth ( ) ; i = i + input . getWidth ( ) ) { double tmp [ ] = new double [ input . getWidth ( ) ] ; for ( int k = 0 ; k < input . getWidth ( ) ; k ++ ) { tmp [ k ] = inputRandomIter . getSampleDouble ( k , j , 0 ) ; } System . arraycopy ( tmp , 0 , U , i , input . getWidth ( ) ) ; j ++ ; } return U ; }
Takes a input raster and vectorializes it .