java - How to get an image's rgb matrix separately? -


i have image database , want store these image's rgb matrix in mysql db separately (forexample : redmatrix_column, greenmatrix_column, bluematrix_column ). in matlab can rbg matrix separately using imread() function. how in java ? help.

this how color components:

public class getimagecolorcomponents {   public static void main(string... args) throws exception {     bufferedimage img = imageio.read(getimagecolorcomponents.class                                      .getresourceasstream("/image.png"));     int[] colors = new int[img.getwidth() * img.getheight()];     img.getrgb(0, 0, img.getwidth(), img.getheight(), colors, 0, img.getwidth());      int[] red = new int[colors.length];     int[] green = new int[colors.length];     int[] blue = new int[colors.length];      (int = 0; < colors.length; i++) {       color color = new color(colors[i]);       red[i] = color.getred();       green[i] = color.getgreen();       blue[i] = color.getblue();     }   } } 

see this gist complete example involving saving , retrieving bytes in mysql database.


Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -