Android Question how to multiply pixel values - Imageprocessing for probability map

Magnus Gärtner

Licensed User
at first, I will try to explain what i want to do. The idea is to use imageprocessing related functions which are hardware accelerated to calculate the probability of objects in 2d space. So the bitmap will represent the map and low pixel values stand for low probability high values for high probability that there is an object.

...and therefore my question:
How to add, multiply and divide 2 bitmaps of the same size by pixel value? Is there a fast way to do to avoid alot of getpixel & setpixel?

my formular to calculate the new bitmap is (per pixel):
Pixel of two source bitmaps: a, b
Maximum pixel value: max
Source pixel: s

S=A*B/ (A*B+(max-a)*(max-b))

I would appreciate any suggestions :)

sorry for my english as it is not my first language ;)


Well-Known Member
Licensed User

I'm not sure of your exact application, but what I think you want to do is compute the probability values as numbers using your equation. Then map results to colors and draw the colors, rather than by trying to use the pixel values of the colors to compute your results.


Magnus Gärtner

Licensed User
Hey Barry,
thanks for your reply. Your solution may be the easiest way to go but I thought I could make use of the graphics capabilities by using bitmaps as data matrices ;)