I have a threshold image and a pattern image. I want to overlay the pattern image onto my threshold image, where the threshold part is black. See images attached:
Threshold Image, Pattern Image:
The issue with that is, my threshold part is not of any uniform shape. It is random, not having some fixed shape like rect, circle etc. (Comes from frontend). It would be similar to this above sample image only.
What I want is to "cover" the black part of threshold with a single pattern image. Now, if my threshold image was of some shape like rectangle / circle, I could simply use some "slicing" operation to overlay them. A sample is shown below as Ideal condition.
Ideal threshold, ideal result:
However, actual shapes are not that trivial. So I cannot use slicing on them. Also, my pattern images are not just one solid color, so I think I can't even do much with that.
I think I need to somehow "generate" the pattern image according to my black portion of threshold Image. How do I do that? Any pointer to that would also help. I'm using OpenCV and Python.
Feel free to consider the dimensions of both images to be same.