Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am new at android and I have a project to take a picture save it and compute its signature. I've taken the picture and saved it already.

Its signature consists in computing the mean of all pixels values in RGB. The problem is that I dont know how to work with pixels and colors.

Can you help me with some explanations and/or tutorials and/or code.

Thank you

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
233 views
Welcome To Ask or Share your Answers For Others

1 Answer

Here is code to get pixel from bitmap.

int width = bitmap.getWidth();
int height = bitmap.getHeight();

int pixel;

for (int x = 0; x < width; ++x) {
    for (int y = 0; y < height; ++y) {
        // get pixel color
        pixel = bitmap.getPixel(x, y);

        int A = Color.alpha(pixel);
        int R = Color.red(pixel);
        int G = Color.green(pixel);
        int B = Color.blue(pixel);
    }
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...