This article is an example of the Android programming implementation based on bitmap to obtain image pixel data methods. Share to everyone for your reference, specific as follows:
The references on the Internet are:
int[] pixels = new Int[bit.getwidth () *bit.getheight ()];//saves an array of all pixels, with a picture wide x high
bit.getpixels (Pixels,0,bit.getwidth ( ), 0,0,bit.getwidth (), Bit.getheight ());
for (int i = 0; i < pixels.length i++) {
int clr = pixels[i];
int red = (CLR & 0x00ff0000) >> 16;//High two-bit
int green = (CLR & 0x0000ff00) >> 8;//two-digit
int Blue = clr & 0x000000ff; Lower two-bit
System.out.println ("r=" +red+ ", g=" +green+ ", b=" +blue ")
;
Where the third parameter in Getpixels is the width of the picture
Actually, there's a better function
Bitmap BM = "Get Bitmap picture";
Bm.getpixels (X,y);
The pixel data at the x,y coordinates are obtained directly.
I hope this article will help you with the Android program.