Python numpy count element occurrences and calculate image pixel ratio.
Input images used :
Pillow (PIL) and NumPy libraries can do wonders in Python! I had once he requirement to overlap two images – not watermarking.
I found several alternatives, but curious to see which would work best.
- (x+y)/2 … Mathematically, x/2+y/2 seems equivalent to above, but it is not. We’d be loosing a ton of info by doing so!
- final = (x+y/2) and then addition = addition[addition>256]=256
- Pillow’s Image.blend(x,y,0.5)
- Pillow’s Image.composite(x,y,y)