I'm trying to clear unwanted area from picture, in the most efficient way,
My code for now:
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);
}
}
}
My mask (ByteBuffer of (for example) 8*8):
My picture (Bitmap of 8*8):
Excepted result:
Thankfully, it works, but unfortunately it takes too long since there are a lot of images to process..
There is any way to make it work faster? (something like matrix multiplication?)
I can transform the bitmap into buffer using
picture.copyPixelsToBuffer(buff)
Thanks in advance.