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: enter image description here

Second step to select part of the image: enter image description here

Ok. If I have this image in the cache, what is the selected area:

enter image description here

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:

enter image description here

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.

+3


source to share


1 answer


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

+1


source







All Articles