Hello and thank you always for your help. I would appreciate if you guys can give me your thoughts on watersheding. This time I will explain my problem with images.
The background
Some time ago, I studied some computer vision. (That was before learning OpenCV). While doing that, I learned the concept of watersheding. Now,as I read opencv watershed documentation, it seems to me that the concept is a bit different (for example there is no concept of "markers") from what I learned so I come to you, to see how can I use opencv to implement the concepts I learned before using OpenCV
The problem
Say I have the following image:(The image might come from say-segmentation, following by separating areas not connected to each other)
You can see that to the human eye there are 6 elements, but so far in the image we can see four clearly separated elements (the three on the right are still considered one) Now, please don't tell me to open them so as to separate them. First, opening has some undesirable results and I want to apply this solutions for cases where even opening does not work.
The goal
To separate those elements and get the 6 of them
Is this Watersheding?
From now on I am going to describe the processes and concepts I learned about watersheding. First, the image above is 2D (of course!) but watersheding can be understood as filling water on a3D map, filling the basins. So to get something like a 3D map, there is the concept of Distance Transform which I haven't tried in OpenCV yet, but I understand as the value of every pixel to the border or the elements they are contained.
So I got a image like this:
And here I can apply watershed to get
You can see that watershed oversegmentates (in red) but by checking the watersheds heigth, I can finally come with a good separation which is the five elements.
As you can see, I didn't need markers. In OpenCV watershed so far I get two areas mistaken as only one area. But in the concept I learned it is actually the opposite: I get one area mistaken as many areas.
So to me watershed is just pouring water on basins and get everything oversegmentated, and by pouring more and more water these basins erase the low watersheds and join, solving the problem of oversegmentation.
Is this conceptually totally different from OpenCV? Can I implement my theoretical concepts?
Any comment, will be greatly appreciated.
Thanks a lot