本文介绍了在Android的像素工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Android的新的和我有一个项目拍照保存,并计算其签名。我拍摄的照片,并已经保存了。

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.

及其签名由在计算中的RGB的所有像素值的平均值。问题是,我不知道如何与像素和色彩工作。

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.

您能帮我一些解释和/或教程和/或code。

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

感谢您

推荐答案

下面是code从位图获取像素。

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);
    }
}

这篇关于在Android的像素工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 00:23