Image processing and outer edge search. Find Algorithm
I have a problem with one of the steps I have to take. The most important problem. I have an image for example:
Second step to select part of the image:
Ok. If I have this image in the cache, what is the selected area:
Early steps I took. The problem lies in the last step, the task of which is to select only (exactly the outer) border of the area. Here's an example of how it should look:
I ask which algorithm or steps should I follow for the last effect. Is this possible for any images? My preferred language is C # / C / JS, but if anyone knows knowledge of a solution, that would be good! I found some algorithm for edge detection, but not for the outer edge.
source to share
Maybe try this:
- pick some random 10 pixels from the selection borders (it is important that they are borders)
- get the average rgb of these pixels
- get MAX = maximum distance between pixels
- fill white gulf with tolerance = k * MAX, starting from one of the extreme pixels
this way you can only fill the fill with a gray background in the selection
source to share