1
如何在像素级别操作图像。我想通过重新排列像素来从图像中提取信息。任何帮助解决这个问题表示赞赏。如何在像素级操作图像并从图像中提取信息?
如何在像素级别操作图像。我想通过重新排列像素来从图像中提取信息。任何帮助解决这个问题表示赞赏。如何在像素级操作图像并从图像中提取信息?
函数提取从图像中你需要下面的代码
import android.graphics.Color;
int[] pixels = new int[myBitmap.getHeight()*myBitmap.getWidth()];
myBitmap.getPixels(pixels, 0, myBitmap.getWidth(), 0, 0, myBitmap.getWidth(), myBitmap.getHeight());
for (int i=0; i<myBitmap.getWidth()*5; i++)
pixels[i] = Color.BLUE;
myBitmap.setPixels(pixels, 0, myBitmap.getWidth(), 0, 0, myBitmap.getWidth(), myBitmap.getHeight());
信息
将图像加载到位图。然而,像
Bitmap b = ...
int color = b.getPixel(x,y);
b.setPixel(x, y, color);