This article describes the method of Android using BitMap to obtain image pixel data. Share it for your reference, as follows:
The references seen online are:
int[] pixels = new int[()*()];//Save all pixel arrays, picture width × height(pixels,0,(),0,0,(),()); for(int i = 0; i < ; i++){ int clr = pixels[i]; int red = (clr & 0x00ff0000) >> 16; //Take two higher int green = (clr & 0x0000ff00) >> 8; //Two digits are selected int blue = clr & 0x000000ff; //Pick the lower two digits ("r="+red+",g="+green+",b="+blue); }
The third parameter in getPixels should be the width of the image
There is actually a better function
Bitmap bm = "Get bitmap picture" (x,y);
Directly obtain pixel point data at x and y coordinates.
For more information about Android related content, please check out the topic of this site:Summary of Android graphics and image processing skills"and"Summary of Android photography and picture processing skills》
I hope this article will be helpful to everyone's Android programming design.