java - Convert an image to matrix -
i'm trying convert simple image matrix m*n, m , n width , heigth of image. @ point don't understand best way work out steps.
there code @ moment:
public double[][] img2matriz(bufferedimage bi){ double[][] c; for(int i=0;i<bi.getheight();i++) { for(int j=0;j<bi.getwidth();j++) { c[i][j] } } } in [i] , [j] want put values of matrix rgb respectively.
try this:
c[i][j] = bi.getrgb(i, j); the getrgb() method returns integer, can bit-masked give individual components. more appropriate if c integer array, not double.
Comments
Post a Comment