I am new to Android and need to process a bitmap to extract the pixel information into a multi-dimensional array by collecting only the black pixels i.e. R = 0, G = 0, and B = 0. I noticed that there is a GetPixel(x, y) method which is apparently slow and I need something like this instead. But I'm lost on how to implement a better GetPixel(x, y) method using information from GetPixels(). I am trying something like this currently:
private static int[][] GetPixels(Bitmap bmp)
{
    int height = bmp.getHeight();
    int width = bmp.getWidth();
    int length = width * height;
    int[] pixels = new int[length];
    bmp.getPixels(pixels, 0, 0, 0, 0, width, height);
    int[][]result = new int[width][height];
    for(int pixel = 0, x = 0, y = 0; pixel < pixels.length; pixel += 4)
    {
        int argb = pixels[pixel];//how to access pixel information?
        result[x][y] = argb;//store only black pixels??
        x++;
        if(y == width)
        {
            x = 0;
            y++;
        }
    }
    return result;
}
 
    