根据 byteBuffer 改变位图像素

问题描述

我正在尝试以最有效的方式清除图片中不需要的区域

我现在的代码:

Bitmap picture = ...;
ByteBuffer mask = ...;
int height = picture.getHeight();
int width = picture.getWidth();
for (int y = 0; y < height; y++) {
    for (int x = 0; x < width; x++) {
        float currFloat = mask.getFloat();
        if (currFloat > 0.7) {
            req.setPixel(x,y,Color.TRANSPARENT);
        }
    }
}

我的掩码((例如)8*8的ByteBuffer):

mask

我的图片(8*8位图):

enter image description here

异常结果:

enter image description here

谢天谢地,它有效, 但不幸的是,由于要处理的图像很多,所以时间太长了..

有什么办法可以让它运行得更快? (类似于矩阵乘法?)

我可以使用

将位图转换为缓冲区
picture.copyPixelsToBuffer(buff)

提前致谢。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...