[1/4] Docker: Java, SpringBoot, MySQL & docker-compose


I created a video, for a web conference for my school. In this video I talk about how to perform initial groundwork to perform initial set-up. In the 2nd episode, I would talk more about the docker-compose v2, v 2.1 and v2.3.

 

IsClose() in python


This post tries to answer whether given numbers are comparatively close to each other. This can help if you are using Python for data science or in the area of computer vision doing computing with images. A quick stack-overflow search shows discussion around finding “nearest” value from a set of given values for any given number [1] [2] [3]. However, there could be a need to limit how much further the nearest number could be. I’d call this limit a “threshold”.

Quite a few times, in my Python (esp. in computer vision related) programming I come across scenarios when I want to tell if the two numbers are close to each other. Some might ask, “Well define close!?” or “How close?”, well … comparatively close.

Now Continue reading “IsClose() in python”

Python Numpy count elements


Python numpy count element occurrences and calculate image pixel ratio.


As you already know, in order to calculate non-zero elements in your np array, you can use numpy.count_nonzero. But how about 0? How about an expression? Well, Continue reading “Python Numpy count elements”

Python: PIL (Pillow) & Numpy intersect images


Input images used :

1.png C.png

Continue reading “Python: PIL (Pillow) & Numpy intersect images”

Python: PIL ( Pillow ) & NumPy add images


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.

  1. (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!
  2. Numpy.minimum((x+y),256)
  3. final = (x+y/2) and then addition = addition[addition>256]=256
  4. Pillow’s Image.blend(x,y,0.5)
  5. Pillow’s Image.composite(x,y,y)

Continue reading “Python: PIL ( Pillow ) & NumPy add images”