Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/343.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/234.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 在Android中将RGB值数组转换为图像_Java_Android_Rgb_Android Bitmap - Fatal编程技术网

Java 在Android中将RGB值数组转换为图像

Java 在Android中将RGB值数组转换为图像,java,android,rgb,android-bitmap,Java,Android,Rgb,Android Bitmap,我已通过BitmapFactory.decodeStream将JPEG图像转换为RGB颜色值数组,代码如下: picw = selectedImage.getWidth(); pich = selectedImage.getHeight(); int[] pix = new int[picw * pich]; selectedImage.getPixels(pix, 0, picw, 0, 0, picw, pich); int R, G, B; for (int y = 0; y <

我已通过
BitmapFactory.decodeStream
将JPEG图像转换为RGB颜色值数组,代码如下:

picw = selectedImage.getWidth();
pich = selectedImage.getHeight();

int[] pix = new int[picw * pich];

selectedImage.getPixels(pix, 0, picw, 0, 0, picw, pich);
int R, G, B;

for (int y = 0; y < pich; y++) {
        for (int x = 0; x < picw; x++) {
            int index = y * picw + x;
            R = (pix[index] >> 16) & 0xff;
            G = (pix[index] >> 8) & 0xff;
            B = pix[index] & 0xff;
            pix[index] = (R << 16) | (G << 8) | B;
        }
    }
picw=selectedImage.getWidth();
pich=selectedImage.getHeight();
int[]pix=新的int[picw*pich];
选择eImage.getPixels(像素,0,像素,0,0,像素,像素);
int R,G,B;
对于(int y=0;y>16)&0xff;
G=(pix[index]>>8)&0xff;
B=pix[索引]&0xff;

pix[index]=(R您可以使用静态方法


android中没有@Venugopal setRGB的可能副本
Bitmap bmp = Bitmap.createBitmap(pix, picw, pich, Bitmap.Config.ARGB_8888)